comparison src/com/trilead/ssh2/packets/PacketOpenDirectTCPIPChannel.java @ 0:0ce5cc452d02

initial version
author Carl Byington <carl@five-ten-sg.com>
date Thu, 22 May 2014 10:41:19 -0700
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:0ce5cc452d02
1 package com.trilead.ssh2.packets;
2
3
4 /**
5 * PacketOpenDirectTCPIPChannel.
6 *
7 * @author Christian Plattner, plattner@trilead.com
8 * @version $Id: PacketOpenDirectTCPIPChannel.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $
9 */
10 public class PacketOpenDirectTCPIPChannel {
11 byte[] payload;
12
13 int channelID;
14 int initialWindowSize;
15 int maxPacketSize;
16
17 String host_to_connect;
18 int port_to_connect;
19 String originator_IP_address;
20 int originator_port;
21
22 public PacketOpenDirectTCPIPChannel(int channelID, int initialWindowSize, int maxPacketSize,
23 String host_to_connect, int port_to_connect, String originator_IP_address,
24 int originator_port) {
25 this.channelID = channelID;
26 this.initialWindowSize = initialWindowSize;
27 this.maxPacketSize = maxPacketSize;
28 this.host_to_connect = host_to_connect;
29 this.port_to_connect = port_to_connect;
30 this.originator_IP_address = originator_IP_address;
31 this.originator_port = originator_port;
32 }
33
34 public byte[] getPayload() {
35 if (payload == null) {
36 TypesWriter tw = new TypesWriter();
37 tw.writeByte(Packets.SSH_MSG_CHANNEL_OPEN);
38 tw.writeString("direct-tcpip");
39 tw.writeUINT32(channelID);
40 tw.writeUINT32(initialWindowSize);
41 tw.writeUINT32(maxPacketSize);
42 tw.writeString(host_to_connect);
43 tw.writeUINT32(port_to_connect);
44 tw.writeString(originator_IP_address);
45 tw.writeUINT32(originator_port);
46 payload = tw.getBytes();
47 }
48
49 return payload;
50 }
51 }