aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2015-01-04 18:47:40 +0100
committerPascal Quantin <pascal.quantin@gmail.com>2015-01-04 20:14:11 +0000
commit9aeb24994364c9a3a983b4aa8db4725b1213d64d (patch)
treea66913c1ff1e76ee0980a9dcf2e01e3faba32b56 /epan
parentd9b480dd5809b76f5ed6a06eda9f9663087af6aa (diff)
ACSE: get rid of an evil global variable
Bug: 10787 Change-Id: I225dab439e195bbd308bcafd4658e77ef9023c0f Reviewed-on: https://code.wireshark.org/review/6263 Tested-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-acse.c84
1 files changed, 52 insertions, 32 deletions
diff --git a/epan/dissectors/packet-acse.c b/epan/dissectors/packet-acse.c
index 885db949bd..fdb97a06e4 100644
--- a/epan/dissectors/packet-acse.c
+++ b/epan/dissectors/packet-acse.c
@@ -236,7 +236,6 @@ 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
kind of data is transferred in SES_DATA_TRANSFER_PDUs */
static guint32 indir_ref=0;
@@ -315,7 +314,12 @@ find_oid_by_ctx_id(packet_info *pinfo _U_, guint32 idx)
static int
dissect_acse_T_direct_reference(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &object_identifier_id);
+#line 102 "../../asn1/acse/acse.cnf"
+ offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &actx->external.direct_reference);
+
+ actx->external.direct_ref_present = (actx->external.direct_reference != NULL) ? TRUE : FALSE;
+
+
return offset;
}
@@ -324,7 +328,7 @@ dissect_acse_T_direct_reference(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in
static int
dissect_acse_T_indirect_reference(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 72 "../../asn1/acse/acse.cnf"
+#line 82 "../../asn1/acse/acse.cnf"
char *oid;
struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE*) actx->private_data;
@@ -334,7 +338,8 @@ dissect_acse_T_indirect_reference(gboolean implicit_tag _U_, tvbuff_t *tvb _U_,
/* look up the indirect reference */
if((oid = find_oid_by_pres_ctx_id(actx->pinfo, indir_ref)) != NULL) {
- object_identifier_id = wmem_strdup(wmem_packet_scope(), oid);
+ actx->external.direct_reference = wmem_strdup(wmem_packet_scope(), oid);
+ actx->external.direct_ref_present = TRUE;
}
if(session)
@@ -360,8 +365,10 @@ dissect_acse_ObjectDescriptor(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
static int
dissect_acse_T_single_ASN1_type(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 91 "../../asn1/acse/acse.cnf"
- offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, top_tree ? top_tree : tree, actx->private_data);
+#line 106 "../../asn1/acse/acse.cnf"
+ if (actx->external.direct_ref_present) {
+ offset=call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, top_tree ? top_tree : tree, actx->private_data);
+ }
@@ -372,8 +379,10 @@ dissect_acse_T_single_ASN1_type(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in
static int
dissect_acse_T_octet_aligned(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 94 "../../asn1/acse/acse.cnf"
- offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, top_tree ? top_tree : tree, actx->private_data);
+#line 111 "../../asn1/acse/acse.cnf"
+ if (actx->external.direct_ref_present) {
+ offset=call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, top_tree ? top_tree : tree, actx->private_data);
+ }
@@ -470,9 +479,10 @@ dissect_acse_ASO_context_name(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
static int
dissect_acse_T_AARQ_aSO_context_name(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 56 "../../asn1/acse/acse.cnf"
+#line 62 "../../asn1/acse/acse.cnf"
offset = dissect_ber_object_identifier_str(FALSE, actx, tree, tvb, offset,
- hf_index, &object_identifier_id);
+ hf_index, &actx->external.direct_reference);
+ actx->external.direct_ref_present = (actx->external.direct_reference != NULL) ? TRUE : FALSE;
@@ -669,7 +679,12 @@ dissect_acse_GraphicString(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off
static int
dissect_acse_T_other_mechanism_name(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &object_identifier_id);
+#line 50 "../../asn1/acse/acse.cnf"
+ offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &actx->external.direct_reference);
+
+ actx->external.direct_ref_present = (actx->external.direct_reference != NULL) ? TRUE : FALSE;
+
+
return offset;
}
@@ -678,8 +693,10 @@ dissect_acse_T_other_mechanism_name(gboolean implicit_tag _U_, tvbuff_t *tvb _U_
static int
dissect_acse_T_other_mechanism_value(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 50 "../../asn1/acse/acse.cnf"
- offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, top_tree, actx->private_data);
+#line 54 "../../asn1/acse/acse.cnf"
+ if (actx->external.direct_ref_present) {
+ offset=call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, top_tree, actx->private_data);
+ }
@@ -958,7 +975,7 @@ dissect_acse_AARQ_apdu_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
static int
dissect_acse_AARQ_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 97 "../../asn1/acse/acse.cnf"
+#line 116 "../../asn1/acse/acse.cnf"
col_append_str(actx->pinfo->cinfo, COL_INFO, "A-Associate-Request");
offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
@@ -989,9 +1006,10 @@ dissect_acse_T_AARE_protocol_version(gboolean implicit_tag _U_, tvbuff_t *tvb _U
static int
dissect_acse_T_AARE_aSO_context_name(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 60 "../../asn1/acse/acse.cnf"
+#line 67 "../../asn1/acse/acse.cnf"
offset = dissect_ber_object_identifier_str(FALSE, actx, tree, tvb, offset,
- hf_index, &object_identifier_id);
+ hf_index, &actx->external.direct_reference);
+ actx->external.direct_ref_present = (actx->external.direct_reference != NULL) ? TRUE : FALSE;
@@ -1190,7 +1208,7 @@ dissect_acse_AARE_apdu_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
static int
dissect_acse_AARE_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 102 "../../asn1/acse/acse.cnf"
+#line 121 "../../asn1/acse/acse.cnf"
col_append_str(actx->pinfo->cinfo, COL_INFO, "A-Associate-Response");
offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
@@ -1213,7 +1231,7 @@ static const value_string acse_Release_request_reason_vals[] = {
static int
dissect_acse_Release_request_reason(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 115 "../../asn1/acse/acse.cnf"
+#line 134 "../../asn1/acse/acse.cnf"
int reason = -1;
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
@@ -1249,7 +1267,7 @@ dissect_acse_RLRQ_apdu_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
static int
dissect_acse_RLRQ_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 107 "../../asn1/acse/acse.cnf"
+#line 126 "../../asn1/acse/acse.cnf"
col_append_str(actx->pinfo->cinfo, COL_INFO, "Release-Request");
offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
@@ -1272,7 +1290,7 @@ static const value_string acse_Release_response_reason_vals[] = {
static int
dissect_acse_Release_response_reason(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 131 "../../asn1/acse/acse.cnf"
+#line 150 "../../asn1/acse/acse.cnf"
int reason = -1;
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
@@ -1308,7 +1326,7 @@ dissect_acse_RLRE_apdu_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
static int
dissect_acse_RLRE_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 123 "../../asn1/acse/acse.cnf"
+#line 142 "../../asn1/acse/acse.cnf"
col_append_str(actx->pinfo->cinfo, COL_INFO, "Release-Response");
offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
@@ -1330,7 +1348,7 @@ static const value_string acse_ABRT_source_vals[] = {
static int
dissect_acse_ABRT_source(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 144 "../../asn1/acse/acse.cnf"
+#line 163 "../../asn1/acse/acse.cnf"
int source = -1;
offset = dissect_ber_constrained_integer(implicit_tag, actx, tree, tvb, offset,
@@ -1387,7 +1405,7 @@ dissect_acse_ABRT_apdu_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
static int
dissect_acse_ABRT_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 139 "../../asn1/acse/acse.cnf"
+#line 158 "../../asn1/acse/acse.cnf"
col_append_str(actx->pinfo->cinfo, COL_INFO, "Abort");
offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
@@ -1422,7 +1440,7 @@ dissect_acse_Simply_encoded_data(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, i
static int
dissect_acse_T_simple_ASN1_type(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 53 "../../asn1/acse/acse.cnf"
+#line 59 "../../asn1/acse/acse.cnf"
/*XXX not implemented yet */
@@ -1534,9 +1552,10 @@ dissect_acse_A_DT_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
dissect_acse_T_ACRQ_aSO_context_name(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 64 "../../asn1/acse/acse.cnf"
+#line 72 "../../asn1/acse/acse.cnf"
offset = dissect_ber_object_identifier_str(FALSE, actx, tree, tvb, offset,
- hf_index, &object_identifier_id);
+ hf_index, &actx->external.direct_reference);
+ actx->external.direct_ref_present = (actx->external.direct_reference != NULL) ? TRUE : FALSE;
@@ -1576,9 +1595,10 @@ dissect_acse_ACRQ_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
dissect_acse_T_ACRP_aSO_context_name(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 68 "../../asn1/acse/acse.cnf"
+#line 77 "../../asn1/acse/acse.cnf"
offset = dissect_ber_object_identifier_str(FALSE, actx, tree, tvb, offset,
- hf_index, &object_identifier_id);
+ hf_index, &actx->external.direct_reference);
+ actx->external.direct_ref_present = (actx->external.direct_reference != NULL) ? TRUE : FALSE;
@@ -1677,7 +1697,7 @@ dissect_acse_AE_title(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _
/*--- End of included file: packet-acse-fn.c ---*/
-#line 151 "../../asn1/acse/packet-acse-template.c"
+#line 150 "../../asn1/acse/packet-acse-template.c"
/*
@@ -2228,7 +2248,7 @@ void proto_register_acse(void) {
NULL, HFILL }},
/*--- End of included file: packet-acse-hfarr.c ---*/
-#line 269 "../../asn1/acse/packet-acse-template.c"
+#line 268 "../../asn1/acse/packet-acse-template.c"
};
/* List of subtrees */
@@ -2274,12 +2294,12 @@ void proto_register_acse(void) {
&ett_acse_Authentication_value,
/*--- End of included file: packet-acse-ettarr.c ---*/
-#line 275 "../../asn1/acse/packet-acse-template.c"
+#line 274 "../../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_malformed, { "acse.malformed", PI_MALFORMED, PI_ERROR, "Malformed packet", EXPFILL }},
{ &ei_acse_invalid_oid, { "acse.invalid_oid", PI_UNDECODED, PI_WARN, "Invalid OID", EXPFILL }},
};