01: package ch.ethz.ssh2.packets;
02:
03: /**
04: * PacketOpenDirectTCPIPChannel.
05: *
06: * @author Christian Plattner, plattner@inf.ethz.ch
07: * @version $Id: PacketOpenDirectTCPIPChannel.java,v 1.2 2005/08/24 17:54:09 cplattne Exp $
08: */
09: public class PacketOpenDirectTCPIPChannel {
10: byte[] payload;
11:
12: int channelID;
13: int initialWindowSize;
14: int maxPacketSize;
15:
16: String host_to_connect;
17: int port_to_connect;
18: String originator_IP_address;
19: int originator_port;
20:
21: public PacketOpenDirectTCPIPChannel(int channelID,
22: int initialWindowSize, int maxPacketSize,
23: String host_to_connect, int port_to_connect,
24: String originator_IP_address, 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:
38: tw.writeByte(Packets.SSH_MSG_CHANNEL_OPEN);
39: tw.writeString("direct-tcpip");
40: tw.writeUINT32(channelID);
41: tw.writeUINT32(initialWindowSize);
42: tw.writeUINT32(maxPacketSize);
43: tw.writeString(host_to_connect);
44: tw.writeUINT32(port_to_connect);
45: tw.writeString(originator_IP_address);
46: tw.writeUINT32(originator_port);
47:
48: payload = tw.getBytes();
49: }
50: return payload;
51: }
52: }
|