aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/h450/packet-h450-template.c
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/h450/packet-h450-template.c
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/h450/packet-h450-template.c')
-rw-r--r--asn1/h450/packet-h450-template.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/asn1/h450/packet-h450-template.c b/asn1/h450/packet-h450-template.c
index 89a9313c1c..4516578eff 100644
--- a/asn1/h450/packet-h450-template.c
+++ b/asn1/h450/packet-h450-template.c
@@ -30,6 +30,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/expert.h>
#include <epan/asn1.h>
@@ -55,6 +56,10 @@ static int hf_h450_error = -1;
/* Initialize the subtree pointers */
#include "packet-h450-ett.c"
+static expert_field ei_h450_unsupported_arg_type = EI_INIT;
+static expert_field ei_h450_unsupported_result_type = EI_INIT;
+static expert_field ei_h450_unsupported_error_type = EI_INIT;
+
static const value_string h450_str_operation[] = {
#include "packet-h450-table10.c"
{ 0, NULL}
@@ -149,7 +154,7 @@ dissect_h450_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
offset = op_ptr->arg_pdu(tvb, pinfo, tree, NULL);
else
if (tvb_length_remaining(tvb, offset) > 0) {
- proto_tree_add_text(tree, tvb, offset, -1, "UNSUPPORTED ARGUMENT TYPE (H.450)");
+ proto_tree_add_expert(tree, pinfo, &ei_h450_unsupported_arg_type, tvb, offset, -1);
offset += tvb_length_remaining(tvb, offset);
}
@@ -194,7 +199,7 @@ dissect_h450_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
offset = op_ptr->res_pdu(tvb, pinfo, tree, NULL);
else
if (tvb_length_remaining(tvb, offset) > 0) {
- proto_tree_add_text(tree, tvb, offset, -1, "UNSUPPORTED RESULT TYPE (H.450)");
+ proto_tree_add_expert(tree, pinfo, &ei_h450_unsupported_result_type, tvb, offset, -1);
offset += tvb_length_remaining(tvb, offset);
}
@@ -239,7 +244,7 @@ dissect_h450_err(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
offset = err_ptr->err_pdu(tvb, pinfo, tree, NULL);
else
if (tvb_length_remaining(tvb, offset) > 0) {
- proto_tree_add_text(tree, tvb, offset, -1, "UNSUPPORTED ERROR TYPE (H.450)");
+ proto_tree_add_expert(tree, pinfo, &ei_h450_unsupported_error_type, tvb, offset, -1);
offset += tvb_length_remaining(tvb, offset);
}
@@ -265,6 +270,13 @@ void proto_register_h450(void) {
#include "packet-h450-ettarr.c"
};
+ static ei_register_info ei[] = {
+ { &ei_h450_unsupported_arg_type, { "h450.unsupported.arg_type", PI_UNDECODED, PI_WARN, "UNSUPPORTED ARGUMENT TYPE (H.450)", EXPFILL }},
+ { &ei_h450_unsupported_result_type, { "h450.unsupported.result_type", PI_UNDECODED, PI_WARN, "UNSUPPORTED RESULT TYPE (H.450)", EXPFILL }},
+ { &ei_h450_unsupported_error_type, { "h450.unsupported.error_type", PI_UNDECODED, PI_WARN, "UNSUPPORTED ERROR TYPE (H.450)", EXPFILL }},
+ };
+
+ expert_module_t* expert_h450;
/* Register protocol */
proto_h450 = proto_register_protocol(PNAME, PSNAME, PFNAME);
@@ -272,6 +284,8 @@ void proto_register_h450(void) {
/* Register fields and subtrees */
proto_register_field_array(proto_h450, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ expert_h450 = expert_register_protocol(proto_h450);
+ expert_register_field_array(expert_h450, ei, array_length(ei));
rose_ctx_init(&h450_rose_ctx);