diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 2000-03-12 04:48:32 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 2000-03-12 04:48:32 +0000 |
commit | f6e92a9e939a28327eea49b5931715ba97a62970 (patch) | |
tree | 0b5f52ee7613baacc77f73697eb895592aa6a137 /packet-bootp.c | |
parent | 3d6cb57256c889b2f1ba51e89886d9bb9ea812fb (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().
svn path=/trunk/; revision=1713
Diffstat (limited to 'packet-bootp.c')
-rw-r--r-- | packet-bootp.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/packet-bootp.c b/packet-bootp.c index 78bf6fcd99..f16e662274 100644 --- a/packet-bootp.c +++ b/packet-bootp.c @@ -2,7 +2,7 @@ * Routines for BOOTP/DHCP packet disassembly * Gilbert Ramirez <gram@xiexie.org> * - * $Id: packet-bootp.c,v 1.26 2000/02/14 18:15:29 guy Exp $ + * $Id: packet-bootp.c,v 1.27 2000/03/12 04:47:35 gram Exp $ * * The information used comes from: * RFC 2132: DHCP Options and BOOTP Vendor Extensions @@ -479,12 +479,12 @@ dissect_bootp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) ti = proto_tree_add_item(tree, proto_bootp, offset, END_OF_FRAME, NULL); bp_tree = proto_item_add_subtree(ti, ett_bootp); - proto_tree_add_item_format(bp_tree, hf_bootp_type, + proto_tree_add_uint_format(bp_tree, hf_bootp_type, offset, 1, pd[offset], pd[offset] == 1 ? "Boot Request" : "Boot Reply"); - proto_tree_add_item_format(bp_tree, hf_bootp_hw_type, + proto_tree_add_uint_format(bp_tree, hf_bootp_hw_type, offset + 1, 1, pd[offset+1], "Hardware type: %s", @@ -514,7 +514,7 @@ dissect_bootp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_item(bp_tree, hf_bootp_ip_relay, offset + 24, 4, ip_addr); - proto_tree_add_item_format(bp_tree, hf_bootp_hw_addr, + proto_tree_add_bytes_format(bp_tree, hf_bootp_hw_addr, offset + 28, pd[offset+2], &pd[offset+28], "Client hardware address: %s", @@ -523,14 +523,14 @@ dissect_bootp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) /* The server host name is optional */ if (pd[offset+44]) { - proto_tree_add_item_format(bp_tree, hf_bootp_server, + proto_tree_add_string_format(bp_tree, hf_bootp_server, offset + 44, 64, &pd[offset+44], "Server host name: %s", &pd[offset+44]); } else { - proto_tree_add_item_format(bp_tree, hf_bootp_server, + proto_tree_add_string_format(bp_tree, hf_bootp_server, offset + 44, 64, &pd[offset+44], "Server host name not given"); @@ -538,21 +538,21 @@ dissect_bootp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) /* Boot file */ if (pd[offset+108]) { - proto_tree_add_item_format(bp_tree, hf_bootp_file, + proto_tree_add_string_format(bp_tree, hf_bootp_file, offset + 108, 128, &pd[offset+108], "Boot file name: %s", &pd[offset+108]); } else { - proto_tree_add_item_format(bp_tree, hf_bootp_file, + proto_tree_add_string_format(bp_tree, hf_bootp_file, offset + 108, 128, &pd[offset+108], "Boot file name not given"); } if (pntohl(&pd[offset+236]) == 0x63825363) { - proto_tree_add_item_format(bp_tree, hf_bootp_cookie, + proto_tree_add_ipv4_format(bp_tree, hf_bootp_cookie, offset + 236, 4, pd[offset+236], "Magic cookie: (OK)"); |