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/ansi_tcap | |
parent | bb15274a4a82fcab1c06935fa1e249f436420a02 (diff) |
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/ansi_tcap')
-rw-r--r-- | asn1/ansi_tcap/packet-ansi_tcap-template.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/asn1/ansi_tcap/packet-ansi_tcap-template.c b/asn1/ansi_tcap/packet-ansi_tcap-template.c index 439a64cafa..c13df91e61 100644 --- a/asn1/ansi_tcap/packet-ansi_tcap-template.c +++ b/asn1/ansi_tcap/packet-ansi_tcap-template.c @@ -28,6 +28,7 @@ #include <glib.h> #include <epan/packet.h> #include <epan/prefs.h> +#include <epan/expert.h> #include <epan/oids.h> #include <epan/wmem/wmem.h> #include <epan/asn1.h> @@ -71,6 +72,8 @@ static gint ett_otid = -1; static gint ett_dtid = -1; static gint ett_ansi_tcap_stat = -1; +static expert_field ei_ansi_tcap_dissector_not_implemented = EI_INIT; + static struct tcapsrt_info_t * gp_tcapsrt_info; static gboolean tcap_subdissector_used=FALSE; @@ -321,22 +324,20 @@ find_tcap_subdissector(tvbuff_t *tvb, asn1_ctx_t *actx, proto_tree *tree){ guint8 family = (ansi_tcap_private.d.OperationCode_national & 0x7f00)>>8; guint8 specifier = (guint8)(ansi_tcap_private.d.OperationCode_national & 0xff); if(!dissector_try_uint(ansi_tcap_national_opcode_table, ansi_tcap_private.d.OperationCode_national, tvb, actx->pinfo, tcap_top_tree)){ - item = proto_tree_add_text(tree, tvb, 0, -1, + proto_tree_add_expert_format(tree, actx->pinfo, &ei_ansi_tcap_dissector_not_implemented, tvb, 0, -1, "Dissector for ANSI TCAP NATIONAL code:0x%x(Family %u, Specifier %u) \n" "not implemented. Contact Wireshark developers if you want this supported(Spec required)", ansi_tcap_private.d.OperationCode_national, family, specifier); - PROTO_ITEM_SET_GENERATED(item); return FALSE; } return TRUE; }else if(ansi_tcap_private.d.OperationCode == 1){ /* private */ if((ansi_tcap_private.d.OperationCode_private & 0x0900) != 0x0900){ - item = proto_tree_add_text(tree, tvb, 0, -1, + proto_tree_add_expert_format(tree, actx->pinfo, &ei_ansi_tcap_dissector_not_implemented, tvb, 0, -1, "Dissector for ANSI TCAP PRIVATE code:%u not implemented.\n" "Contact Wireshark developers if you want this supported(Spec required)", ansi_tcap_private.d.OperationCode_private); - PROTO_ITEM_SET_GENERATED(item); return FALSE; } } @@ -503,6 +504,12 @@ proto_register_ansi_tcap(void) #include "packet-ansi_tcap-ettarr.c" }; + static ei_register_info ei[] = { + { &ei_ansi_tcap_dissector_not_implemented, { "ansi_tcap.dissector_not_implemented", PI_UNDECODED, PI_WARN, "Dissector not implemented", EXPFILL }}, + }; + + expert_module_t* expert_ansi_tcap; + static const enum_val_t ansi_tcap_response_matching_type_values[] = { {"Only Transaction ID will be used in Invoke/response matching", "Transaction ID only", 0}, {"Transaction ID and Source will be used in Invoke/response matching", "Transaction ID and Source", 1}, @@ -510,7 +517,6 @@ proto_register_ansi_tcap(void) {NULL, NULL, -1} }; - /* Register the protocol name and description */ proto_ansi_tcap = proto_register_protocol(PNAME, PSNAME, PFNAME); register_dissector("ansi_tcap", dissect_ansi_tcap, proto_ansi_tcap); @@ -520,6 +526,8 @@ proto_register_ansi_tcap(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_ansi_tcap, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_ansi_tcap = expert_register_protocol(proto_ansi_tcap); + expert_register_field_array(expert_ansi_tcap, ei, array_length(ei)); ansi_tcap_module = prefs_register_protocol(proto_ansi_tcap, proto_reg_handoff_ansi_tcap); |