aboutsummaryrefslogtreecommitdiffstats
path: root/packet-tcp.c
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>2000-03-12 04:48:32 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>2000-03-12 04:48:32 +0000
commitf6e92a9e939a28327eea49b5931715ba97a62970 (patch)
tree0b5f52ee7613baacc77f73697eb895592aa6a137 /packet-tcp.c
parent3d6cb57256c889b2f1ba51e89886d9bb9ea812fb (diff)
downloadwireshark-f6e92a9e939a28327eea49b5931715ba97a62970.tar.gz
wireshark-f6e92a9e939a28327eea49b5931715ba97a62970.tar.bz2
wireshark-f6e92a9e939a28327eea49b5931715ba97a62970.zip
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-tcp.c')
-rw-r--r--packet-tcp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/packet-tcp.c b/packet-tcp.c
index 3933e63016..fa4ba8b555 100644
--- a/packet-tcp.c
+++ b/packet-tcp.c
@@ -1,7 +1,7 @@
/* packet-tcp.c
* Routines for TCP packet disassembly
*
- * $Id: packet-tcp.c,v 1.59 2000/03/12 04:26:35 guy Exp $
+ * $Id: packet-tcp.c,v 1.60 2000/03/12 04:47:50 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -452,20 +452,20 @@ dissect_tcp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
}
if (tree) {
- ti = proto_tree_add_item_format(tree, proto_tcp, offset, hlen, NULL, "Transmission Control Protocol, Src Port: %s (%u), Dst Port: %s (%u), Seq: %u, Ack: %u", get_tcp_port(th.th_sport), th.th_sport, get_tcp_port(th.th_dport), th.th_dport, th.th_seq, th.th_ack);
+ ti = proto_tree_add_protocol_format(tree, proto_tcp, offset, hlen, "Transmission Control Protocol, Src Port: %s (%u), Dst Port: %s (%u), Seq: %u, Ack: %u", get_tcp_port(th.th_sport), th.th_sport, get_tcp_port(th.th_dport), th.th_dport, th.th_seq, th.th_ack);
tcp_tree = proto_item_add_subtree(ti, ett_tcp);
- proto_tree_add_item_format(tcp_tree, hf_tcp_srcport, offset, 2, th.th_sport,
+ proto_tree_add_uint_format(tcp_tree, hf_tcp_srcport, offset, 2, th.th_sport,
"Source port: %s (%u)", get_tcp_port(th.th_sport), th.th_sport);
- proto_tree_add_item_format(tcp_tree, hf_tcp_dstport, offset + 2, 2, th.th_dport,
+ proto_tree_add_uint_format(tcp_tree, hf_tcp_dstport, offset + 2, 2, th.th_dport,
"Destination port: %s (%u)", get_tcp_port(th.th_dport), th.th_dport);
proto_tree_add_item_hidden(tcp_tree, hf_tcp_port, offset, 2, th.th_sport);
proto_tree_add_item_hidden(tcp_tree, hf_tcp_port, offset + 2, 2, th.th_dport);
proto_tree_add_item(tcp_tree, hf_tcp_seq, offset + 4, 4, th.th_seq);
if (th.th_flags & TH_ACK)
proto_tree_add_item(tcp_tree, hf_tcp_ack, offset + 8, 4, th.th_ack);
- proto_tree_add_item_format(tcp_tree, hf_tcp_hdr_len, offset + 12, 1, hlen,
+ proto_tree_add_uint_format(tcp_tree, hf_tcp_hdr_len, offset + 12, 1, hlen,
"Header length: %u bytes", hlen);
- tf = proto_tree_add_item_format(tcp_tree, hf_tcp_flags, offset + 13, 1,
+ tf = proto_tree_add_uint_format(tcp_tree, hf_tcp_flags, offset + 13, 1,
th.th_flags, "Flags: 0x%04x (%s)", th.th_flags, flags);
field_tree = proto_item_add_subtree(tf, ett_tcp_flags);
proto_tree_add_item(field_tree, hf_tcp_flags_urg, offset + 13, 1, th.th_flags);