diff options
author | gram <gram@f5534014-38df-0310-8fa8-9805f1628bb7> | 2000-05-11 08:18:09 +0000 |
---|---|---|
committer | gram <gram@f5534014-38df-0310-8fa8-9805f1628bb7> | 2000-05-11 08:18:09 +0000 |
commit | be84f10d1819ef058061de43e78962f045da55f0 (patch) | |
tree | db4edef02456a48d0f6d505166ac7d70f6c0f644 /packet-v120.c | |
parent | 9faed730f03b0f9dd161698662886cc7702319e4 (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.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@1939 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-v120.c')
-rw-r--r-- | packet-v120.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/packet-v120.c b/packet-v120.c index 9775f2d2c8..5862a67579 100644 --- a/packet-v120.c +++ b/packet-v120.c @@ -2,7 +2,7 @@ * Routines for v120 frame disassembly * Bert Driehuis <driehuis@playbeing.org> * - * $Id: packet-v120.c,v 1.5 2000/03/17 05:21:48 guy Exp $ + * $Id: packet-v120.c,v 1.6 2000/05/11 08:15:54 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -72,7 +72,7 @@ dissect_v120(const u_char *pd, frame_data *fd, proto_tree *tree) if (check_col(fd, COL_INFO)) col_add_str(fd, COL_INFO, "Invalid V.120 frame"); if (tree) - ti = proto_tree_add_protocol_format(tree, proto_v120, 0, fd->cap_len, + ti = proto_tree_add_protocol_format(tree, proto_v120, NullTVB, 0, fd->cap_len, "Invalid V.120 frame"); return; } @@ -97,27 +97,27 @@ dissect_v120(const u_char *pd, frame_data *fd, proto_tree *tree) is_response = FALSE; if (tree) { - ti = proto_tree_add_protocol_format(tree, proto_v120, 0, 0, + ti = proto_tree_add_protocol_format(tree, proto_v120, NullTVB, 0, 0, "V.120"); v120_tree = proto_item_add_subtree(ti, ett_v120); addr = pd[1] << 8 | pd[0]; sprintf(info, "LLI: %d C/R: %s", ((pd[0] & 0xfc) << 5) | ((pd[1] & 0xfe) >> 1), pd[0] & 0x02 ? "R" : "C"); - tc = proto_tree_add_text(v120_tree, + tc = proto_tree_add_text(v120_tree, NullTVB, 0, 2, "Address field: %s", info); address_tree = proto_item_add_subtree(tc, ett_v120_address); - proto_tree_add_text(address_tree, 0, 2, + proto_tree_add_text(address_tree, NullTVB, 0, 2, decode_boolean_bitfield(addr, 0x0002, 2*8, "Response", "Command"), NULL); sprintf(info, "LLI: %d", ((pd[0] & 0xfc) << 5) | ((pd[1] & 0xfe) >> 1)); - proto_tree_add_text(address_tree, 0, 2, + proto_tree_add_text(address_tree, NullTVB, 0, 2, decode_numeric_bitfield(addr, 0xfefc, 2*8, info)); - proto_tree_add_text(address_tree, 0, 2, + proto_tree_add_text(address_tree, NullTVB, 0, 2, decode_boolean_bitfield(addr, 0x0001, 2*8, "EA0 = 1 (Error)", "EA0 = 0"), NULL); - proto_tree_add_text(address_tree, 0, 2, + proto_tree_add_text(address_tree, NullTVB, 0, 2, decode_boolean_bitfield(addr, 0x0100, 2*8, "EA1 = 1", "EA1 = 0 (Error)"), NULL); } @@ -155,36 +155,36 @@ dissect_v120_header(const u_char *pd, int offset, frame_data *fd, proto_tree *tr nbits = header_len * 8; sprintf(info, "Header: B: %d F: %d", pd[offset] & 0x02 ? 1:0, pd[offset] & 0x01 ? 1:0); - tc = proto_tree_add_text(tree, + tc = proto_tree_add_text(tree, NullTVB, offset, header_len, "Header octet: %s (0x%02X)", info, pd[offset]); h_tree = proto_item_add_subtree(tc, ett_v120_header); - proto_tree_add_text(h_tree, offset, header_len, + proto_tree_add_text(h_tree, NullTVB, offset, header_len, decode_boolean_bitfield(header, 0x80, nbits, "No extension octet", "Extension octet follows"), NULL); - proto_tree_add_text(h_tree, offset, header_len, + proto_tree_add_text(h_tree, NullTVB, offset, header_len, decode_boolean_bitfield(header, 0x40, nbits, "Break condition", "No break condition"), NULL); sprintf(info, "Error control C1/C2: %d", (header & 0x0c) >> 2); - proto_tree_add_text(h_tree, offset, header_len, + proto_tree_add_text(h_tree, NullTVB, offset, header_len, decode_numeric_bitfield(header, 0x0c, nbits, info)); - proto_tree_add_text(h_tree, offset, header_len, + proto_tree_add_text(h_tree, NullTVB, offset, header_len, decode_boolean_bitfield(header, 0x02, nbits, "Segmentation bit B", "No segmentation bit B"), NULL); - proto_tree_add_text(h_tree, offset, header_len, + proto_tree_add_text(h_tree, NullTVB, offset, header_len, decode_boolean_bitfield(header, 0x01, nbits, "Segmentation bit F", "No segmentation bit F"), NULL); if (header_len == 2) { - proto_tree_add_text(h_tree, offset, header_len, + proto_tree_add_text(h_tree, NullTVB, offset, header_len, decode_boolean_bitfield(header, 0x8000, nbits, "E", "E bit not set (Error)"), NULL); - proto_tree_add_text(h_tree, offset, header_len, + proto_tree_add_text(h_tree, NullTVB, offset, header_len, decode_boolean_bitfield(header, 0x4000, nbits, "DR", "No DR"), NULL); - proto_tree_add_text(h_tree, offset, header_len, + proto_tree_add_text(h_tree, NullTVB, offset, header_len, decode_boolean_bitfield(header, 0x2000, nbits, "SR", "No SR"), NULL); - proto_tree_add_text(h_tree, offset, header_len, + proto_tree_add_text(h_tree, NullTVB, offset, header_len, decode_boolean_bitfield(header, 0x1000, nbits, "RR", "No RR"), NULL); } |