Minor cleanup of the radio logger output (packet description).
This commit is contained in:
parent
ac4ba199bc
commit
6d9f904627
3 changed files with 523 additions and 519 deletions
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: RadioLogger.java,v 1.34 2010/03/17 22:44:20 nifi Exp $
|
* $Id: RadioLogger.java,v 1.35 2010/04/06 23:38:18 nifi Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.plugins;
|
package se.sics.cooja.plugins;
|
||||||
|
@ -266,6 +266,7 @@ public class RadioLogger extends VisPlugin {
|
||||||
prepareTooltipString(conn);
|
prepareTooltipString(conn);
|
||||||
}
|
}
|
||||||
verboseBox.setText(conn.tooltip);
|
verboseBox.setText(conn.tooltip);
|
||||||
|
verboseBox.setCaretPosition(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -427,12 +428,16 @@ public class RadioLogger extends VisPlugin {
|
||||||
if (packet.hasMoreData()) {
|
if (packet.hasMoreData()) {
|
||||||
byte[] payload = packet.getPayload();
|
byte[] payload = packet.getPayload();
|
||||||
brief.append(StringUtils.toHex(payload, 4));
|
brief.append(StringUtils.toHex(payload, 4));
|
||||||
|
if (verbose.length() > 0) {
|
||||||
|
verbose.append("<p>");
|
||||||
|
}
|
||||||
verbose.append("<b>Payload (")
|
verbose.append("<b>Payload (")
|
||||||
.append(payload.length).append(" bytes)</b><br><pre>")
|
.append(payload.length).append(" bytes)</b><br><pre>")
|
||||||
.append(StringUtils.hexDump(payload))
|
.append(StringUtils.hexDump(payload))
|
||||||
.append("</pre>");
|
.append("</pre>");
|
||||||
}
|
}
|
||||||
conn.data = (data.length < 10 ? " " : "") + data.length + ": " + brief;
|
conn.data = (data.length < 100 ? (data.length < 10 ? " " : " ") : "")
|
||||||
|
+ data.length + ": " + brief;
|
||||||
if (verbose.length() > 0) {
|
if (verbose.length() > 0) {
|
||||||
conn.tooltip = verbose.toString();
|
conn.tooltip = verbose.toString();
|
||||||
}
|
}
|
||||||
|
@ -450,16 +455,16 @@ public class RadioLogger extends VisPlugin {
|
||||||
PacketAnalyzer analyzer = analyzers.get(i);
|
PacketAnalyzer analyzer = analyzers.get(i);
|
||||||
if (analyzer.matchPacket(packet)) {
|
if (analyzer.matchPacket(packet)) {
|
||||||
int res = analyzer.analyzePacket(packet, brief, verbose);
|
int res = analyzer.analyzePacket(packet, brief, verbose);
|
||||||
|
if (packet.hasMoreData() && brief.length() > 0) {
|
||||||
|
brief.append('|');
|
||||||
|
verbose.append("<br>");
|
||||||
|
}
|
||||||
if (res != PacketAnalyzer.ANALYSIS_OK_CONTINUE) {
|
if (res != PacketAnalyzer.ANALYSIS_OK_CONTINUE) {
|
||||||
/* this was the final or the analysis failed - no analyzable payload possible here... */
|
/* this was the final or the analysis failed - no analyzable payload possible here... */
|
||||||
return brief.length() > 0;
|
return brief.length() > 0;
|
||||||
}
|
}
|
||||||
/* continue another round if more bytes left */
|
/* continue another round if more bytes left */
|
||||||
analyze = packet.hasMoreData();
|
analyze = packet.hasMoreData();
|
||||||
if (analyze) {
|
|
||||||
brief.append('|');
|
|
||||||
verbose.append("<p>");
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,34 +42,33 @@ public class ICMPv6Analyzer extends PacketAnalyzer {
|
||||||
StringBuffer verbose) {
|
StringBuffer verbose) {
|
||||||
int type = packet.get(0) & 0xff;
|
int type = packet.get(0) & 0xff;
|
||||||
int code = packet.get(1) & 0xff;
|
int code = packet.get(1) & 0xff;
|
||||||
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 ");
|
||||||
if (type >= 128 && (type - 128) < TYPE_NAME.length) {
|
if (type >= 128 && (type - 128) < TYPE_NAME.length) {
|
||||||
brief.append(TYPE_NAME[type - 128]).append(" ");
|
brief.append(TYPE_NAME[type - 128]).append(' ').append(code);
|
||||||
brief.append(" " + code);
|
verbose.append("Type: ").append(TYPE_NAME[type - 128]);
|
||||||
verbose.append("Type: " + TYPE_NAME[type - 128]).append("<br>");
|
verbose.append(" Code:").append(code);
|
||||||
verbose.append("Code:" + code + "<br>");
|
|
||||||
} else if (type == 155) {
|
} else if (type == 155) {
|
||||||
/* RPL */
|
/* RPL */
|
||||||
brief.append("RPL ");
|
brief.append("RPL ");
|
||||||
verbose.append("Type: RPL<br>");
|
verbose.append("Type: RPL Code: ");
|
||||||
switch(code) {
|
switch(code) {
|
||||||
case RPL_CODE_DIS:
|
case RPL_CODE_DIS:
|
||||||
brief.append("DIS ");
|
brief.append("DIS");
|
||||||
verbose.append("Code: DIS<br>");
|
verbose.append("DIS");
|
||||||
break;
|
break;
|
||||||
case RPL_CODE_DIO:
|
case RPL_CODE_DIO:
|
||||||
brief.append("DIO ");
|
brief.append("DIO");
|
||||||
verbose.append("Code: DIO<br>");
|
verbose.append("DIO");
|
||||||
break;
|
break;
|
||||||
case RPL_CODE_DAO:
|
case RPL_CODE_DAO:
|
||||||
brief.append("DAO ");
|
brief.append("DAO");
|
||||||
verbose.append("Code: DAO<br>");
|
verbose.append("DAO");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
brief.append(" " + code);
|
brief.append(code);
|
||||||
verbose.append("Code: " + code);
|
verbose.append(code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,10 +90,10 @@ public class IPHCPacketAnalyzer extends PacketAnalyzer {
|
||||||
verbose.append("<b>IPHC HC-06</b><br>");
|
verbose.append("<b>IPHC HC-06</b><br>");
|
||||||
verbose.append("tf = " + tf + " nhc = " + nhc + " hlim = " + hlim
|
verbose.append("tf = " + tf + " nhc = " + nhc + " hlim = " + hlim
|
||||||
+ " cid = " + cid + " sac = " + sac + " sam = " + sam
|
+ " cid = " + cid + " sac = " + sac + " sam = " + sam
|
||||||
+ " MCast = " + m + " dac = " + dac + " dam = " + dam + "<br>");
|
+ " MCast = " + m + " dac = " + dac + " dam = " + dam);
|
||||||
if (cid == 1) {
|
if (cid == 1) {
|
||||||
verbose.append("Contexts: sci=" + (packet.get(2) >> 4) + " dci="
|
verbose.append("<br>Contexts: sci=" + (packet.get(2) >> 4) + " dci="
|
||||||
+ (packet.get(2) & 0x0f) + "<br>");
|
+ (packet.get(2) & 0x0f));
|
||||||
sci = packet.get(2) >> 4;
|
sci = packet.get(2) >> 4;
|
||||||
dci = packet.get(2) & 0x0f;
|
dci = packet.get(2) & 0x0f;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue