summaryrefslogtreecommitdiff
path: root/packet-bofl.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-03-01 09:37:38 +0000
committerGuy Harris <guy@alum.mit.edu>2003-03-01 09:37:38 +0000
commit367954ea2d8494579203e807a593afb099d2cdb9 (patch)
treeaf89846b885200d43c1f432361c3da2cbbdd09ff /packet-bofl.c
parent8d91fe53a8cb430534058434d470cfbae653678e (diff)
downloadwireshark-367954ea2d8494579203e807a593afb099d2cdb9.tar.gz
Make the dissector static - it's not called from outside packet-bofl.c
Let the tvbuff mechanism check the length of the packet - don't check it ourselves. Put each field into the protocol tree and the Info column separately, so that we at least get a partial dissection - I've seen some packets that look like breath-of-life packets but that have only the PDU field. Show the PDU field with all 8 hex digits, and show the sequence number as an unsigned quantity, in the Info column. Show the padding size based on the actual length of the frame, not on the amount of the frame that was captured. svn path=/trunk/; revision=7238
Diffstat (limited to 'packet-bofl.c')
-rw-r--r--packet-bofl.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/packet-bofl.c b/packet-bofl.c
index 4a20446a2c..5d3f1f1cc4 100644
--- a/packet-bofl.c
+++ b/packet-bofl.c
@@ -2,7 +2,7 @@
* Routines for Wellfleet BOFL dissection
* Author: Endoh Akira (endoh@netmarks.co.jp)
*
- * $Id: packet-bofl.c,v 1.2 2003/02/28 00:08:04 jmayer Exp $
+ * $Id: packet-bofl.c,v 1.3 2003/03/01 09:37:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -60,40 +60,45 @@ static int hf_bofl_sequence = -1;
static gint ett_bofl = -1;
/* Code to actually dissect the packets */
-void
+static void
dissect_bofl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *ti;
- proto_tree *bofl_tree;
- const guint len = tvb_length(tvb);
+ proto_tree *bofl_tree = NULL;
+ gint len;
guint32 pdu, sequence;
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "BOFL");
- if (len < BOFL_MIN_LEN) {
- if (check_col(pinfo->cinfo, COL_INFO))
- col_set_str(pinfo->cinfo, COL_INFO, "(packet too short)");
- proto_tree_add_text(tree, tvb, 0, len,
- "Wellfleet Breath of Life (packet too short)");
- return;
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_clear(pinfo->cinfo, COL_INFO);
+
+ if (tree) {
+ ti = proto_tree_add_item(tree, proto_bofl, tvb, 0, -1, FALSE);
+ bofl_tree = proto_item_add_subtree(ti, ett_bofl);
}
pdu = tvb_get_ntohl(tvb, 0);
- sequence = tvb_get_ntohl(tvb, 4);
if (check_col(pinfo->cinfo, COL_INFO)) {
- col_clear(pinfo->cinfo, COL_INFO);
col_add_fstr(pinfo->cinfo, COL_INFO,
- "PDU: 0x%x Sequence: %d", pdu, sequence);
+ "PDU: 0x%08x", pdu);
}
- if (tree) {
- ti = proto_tree_add_item(tree, proto_bofl, tvb, 0, len, FALSE);
- bofl_tree = proto_item_add_subtree(ti, ett_bofl);
+ if (tree)
proto_tree_add_uint(bofl_tree, hf_bofl_pdu, tvb, 0, 4, pdu);
+
+ sequence = tvb_get_ntohl(tvb, 4);
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_append_fstr(pinfo->cinfo, COL_INFO,
+ " Sequence: %u", sequence);
+ }
+ if (tree) {
proto_tree_add_uint(bofl_tree, hf_bofl_sequence, tvb, 4, 4, sequence);
- if (len > 8)
- proto_tree_add_text(bofl_tree, tvb, 8, len-8,
- "Padding (%d byte)", len-8);
+
+ len = tvb_length_remaining(tvb, 8);
+ if (len > 0)
+ proto_tree_add_text(bofl_tree, tvb, 8, len,
+ "Padding (%d byte)", len);
}
}