aboutsummaryrefslogtreecommitdiffstats
path: root/asn1
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-11-22 11:54:54 -0500
committerAnders Broman <a.broman58@gmail.com>2014-11-26 09:20:44 +0000
commitab8cad28160cef32889abdc498f9c657bb31024f (patch)
tree66ba08b9079aada6f3d95419cf1681759c4d6493 /asn1
parent7c475037e4b58d75a513f206896db1885cdb9ada (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')
-rw-r--r--asn1/gsm_map/gsm_map.cnf17
-rw-r--r--asn1/gsm_map/packet-gsm_map-template.c41
-rw-r--r--asn1/ranap/packet-ranap-template.c20
-rw-r--r--asn1/ranap/ranap.cnf12
4 files changed, 72 insertions, 18 deletions
diff --git a/asn1/gsm_map/gsm_map.cnf b/asn1/gsm_map/gsm_map.cnf
index 1c4cba9511..55e3de48c9 100644
--- a/asn1/gsm_map/gsm_map.cnf
+++ b/asn1/gsm_map/gsm_map.cnf
@@ -2,7 +2,7 @@
-b
#-d satcom
#-s packet-gsm_map-tmp
--k
+#-k
-o gsm_map
#.END
@@ -315,7 +315,8 @@ MAP-DialoguePDU B "0.4.0.0.1.1.1.1" "map-DialogueAS"
/* Strip off discrimination and length */
proto_tree_add_item(subtree, hf_gsm_map_len, parameter_tvb, 1,1,ENC_BIG_ENDIAN);
next_tvb = tvb_new_subset_remaining(parameter_tvb, 2);
- dissect_bssmap(next_tvb, actx->pinfo, subtree);
+ call_dissector_with_data(bssap_handle, next_tvb, actx->pinfo, subtree,
+ p_get_proto_data(actx->pinfo->pool, actx->pinfo, proto_gsm_map, actx->pinfo->curr_layer_num));
}else if(octet==1){
proto_tree_add_item(subtree, hf_gsm_map_dlci, parameter_tvb, 1,1,ENC_BIG_ENDIAN);
proto_tree_add_item(subtree, hf_gsm_map_len, parameter_tvb, 2,1,ENC_BIG_ENDIAN);
@@ -770,7 +771,8 @@ if (!actx->value_ptr)
/* Strip off discrimination and length */
proto_tree_add_item(subtree, hf_gsm_map_len, (tvbuff_t*)actx->value_ptr, 1,1,ENC_BIG_ENDIAN);
next_tvb = tvb_new_subset_remaining((tvbuff_t*)actx->value_ptr, 2);
- dissect_bssmap(next_tvb, actx->pinfo, subtree);
+ call_dissector_with_data(bssap_handle, next_tvb, actx->pinfo, subtree,
+ p_get_proto_data(actx->pinfo->pool, actx->pinfo, proto_gsm_map, actx->pinfo->curr_layer_num));
}else if(octet==1){
proto_tree_add_item(subtree, hf_gsm_map_dlci, (tvbuff_t*)actx->value_ptr, 1,1,ENC_BIG_ENDIAN);
proto_tree_add_item(subtree, hf_gsm_map_len, (tvbuff_t*)actx->value_ptr, 2,1,ENC_BIG_ENDIAN);
@@ -783,7 +785,8 @@ if (!actx->value_ptr)
octet = tvb_get_guint8((tvbuff_t*)actx->value_ptr,0);
if ( octet == 0) {/* DISCRIMINATION TS 48 006 */
next_tvb = tvb_new_subset_remaining((tvbuff_t*)actx->value_ptr, 2);
- dissect_bssmap(next_tvb, actx->pinfo, subtree);
+ call_dissector_with_data(bssap_handle, next_tvb, actx->pinfo, subtree,
+ p_get_proto_data(actx->pinfo->pool, actx->pinfo, proto_gsm_map, actx->pinfo->curr_layer_num));
}
break;
/* ets-300102-1 (~Q.931 ) */
@@ -850,7 +853,8 @@ if (!actx->value_ptr)
/* Strip off discrimination and length */
proto_tree_add_item(subtree, hf_gsm_map_len, (tvbuff_t*)actx->value_ptr, 1,1,ENC_BIG_ENDIAN);
next_tvb = tvb_new_subset_remaining((tvbuff_t*)actx->value_ptr, 2);
- dissect_bssmap(next_tvb, actx->pinfo, subtree);
+ call_dissector_with_data(bssap_handle, next_tvb, actx->pinfo, subtree,
+ p_get_proto_data(actx->pinfo->pool, actx->pinfo, proto_gsm_map, actx->pinfo->curr_layer_num));
}else if(octet==1){
proto_tree_add_item(subtree, hf_gsm_map_dlci, (tvbuff_t*)actx->value_ptr, 1,1,ENC_BIG_ENDIAN);
proto_tree_add_item(subtree, hf_gsm_map_len, (tvbuff_t*)actx->value_ptr, 2,1,ENC_BIG_ENDIAN);
@@ -863,7 +867,8 @@ if (!actx->value_ptr)
octet = tvb_get_guint8((tvbuff_t*)actx->value_ptr,0);
if ( octet == 0) {/* DISCRIMINATION TS 48 006 */
next_tvb = tvb_new_subset_remaining((tvbuff_t*)actx->value_ptr, 2);
- dissect_bssmap(next_tvb, actx->pinfo, subtree);
+ call_dissector_with_data(bssap_handle, next_tvb, actx->pinfo, subtree,
+ p_get_proto_data(actx->pinfo->pool, actx->pinfo, proto_gsm_map, actx->pinfo->curr_layer_num));
}
break;
/* ets-300102-1 (~Q.931 ) */
diff --git a/asn1/gsm_map/packet-gsm_map-template.c b/asn1/gsm_map/packet-gsm_map-template.c
index ef0e622e5d..375530e42f 100644
--- a/asn1/gsm_map/packet-gsm_map-template.c
+++ b/asn1/gsm_map/packet-gsm_map-template.c
@@ -191,6 +191,7 @@ static dissector_handle_t data_handle;
static dissector_handle_t ranap_handle;
static dissector_handle_t dtap_handle;
static dissector_handle_t map_handle;
+static dissector_handle_t bssap_handle;
static dissector_table_t map_prop_arg_opcode_table; /* prorietary operation codes */
static dissector_table_t map_prop_res_opcode_table; /* prorietary operation codes */
static dissector_table_t map_prop_err_opcode_table; /* prorietary operation codes */
@@ -2153,6 +2154,44 @@ dissect_gsm_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void
return tvb_captured_length(tvb);
}
+static int
+dissect_gsm_map_sccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data)
+{
+ proto_item *item=NULL;
+ proto_tree *tree=NULL;
+ /* Used for gsm_map TAP */
+ static gsm_map_tap_rec_t tap_rec;
+ gint op_idx;
+ asn1_ctx_t asn1_ctx;
+
+ asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
+
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSM MAP");
+
+ top_tree = parent_tree;
+
+ /* create display subtree for the protocol */
+ item = proto_tree_add_item(parent_tree, proto_gsm_map, tvb, 0, -1, ENC_NA);
+ tree = proto_item_add_subtree(item, ett_gsm_map);
+
+ /* 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_gsm_map, pinfo->curr_layer_num, data);
+
+ dissect_gsm_map_GSMMAPPDU(FALSE, tvb, 0, &asn1_ctx, tree, -1, NULL);
+ try_val_to_str_idx(opcode, gsm_map_opr_code_strings, &op_idx);
+
+ if (op_idx != -1) {
+ tap_rec.invoke = (gsmmap_pdu_type == 1) ? TRUE : FALSE;
+ tap_rec.opr_code_idx = op_idx;
+ tap_rec.size = gsm_map_pdu_size;
+
+ tap_queue_packet(gsm_map_tap, pinfo, &tap_rec);
+ }
+
+ return tvb_captured_length(tvb);
+}
+
const value_string ssCode_vals[] = {
{ 0x00, "allSS - all SS" },
{ 0x10 ,"allLineIdentificationSS - all line identification SS" },
@@ -2445,6 +2484,7 @@ void proto_reg_handoff_gsm_map(void) {
ranap_handle = find_dissector("ranap");
dtap_handle = find_dissector("gsm_a_dtap");
gsm_sms_handle = find_dissector("gsm_sms");
+ bssap_handle = find_dissector("gsm_a_bssmap");
map_handle = find_dissector("gsm_map");
oid_add_from_string("itu(0) administration(2) japan(440)","0.2.440" );
@@ -2913,6 +2953,7 @@ void proto_register_gsm_map(void) {
proto_gsm_map_dialogue =proto_gsm_map = proto_register_protocol(PNAME, PSNAME, PFNAME);
new_register_dissector("gsm_map", dissect_gsm_map, proto_gsm_map);
+ new_register_dissector("gsm_map_sccp", dissect_gsm_map_sccp, proto_gsm_map);
/* Register fields and subtrees */
proto_register_field_array(proto_gsm_map, hf, array_length(hf));
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 );
}