• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2006-2011 Christian Plattner. All rights reserved.
3  * Please refer to the LICENSE.txt for licensing details.
4  */
5 package ch.ethz.ssh2.packets;
6 
7 /**
8  * PacketSessionPtyRequest.
9  *
10  * @author Christian Plattner
11  * @version 2.50, 03/15/10
12  */
13 public class PacketSessionPtyRequest
14 {
15 	byte[] payload;
16 
17 	public int recipientChannelID;
18 	public boolean wantReply;
19 	public String term;
20 	public int character_width;
21 	public int character_height;
22 	public int pixel_width;
23 	public int pixel_height;
24 	public byte[] terminal_modes;
25 
PacketSessionPtyRequest(int recipientChannelID, boolean wantReply, String term, int character_width, int character_height, int pixel_width, int pixel_height, byte[] terminal_modes)26 	public PacketSessionPtyRequest(int recipientChannelID, boolean wantReply, String term,
27 			int character_width, int character_height, int pixel_width, int pixel_height,
28 			byte[] terminal_modes)
29 	{
30 		this.recipientChannelID = recipientChannelID;
31 		this.wantReply = wantReply;
32 		this.term = term;
33 		this.character_width = character_width;
34 		this.character_height = character_height;
35 		this.pixel_width = pixel_width;
36 		this.pixel_height = pixel_height;
37 		this.terminal_modes = terminal_modes;
38 	}
39 
getPayload()40 	public byte[] getPayload()
41 	{
42 		if (payload == null)
43 		{
44 			TypesWriter tw = new TypesWriter();
45 			tw.writeByte(Packets.SSH_MSG_CHANNEL_REQUEST);
46 			tw.writeUINT32(recipientChannelID);
47 			tw.writeString("pty-req");
48 			tw.writeBoolean(wantReply);
49 			tw.writeString(term);
50 			tw.writeUINT32(character_width);
51 			tw.writeUINT32(character_height);
52 			tw.writeUINT32(pixel_width);
53 			tw.writeUINT32(pixel_height);
54 			tw.writeString(terminal_modes, 0, terminal_modes.length);
55 
56 			payload = tw.getBytes();
57 		}
58 		return payload;
59 	}
60 }
61