diff options
author | gram <gram@f5534014-38df-0310-8fa8-9805f1628bb7> | 2000-03-12 04:48:32 +0000 |
---|---|---|
committer | gram <gram@f5534014-38df-0310-8fa8-9805f1628bb7> | 2000-03-12 04:48:32 +0000 |
commit | 929f70ac0b14506508e6de9dc357608b91667120 (patch) | |
tree | 0b5f52ee7613baacc77f73697eb895592aa6a137 /packet-v120.c | |
parent | 45942c1c41dfad28ac1aeca038e69c888d9a95c4 (diff) |
Break proto_tree_add_item_format() into multiple functions:
proto_tree_add_protocol_format()
proto_tree_add_uint_format()
proto_tree_add_ipxnet_format()
proto_tree_add_ipv4_format()
proto_tree_add_ipv6_format()
proto_tree_add_bytes_format()
proto_tree_add_string_format()
proto_tree_add_ether_format()
proto_tree_add_time_format()
proto_tree_add_double_format()
proto_tree_add_boolean_format()
If using GCC 2.x, we can check the print-format against the variable args
passed in. Regardless of compiler, we can now check at run-time that the
field type passed into the function corresponds to what that function
expects (FT_UINT, FT_BOOLEAN, etc.)
Note that proto_tree_add_protocol_format() does not require a value field,
since the value of a protocol is always NULL. It's more intuitive w/o the
vestigial argument.
Fixed a proto_tree_add_item_format-related bug in packet-isis-hello.c
Fixed a variable usage bug in packet-v120.c. (ett_* was used instead of hf_*)
Checked in Guy's fix for the function declearation for proto_tree_add_text()
and proto_tree_add_notext().
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@1713 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-v120.c')
-rw-r--r-- | packet-v120.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/packet-v120.c b/packet-v120.c index 6e94f24735..1a4bd318fc 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.3 1999/12/14 06:21:19 guy Exp $ + * $Id: packet-v120.c,v 1.4 2000/03/12 04:47:51 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -71,8 +71,8 @@ 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_item_format(tree, proto_v120, 0, fd->cap_len, - NULL, "Invalid V.120 frame"); + ti = proto_tree_add_protocol_format(tree, proto_v120, 0, fd->cap_len, + "Invalid V.120 frame"); return; } @@ -100,14 +100,14 @@ dissect_v120(const u_char *pd, frame_data *fd, proto_tree *tree) else v120len = 5; if (tree) { - ti = proto_tree_add_item_format(tree, proto_v120, 0, v120len, NULL, + ti = proto_tree_add_protocol_format(tree, proto_v120, 0, v120len, "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_item_format(v120_tree, ett_v120_address, + tc = proto_tree_add_text(v120_tree, 0, 2, "Address field: %s", info); address_tree = proto_item_add_subtree(tc, ett_v120_address); @@ -150,7 +150,7 @@ 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_item_format(tree, ett_v120_header, + tc = proto_tree_add_text(tree, offset, header_len, "Header octet: %s (0x%02X)", info, pd[offset]); h_tree = proto_item_add_subtree(tc, ett_v120_header); |