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  * PacketSessionX11Request.
      9  *
     10  * @author Christian Plattner
     11  * @version 2.50, 03/15/10
     12  */
     13 public class PacketSessionX11Request
     14 {
     15 	byte[] payload;
     16 
     17 	public int recipientChannelID;
     18 	public boolean wantReply;
     19 
     20 	public boolean singleConnection;
     21 	String x11AuthenticationProtocol;
     22 	String x11AuthenticationCookie;
     23 	int x11ScreenNumber;
     24 
     25 	public PacketSessionX11Request(int recipientChannelID, boolean wantReply, boolean singleConnection,
     26 			String x11AuthenticationProtocol, String x11AuthenticationCookie, int x11ScreenNumber)
     27 	{
     28 		this.recipientChannelID = recipientChannelID;
     29 		this.wantReply = wantReply;
     30 
     31 		this.singleConnection = singleConnection;
     32 		this.x11AuthenticationProtocol = x11AuthenticationProtocol;
     33 		this.x11AuthenticationCookie = x11AuthenticationCookie;
     34 		this.x11ScreenNumber = x11ScreenNumber;
     35 	}
     36 
     37 	public byte[] getPayload()
     38 	{
     39 		if (payload == null)
     40 		{
     41 			TypesWriter tw = new TypesWriter();
     42 			tw.writeByte(Packets.SSH_MSG_CHANNEL_REQUEST);
     43 			tw.writeUINT32(recipientChannelID);
     44 			tw.writeString("x11-req");
     45 			tw.writeBoolean(wantReply);
     46 
     47 			tw.writeBoolean(singleConnection);
     48 			tw.writeString(x11AuthenticationProtocol);
     49 			tw.writeString(x11AuthenticationCookie);
     50 			tw.writeUINT32(x11ScreenNumber);
     51 
     52 			payload = tw.getBytes();
     53 		}
     54 		return payload;
     55 	}
     56 }
     57