diff options
author | Guy Harris <guy@alum.mit.edu> | 2000-12-28 09:49:09 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2000-12-28 09:49:09 +0000 |
commit | d13901155d5108fc756bf2b4a4608fa9af73a146 (patch) | |
tree | a3fc4e9de7e42980ada10de139813e9937956393 /packet-cgmp.c | |
parent | f69876eece2a86501b309e9aecfdcd69b95dc500 (diff) |
Tvbuffify the CDP, CGMP, ISL, and VTP dissectors.
Add a new subdissector table in the LLC dissector for protocol IDs with
a Cisco OUI, and register the CDP, CGMP, and VTMP dissectors in that
table, rather than calling them via a switch statement.
Register the ISL dissector by name, and have the Ethernet dissector call
it via a handle.
Fix the handling of the checksum field in the CDP dissector.
The strings in CDP are counted, not null-terminated; treat them as such.
Fix the handling of the encapsulated frame CRC, and the encapsulated
frame, in the ISL dissector, at least for Ethernet frames; it may not be
correct for encapsulated Token Ring frames.
svn path=/trunk/; revision=2792
Diffstat (limited to 'packet-cgmp.c')
-rw-r--r-- | packet-cgmp.c | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/packet-cgmp.c b/packet-cgmp.c index 8674e97f8b..8485208b17 100644 --- a/packet-cgmp.c +++ b/packet-cgmp.c @@ -1,7 +1,7 @@ /* packet-cgmp.c * Routines for the disassembly of the Cisco Group Management Protocol * - * $Id: packet-cgmp.c,v 1.5 2000/11/19 08:53:56 guy Exp $ + * $Id: packet-cgmp.c,v 1.6 2000/12/28 09:49:09 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -58,48 +58,48 @@ static const value_string type_vals[] = { { 0, NULL }, }; -void -dissect_cgmp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) +static void +dissect_cgmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_item *ti; proto_tree *cgmp_tree = NULL; + int offset = 0; guint8 count; - OLD_CHECK_DISPLAY_AS_DATA(proto_cgmp, pd, offset, fd, tree); + CHECK_DISPLAY_AS_DATA(proto_cgmp, tvb, pinfo, tree); - if (check_col(fd, COL_PROTOCOL)) - col_set_str(fd, COL_PROTOCOL, "CGMP"); - if (check_col(fd, COL_INFO)) - col_set_str(fd, COL_INFO, "Cisco Group Management Protocol"); + pinfo->current_proto = "CGMP"; + + if (check_col(pinfo->fd, COL_PROTOCOL)) + col_set_str(pinfo->fd, COL_PROTOCOL, "CGMP"); + if (check_col(pinfo->fd, COL_INFO)) + col_set_str(pinfo->fd, COL_INFO, "Cisco Group Management Protocol"); if (tree) { - ti = proto_tree_add_item(tree, proto_cgmp, NullTVB, offset, END_OF_FRAME, FALSE); + ti = proto_tree_add_item(tree, proto_cgmp, tvb, offset, + tvb_length_remaining(tvb, offset), FALSE); cgmp_tree = proto_item_add_subtree(ti, ett_cgmp); - proto_tree_add_uint(cgmp_tree, hf_cgmp_version, NullTVB, offset, 1, - pd[offset]); - proto_tree_add_uint(cgmp_tree, hf_cgmp_type, NullTVB, offset, 1, - pd[offset]); + proto_tree_add_item(cgmp_tree, hf_cgmp_version, tvb, offset, 1, + FALSE); + proto_tree_add_item(cgmp_tree, hf_cgmp_type, tvb, offset, 1, + FALSE); offset += 1; offset += 2; /* skip reserved field */ - count = pd[offset]; - proto_tree_add_uint(cgmp_tree, hf_cgmp_count, NullTVB, offset, 1, + count = tvb_get_guint8(tvb, offset); + proto_tree_add_uint(cgmp_tree, hf_cgmp_count, tvb, offset, 1, count); offset += 1; while (count != 0) { - if (!BYTES_ARE_IN_FRAME(offset, 6)) - break; - proto_tree_add_ether(cgmp_tree, hf_cgmp_gda, NullTVB, offset, 6, - &pd[offset]); + proto_tree_add_item(cgmp_tree, hf_cgmp_gda, tvb, offset, 6, + FALSE); offset += 6; - if (!BYTES_ARE_IN_FRAME(offset, 6)) - break; - proto_tree_add_ether(cgmp_tree, hf_cgmp_usa, NullTVB, offset, 6, - &pd[offset]); + proto_tree_add_item(cgmp_tree, hf_cgmp_usa, tvb, offset, 6, + FALSE); offset += 6; count--; @@ -139,3 +139,9 @@ proto_register_cgmp(void) proto_register_field_array(proto_cgmp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); } + +void +proto_reg_handoff_cgmp(void) +{ + dissector_add("llc.cisco_pid", 0x2001, dissect_cgmp); +} |