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 * PacketOpenDirectTCPIPChannel. 9 * 10 * @author Christian Plattner 11 * @version 2.50, 03/15/10 12 */ 13 public class PacketOpenDirectTCPIPChannel 14 { 15 byte[] payload; 16 17 int channelID; 18 int initialWindowSize; 19 int maxPacketSize; 20 21 String host_to_connect; 22 int port_to_connect; 23 String originator_IP_address; 24 int originator_port; 25 26 public PacketOpenDirectTCPIPChannel(int channelID, int initialWindowSize, int maxPacketSize, 27 String host_to_connect, int port_to_connect, String originator_IP_address, 28 int originator_port) 29 { 30 this.channelID = channelID; 31 this.initialWindowSize = initialWindowSize; 32 this.maxPacketSize = maxPacketSize; 33 this.host_to_connect = host_to_connect; 34 this.port_to_connect = port_to_connect; 35 this.originator_IP_address = originator_IP_address; 36 this.originator_port = originator_port; 37 } 38 39 public byte[] getPayload() 40 { 41 if (payload == null) 42 { 43 TypesWriter tw = new TypesWriter(); 44 45 tw.writeByte(Packets.SSH_MSG_CHANNEL_OPEN); 46 tw.writeString("direct-tcpip"); 47 tw.writeUINT32(channelID); 48 tw.writeUINT32(initialWindowSize); 49 tw.writeUINT32(maxPacketSize); 50 tw.writeString(host_to_connect); 51 tw.writeUINT32(port_to_connect); 52 tw.writeString(originator_IP_address); 53 tw.writeUINT32(originator_port); 54 55 payload = tw.getBytes(); 56 } 57 return payload; 58 } 59 } 60