aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-echo.c
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss@ulticom.com>2011-01-16 03:35:29 +0000
committerJeff Morriss <jeff.morriss@ulticom.com>2011-01-16 03:35:29 +0000
commitf36e2be2874db3eb3917e2b9299509725d483ce3 (patch)
tree9659b266111b939e5e8ec48e927fd36978e40e88 /epan/dissectors/packet-echo.c
parent067a0761790aabf2d6a829c59dbdac4c2d0fccdf (diff)
Use tvb_memeql() and tvb_memcpy().
Use tvb_ip_to_str() and tvb_ip6_to_str(). There's no need to pass the result of tvb_get_ptr() as the 'value' in proto_tree_add_*(): just use proto_tree_add_item(). Replace some tvb_get_ptr()s with tvb_get_ephemeral_string()s to ensure the return string is NULL terminated. svn path=/trunk/; revision=35546
Diffstat (limited to 'epan/dissectors/packet-echo.c')
-rw-r--r--epan/dissectors/packet-echo.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/epan/dissectors/packet-echo.c b/epan/dissectors/packet-echo.c
index c71d015bd6..f566ff1dd5 100644
--- a/epan/dissectors/packet-echo.c
+++ b/epan/dissectors/packet-echo.c
@@ -46,12 +46,11 @@ static gint ett_echo = -1;
static void dissect_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
-
+
proto_tree *echo_tree = NULL;
proto_item *ti, *hidden_item;
int offset = 0;
gboolean request = FALSE;
- const guint8 *data = tvb_get_ptr(tvb, offset, -1);
if (pinfo->destport == ECHO_PORT) {
request = TRUE;
@@ -60,10 +59,10 @@ static void dissect_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ECHO");
if (check_col(pinfo->cinfo, COL_INFO)) {
- col_set_str(pinfo->cinfo, COL_INFO,
+ col_set_str(pinfo->cinfo, COL_INFO,
(request) ? "Request" : "Response");
}
-
+
if (tree) {
ti = proto_tree_add_item(tree, proto_echo, tvb, offset, -1, FALSE);
@@ -76,26 +75,26 @@ static void dissect_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
PROTO_ITEM_SET_HIDDEN(hidden_item);
- proto_tree_add_bytes(echo_tree, hf_echo_data, tvb, offset, -1, data);
+ proto_tree_add_item(echo_tree, hf_echo_data, tvb, offset, -1, ENC_NA);
}
} /* dissect_echo */
-void proto_register_echo(void)
+void proto_register_echo(void)
{
static hf_register_info hf[] = {
{ &hf_echo_data,
- { "Echo data", "echo.data",
+ { "Echo data", "echo.data",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_echo_request,
- { "Echo request", "echo.request",
+ { "Echo request", "echo.request",
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"Echo data", HFILL }},
{ &hf_echo_response,
- { "Echo response","echo.response",
+ { "Echo response","echo.response",
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"Echo data", HFILL }}
};
@@ -110,7 +109,7 @@ void proto_register_echo(void)
}
-void proto_reg_handoff_echo(void)
+void proto_reg_handoff_echo(void)
{
dissector_handle_t echo_handle;