aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/acse
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/acse
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/acse')
-rw-r--r--asn1/acse/packet-acse-template.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/asn1/acse/packet-acse-template.c b/asn1/acse/packet-acse-template.c
index 2f700fa2eb..37bc5e6f06 100644
--- a/asn1/acse/packet-acse-template.c
+++ b/asn1/acse/packet-acse-template.c
@@ -69,12 +69,15 @@ int proto_clacse = -1;
#include "packet-acse-hf.c"
+static gint hf_acse_user_data = -1;
/* Initialize the subtree pointers */
static gint ett_acse = -1;
#include "packet-acse-ett.c"
static expert_field ei_acse_dissector_not_available = EI_INIT;
+static expert_field ei_acse_malformed = EI_INIT;
+static expert_field ei_acse_invalid_oid = EI_INIT;
static const char *object_identifier_id;
/* indirect_reference, used to pick up the signalling so we know what
@@ -173,9 +176,8 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
/* first, try to check length */
/* do we have at least 2 bytes */
if (!tvb_bytes_exist(tvb, 0, 2)){
- proto_tree_add_text(parent_tree, tvb, offset,
- tvb_reported_length_remaining(tvb,offset),
- "User data");
+ proto_tree_add_item(parent_tree, hf_acse_user_data, tvb, offset,
+ tvb_reported_length_remaining(tvb,offset), ENC_NA);
return 0; /* no, it isn't a ACSE PDU */
}
@@ -208,7 +210,7 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
oid=find_oid_by_pres_ctx_id(pinfo, indir_ref);
if(oid){
if(strcmp(oid, ACSE_APDU_OID) == 0){
- proto_tree_add_text(parent_tree, tvb, offset, -1,
+ proto_tree_add_expert_format(parent_tree, pinfo, &ei_acse_invalid_oid, tvb, offset, -1,
"Invalid OID: %s", ACSE_APDU_OID);
THROW(ReportedBoundsError);
}
@@ -249,7 +251,7 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
int old_offset=offset;
offset = dissect_acse_ACSE_apdu(FALSE, tvb, offset, &asn1_ctx, tree, -1);
if(offset == old_offset ){
- proto_tree_add_text(tree, tvb, offset, -1,"Malformed packet");
+ proto_tree_add_expert(tree, pinfo, &ei_acse_malformed, tvb, offset, -1);
break;
}
}
@@ -263,6 +265,10 @@ void proto_register_acse(void) {
/* List of fields */
static hf_register_info hf[] = {
+ { &hf_acse_user_data,
+ { "User data", "acse.user_data",
+ FT_BYTES, BASE_NONE, NULL, 0,
+ NULL, HFILL }},
#include "packet-acse-hfarr.c"
};
@@ -274,6 +280,8 @@ void proto_register_acse(void) {
static ei_register_info ei[] = {
{ &ei_acse_dissector_not_available, { "acse.dissector_not_available", PI_UNDECODED, PI_WARN, "Dissector is not available", EXPFILL }},
+ { &ei_acse_malformed, { "acse._malformed", PI_MALFORMED, PI_ERROR, "Malformed packet", EXPFILL }},
+ { &ei_acse_invalid_oid, { "acse.invalid_oid", PI_UNDECODED, PI_WARN, "Invalid OID", EXPFILL }},
};
expert_module_t* expert_acse;