fixed UDP uncompression

This commit is contained in:
joxe 2010-03-12 14:23:40 +00:00
parent 6be0bac1a1
commit efda8edcc5

View file

@ -42,9 +42,10 @@ public class IPHCPacketAnalyzer extends PacketAnalyzer {
public final static int SICSLOWPAN_IPHC_DAM_10 = 0x02;
public final static int SICSLOWPAN_IPHC_DAM_11 = 0x03;
private static final int SICSLOWPAN_NHC_UDP_ID = 0xf8;
private static final int SICSLOWPAN_NHC_UDP_C = 0xFB;
private static final int SICSLOWPAN_NHC_UDP_I = 0xF8;
private static final int SICSLOWPAN_NDC_UDP_MASK = 0xf8;
private static final int SICSLOWPAN_NHC_UDP_ID = 0xf0;
private static final int SICSLOWPAN_NHC_UDP_C = 0xf3;
private static final int SICSLOWPAN_NHC_UDP_I = 0xf0;
public final static int PROTO_UDP = 17;
public final static int PROTO_TCP = 6;
@ -71,7 +72,7 @@ public class IPHCPacketAnalyzer extends PacketAnalyzer {
if (packet.size() < 3) return ANALYSIS_FAILED;
int tf = (packet.get(0) >> 3) & 0x03;
int nh = (packet.get(0) >> 2) & 0x01;
boolean nhc = (packet.get(0) & SICSLOWPAN_IPHC_NH_C) > 0;
int hlim = (packet.get(0) & 0x03);
int cid = (packet.get(1) >> 7) & 0x01;
int sac = (packet.get(1) >> 6) & 0x01;
@ -82,7 +83,7 @@ public class IPHCPacketAnalyzer extends PacketAnalyzer {
int sci = 0;
int dci = 0;
brief.append("IPHC tf=" + tf + (nh == 1 ? " nh" : "") + " hl=" + hlim + (cid == 1 ? " cid " : ""));
brief.append("IPHC tf=" + tf + (nhc ? " nh" : "") + " hl=" + hlim + (cid == 1 ? " cid " : ""));
brief.append((sac == 1 ? " sac" : "") + " sam=" + sam + (m == 1 ? " M" : "") +
(dac == 1 ? " dac" : " -") + " dam=" + dam);
@ -92,7 +93,7 @@ public class IPHCPacketAnalyzer extends PacketAnalyzer {
/* need to decompress while analyzing - add that later... */
verbose.append("<b>IPHC HC-06</b><br>");
verbose.append("tf = " + tf + " nhc = " + nh + " hlim = " + hlim
verbose.append("tf = " + tf + " nhc = " + nhc + " hlim = " + hlim
+ " cid = " + cid + " sac = " + sac + " sam = " + sam
+ " MCast = " + m + " dac = " + dac + " dam = " + dam + "<br>");
if (cid == 1) {
@ -348,10 +349,10 @@ public class IPHCPacketAnalyzer extends PacketAnalyzer {
}
/* Next header processing - continued */
if((packet.get(0) & SICSLOWPAN_IPHC_NH_C) != 0) {
if(nhc) {
/* TODO: check if this is correct in hc-06 */
/* The next header is compressed, NHC is following */
if((packet.get(hc06_ptr) & 0xFC) == SICSLOWPAN_NHC_UDP_ID) {
if((packet.get(hc06_ptr) & SICSLOWPAN_NDC_UDP_MASK) == SICSLOWPAN_NHC_UDP_ID) {
proto = PROTO_UDP;
switch(packet.get(hc06_ptr)) {
case (byte) SICSLOWPAN_NHC_UDP_C: