aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/dsp
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/dsp
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/dsp')
-rw-r--r--asn1/dsp/packet-dsp-template.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/asn1/dsp/packet-dsp-template.c b/asn1/dsp/packet-dsp-template.c
index b0ebba4412..f6adf54b08 100644
--- a/asn1/dsp/packet-dsp-template.c
+++ b/asn1/dsp/packet-dsp-template.c
@@ -25,6 +25,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/expert.h>
#include <epan/prefs.h>
#include <epan/oids.h>
#include <epan/asn1.h>
@@ -62,6 +63,11 @@ static int proto_dsp = -1;
static gint ett_dsp = -1;
#include "packet-dsp-ett.c"
+static expert_field ei_dsp_unsupported_opcode = EI_INIT;
+static expert_field ei_dsp_unsupported_errcode = EI_INIT;
+static expert_field ei_dsp_unsupported_pdu = EI_INIT;
+static expert_field ei_dsp_zero_pdu = EI_INIT;
+
#include "packet-dsp-fn.c"
/*
@@ -146,8 +152,8 @@ dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da
dsp_op_name = "ChainedModify-DN-Argument";
break;
default:
- proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DSP opcode (%d)",
- session->ros_op & ROS_OP_OPCODE_MASK);
+ proto_tree_add_expert_format(tree, pinfo, &ei_dsp_unsupported_opcode, tvb, offset, -1,
+ "Unsupported DSP opcode (%d)", session->ros_op & ROS_OP_OPCODE_MASK);
break;
}
break;
@@ -190,7 +196,7 @@ dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da
dsp_op_name = "ChainedModify-DN-Result";
break;
default:
- proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DSP opcode");
+ proto_tree_add_expert(tree, pinfo, &ei_dsp_unsupported_opcode, tvb, offset, -1);
break;
}
break;
@@ -233,12 +239,12 @@ dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da
dsp_op_name = "DSA-Referral";
break;
default:
- proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DSP errcode");
+ proto_tree_add_expert(tree, pinfo, &ei_dsp_unsupported_errcode, tvb, offset, -1);
break;
}
break;
default:
- proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DSP PDU");
+ proto_tree_add_expert(tree, pinfo, &ei_dsp_unsupported_pdu, tvb, offset, -1);
return tvb_captured_length(tvb);
}
@@ -249,7 +255,7 @@ dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* da
old_offset=offset;
offset=(*dsp_dissector)(FALSE, tvb, offset, &asn1_ctx, tree, -1);
if(offset == old_offset){
- proto_tree_add_text(tree, tvb, offset, -1,"Internal error, zero-byte DSP PDU");
+ proto_tree_add_expert(tree, pinfo, &ei_dsp_zero_pdu, tvb, offset, -1);
break;
}
}
@@ -273,7 +279,15 @@ void proto_register_dsp(void) {
&ett_dsp,
#include "packet-dsp-ettarr.c"
};
+ static ei_register_info ei[] = {
+ { &ei_dsp_unsupported_opcode, { "dsp.unsupported_opcode", PI_UNDECODED, PI_WARN, "Unsupported DSP opcode", EXPFILL }},
+ { &ei_dsp_unsupported_errcode, { "dsp.unsupported_errcode", PI_UNDECODED, PI_WARN, "Unsupported DSP errcode", EXPFILL }},
+ { &ei_dsp_unsupported_pdu, { "dsp.unsupported_pdu", PI_UNDECODED, PI_WARN, "Unsupported DSP PDU", EXPFILL }},
+ { &ei_dsp_zero_pdu, { "dsp.zero_pdu", PI_PROTOCOL, PI_ERROR, "Internal error, zero-byte DSP PDU", EXPFILL }},
+ };
+
module_t *dsp_module;
+ expert_module_t* expert_dsp;
/* Register protocol */
proto_dsp = proto_register_protocol(PNAME, PSNAME, PFNAME);
@@ -283,6 +297,8 @@ void proto_register_dsp(void) {
/* Register fields and subtrees */
proto_register_field_array(proto_dsp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ expert_dsp = expert_register_protocol(proto_dsp);
+ expert_register_field_array(expert_dsp, ei, array_length(ei));
/* Register our configuration options for DSP, particularly our port */