Home | History | Annotate | Download | only in packets
      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  * PacketGlobalForwardRequest.
      9  *
     10  * @author Christian Plattner
     11  * @version 2.50, 03/15/10
     12  */
     13 public class PacketGlobalForwardRequest
     14 {
     15 	byte[] payload;
     16 
     17 	public boolean wantReply;
     18 	public String bindAddress;
     19 	public int bindPort;
     20 
     21 	public PacketGlobalForwardRequest(boolean wantReply, String bindAddress, int bindPort)
     22 	{
     23 		this.wantReply = wantReply;
     24 		this.bindAddress = bindAddress;
     25 		this.bindPort = bindPort;
     26 	}
     27 
     28 	public byte[] getPayload()
     29 	{
     30 		if (payload == null)
     31 		{
     32 			TypesWriter tw = new TypesWriter();
     33 			tw.writeByte(Packets.SSH_MSG_GLOBAL_REQUEST);
     34 
     35 			tw.writeString("tcpip-forward");
     36 			tw.writeBoolean(wantReply);
     37 			tw.writeString(bindAddress);
     38 			tw.writeUINT32(bindPort);
     39 
     40 			payload = tw.getBytes();
     41 		}
     42 		return payload;
     43 	}
     44 }
     45