aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/qsig
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-08-08 09:19:29 -0400
committerMichael Mann <mmann78@netscape.net>2014-08-09 01:57:08 +0000
commitcd02af56a1e39c66b44fd7957aff3b7b77a59e9d (patch)
tree4a3e859751bb73268115a607e9dffcec008bb411 /asn1/qsig
parentbb15274a4a82fcab1c06935fa1e249f436420a02 (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/qsig')
-rw-r--r--asn1/qsig/packet-qsig-template.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/asn1/qsig/packet-qsig-template.c b/asn1/qsig/packet-qsig-template.c
index cad737acff..304ab88d02 100644
--- a/asn1/qsig/packet-qsig-template.c
+++ b/asn1/qsig/packet-qsig-template.c
@@ -24,6 +24,7 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/expert.h>
#include <epan/strutil.h>
#include <epan/asn1.h>
@@ -308,6 +309,10 @@ static gint ett_qsig_unknown_extension = -1;
#include "packet-qsig-ett.c"
static gint ett_cnq_PSS1InformationElement = -1;
+static expert_field ei_qsig_unsupported_arg_type = EI_INIT;
+static expert_field ei_qsig_unsupported_result_type = EI_INIT;
+static expert_field ei_qsig_unsupported_error_type = EI_INIT;
+
/* Preferences */
/* Subdissectors */
@@ -420,7 +425,7 @@ dissect_qsig_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
offset = op_ptr->arg_pdu(tvb, pinfo, qsig_tree, NULL);
else
if (tvb_reported_length_remaining(tvb, offset) > 0) {
- proto_tree_add_text(qsig_tree, tvb, offset, -1, "UNSUPPORTED ARGUMENT TYPE (QSIG)");
+ proto_tree_add_expert(tree, pinfo, &ei_qsig_unsupported_error_type, tvb, offset, -1);
offset += tvb_captured_length_remaining(tvb, offset);
}
@@ -474,7 +479,7 @@ dissect_qsig_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
offset = op_ptr->res_pdu(tvb, pinfo, qsig_tree, NULL);
else
if (tvb_reported_length_remaining(tvb, offset) > 0) {
- proto_tree_add_text(qsig_tree, tvb, offset, -1, "UNSUPPORTED RESULT TYPE (QSIG)");
+ proto_tree_add_expert(tree, pinfo, &ei_qsig_unsupported_result_type, tvb, offset, -1);
offset += tvb_captured_length_remaining(tvb, offset);
}
@@ -523,7 +528,7 @@ dissect_qsig_err(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
offset = err_ptr->err_pdu(tvb, pinfo, qsig_tree, NULL);
else
if (tvb_reported_length_remaining(tvb, offset) > 0) {
- proto_tree_add_text(qsig_tree, tvb, offset, -1, "UNSUPPORTED ERROR TYPE (QSIG)");
+ proto_tree_add_expert(tree, pinfo, &ei_qsig_unsupported_error_type, tvb, offset, -1);
offset += tvb_captured_length_remaining(tvb, offset);
}
@@ -668,12 +673,22 @@ void proto_register_qsig(void) {
&ett_cnq_PSS1InformationElement,
};
+ static ei_register_info ei[] = {
+ { &ei_qsig_unsupported_arg_type, { "qsig.unsupported.arg_type", PI_UNDECODED, PI_WARN, "UNSUPPORTED ARGUMENT TYPE (QSIG)", EXPFILL }},
+ { &ei_qsig_unsupported_result_type, { "qsig.unsupported.result_type", PI_UNDECODED, PI_WARN, "UNSUPPORTED RESULT TYPE (QSIG)", EXPFILL }},
+ { &ei_qsig_unsupported_error_type, { "qsig.unsupported.error_type", PI_UNDECODED, PI_WARN, "UNSUPPORTED ERROR TYPE (QSIG)", EXPFILL }},
+ };
+
+ expert_module_t* expert_qsig;
+
/* Register protocol and dissector */
proto_qsig = proto_register_protocol(PNAME, PSNAME, PFNAME);
/* Register fields and subtrees */
proto_register_field_array(proto_qsig, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ expert_qsig = expert_register_protocol(proto_qsig);
+ expert_register_field_array(expert_qsig, ei, array_length(ei));
/* Register dissector tables */
extension_dissector_table = register_dissector_table("qsig.ext", "QSIG Extension", FT_STRING, BASE_NONE);