diff options
author | Michael Mann <mmann78@netscape.net> | 2014-08-08 09:19:29 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-08-09 01:57:08 +0000 |
commit | cd02af56a1e39c66b44fd7957aff3b7b77a59e9d (patch) | |
tree | 4a3e859751bb73268115a607e9dffcec008bb411 /asn1/cmip | |
parent | bb15274a4a82fcab1c06935fa1e249f436420a02 (diff) | |
download | wireshark-cd02af56a1e39c66b44fd7957aff3b7b77a59e9d.tar.gz wireshark-cd02af56a1e39c66b44fd7957aff3b7b77a59e9d.tar.bz2 wireshark-cd02af56a1e39c66b44fd7957aff3b7b77a59e9d.zip |
Eliminate (almost all) proto_tree_add_text calls from ASN.1 dissectors.
This mostly involved adding expert info capabilities to many of the dissectors so that they could correctly flag error conditions.
Only remaining proto_tree_add_text calls are in H248.cnf, which has a convoluted way of using hf_ data to make its tree.
Change-Id: I6412150c2ec1977d7fa38f3f0ed416680bdfb141
Reviewed-on: https://code.wireshark.org/review/3500
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'asn1/cmip')
-rw-r--r-- | asn1/cmip/packet-cmip-template.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/asn1/cmip/packet-cmip-template.c b/asn1/cmip/packet-cmip-template.c index 12b2d057e2..0c6a105a97 100644 --- a/asn1/cmip/packet-cmip-template.c +++ b/asn1/cmip/packet-cmip-template.c @@ -25,6 +25,7 @@ #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include <epan/oids.h> #include <epan/asn1.h> @@ -60,6 +61,8 @@ static int hf_ObjectClass = -1; static gint ett_cmip = -1; #include "packet-cmip-ett.c" +static expert_field ei_wrong_spdu_type = EI_INIT; + static guint32 opcode; /* Dissector table */ @@ -110,8 +113,8 @@ dissect_cmip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d session = (struct SESSION_DATA_STRUCTURE*)data; if(session->spdu_type == 0 ) { - proto_tree_add_text(parent_tree, tvb, 0, -1, - "Internal error:wrong spdu type %x from session dissector.",session->spdu_type); + proto_tree_add_expert_format(parent_tree, pinfo, &ei_wrong_spdu_type, tvb, 0, -1, + "Internal error: wrong spdu type %x from session dissector.", session->spdu_type); return 0; } @@ -190,6 +193,12 @@ void proto_register_cmip(void) { #include "packet-cmip-ettarr.c" }; + static ei_register_info ei[] = { + { &ei_wrong_spdu_type, { "cmip.wrong_spdu_type", PI_PROTOCOL, PI_ERROR, "Internal error: wrong spdu type", EXPFILL }}, + }; + + expert_module_t* expert_cmip; + /* Register protocol */ proto_cmip = proto_register_protocol(PNAME, PSNAME, PFNAME); new_register_dissector("cmip", dissect_cmip, proto_cmip); @@ -197,6 +206,9 @@ void proto_register_cmip(void) { /* Register fields and subtrees */ proto_register_field_array(proto_cmip, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_cmip = expert_register_protocol(proto_cmip); + expert_register_field_array(expert_cmip, ei, array_length(ei)); + #include "packet-cmip-dis-tab.c" oid_add_from_string("discriminatorId(1)","2.9.3.2.7.1"); |