From d894390f3ed8be1c8f9fd23789a5c7d094cb9c61 Mon Sep 17 00:00:00 2001 From: Enrico Joerns Date: Thu, 19 Jun 2014 04:38:19 +0200 Subject: [PATCH] [cooja] plugins/analyzers: printout of UDP ports and clearer layer separation --- .../plugins/analyzers/ICMPv6Analyzer.java | 1 + .../plugins/analyzers/IPHCPacketAnalyzer.java | 27 ++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/tools/cooja/java/org/contikios/cooja/plugins/analyzers/ICMPv6Analyzer.java b/tools/cooja/java/org/contikios/cooja/plugins/analyzers/ICMPv6Analyzer.java index 3dd1d80f6..29ea423c8 100644 --- a/tools/cooja/java/org/contikios/cooja/plugins/analyzers/ICMPv6Analyzer.java +++ b/tools/cooja/java/org/contikios/cooja/plugins/analyzers/ICMPv6Analyzer.java @@ -53,6 +53,7 @@ public class ICMPv6Analyzer extends PacketAnalyzer { // int checksum = ((packet.get(2) & 0xff) << 8) | packet.get(3) & 0xff; brief.append("ICMPv6 "); + verbose.append("ICMPv6"); if (type >= 128 && (type - 128) < TYPE_NAME.length) { brief.append(BRIEF_TYPE_NAME[type - 128]).append(' ').append(code); verbose.append("
Type: ").append(TYPE_NAME[type - 128]); 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 a3576efac..b6121c6ce 100644 --- a/tools/cooja/java/org/contikios/cooja/plugins/analyzers/IPHCPacketAnalyzer.java +++ b/tools/cooja/java/org/contikios/cooja/plugins/analyzers/IPHCPacketAnalyzer.java @@ -454,17 +454,36 @@ public class IPHCPacketAnalyzer extends PacketAnalyzer { protoStr = "UDP"; } else if (proto == PROTO_TCP) { protoStr = "TCP"; + } else { + protoStr = String.valueOf(proto); } - verbose.append("
IPv6 ").append(protoStr) - .append(" TC = ").append(trafficClass) - .append(" FL: ").append(flowLabel) + // IPv6 Information + + brief.append("|IPv6"); + verbose.append("
IPv6") + .append(" TC = ").append(trafficClass) + .append(", FL = ").append(flowLabel) .append("
"); verbose.append("From "); printAddress(verbose, srcAddress); verbose.append(" to "); printAddress(verbose, destAddress); - if (error != null) verbose.append(" " + error); + if (error != null) { + verbose.append(" ").append(error); + } + + // Application Layer Information + + if (proto != PROTO_ICMP) { + brief.append('|').append(protoStr); + verbose.append("
").append(protoStr).append(""); + } + if (proto == PROTO_UDP) { + brief.append(' ').append(srcPort).append(' ').append(destPort); + verbose.append("
Src Port: ").append(srcPort); + verbose.append(", Dst Port: ").append(destPort); + } packet.lastDispatch = (byte) (proto & 0xff); if (proto == PROTO_UDP || proto == PROTO_ICMP