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