diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 2000-05-11 08:18:09 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 2000-05-11 08:18:09 +0000 |
commit | 292e38e2c61edcd14bfa30ca3c72bacda1bcbe32 (patch) | |
tree | db4edef02456a48d0f6d505166ac7d70f6c0f644 /xdlc.c | |
parent | 162800efb308901e0c302517be01226130e39b19 (diff) |
Add tvbuff class.
Add exceptions routines.
Convert proto_tree_add_*() routines to require tvbuff_t* argument.
Convert all dissectors to pass NULL argument ("NullTVB" macro == NULL) as
the tvbuff_t* argument to proto_tree_add_*() routines.
dissect_packet() creates a tvbuff_t, wraps the next dissect call in
a TRY block, will print "Short Frame" on the proto_tree if a BoundsError
exception is caught.
The FDDI dissector is converted to use tvbuff's.
svn path=/trunk/; revision=1939
Diffstat (limited to 'xdlc.c')
-rw-r--r-- | xdlc.c | 48 |
1 files changed, 24 insertions, 24 deletions
@@ -2,7 +2,7 @@ * Routines for use by various SDLC-derived protocols, such as HDLC * and its derivatives LAPB, IEEE 802.2 LLC, etc.. * - * $Id: xdlc.c,v 1.13 2000/03/14 06:03:26 guy Exp $ + * $Id: xdlc.c,v 1.14 2000/05/11 08:16:00 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -249,45 +249,45 @@ dissect_xdlc_control(const u_char *pd, int offset, frame_data *fd, col_add_str(fd, COL_INFO, info); if (xdlc_tree) { if (is_extended) { - tc = proto_tree_add_uint_format(xdlc_tree, hf_xdlc_control, + tc = proto_tree_add_uint_format(xdlc_tree, hf_xdlc_control, NullTVB, offset, 2, control, "Control field: %s (0x%04X)", info, control); control_tree = proto_item_add_subtree(tc, ett_xdlc_control); - proto_tree_add_text(control_tree, offset, 2, + proto_tree_add_text(control_tree, NullTVB, offset, 2, decode_numeric_bitfield(control, XDLC_N_R_EXT_MASK, 2*8, "N(R) = %u")); if (control & XDLC_P_F_EXT) { - proto_tree_add_text(control_tree, offset, 2, + proto_tree_add_text(control_tree, NullTVB, offset, 2, decode_boolean_bitfield(control, XDLC_P_F_EXT, 2*8, (is_response ? "Final" : "Poll"), NULL)); } - proto_tree_add_text(control_tree, offset, 2, + proto_tree_add_text(control_tree, NullTVB, offset, 2, decode_enumerated_bitfield(control, XDLC_S_FTYPE_MASK, 2*8, stype_vals, "Supervisory frame - %s")); /* This will always say it's a supervisory frame */ - proto_tree_add_text(control_tree, offset, 2, + proto_tree_add_text(control_tree, NullTVB, offset, 2, decode_boolean_bitfield(control, 0x03, 2*8, "Supervisory frame", NULL)); } else { - tc = proto_tree_add_uint_format(xdlc_tree, hf_xdlc_control, + tc = proto_tree_add_uint_format(xdlc_tree, hf_xdlc_control, NullTVB, offset, 1, control, "Control field: %s (0x%02X)", info, control); control_tree = proto_item_add_subtree(tc, ett_xdlc_control); - proto_tree_add_text(control_tree, offset, 1, + proto_tree_add_text(control_tree, NullTVB, offset, 1, decode_numeric_bitfield(control, XDLC_N_R_MASK, 1*8, "N(R) = %u")); if (control & XDLC_P_F) { - proto_tree_add_text(control_tree, offset, 1, + proto_tree_add_text(control_tree, NullTVB, offset, 1, decode_boolean_bitfield(control, XDLC_P_F, 1*8, (is_response ? "Final" : "Poll"), NULL)); } - proto_tree_add_text(control_tree, offset, 1, + proto_tree_add_text(control_tree, NullTVB, offset, 1, decode_enumerated_bitfield(control, XDLC_S_FTYPE_MASK, 1*8, stype_vals, "%s")); /* This will always say it's a supervisory frame */ - proto_tree_add_text(control_tree, offset, 1, + proto_tree_add_text(control_tree, NullTVB, offset, 1, decode_boolean_bitfield(control, 0x03, 1*8, "Supervisory frame", NULL)); } @@ -323,22 +323,22 @@ dissect_xdlc_control(const u_char *pd, int offset, frame_data *fd, if (check_col(fd, COL_INFO)) col_add_str(fd, COL_INFO, info); if (xdlc_tree) { - tc = proto_tree_add_uint_format(xdlc_tree, hf_xdlc_control, + tc = proto_tree_add_uint_format(xdlc_tree, hf_xdlc_control, NullTVB, offset, 1, control, "Control field: %s (0x%02X)", info, control); control_tree = proto_item_add_subtree(tc, ett_xdlc_control); if (control & XDLC_P_F) { - proto_tree_add_text(control_tree, offset, 2, + proto_tree_add_text(control_tree, NullTVB, offset, 2, decode_boolean_bitfield(control, XDLC_P_F, 1*8, (is_response ? "Final" : "Poll"), NULL)); } - proto_tree_add_text(control_tree, offset, 1, + proto_tree_add_text(control_tree, NullTVB, offset, 1, decode_enumerated_bitfield(control, XDLC_U_MODIFIER_MASK, 1*8, (is_response ? modifier_vals_resp : modifier_vals_cmd), "%s")); /* This will always say it's an unnumbered frame */ - proto_tree_add_text(control_tree, offset, 1, + proto_tree_add_text(control_tree, NullTVB, offset, 1, decode_boolean_bitfield(control, 0x03, 1*8, "Unnumbered frame", NULL)); } @@ -366,7 +366,7 @@ dissect_xdlc_control(const u_char *pd, int offset, frame_data *fd, if (check_col(fd, COL_INFO)) col_add_str(fd, COL_INFO, info); if (xdlc_tree) { - tc = proto_tree_add_uint_format(xdlc_tree, hf_xdlc_control, + tc = proto_tree_add_uint_format(xdlc_tree, hf_xdlc_control, NullTVB, offset, (is_extended) ? 2 : 1, control, (is_extended) ? "Control field: %s (0x%04X)" @@ -374,35 +374,35 @@ dissect_xdlc_control(const u_char *pd, int offset, frame_data *fd, info, control); control_tree = proto_item_add_subtree(tc, ett_xdlc_control); if (is_extended) { - proto_tree_add_text(control_tree, offset, 2, + proto_tree_add_text(control_tree, NullTVB, offset, 2, decode_numeric_bitfield(control, XDLC_N_R_EXT_MASK, 2*8, "N(R) = %u")); - proto_tree_add_text(control_tree, offset, 2, + proto_tree_add_text(control_tree, NullTVB, offset, 2, decode_numeric_bitfield(control, XDLC_N_S_EXT_MASK, 2*8, "N(S) = %u")); if (control & XDLC_P_F_EXT) { - proto_tree_add_text(control_tree, offset, 2, + proto_tree_add_text(control_tree, NullTVB, offset, 2, decode_boolean_bitfield(control, XDLC_P_F_EXT, 2*8, "Poll", NULL)); } /* This will always say it's an information frame */ - proto_tree_add_text(control_tree, offset, 2, + proto_tree_add_text(control_tree, NullTVB, offset, 2, decode_boolean_bitfield(control, 0x01, 2*8, NULL, "Information frame")); } else { - proto_tree_add_text(control_tree, offset, 1, + proto_tree_add_text(control_tree, NullTVB, offset, 1, decode_numeric_bitfield(control, XDLC_N_R_MASK, 1*8, "N(R) = %u")); - proto_tree_add_text(control_tree, offset, 1, + proto_tree_add_text(control_tree, NullTVB, offset, 1, decode_numeric_bitfield(control, XDLC_N_S_MASK, 1*8, "N(S) = %u")); if (control & XDLC_P_F) { - proto_tree_add_text(control_tree, offset, 1, + proto_tree_add_text(control_tree, NullTVB, offset, 1, decode_boolean_bitfield(control, XDLC_P_F, 1*8, "Poll", NULL)); } /* This will always say it's an information frame */ - proto_tree_add_text(control_tree, offset, 1, + proto_tree_add_text(control_tree, NullTVB, offset, 1, decode_boolean_bitfield(control, 0x01, 1*8, NULL, "Information frame")); } |