diff options
author | Michael Mann <mmann78@netscape.net> | 2013-10-28 13:36:49 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-10-28 13:36:49 +0000 |
commit | 3b91b9586fbb1f1cadeaa0b24a2521d8822c58d8 (patch) | |
tree | 593ed5da597ad0ceee006cdf385fa326c6e3ddc7 /epan/dissectors/packet-camel.c | |
parent | 6697d30b7213b1bf0147e5acfbbf1072e13d2810 (diff) |
Pass tcap_private into the dissectors that need it rather than use private_data. Not sure if value_ptr is the "proper" place to pass tcap_private "internally" within the TCAP dissector, but it gets away from (potential) private_data (ab)use.
svn path=/trunk/; revision=52916
Diffstat (limited to 'epan/dissectors/packet-camel.c')
-rw-r--r-- | epan/dissectors/packet-camel.c | 70 |
1 files changed, 34 insertions, 36 deletions
diff --git a/epan/dissectors/packet-camel.c b/epan/dissectors/packet-camel.c index 0b484529e2..d3debdd982 100644 --- a/epan/dissectors/packet-camel.c +++ b/epan/dissectors/packet-camel.c @@ -7221,16 +7221,14 @@ static guint8 camel_pdu_size = 0; static int -dissect_camel_camelPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_,proto_tree *tree, int hf_index) { +dissect_camel_camelPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_,proto_tree *tree, + int hf_index, struct tcap_private_t * p_private_tcap) { char *version_ptr; - struct tcap_private_t * p_private_tcap; opcode = 0; application_context_version = 0; - if (actx->pinfo->private_data != NULL){ - p_private_tcap=(struct tcap_private_t *)actx->pinfo->private_data; - + if (p_private_tcap != NULL){ if (p_private_tcap->acv==TRUE ){ version_ptr = strrchr((char *)p_private_tcap->oid,'.'); if (version_ptr) @@ -7255,13 +7253,12 @@ dissect_camel_camelPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn return offset; } -static void -dissect_camel_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_camel_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { - proto_item *item=NULL; - proto_tree *tree=NULL; - proto_item *stat_item=NULL; - proto_tree *stat_tree=NULL; + proto_item *item, *stat_item; + proto_tree *tree, *stat_tree; + struct tcap_private_t * p_private_tcap = (struct tcap_private_t*)data; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); @@ -7278,7 +7275,7 @@ dissect_camel_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) to store service response time related data */ gp_camelsrt_info=camelsrt_razinfo(); - dissect_camel_camelPDU(FALSE, tvb, 0, &asn1_ctx , tree, -1); + dissect_camel_camelPDU(FALSE, tvb, 0, &asn1_ctx , tree, -1, p_private_tcap); /* If a Tcap context is associated to this transaction */ if (gcamel_HandleSRT && @@ -7291,15 +7288,15 @@ dissect_camel_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) tap_queue_packet(camel_tap, pinfo, gp_camelsrt_info); } + return tvb_length(tvb); } -static void -dissect_camel_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_camel_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { - proto_item *item=NULL; - proto_tree *tree=NULL; - proto_item *stat_item=NULL; - proto_tree *stat_tree=NULL; + proto_item *item, *stat_item; + proto_tree *tree, *stat_tree; + struct tcap_private_t * p_private_tcap = (struct tcap_private_t*)data; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); @@ -7316,7 +7313,7 @@ dissect_camel_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) to store service response time related data */ gp_camelsrt_info=camelsrt_razinfo(); - dissect_camel_camelPDU(FALSE, tvb, 0, &asn1_ctx , tree, -1); + dissect_camel_camelPDU(FALSE, tvb, 0, &asn1_ctx , tree, -1, p_private_tcap); /* If a Tcap context is associated to this transaction */ if (gcamel_HandleSRT && @@ -7329,15 +7326,15 @@ dissect_camel_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) tap_queue_packet(camel_tap, pinfo, gp_camelsrt_info); } + return tvb_length(tvb); } -static void -dissect_camel(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_camel(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { - proto_item *item=NULL; - proto_tree *tree=NULL; - proto_item *stat_item=NULL; - proto_tree *stat_tree=NULL; + proto_item *item, *stat_item; + proto_tree *tree, *stat_tree; + struct tcap_private_t * p_private_tcap = (struct tcap_private_t*)data; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); @@ -7347,14 +7344,13 @@ dissect_camel(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) camel_ver = 0; /* create display subtree for the protocol */ - if(parent_tree){ - item = proto_tree_add_item(parent_tree, proto_camel, tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_camel); - } + item = proto_tree_add_item(parent_tree, proto_camel, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_camel); + /* camelsrt reset counter, and initialise global pointer to store service response time related data */ gp_camelsrt_info=camelsrt_razinfo(); - dissect_camel_camelPDU(FALSE, tvb, 0, &asn1_ctx , tree, -1); + dissect_camel_camelPDU(FALSE, tvb, 0, &asn1_ctx , tree, -1, p_private_tcap); /* If a Tcap context is associated to this transaction */ if (gcamel_HandleSRT && @@ -7366,6 +7362,8 @@ dissect_camel(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) camelsrt_call_matching(tvb, pinfo, stat_tree, gp_camelsrt_info); tap_queue_packet(camel_tap, pinfo, gp_camelsrt_info); } + + return tvb_length(tvb); } /*--- proto_reg_handoff_camel ---------------------------------------*/ @@ -7414,7 +7412,7 @@ void proto_reg_handoff_camel(void) { /*--- End of included file: packet-camel-dis-tab.c ---*/ -#line 520 "../../asn1/camel/packet-camel-template.c" +#line 518 "../../asn1/camel/packet-camel-template.c" } else { range_foreach(ssn_range, range_delete_callback); g_free(ssn_range); @@ -9528,7 +9526,7 @@ void proto_register_camel(void) { "InvokeId_present", HFILL }}, /*--- End of included file: packet-camel-hfarr.c ---*/ -#line 693 "../../asn1/camel/packet-camel-template.c" +#line 691 "../../asn1/camel/packet-camel-template.c" }; /* List of subtrees */ @@ -9743,7 +9741,7 @@ void proto_register_camel(void) { &ett_camel_InvokeId, /*--- End of included file: packet-camel-ettarr.c ---*/ -#line 709 "../../asn1/camel/packet-camel-template.c" +#line 707 "../../asn1/camel/packet-camel-template.c" }; static ei_register_info ei[] = { @@ -9757,9 +9755,9 @@ void proto_register_camel(void) { /* Register protocol */ proto_camel = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("camel", dissect_camel, proto_camel); - register_dissector("camel-v1", dissect_camel_v1, proto_camel); - register_dissector("camel-v2", dissect_camel_v2, proto_camel); + new_register_dissector("camel", dissect_camel, proto_camel); + new_register_dissector("camel-v1", dissect_camel_v1, proto_camel); + new_register_dissector("camel-v2", dissect_camel_v2, proto_camel); proto_register_field_array(proto_camel, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); |