1 2 package ch.ethz.ssh2.packets; 3 4 import java.io.IOException ; 5 6 12 public class PacketIgnore 13 { 14 byte[] payload; 15 16 byte[] data; 17 18 public void setData(byte[] data) 19 { 20 this.data = data; 21 payload = null; 22 } 23 24 public PacketIgnore() 25 { 26 } 27 28 public PacketIgnore(byte payload[], int off, int len) throws IOException  29 { 30 this.payload = new byte[len]; 31 System.arraycopy(payload, off, this.payload, 0, len); 32 33 TypesReader tr = new TypesReader(payload, off, len); 34 35 int packet_type = tr.readByte(); 36 37 if (packet_type != Packets.SSH_MSG_IGNORE) 38 throw new IOException ("This is not a SSH_MSG_IGNORE packet! (" + packet_type + ")"); 39 40 41 } 42 43 public byte[] getPayload() 44 { 45 if (payload == null) 46 { 47 TypesWriter tw = new TypesWriter(); 48 tw.writeByte(Packets.SSH_MSG_IGNORE); 49 50 if (data != null) 51 tw.writeString(data, 0, data.length); 52 else 53 tw.writeString(""); 54 55 payload = tw.getBytes(); 56 } 57 return payload; 58 } 59 } 60 | Popular Tags |