KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ch > ethz > ssh2 > packets > PacketSessionExecCommand


1 package ch.ethz.ssh2.packets;
2
3
4 /**
5  * PacketSessionExecCommand.
6  *
7  * @author Christian Plattner, plattner@inf.ethz.ch
8  * @version $Id: PacketSessionExecCommand.java,v 1.2 2005/08/24 17:54:09 cplattne Exp $
9  */

10 public class PacketSessionExecCommand
11 {
12     byte[] payload;
13
14     public int recipientChannelID;
15     public boolean wantReply;
16     public String JavaDoc command;
17
18     public PacketSessionExecCommand(int recipientChannelID, boolean wantReply, String JavaDoc command)
19     {
20         this.recipientChannelID = recipientChannelID;
21         this.wantReply = wantReply;
22         this.command = command;
23     }
24     
25     public byte[] getPayload()
26     {
27         if (payload == null)
28         {
29             TypesWriter tw = new TypesWriter();
30             tw.writeByte(Packets.SSH_MSG_CHANNEL_REQUEST);
31             tw.writeUINT32(recipientChannelID);
32             tw.writeString("exec");
33             tw.writeBoolean(wantReply);
34             tw.writeString(command);
35             payload = tw.getBytes();
36         }
37         return payload;
38     }
39 }
40
Popular Tags