2
Copyright (c) 2006-2010 ymnk, JCraft,Inc. All rights reserved.
4
Redistribution and use in source and binary forms, with or without
5
modification, are permitted provided that the following conditions are met:
7
1. Redistributions of source code must retain the above copyright notice,
8
this list of conditions and the following disclaimer.
10
2. Redistributions in binary form must reproduce the above copyright
11
notice, this list of conditions and the following disclaimer in
12
the documentation and/or other materials provided with the distribution.
14
3. The names of the authors may not be used to endorse or promote products
15
derived from this software without specific prior written permission.
17
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
18
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
19
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
20
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
21
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
23
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
This code is based on jsch (http://www.jcraft.com/jsch).
29
All credit should go to the authors of jsch.
37
internal class RequestWindowChange : Request
39
internal int width_columns = 80;
41
internal int height_rows = 24;
43
internal int width_pixels = 640;
45
internal int height_pixels = 480;
47
internal virtual void SetSize(int col, int row, int wp, int hp)
49
this.width_columns = col;
50
this.height_rows = row;
51
this.width_pixels = wp;
52
this.height_pixels = hp;
55
/// <exception cref="System.Exception"></exception>
56
internal override void DoRequest(Session session, Channel channel)
58
base.DoRequest(session, channel);
59
Buffer buf = new Buffer();
60
Packet packet = new Packet(buf);
61
//byte SSH_MSG_CHANNEL_REQUEST
62
//uint32 recipient_channel
63
//string "window-change"
65
//uint32 terminal width, columns
66
//uint32 terminal height, rows
67
//uint32 terminal width, pixels
68
//uint32 terminal height, pixels
70
buf.PutByte(unchecked((byte)Session.SSH_MSG_CHANNEL_REQUEST));
71
buf.PutInt(channel.GetRecipient());
72
buf.PutString(Util.Str2byte("window-change"));
73
buf.PutByte(unchecked((byte)(WaitForReply() ? 1 : 0)));
74
buf.PutInt(width_columns);
75
buf.PutInt(height_rows);
76
buf.PutInt(width_pixels);
77
buf.PutInt(height_pixels);