comparison src/ch/ethz/ssh2/packets/PacketDisconnect.java @ 308:42b15aaa7ac7 ganymed

merge
author Carl Byington <carl@five-ten-sg.com>
date Wed, 30 Jul 2014 14:21:50 -0700
parents 071eccdff8ea
children
comparison
equal deleted inserted replaced
306:90e47d99ea54 308:42b15aaa7ac7
39 39
40 private final String message; 40 private final String message;
41 41
42 public PacketDisconnect(byte payload[]) throws IOException { 42 public PacketDisconnect(byte payload[]) throws IOException {
43 this.payload = payload; 43 this.payload = payload;
44
45 TypesReader tr = new TypesReader(payload); 44 TypesReader tr = new TypesReader(payload);
46
47 int packet_type = tr.readByte(); 45 int packet_type = tr.readByte();
48 46
49 if(packet_type != Packets.SSH_MSG_DISCONNECT) { 47 if (packet_type != Packets.SSH_MSG_DISCONNECT) {
50 throw new PacketTypeException(packet_type); 48 throw new PacketTypeException(packet_type);
51 } 49 }
50
52 reason = PacketDisconnect.Reason.values()[tr.readUINT32()]; 51 reason = PacketDisconnect.Reason.values()[tr.readUINT32()];
53 message = tr.readString(); 52 message = tr.readString();
54 String lang = tr.readString(); 53 String lang = tr.readString();
55 54
56 if(tr.remain() != 0) { 55 if (tr.remain() != 0) {
57 throw new PacketFormatException(String.format("Padding in %s", Packets.getMessageName(packet_type))); 56 throw new PacketFormatException(String.format("Padding in %s", Packets.getMessageName(packet_type)));
58 } 57 }
59 } 58 }
60 59
61 public PacketDisconnect(Reason reason, String desc) { 60 public PacketDisconnect(Reason reason, String desc) {