From 9f70a6f3272e38224d40798aee4e4653a085b4d0 Mon Sep 17 00:00:00 2001 From: Enrico Joerns Date: Thu, 19 Jun 2014 04:21:23 +0200 Subject: [PATCH] [cooja] plugins/analyzers/IPHCPacketAnalyzer: fixed ttl encoding, addded hlim decoding --- .../plugins/analyzers/IPHCPacketAnalyzer.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/cooja/java/org/contikios/cooja/plugins/analyzers/IPHCPacketAnalyzer.java b/tools/cooja/java/org/contikios/cooja/plugins/analyzers/IPHCPacketAnalyzer.java index 2a70fea6f..6d3665d32 100644 --- a/tools/cooja/java/org/contikios/cooja/plugins/analyzers/IPHCPacketAnalyzer.java +++ b/tools/cooja/java/org/contikios/cooja/plugins/analyzers/IPHCPacketAnalyzer.java @@ -76,6 +76,20 @@ public class IPHCPacketAnalyzer extends PacketAnalyzer { int tf = (packet.get(0) >> 3) & 0x03; boolean nhc = (packet.get(0) & SICSLOWPAN_IPHC_NH_C) > 0; int hlim = (packet.get(0) & 0x03); + switch (hlim) { + case 0x00: + hlim = 0; + break; + case 0x01: + hlim = 1; + break; + case 0x02: + hlim = 64; + break; + case 0x03: + hlim = 255; + break; + } int cid = (packet.get(1) >> 7) & 0x01; int sac = (packet.get(1) >> 6) & 0x01; int sam = (packet.get(1) >> 4) & 0x03; @@ -164,7 +178,7 @@ public class IPHCPacketAnalyzer extends PacketAnalyzer { ttl = 1; break; case SICSLOWPAN_IPHC_TTL_64: - ttl = 2; + ttl = 64; break; case SICSLOWPAN_IPHC_TTL_255: ttl = 255;