Mercurial > 510Connectbot
comparison src/ch/ethz/ssh2/packets/PacketServiceAccept.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 |
---|---|
14 */ | 14 */ |
15 public final class PacketServiceAccept { | 15 public final class PacketServiceAccept { |
16 private final byte[] payload; | 16 private final byte[] payload; |
17 | 17 |
18 public PacketServiceAccept(String serviceName) { | 18 public PacketServiceAccept(String serviceName) { |
19 | |
20 TypesWriter tw = new TypesWriter(); | 19 TypesWriter tw = new TypesWriter(); |
21 tw.writeByte(Packets.SSH_MSG_SERVICE_ACCEPT); | 20 tw.writeByte(Packets.SSH_MSG_SERVICE_ACCEPT); |
22 tw.writeString(serviceName); | 21 tw.writeString(serviceName); |
23 payload = tw.getBytes(); | 22 payload = tw.getBytes(); |
24 } | 23 } |
25 | 24 |
26 public PacketServiceAccept(byte payload[]) throws IOException { | 25 public PacketServiceAccept(byte payload[]) throws IOException { |
27 this.payload = payload; | 26 this.payload = payload; |
28 | |
29 TypesReader tr = new TypesReader(payload); | 27 TypesReader tr = new TypesReader(payload); |
30 | |
31 int packet_type = tr.readByte(); | 28 int packet_type = tr.readByte(); |
32 | 29 |
33 if(packet_type != Packets.SSH_MSG_SERVICE_ACCEPT) { | 30 if (packet_type != Packets.SSH_MSG_SERVICE_ACCEPT) { |
34 throw new PacketTypeException(packet_type); | 31 throw new PacketTypeException(packet_type); |
35 } | 32 } |
36 if(tr.remain() != 0) { | 33 |
34 if (tr.remain() != 0) { | |
37 String serviceName = tr.readString(); | 35 String serviceName = tr.readString(); |
38 } | 36 } |
39 } | 37 } |
40 | 38 |
41 public byte[] getPayload() { | 39 public byte[] getPayload() { |