aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-socks.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-09-06 08:44:23 -0400
committerMichael Mann <mmann78@netscape.net>2014-09-09 01:25:36 +0000
commit80407a46df538011c1dcea96714c401a4078a697 (patch)
treef62b063004ba6a8946c552c6a3180cb8f417cd83 /epan/dissectors/packet-socks.c
parent124923b02f3113a1f2aeae205417a18828671850 (diff)
Eliminate proto_tree_add_text from some of the dissectors.
Other minor cleanups while in the area. Change-Id: I99096ade9c69a4c148962d45bb6b0bd775040ba1 Reviewed-on: https://code.wireshark.org/review/4020 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-socks.c')
-rw-r--r--epan/dissectors/packet-socks.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/epan/dissectors/packet-socks.c b/epan/dissectors/packet-socks.c
index 0226f6e7d1..e685dcd881 100644
--- a/epan/dissectors/packet-socks.c
+++ b/epan/dissectors/packet-socks.c
@@ -126,6 +126,10 @@ static int hf_socks_password = -1;
static int hf_socks_remote_name = -1;
static int hf_socks_address_type = -1;
static int hf_socks_fragment_number = -1;
+static int hf_socks_ping_end_command = -1;
+static int hf_socks_ping_results = -1;
+static int hf_socks_traceroute_end_command = -1;
+static int hf_socks_traceroute_results = -1;
/************* Dissector handles ***********/
@@ -890,20 +894,13 @@ display_ping_and_tracert(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
if ( pinfo->destport == TCP_PORT_SOCKS){
col_append_str(pinfo->cinfo, COL_INFO, ", Terminate Request");
- if ( tree)
- proto_tree_add_text(tree, tvb, offset, 1,
- (hash_info->command == PING_COMMAND) ?
- "Ping: End command" :
- "Traceroute: End command");
+ proto_tree_add_item(tree, (hash_info->command == PING_COMMAND) ? hf_socks_ping_end_command : hf_socks_traceroute_end_command, tvb, offset, 1, ENC_NA);
}
else { /* display the PING or Traceroute results */
col_append_str(pinfo->cinfo, COL_INFO, ", Results");
if ( tree){
- proto_tree_add_text(tree, tvb, offset, -1,
- (hash_info->command == PING_COMMAND) ?
- "Ping Results:" :
- "Traceroute Results");
+ proto_tree_add_item(tree, (hash_info->command == PING_COMMAND) ? hf_socks_ping_results : hf_socks_traceroute_results, tvb, offset, -1, ENC_NA);
data = tvb_get_ptr(tvb, offset, -1);
dataend = data + tvb_length_remaining(tvb, offset);
@@ -913,8 +910,7 @@ display_ping_and_tracert(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
lineend = find_line_end(data, dataend, &eol);
linelen = (int)(lineend - data);
- proto_tree_add_text( tree, tvb, offset, linelen,
- "%s", format_text(data, linelen));
+ proto_tree_add_format_text( tree, tvb, offset, linelen);
offset += linelen;
data = lineend;
}
@@ -1280,6 +1276,26 @@ proto_register_socks( void){
BASE_DEC, NULL, 0x0, NULL, HFILL
}
},
+ { &hf_socks_ping_end_command,
+ { "Ping: End command", "socks.ping_end_command", FT_NONE,
+ BASE_NONE, NULL, 0x0, NULL, HFILL
+ }
+ },
+ { &hf_socks_ping_results,
+ { "Ping Results", "socks.ping_results", FT_NONE,
+ BASE_NONE, NULL, 0x0, NULL, HFILL
+ }
+ },
+ { &hf_socks_traceroute_end_command,
+ { "Traceroute: End command", "socks.traceroute_end_command", FT_NONE,
+ BASE_NONE, NULL, 0x0, NULL, HFILL
+ }
+ },
+ { &hf_socks_traceroute_results,
+ { "Traceroute Results", "socks.traceroute_results", FT_NONE,
+ BASE_NONE, NULL, 0x0, NULL, HFILL
+ }
+ },
};
proto_socks = proto_register_protocol ( "Socks Protocol", "Socks", "socks");