diff options
author | Michael Mann <mmann78@netscape.net> | 2014-09-06 08:44:23 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-09-09 01:25:36 +0000 |
commit | 80407a46df538011c1dcea96714c401a4078a697 (patch) | |
tree | f62b063004ba6a8946c552c6a3180cb8f417cd83 /epan/dissectors/packet-raw.c | |
parent | 124923b02f3113a1f2aeae205417a18828671850 (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-raw.c')
-rw-r--r-- | epan/dissectors/packet-raw.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/epan/dissectors/packet-raw.c b/epan/dissectors/packet-raw.c index 572e02e945..1f81a69cc8 100644 --- a/epan/dissectors/packet-raw.c +++ b/epan/dissectors/packet-raw.c @@ -27,6 +27,7 @@ #include <string.h> #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include <wiretap/wtap.h> #include "packet-raw.h" #include "packet-ip.h" @@ -38,6 +39,8 @@ void proto_reg_handoff_raw(void); static int proto_raw = -1; static gint ett_raw = -1; +static expert_field ei_raw_no_link = EI_INIT; + static const char zeroes[10] = {0,0,0,0,0,0,0,0,0,0}; static dissector_handle_t ip_handle; @@ -99,7 +102,6 @@ capture_raw(const guchar *pd, int len, packet_counts *ld) static void dissect_raw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_tree *fh_tree; proto_item *ti; tvbuff_t *next_tvb; @@ -112,11 +114,8 @@ dissect_raw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* populate a tree in the second pane with the status of the link layer (ie none) */ - if (tree) { - ti = proto_tree_add_item(tree, proto_raw, tvb, 0, 0, ENC_NA); - fh_tree = proto_item_add_subtree(ti, ett_raw); - proto_tree_add_text(fh_tree, tvb, 0, 0, "No link information available"); - } + ti = proto_tree_add_item(tree, proto_raw, tvb, 0, 0, ENC_NA); + expert_add_info(pinfo, ti, &ei_raw_no_link); if (pinfo->fd->lnk_t == WTAP_ENCAP_RAW_IP4) { call_dissector(ip_handle, tvb, pinfo, tree); @@ -185,8 +184,16 @@ proto_register_raw(void) &ett_raw, }; + static ei_register_info ei[] = { + { &ei_raw_no_link, { "raw.no_link", PI_PROTOCOL, PI_NOTE, "No link information available", EXPFILL }}, + }; + + expert_module_t* expert_raw; + proto_raw = proto_register_protocol("Raw packet data", "Raw", "raw"); proto_register_subtree_array(ett, array_length(ett)); + expert_raw = expert_register_protocol(proto_raw); + expert_register_field_array(expert_raw, ei, array_length(ei)); } void |