[cooja] plugins/analyzers: printout of UDP ports and clearer layer separation

This commit is contained in:
Enrico Joerns 2014-06-19 04:38:19 +02:00
parent 70a44031bf
commit d894390f3e
2 changed files with 24 additions and 4 deletions

View file

@ -53,6 +53,7 @@ public class ICMPv6Analyzer extends PacketAnalyzer {
// int checksum = ((packet.get(2) & 0xff) << 8) | packet.get(3) & 0xff; // int checksum = ((packet.get(2) & 0xff) << 8) | packet.get(3) & 0xff;
brief.append("ICMPv6 "); brief.append("ICMPv6 ");
verbose.append("<b>ICMPv6</b>");
if (type >= 128 && (type - 128) < TYPE_NAME.length) { if (type >= 128 && (type - 128) < TYPE_NAME.length) {
brief.append(BRIEF_TYPE_NAME[type - 128]).append(' ').append(code); brief.append(BRIEF_TYPE_NAME[type - 128]).append(' ').append(code);
verbose.append("<br/>Type: ").append(TYPE_NAME[type - 128]); verbose.append("<br/>Type: ").append(TYPE_NAME[type - 128]);

View file

@ -454,17 +454,36 @@ public class IPHCPacketAnalyzer extends PacketAnalyzer {
protoStr = "UDP"; protoStr = "UDP";
} else if (proto == PROTO_TCP) { } else if (proto == PROTO_TCP) {
protoStr = "TCP"; protoStr = "TCP";
} else {
protoStr = String.valueOf(proto);
} }
verbose.append("<br><b>IPv6 ").append(protoStr) // IPv6 Information
.append("</b> TC = ").append(trafficClass)
.append(" FL: ").append(flowLabel) brief.append("|IPv6");
verbose.append("<br/><b>IPv6</b>")
.append(" TC = ").append(trafficClass)
.append(", FL = ").append(flowLabel)
.append("<br>"); .append("<br>");
verbose.append("From "); verbose.append("From ");
printAddress(verbose, srcAddress); printAddress(verbose, srcAddress);
verbose.append(" to "); verbose.append(" to ");
printAddress(verbose, destAddress); 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("<br/><b>").append(protoStr).append("</b>");
}
if (proto == PROTO_UDP) {
brief.append(' ').append(srcPort).append(' ').append(destPort);
verbose.append("<br/>Src Port: ").append(srcPort);
verbose.append(", Dst Port: ").append(destPort);
}
packet.lastDispatch = (byte) (proto & 0xff); packet.lastDispatch = (byte) (proto & 0xff);
if (proto == PROTO_UDP || proto == PROTO_ICMP if (proto == PROTO_UDP || proto == PROTO_ICMP