diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2003-06-11 20:41:45 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2003-06-11 20:41:45 +0000 |
commit | 429b6b55f05bc1cabf84ee940af64a43b9c16933 (patch) | |
tree | 805ae4cce3265e2cb789dacc5ec97c7ca63aef6c /packet-tsp.c | |
parent | f19755e6b11a2b9374d931e41fbc611ca30dd457 (diff) |
Replace value fetches and "proto_tree_add_XXX" calls with
"proto_tree_add_item()" if the value isn't being used. (In one case,
there wasn't a corresponding value fetch, and some other value was being
put into the tree.)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@7846 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-tsp.c')
-rw-r--r-- | packet-tsp.c | 66 |
1 files changed, 29 insertions, 37 deletions
diff --git a/packet-tsp.c b/packet-tsp.c index c96def8c7a..43f63f315d 100644 --- a/packet-tsp.c +++ b/packet-tsp.c @@ -3,7 +3,7 @@ * * Uwe Girlich <Uwe.Girlich@philosys.de> * - * $Id: packet-tsp.c,v 1.3 2002/08/28 21:00:36 jmayer Exp $ + * $Id: packet-tsp.c,v 1.4 2003/06/11 20:41:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -118,13 +118,6 @@ dissect_tsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item *tsp_item = NULL; guint8 tsp_type; - guint8 tsp_vers; - guint16 tsp_seq; - guint32 tsp_time_sec; - guint32 tsp_time_usec; - guint8 tsp_hopcnt; - gint tsp_name_length; - guint8 tsp_name[256]; if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "TSP"); @@ -132,8 +125,9 @@ dissect_tsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_clear(pinfo->cinfo, COL_INFO); tsp_type = tvb_get_guint8(tvb, 0); - tsp_vers = tvb_get_guint8(tvb, 1); - tsp_seq = tvb_get_ntohs(tvb, 2); + if (check_col(pinfo->cinfo, COL_INFO)) + col_add_str(pinfo->cinfo, COL_INFO, + val_to_str(tsp_type, names_tsp_type, "Unknown message type (%u)")); if (tree) { tsp_item = proto_tree_add_item(tree, proto_tsp, @@ -145,38 +139,36 @@ dissect_tsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tsp_tree) { proto_tree_add_uint(tsp_tree, hf_tsp_type, tvb, 0, 1, tsp_type); - proto_tree_add_uint(tsp_tree, hf_tsp_vers, - tvb, 1, 1, tsp_vers); - proto_tree_add_uint(tsp_tree, hf_tsp_seq, - tvb, 2, 2, tsp_seq); - } - - if (tsp_type == TSP_LOOP) { - tsp_hopcnt = tvb_get_guint8(tvb, 4); - if (tsp_tree) - proto_tree_add_uint(tsp_tree, hf_tsp_hopcnt, - tvb, 4, 1, tsp_type); + proto_tree_add_item(tsp_tree, hf_tsp_vers, + tvb, 1, 1, FALSE); + proto_tree_add_item(tsp_tree, hf_tsp_seq, + tvb, 2, 2, FALSE); } - if (tsp_type == TSP_SETTIME || - tsp_type == TSP_ADJTIME || - tsp_type == TSP_SETDATE || - tsp_type == TSP_SETDATEREQ) { + switch (tsp_type) { - tsp_time_sec = tvb_get_ntohl(tvb, 4); - if (tsp_tree) - proto_tree_add_uint(tsp_tree, hf_tsp_time_sec, - tvb, 4, 4, tsp_time_sec); - tsp_time_usec = tvb_get_ntohl(tvb, 8); + case TSP_LOOP: if (tsp_tree) - proto_tree_add_uint(tsp_tree, hf_tsp_time_usec, - tvb, 8, 4, tsp_time_usec); + proto_tree_add_item(tsp_tree, hf_tsp_hopcnt, + tvb, 4, 1, FALSE); + break; + + case TSP_SETTIME: + case TSP_ADJTIME: + case TSP_SETDATE: + case TSP_SETDATEREQ: + if (tsp_tree) { + proto_tree_add_item(tsp_tree, hf_tsp_time_sec, + tvb, 4, 4, FALSE); + proto_tree_add_item(tsp_tree, hf_tsp_time_usec, + tvb, 8, 4, FALSE); + } + break; } - tsp_name_length = tvb_get_nstringz(tvb, 12, 256, tsp_name); - if (tsp_name_length>0 && tsp_tree) { - proto_tree_add_string(tsp_tree, hf_tsp_name, tvb, 12, - tsp_name_length, tsp_name); + if (tsp_tree) { + proto_tree_add_item(tsp_tree, hf_tsp_name, tvb, 12, + -1, FALSE); } } @@ -218,7 +210,7 @@ proto_register_tsp(void) "Microseconds", HFILL }}, { &hf_tsp_name, { "Machine Name", "tsp.name", - FT_STRING, BASE_DEC, NULL, 0x0, + FT_STRINGZ, BASE_DEC, NULL, 0x0, "Sender Machine Name", HFILL }} }; static gint *ett[] = { |