aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-acse.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 /epan/dissectors/packet-acse.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 'epan/dissectors/packet-acse.c')
-rw-r--r--epan/dissectors/packet-acse.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/epan/dissectors/packet-acse.c b/epan/dissectors/packet-acse.c
index b7a7643542..07d7cbf216 100644
--- a/epan/dissectors/packet-acse.c
+++ b/epan/dissectors/packet-acse.c
@@ -190,6 +190,7 @@ static int hf_acse_ACSE_requirements_nested_association = -1;
/*--- End of included file: packet-acse-hf.c ---*/
#line 72 "../../asn1/acse/packet-acse-template.c"
+static gint hf_acse_user_data = -1;
/* Initialize the subtree pointers */
static gint ett_acse = -1;
@@ -233,9 +234,11 @@ static gint ett_acse_Authentication_value_other = -1;
static gint ett_acse_Authentication_value = -1;
/*--- End of included file: packet-acse-ett.c ---*/
-#line 76 "../../asn1/acse/packet-acse-template.c"
+#line 77 "../../asn1/acse/packet-acse-template.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
@@ -1678,7 +1681,7 @@ dissect_acse_AE_title(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _
/*--- End of included file: packet-acse-fn.c ---*/
-#line 152 "../../asn1/acse/packet-acse-template.c"
+#line 155 "../../asn1/acse/packet-acse-template.c"
/*
@@ -1703,9 +1706,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 */
}
@@ -1738,7 +1740,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);
}
@@ -1779,7 +1781,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;
}
}
@@ -1793,6 +1795,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 }},
/*--- Included file: packet-acse-hfarr.c ---*/
#line 1 "../../asn1/acse/packet-acse-hfarr.c"
@@ -2226,7 +2232,7 @@ void proto_register_acse(void) {
NULL, HFILL }},
/*--- End of included file: packet-acse-hfarr.c ---*/
-#line 267 "../../asn1/acse/packet-acse-template.c"
+#line 273 "../../asn1/acse/packet-acse-template.c"
};
/* List of subtrees */
@@ -2272,11 +2278,13 @@ void proto_register_acse(void) {
&ett_acse_Authentication_value,
/*--- End of included file: packet-acse-ettarr.c ---*/
-#line 273 "../../asn1/acse/packet-acse-template.c"
+#line 279 "../../asn1/acse/packet-acse-template.c"
};
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;