diff options
author | Michael Mann <mmann78@netscape.net> | 2014-11-22 11:54:54 -0500 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-11-26 09:20:44 +0000 |
commit | ab8cad28160cef32889abdc498f9c657bb31024f (patch) | |
tree | 66ba08b9079aada6f3d95419cf1681759c4d6493 /asn1/ranap | |
parent | 7c475037e4b58d75a513f206896db1885cdb9ada (diff) |
Remove sccp_info member from packet_info structure.
sccp_msg_info_t* is now passed from SCCP dissector to its subdissectors through dissector data parameter.
Change-Id: Iab4aae58f8995e844f72e02e9f2de36e83589fc0
Reviewed-on: https://code.wireshark.org/review/5442
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'asn1/ranap')
-rw-r--r-- | asn1/ranap/packet-ranap-template.c | 20 | ||||
-rw-r--r-- | asn1/ranap/ranap.cnf | 12 |
2 files changed, 20 insertions, 12 deletions
diff --git a/asn1/ranap/packet-ranap-template.c b/asn1/ranap/packet-ranap-template.c index b067e4bb57..edfb747486 100644 --- a/asn1/ranap/packet-ranap-template.c +++ b/asn1/ranap/packet-ranap-template.c @@ -221,11 +221,12 @@ dissect_OutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * return (dissector_try_uint_new(ranap_proc_out_dissector_table, ProcedureCode, tvb, pinfo, tree, FALSE, NULL)) ? tvb_captured_length(tvb) : 0; } -static void -dissect_ranap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ranap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { proto_item *ranap_item = NULL; proto_tree *ranap_tree = NULL; + sccp_msg_info_t *sccp_msg_lcl = (sccp_msg_info_t *)data; pdu_type = 0; ProtocolIE_ID = 0; @@ -237,9 +238,12 @@ dissect_ranap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ranap_item = proto_tree_add_item(tree, proto_ranap, tvb, 0, -1, ENC_NA); ranap_tree = proto_item_add_subtree(ranap_item, ett_ranap); + /* Save the sccp_msg_info_t data (if present) because it can't be passed + through function calls */ + p_add_proto_data(pinfo->pool, pinfo, proto_ranap, pinfo->curr_layer_num, data); + dissect_RANAP_PDU_PDU(tvb, pinfo, ranap_tree, NULL); - if (pinfo->sccp_info) { - sccp_msg_info_t* sccp_msg_lcl = pinfo->sccp_info; + if (sccp_msg_lcl) { if (sccp_msg_lcl->data.co.assoc) sccp_msg_lcl->data.co.assoc->payload = SCCP_PLOAD_RANAP; @@ -249,11 +253,13 @@ dissect_ranap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) sccp_msg_lcl->data.co.label = wmem_strdup(wmem_file_scope(), str); } } + + return tvb_reported_length(tvb); } #define RANAP_MSG_MIN_LENGTH 7 static gboolean -dissect_sccp_ranap_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +dissect_sccp_ranap_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { guint8 temp; guint16 word; @@ -290,7 +296,7 @@ dissect_sccp_ranap_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if(word > 0x1ff){ return FALSE; } - dissect_ranap(tvb, pinfo, tree); + dissect_ranap(tvb, pinfo, tree, data); return TRUE; } @@ -335,7 +341,7 @@ void proto_register_ranap(void) { proto_register_subtree_array(ett, array_length(ett)); /* Register dissector */ - register_dissector("ranap", dissect_ranap, proto_ranap); + new_register_dissector("ranap", dissect_ranap, proto_ranap); /* Register dissector tables */ ranap_ies_dissector_table = register_dissector_table("ranap.ies", "RANAP-PROTOCOL-IES", FT_UINT32, BASE_DEC); diff --git a/asn1/ranap/ranap.cnf b/asn1/ranap/ranap.cnf index 452d7cd7a7..830fa486c4 100644 --- a/asn1/ranap/ranap.cnf +++ b/asn1/ranap/ranap.cnf @@ -188,7 +188,7 @@ MAX_VAL = asn1_param_get_integer(%(ACTX)s,"upperBound") #.FN_BODY IMSI tvbuff_t* imsi_tvb; const char *digit_str; - + sccp_msg_info_t *sccp_info; offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index, 3, 8, FALSE, &imsi_tvb); @@ -198,11 +198,13 @@ MAX_VAL = asn1_param_get_integer(%(ACTX)s,"upperBound") PROTO_ITEM_SET_HIDDEN(actx->created_item); digit_str = dissect_e212_imsi(imsi_tvb, actx->pinfo, tree, 0, tvb_reported_length(imsi_tvb), FALSE); - if ( actx->pinfo->sccp_info - && actx->pinfo->sccp_info->data.co.assoc - && ! actx->pinfo->sccp_info->data.co.assoc->calling_party ) { + sccp_info = (sccp_msg_info_t *)p_get_proto_data(actx->pinfo->pool, actx->pinfo, proto_ranap, actx->pinfo->curr_layer_num); + + if ( sccp_info + && sccp_info->data.co.assoc + && ! sccp_info->data.co.assoc->calling_party ) { - actx->pinfo->sccp_info->data.co.assoc->calling_party = + sccp_info->data.co.assoc->calling_party = wmem_strdup_printf(wmem_file_scope(), "IMSI: %%s", digit_str ); } |