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-bpdu.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-bpdu.c')
-rw-r--r-- | packet-bpdu.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/packet-bpdu.c b/packet-bpdu.c index cb7bbac743..1db910270a 100644 --- a/packet-bpdu.c +++ b/packet-bpdu.c @@ -1,7 +1,7 @@ /* packet-bpdu.c * Routines for BPDU (Spanning Tree Protocol) disassembly * - * $Id: packet-bpdu.c,v 1.7 2000/01/16 02:54:44 guy Exp $ + * $Id: packet-bpdu.c,v 1.8 2000/03/12 04:47:36 gram Exp $ * * Copyright 1999 Christophe Tronche <ch.tronche@computer.org> * @@ -120,9 +120,10 @@ void dissect_bpdu(const u_char *pd, int offset, frame_data *fd, proto_tree *tree protocol_identifier = pntohs(bpdu + BPDU_IDENTIFIER); protocol_version_identifier = (guint8) bpdu[BPDU_VERSION_IDENTIFIER]; - ti = proto_tree_add_item_format(tree, proto_bpdu, offset, 35, NULL, "Spanning Tree Protocol"); + ti = proto_tree_add_protocol_format(tree, proto_bpdu, offset, 35, + "Spanning Tree Protocol"); bpdu_tree = proto_item_add_subtree(ti, ett_bpdu); - proto_tree_add_item_format(bpdu_tree, hf_bpdu_proto_id, + proto_tree_add_uint_format(bpdu_tree, hf_bpdu_proto_id, offset + BPDU_IDENTIFIER, 2, protocol_identifier, "Protocol Identifier: 0x%04x (%s)", @@ -135,7 +136,7 @@ void dissect_bpdu(const u_char *pd, int offset, frame_data *fd, proto_tree *tree protocol_version_identifier); if (protocol_version_identifier != 0) proto_tree_add_text(bpdu_tree, offset + BPDU_VERSION_IDENTIFIER, 1, " (Warning: this version of packet-bpdu only knows about version = 0)"); - proto_tree_add_item_format(bpdu_tree, hf_bpdu_type, + proto_tree_add_uint_format(bpdu_tree, hf_bpdu_type, offset + BPDU_TYPE, 1, bpdu_type, "BPDU Type: 0x%02x (%s)", |