01: package ch.ethz.ssh2.packets;
02:
03: import java.io.IOException;
04:
05: /**
06: * PacketIgnore.
07: *
08: * @author Christian Plattner, plattner@inf.ethz.ch
09: * @version $Id: PacketIgnore.java,v 1.2 2005/08/24 17:54:09 cplattne Exp $
10: */
11: public class PacketIgnore {
12: byte[] payload;
13:
14: byte[] body;
15:
16: public void setBody(byte[] body) {
17: this .body = body;
18: payload = null;
19: }
20:
21: public PacketIgnore(byte payload[], int off, int len)
22: throws IOException {
23: this .payload = new byte[len];
24: System.arraycopy(payload, off, this .payload, 0, len);
25:
26: TypesReader tr = new TypesReader(payload, off, len);
27:
28: int packet_type = tr.readByte();
29:
30: if (packet_type != Packets.SSH_MSG_IGNORE)
31: throw new IOException(
32: "This is not a SSH_MSG_IGNORE packet! ("
33: + packet_type + ")");
34:
35: /* Could parse String body */
36: }
37:
38: public byte[] getPayload() {
39: if (payload == null) {
40: TypesWriter tw = new TypesWriter();
41: tw.writeByte(Packets.SSH_MSG_IGNORE);
42: tw.writeString(body, 0, body.length);
43: payload = tw.getBytes();
44: }
45: return payload;
46: }
47: }
|