1 /* XXX see bug 1852:
2  *
3  * packet-gsm_map.c: There are 1174 display filter fields registered.  Most are
4  * prefixed appropriately as "gsm_map", but many others are prefixed as
5  * "gsm_old", or even "gad", "gsm_ss", or with no prefix at all.  I don't know
6  * if the ones with "gsm_old" are simply obsolete display filter fields or if
7  * they should be prefixed as "gsm_map.old." or what.  Similar uncertainties
8  * for the others. Someone more knowledgeable than I am with respect to this
9  * dissector should provide a patch for it.
10  */
11 
12 /* packet-gsm_map-template.c
13  * Routines for GSM MobileApplication packet dissection
14  * including GSM SS.
15  * Copyright 2004 - 2010 , Anders Broman <anders.broman [AT] ericsson.com>
16  * Based on the dissector by:
17  * Felix Fei <felix.fei [AT] utstar.com>
18  * and Michael Lum <mlum [AT] telostech.com>
19  *
20  * Wireshark - Network traffic analyzer
21  * By Gerald Combs <gerald@wireshark.org>
22  * Copyright 1998 Gerald Combs
23  *
24  * SPDX-License-Identifier: GPL-2.0-or-later
25  * References GSM MAP:
26  * ETSI TS 129 002
27  * Updated to ETSI TS 129 002 V7.5.0 (3GPP TS 29.002 V7.5.0 (2006-09) Release 7)
28  * Updated to ETSI TS 129 002 V8.4.0 (3GPP TS 29.002 V8.1.0 (2007-06) Release 8)
29  * References GSM SS
30  * References: 3GPP TS 24.080
31  */
32 
33 #include "config.h"
34 
35 #include <stdlib.h>
36 
37 #include <epan/packet.h>
38 #include <epan/prefs.h>
39 #include <epan/stat_tap_ui.h>
40 #include <epan/tap.h>
41 #include <epan/oids.h>
42 #include <epan/expert.h>
43 #include <epan/proto_data.h>
44 #include <epan/conversation.h>
45 #include <wsutil/strtoi.h>
46 
47 #include <epan/asn1.h>
48 #include "packet-ber.h"
49 #include "packet-per.h"
50 #include "packet-q931.h"
51 #include "packet-gsm_map.h"
52 #include "packet-gsm_a_common.h"
53 #include "packet-tcap.h"
54 #include "packet-e164.h"
55 #include "packet-e212.h"
56 #include "packet-smpp.h"
57 #include "packet-gsm_sms.h"
58 #include "packet-ranap.h"
59 #include "packet-isup.h"
60 
61 #define PNAME  "GSM Mobile Application"
62 #define PSNAME "GSM_MAP"
63 #define PFNAME "gsm_map"
64 
65 void proto_register_gsm_map(void);
66 void proto_reg_handoff_gsm_map(void);
67 
68 /* Initialize the protocol and registered fields */
69 static int proto_gsm_map = -1;
70 static int proto_gsm_map_dialogue = -1;
71 static int proto_gsm_map_ms = -1;
72 
73 static int hf_gsm_map_old_Component_PDU = -1;
74 static int hf_gsm_map_getPassword = -1;
75 static int hf_gsm_map_currentPassword = -1;
76 static int hf_gsm_map_extension = -1;
77 static int hf_gsm_map_nature_of_number = -1;
78 static int hf_gsm_map_number_plan = -1;
79 static int hf_gsm_map_address_digits = -1;
80 static int hf_gsm_map_TBCD_digits = -1;
81 static int hf_gsm_map_Ss_Status_unused = -1;
82 static int hf_gsm_map_Ss_Status_q_bit = -1;
83 static int hf_gsm_map_Ss_Status_p_bit = -1;
84 static int hf_gsm_map_Ss_Status_r_bit = -1;
85 static int hf_gsm_map_Ss_Status_a_bit = -1;
86 static int hf_gsm_map_notification_to_forwarding_party = -1;
87 static int hf_gsm_map_redirecting_presentation = -1;
88 static int hf_gsm_map_notification_to_calling_party = -1;
89 static int hf_gsm_map_forwarding_reason = -1;
90 static int hf_gsm_map_pdp_type_org = -1;
91 static int hf_gsm_map_etsi_pdp_type_number = -1;
92 static int hf_gsm_map_ietf_pdp_type_number = -1;
93 static int hf_gsm_map_ext_qos_subscribed_pri = -1;
94 
95 static int hf_gsm_map_qos_traffic_cls = -1;
96 static int hf_gsm_map_qos_del_order = -1;
97 static int hf_gsm_map_qos_del_of_err_sdu = -1;
98 static int hf_gsm_map_qos_ber = -1;
99 static int hf_gsm_map_qos_sdu_err_rat = -1;
100 static int hf_gsm_map_qos_traff_hdl_pri = -1;
101 static int hf_gsm_map_qos_max_sdu = -1;
102 static int hf_gsm_map_max_brate_ulink = -1;
103 static int hf_gsm_map_max_brate_dlink = -1;
104 static int hf_gsm_map_qos_transfer_delay = -1;
105 static int hf_gsm_map_guaranteed_max_brate_ulink = -1;
106 static int hf_gsm_map_guaranteed_max_brate_dlink = -1;
107 static int hf_gsm_map_GSNAddress_IPv4 = -1;
108 static int hf_gsm_map_GSNAddress_IPv6 = -1;
109 static int hf_gsm_map_ranap_service_Handover = -1;
110 static int hf_gsm_map_IntegrityProtectionInformation = -1;
111 static int hf_gsm_map_EncryptionInformation = -1;
112 static int hf_gsm_map_ss_SS_UserData = -1;
113 static int hf_gsm_map_cbs_coding_grp = -1;
114 static int hf_gsm_map_cbs_coding_grp0_lang = -1;
115 static int hf_gsm_map_cbs_coding_grp1_lang = -1;
116 static int hf_gsm_map_cbs_coding_grp2_lang = -1;
117 static int hf_gsm_map_cbs_coding_grp3_lang = -1;
118 static int hf_gsm_map_cbs_coding_grp4_7_comp = -1;
119 static int hf_gsm_map_cbs_coding_grp4_7_class_ind = -1;
120 static int hf_gsm_map_cbs_coding_grp4_7_char_set = -1;
121 static int hf_gsm_map_cbs_coding_grp4_7_class = -1;
122 static int hf_gsm_map_cbs_coding_grp15_mess_code = -1;
123 static int hf_gsm_map_cbs_coding_grp15_class = -1;
124 static int hf_gsm_map_tmsi = -1;
125 static int hf_gsm_map_ie_tag = -1;
126 static int hf_gsm_map_len = -1;
127 static int hf_gsm_map_disc_par = -1;
128 static int hf_gsm_map_dlci = -1;
129 static int hf_gsm_apn_str = -1;
130 static int hf_gsm_map_ericsson_locationInformation_rat = -1;
131 static int hf_gsm_map_ericsson_locationInformation_lac = -1;
132 static int hf_gsm_map_ericsson_locationInformation_ci = -1;
133 static int hf_gsm_map_ericsson_locationInformation_sac = -1;
134 static int hf_gsm_map_ussd_string = -1;
135 static int hf_gsm_map_spare_bits = -1;
136 static int hf_gsm_map_qos_signalling_ind = -1;
137 static int hf_gsm_map_qos_source_stat_desc = - 1;
138 static int hf_gsm_map_qos_max_bitrate_upl_ext = -1;
139 static int hf_gsm_map_qos_max_bitrate_downl_ext = -1;
140 static int hf_gsm_map_qos_guar_bitrate_upl_ext = -1;
141 static int hf_gsm_map_qos_guar_bitrate_downl_ext = -1;
142 /*
143 static int hf_gsm_map_qos_max_bitrate_upl_ext2 = -1;
144 static int hf_gsm_map_qos_max_bitrate_downl_ext2 = -1;
145 static int hf_gsm_map_qos_guar_bitrate_upl_ext2 = -1;
146 static int hf_gsm_map_qos_guar_bitrate_downl_ext2 = -1;
147 */
148 static int hf_gsm_map_earp_pci = -1;
149 static int hf_gsm_map_earp_pl = -1;
150 static int hf_gsm_map_earp_pvi = -1;
151 
152 #include "packet-gsm_map-hf.c"
153 
154 /* Initialize the subtree pointers */
155 static gint ett_gsm_map = -1;
156 static gint ett_gsm_map_InvokeId = -1;
157 static gint ett_gsm_map_InvokePDU = -1;
158 static gint ett_gsm_map_ReturnResultPDU = -1;
159 static gint ett_gsm_map_ReturnErrorPDU = -1;
160 static gint ett_gsm_map_ReturnResult_result = -1;
161 static gint ett_gsm_map_ReturnError_result = -1;
162 static gint ett_gsm_map_GSMMAPPDU = -1;
163 static gint ett_gsm_map_ext_qos_subscribed = -1;
164 static gint ett_gsm_map_pdptypenumber = -1;
165 static gint ett_gsm_map_RAIdentity = -1;
166 static gint ett_gsm_map_LAIFixedLength = -1;
167 static gint ett_gsm_map_isdn_address_string = -1;
168 static gint ett_gsm_map_geo_desc = -1;
169 static gint ett_gsm_map_LongSignalInfo = -1;
170 static gint ett_gsm_map_RadioResourceInformation =-1;
171 static gint ett_gsm_map_MSNetworkCapability =-1;
172 static gint ett_gsm_map_MSRadioAccessCapability = -1;
173 static gint ett_gsm_map_externalsignalinfo = -1;
174 static gint ett_gsm_map_cbs_data_coding = -1;
175 static gint ett_gsm_map_GlobalCellId = -1;
176 static gint ett_gsm_map_GeographicalInformation = -1;
177 static gint ett_gsm_map_apn_str = -1;
178 static gint ett_gsm_map_LocationNumber = -1;
179 static gint ett_gsm_map_ericsson_locationInformation = -1;
180 static gint ett_gsm_map_extension_data = -1;
181 static gint ett_gsm_map_tbcd_digits = -1;
182 static gint ett_gsm_map_ussd_string = -1;
183 static gint ett_gsm_map_ext2_qos_subscribed = -1;
184 static gint ett_gsm_map_ext3_qos_subscribed = -1;
185 static gint ett_gsm_map_e_utranCellGlobalIdentity = -1;
186 static gint ett_gsm_map_TA_id = -1;
187 static gint ett_gsm_map_GeodeticInformation = -1;
188 
189 #include "packet-gsm_map-ett.c"
190 
191 static expert_field ei_gsm_map_unknown_sequence3 = EI_INIT;
192 static expert_field ei_gsm_map_unknown_sequence = EI_INIT;
193 static expert_field ei_gsm_map_unknown_parameter = EI_INIT;
194 static expert_field ei_gsm_map_unknown_invokeData = EI_INIT;
195 static expert_field ei_gsm_map_undecoded = EI_INIT;
196 
197 static dissector_handle_t       gsm_sms_handle; /* SMS TPDU */
198 static dissector_handle_t       ranap_handle;
199 static dissector_handle_t       dtap_handle;
200 static dissector_handle_t       map_handle;
201 static dissector_handle_t       bssap_handle;
202 static dissector_table_t        map_prop_arg_opcode_table; /* prorietary operation codes */
203 static dissector_table_t        map_prop_res_opcode_table; /* prorietary operation codes */
204 static dissector_table_t        map_prop_err_opcode_table; /* prorietary operation codes */
205 /* Preferenc settings default */
206 #define MAX_SSN 254
207 static range_t *global_ssn_range;
208 #define APPLICATON_CONTEXT_FROM_TRACE 0
209 static gint pref_application_context_version = APPLICATON_CONTEXT_FROM_TRACE;
210 static gboolean pref_ericsson_proprietary_ext = FALSE;
211 
212 /* Global variables */
213 static guint32 opcode=0;
214 static guint32 errorCode;
215 static int application_context_version;
216 static guint ProtocolId;
217 static guint AccessNetworkProtocolId;
218 static int gsm_map_tap = -1;
219 static guint8 gsmmap_pdu_type = 0;
220 static guint8 gsm_map_pdu_size = 0;
221 
222 #define SMS_ENCODING_NOT_SET    0
223 #define SMS_ENCODING_7BIT       1
224 #define SMS_ENCODING_8BIT       2
225 #define SMS_ENCODING_UCS2       3
226 #define SMS_ENCODING_7BIT_LANG  4
227 #define SMS_ENCODING_UCS2_LANG  5
228 
229 static guint8 sms_encoding;
230 
231 /* Forward declarations */
232 static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx);
233 static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx);
234 static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx);
235 const gchar* gsm_map_opr_code(guint32 val, proto_item *item);
236 
237 typedef struct {
238   struct tcap_private_t * tcap_private;
239   sccp_msg_info_t *sccp_msg_info;
240   tvbuff_t *signal_info_tvb;
241 } gsm_map_private_info_t;
242 
243 typedef struct {
244   wmem_tree_t *packets;
245 } gsm_map_conv_info_t;
246 
gsm_map_get_packet_info(asn1_ctx_t * actx,gboolean store_conv_info)247 static gsm_map_packet_info_t *gsm_map_get_packet_info(asn1_ctx_t *actx, gboolean store_conv_info)
248 {
249   gsm_map_packet_info_t *gsm_map_pi = (gsm_map_packet_info_t*)p_get_proto_data(wmem_file_scope(), actx->pinfo, proto_gsm_map, 0);
250   if (!gsm_map_pi) {
251     gsm_map_private_info_t *gsm_map_priv = (gsm_map_private_info_t*)actx->value_ptr;
252     gsm_map_pi = wmem_new0(wmem_file_scope(), gsm_map_packet_info_t);
253     p_add_proto_data(wmem_file_scope(), actx->pinfo, proto_gsm_map, 0, gsm_map_pi);
254     if (gsm_map_priv && gsm_map_priv->tcap_private) {
255       gsm_map_pi->tcap_src_tid = gsm_map_priv->tcap_private->src_tid;
256       if (store_conv_info) {
257         conversation_t *conversation;
258         gsm_map_conv_info_t *gsm_map_info;
259         wmem_tree_key_t key[3];
260         conversation = find_or_create_conversation(actx->pinfo);
261         gsm_map_info = (gsm_map_conv_info_t *)conversation_get_proto_data(conversation, proto_gsm_map);
262         if (!gsm_map_info) {
263             gsm_map_info = wmem_new(wmem_file_scope(), gsm_map_conv_info_t);
264             gsm_map_info->packets = wmem_tree_new(wmem_file_scope());
265             conversation_add_proto_data(conversation, proto_gsm_map, gsm_map_info);
266         }
267         key[0].length = 1;
268         key[0].key = &gsm_map_priv->tcap_private->src_tid;
269         key[1].length = 1;
270         key[1].key = &actx->pinfo->num;
271         key[2].length = 0;
272         key[2].key = NULL;
273         wmem_tree_insert32_array(gsm_map_info->packets, key, (void *)gsm_map_pi);
274       }
275     }
276   }
277   return gsm_map_pi;
278 }
279 
gsm_map_get_matching_tcap_info(asn1_ctx_t * actx)280 static gsm_map_packet_info_t *gsm_map_get_matching_tcap_info(asn1_ctx_t *actx)
281 {
282   gsm_map_private_info_t *gsm_map_priv = (gsm_map_private_info_t*)actx->value_ptr;
283   if (gsm_map_priv && gsm_map_priv->tcap_private) {
284     conversation_t *conversation;
285     gsm_map_conv_info_t *gsm_map_info;
286     wmem_tree_key_t key[3];
287     gsm_map_packet_info_t *gsm_map_pi;
288     conversation = find_or_create_conversation(actx->pinfo);
289     gsm_map_info = (gsm_map_conv_info_t *)conversation_get_proto_data(conversation, proto_gsm_map);
290     if (!gsm_map_info) {
291       gsm_map_info = wmem_new(wmem_file_scope(), gsm_map_conv_info_t);
292       gsm_map_info->packets = wmem_tree_new(wmem_file_scope());
293       conversation_add_proto_data(conversation, proto_gsm_map, gsm_map_info);
294     }
295     key[0].length = 1;
296     key[0].key = &gsm_map_priv->tcap_private->src_tid;
297     key[1].length = 1;
298     key[1].key = &actx->pinfo->num;
299     key[2].length = 0;
300     key[2].key = NULL;
301     gsm_map_pi = (gsm_map_packet_info_t*)wmem_tree_lookup32_array_le(gsm_map_info->packets, key);
302     if (gsm_map_pi && gsm_map_pi->tcap_src_tid == gsm_map_priv->tcap_private->src_tid)
303       return gsm_map_pi;
304   }
305   return NULL;
306 }
307 
308 /* Value strings */
309 
310 const value_string gsm_map_PDP_Type_Organisation_vals[] = {
311   {  0, "ETSI" },
312   {  1, "IETF" },
313   { 0, NULL }
314 };
315 
316 const value_string gsm_map_ietf_defined_pdp_vals[] = {
317   {  0x21, "IPv4 Address" },
318   {  0x57, "IPv6 Address" },
319   { 0, NULL }
320 };
321 
322 const value_string gsm_map_etsi_defined_pdp_vals[] = {
323   {  1, "PPP" },
324   { 0, NULL }
325 };
326 
327 static const value_string gsm_map_tag_vals[] = {
328   {  0x4, "Bearer Capability" },
329   { 0, NULL }
330 };
331 
332 static const value_string gsm_map_disc_par_vals[] = {
333   {  0, "Not Transparent" },
334   {  1, "Transparent" },
335   { 0, NULL }
336 };
337 
338 static const value_string gsm_map_ericsson_locationInformation_rat_vals[] = {
339   { 0x0, "GSM" },
340   { 0x1, "UMTS" },
341   { 0x2, "LTE" },
342   { 0xf, "No information" },
343   { 0, NULL }
344 };
345 
346 
347 /* returns value in kb/s */
348 static guint
gsm_map_calc_bitrate(guint8 value)349 gsm_map_calc_bitrate(guint8 value){
350 
351   guint8 granularity;
352   guint returnvalue;
353 
354   if (value == 0xff)
355     return 0;
356 
357   granularity = value >> 6;
358   returnvalue = value & 0x7f;
359   switch (granularity){
360   case 0:
361     break;
362   case 1:
363     returnvalue = ((returnvalue - 0x40) << 3)+64;
364     break;
365   case 2:
366     returnvalue = (returnvalue << 6)+576;
367     break;
368   case 3:
369     returnvalue = (returnvalue << 6)+576;
370     break;
371   }
372   return returnvalue;
373 
374 }
375 
376 static void
dissect_gsm_map_ext_qos_subscribed(tvbuff_t * tvb,packet_info * pinfo _U_,proto_tree * tree _U_,asn1_ctx_t * actx)377 dissect_gsm_map_ext_qos_subscribed(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx){
378   int offset = 0;
379   proto_tree *subtree;
380   guint8 octet;
381   guint16 value;
382 
383   subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_ext_qos_subscribed);
384   /*  OCTET 1:
385     Allocation/Retention Priority (This octet encodes each priority level defined in
386     23.107 as the binary value of the priority level, declaration in 29.060)
387     Octets 2-9 are coded according to 3GPP TS 24.008[35] Quality of Service Octets
388     6-13.
389    */
390   /* Allocation/Retention Priority */
391   proto_tree_add_item(subtree, hf_gsm_map_ext_qos_subscribed_pri, tvb, offset, 1, ENC_BIG_ENDIAN);
392   offset++;
393 
394   /* Quality of Service Octets 6-13.( Octet 2 - 9 Here) */
395 
396   /* Traffic class, octet 6 (see 3GPP TS 23.107) Bits 8 7 6 */
397   proto_tree_add_item(subtree, hf_gsm_map_qos_traffic_cls, tvb, offset, 1, ENC_BIG_ENDIAN);
398   /* Delivery order, octet 6 (see 3GPP TS 23.107) Bits 5 4 */
399   proto_tree_add_item(subtree, hf_gsm_map_qos_del_order, tvb, offset, 1, ENC_BIG_ENDIAN);
400   /* Delivery of erroneous SDUs, octet 6 (see 3GPP TS 23.107) Bits 3 2 1 */
401   proto_tree_add_item(subtree, hf_gsm_map_qos_del_of_err_sdu, tvb, offset, 1, ENC_BIG_ENDIAN);
402   offset++;
403 
404   /* Maximum SDU size, octet 7 (see 3GPP TS 23.107) */
405   octet = tvb_get_guint8(tvb,offset);
406   switch (octet){
407   case 0:
408     proto_tree_add_uint_format_value(subtree, hf_gsm_map_qos_max_sdu, tvb, offset, 1, octet, "Reserved");
409     break;
410   case 0x93:
411     value = 1502;
412     proto_tree_add_uint(subtree, hf_gsm_map_qos_max_sdu, tvb, offset, 1, value);
413     break;
414   case 0x98:
415     value = 1510;
416     proto_tree_add_uint(subtree, hf_gsm_map_qos_max_sdu, tvb, offset, 1, value);
417     break;
418   case 0x99:
419     value = 1532;
420     proto_tree_add_uint(subtree, hf_gsm_map_qos_max_sdu, tvb, offset, 1, value);
421     break;
422   default:
423     if (octet<0x97){
424       value = octet * 10;
425       proto_tree_add_uint(subtree, hf_gsm_map_qos_max_sdu, tvb, offset, 1, value);
426     }else{
427       proto_tree_add_uint_format_value(subtree, hf_gsm_map_qos_max_sdu, tvb, offset, 1, octet, "0x%x not defined in TS 24.008", octet);
428     }
429   }
430   offset++;
431 
432   /* Maximum bit rate for uplink, octet 8 */
433   octet = tvb_get_guint8(tvb,offset);
434   if (octet == 0 ){
435     proto_tree_add_uint_format_value(subtree, hf_gsm_map_max_brate_ulink, tvb, offset, 1, octet, "Reserved"  );
436   }else{
437     proto_tree_add_uint(subtree, hf_gsm_map_max_brate_ulink, tvb, offset, 1, gsm_map_calc_bitrate(octet));
438   }
439   offset++;
440   /* Maximum bit rate for downlink, octet 9 (see 3GPP TS 23.107) */
441   octet = tvb_get_guint8(tvb,offset);
442   if (octet == 0 ){
443     proto_tree_add_uint_format_value(subtree, hf_gsm_map_max_brate_dlink, tvb, offset, 1, octet, "Reserved"  );
444   }else{
445     proto_tree_add_uint(subtree, hf_gsm_map_max_brate_dlink, tvb, offset, 1, gsm_map_calc_bitrate(octet));
446   }
447   offset++;
448   /* Residual Bit Error Rate (BER), octet 10 (see 3GPP TS 23.107) Bits 8 7 6 5 */
449   proto_tree_add_item(subtree, hf_gsm_map_qos_ber, tvb, offset, 1, ENC_BIG_ENDIAN);
450   /* SDU error ratio, octet 10 (see 3GPP TS 23.107) */
451   proto_tree_add_item(subtree, hf_gsm_map_qos_sdu_err_rat, tvb, offset, 1, ENC_BIG_ENDIAN);
452   offset++;
453 
454   /* Transfer delay, octet 11 (See 3GPP TS 23.107) Bits 8 7 6 5 4 3 */
455   proto_tree_add_item(subtree, hf_gsm_map_qos_transfer_delay, tvb, offset, 1, ENC_BIG_ENDIAN);
456   /* Traffic handling priority, octet 11 (see 3GPP TS 23.107) Bits 2 1 */
457   proto_tree_add_item(subtree, hf_gsm_map_qos_traff_hdl_pri, tvb, offset, 1, ENC_BIG_ENDIAN);
458   offset++;
459 
460   /*  Guaranteed bit rate for uplink, octet 12 (See 3GPP TS 23.107)
461       Coding is identical to that of Maximum bit rate for uplink.
462   */
463   octet = tvb_get_guint8(tvb,offset);
464   if (octet == 0 ){
465     proto_tree_add_uint_format_value(subtree, hf_gsm_map_guaranteed_max_brate_ulink, tvb, offset, 1, octet, "Subscribed guaranteed bit rate for uplink/reserved");
466   }else{
467     proto_tree_add_uint(subtree, hf_gsm_map_guaranteed_max_brate_ulink, tvb, offset, 1, gsm_map_calc_bitrate(octet));
468   }
469   offset++;
470 
471   /*  Guaranteed bit rate for downlink, octet 13(See 3GPP TS 23.107)
472       Coding is identical to that of Maximum bit rate for uplink.
473   */
474   octet = tvb_get_guint8(tvb,offset);
475   if (octet == 0 ){
476     proto_tree_add_uint_format_value(subtree, hf_gsm_map_guaranteed_max_brate_dlink, tvb, offset, 1, octet, "Subscribed guaranteed bit rate for downlink/reserved");
477   }else{
478     proto_tree_add_uint(subtree, hf_gsm_map_guaranteed_max_brate_dlink, tvb, offset, 1, gsm_map_calc_bitrate(octet));
479   }
480 
481 }
482 
483 /*
484 Ext2-QoS-Subscribed ::= OCTET STRING (SIZE (1..3))
485 -- Octets 1-3 are coded according to 3GPP TS 24.008 [35] Quality of Service Octets 14-16.
486 -- If Quality of Service information is structured with 14 octet length, then
487 -- Octet 1 is coded according to 3GPP TS 24.008 [35] Quality of Service Octet 14.
488 
489 */
490 
491 static const true_false_string gsm_map_qos_signalling_ind_value = {
492     "Optimised for signalling traffic",
493     "Not optimised for signalling traffic"
494 };
495 #if 0
496 /* Helper function returning the main bitrates in kbps */
497 static guint32
498 qos_calc_bitrate(guint8 oct)
499 {
500     if (oct <= 0x3f)
501         return oct;
502     if (oct <= 0x7f)
503         return 64 + (oct - 0x40) * 8;
504 
505     return 576 + (oct - 0x80) * 64;
506 }
507 #endif
508 /* Helper function returning the extended bitrates in kbps */
509 static guint32
qos_calc_ext_bitrate(guint8 oct)510 qos_calc_ext_bitrate(guint8 oct)
511 {
512     if (oct <= 0x4a)
513         return 8600 + oct * 100;
514     if (oct <= 0xba)
515         return 16000 + (oct - 0x4a) * 1000;
516 
517     return 128000 + (oct - 0xba) * 2000;
518 }
519 #if 0
520 static guint32
521 qos_calc_ext2_bitrate(guint8 oct)
522 {
523     if (oct <= 0x3d)
524         return (256 + oct * 4);
525     if (oct <= 0xa1)
526         return (500 + (oct - 0x3d) * 10);
527     if (oct <= 0xf6)
528         return (1500 + (oct - 0xa1) * 100);
529 
530     return 10000;
531 }
532 #endif
533 static void
dissect_gsm_map_ext2_qos_subscribed(tvbuff_t * tvb,packet_info * pinfo _U_,proto_tree * tree _U_,asn1_ctx_t * actx)534 dissect_gsm_map_ext2_qos_subscribed(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx) {
535 
536     int offset = 0;
537     proto_tree *subtree;
538     const gchar *str;
539     guint8 oct, tmp_oct;
540     guint32 temp32;
541     int length = tvb_reported_length(tvb);
542 
543     subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_ext2_qos_subscribed);
544 
545     /* Ocet 14 */
546     oct = tvb_get_guint8(tvb, offset);
547     proto_tree_add_bits_item(subtree, hf_gsm_map_spare_bits, tvb, (offset << 3), 3, ENC_BIG_ENDIAN);
548     proto_tree_add_item(subtree, hf_gsm_map_qos_signalling_ind, tvb, offset, 1, ENC_BIG_ENDIAN);
549 
550     tmp_oct = oct & 7;
551     if (tmp_oct == 0x01)
552         str = "speech";
553     else
554         str = "unknown";
555 
556     proto_tree_add_uint_format_value(subtree, hf_gsm_map_qos_source_stat_desc, tvb,
557         offset, 1, oct, "%s (%u)", str, tmp_oct);
558 
559     offset += 1;
560     if (length == offset) {
561         return;
562     }
563 
564     /* Octet 15 */
565     oct = tvb_get_guint8(tvb, offset);
566 
567     if (oct == 0x00)
568         str = "Use the value indicated by the Maximum bit rate for downlink";
569     else
570     {
571         temp32 = qos_calc_ext_bitrate(oct);
572         if (temp32 % 1000 == 0)
573             str = wmem_strdup_printf(pinfo->pool, "%u Mbps", temp32 / 1000);
574         else
575             str = wmem_strdup_printf(pinfo->pool, "%u kbps", temp32);
576     }
577     proto_tree_add_uint_format_value(subtree, hf_gsm_map_qos_max_bitrate_downl_ext, tvb,
578         offset, 1, oct, "%s (%u)", str, oct);
579 
580     offset += 1;
581     if (length == offset) {
582         return;
583     }
584 
585     /* Octet 16 */
586     oct = tvb_get_guint8(tvb, offset);
587 
588     if (oct == 0x00)
589         str = "Use the value indicated by the Guaranteed bit rate for downlink";
590     else
591     {
592         temp32 = qos_calc_ext_bitrate(oct);
593         if (temp32 % 1000 == 0)
594             str = wmem_strdup_printf(pinfo->pool, "%u Mbps", temp32 / 1000);
595         else
596             str = wmem_strdup_printf(pinfo->pool, "%u kbps", temp32);
597     }
598     proto_tree_add_uint_format_value(subtree, hf_gsm_map_qos_guar_bitrate_downl_ext, tvb,
599         offset, 1, oct, "%s (%u)", str, oct);
600 
601 }
602 
603 /*
604 Ext3-QoS-Subscribed ::= OCTET STRING (SIZE (1..2))
605 -- Octets 1-2 are coded according to 3GPP TS 24.008 [35] Quality of Service Octets 17-18.
606 
607 */
608 static void
dissect_gsm_map_ext3_qos_subscribed(tvbuff_t * tvb,packet_info * pinfo _U_,proto_tree * tree _U_,asn1_ctx_t * actx)609 dissect_gsm_map_ext3_qos_subscribed(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx) {
610 
611     int offset = 0;
612     proto_tree *subtree;
613     const gchar *str;
614     guint8 oct;
615     guint32 temp32;
616     int length = tvb_reported_length(tvb);
617 
618     subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_ext3_qos_subscribed);
619 
620     /* Maximum bit rate for uplink (extended) Octet 17 */
621     oct = tvb_get_guint8(tvb, offset);
622 
623     if (oct == 0x00)
624         str = "Use the value indicated by the Maximum bit rate for uplink";
625     else
626     {
627         temp32 = qos_calc_ext_bitrate(oct);
628         if (temp32 % 1000 == 0)
629             str = wmem_strdup_printf(pinfo->pool, "%u Mbps", temp32 / 1000);
630         else
631             str = wmem_strdup_printf(pinfo->pool, "%u kbps", temp32);
632     }
633     proto_tree_add_uint_format_value(subtree, hf_gsm_map_qos_max_bitrate_upl_ext, tvb,
634         offset, 1, oct, "%s (%u)", str, oct);
635 
636     offset += 1;
637     if (length == offset) {
638         return;
639     }
640 
641     /* Guaranteed bit rate for uplink (extended) Octet 18 */
642     oct = tvb_get_guint8(tvb, offset);
643 
644     if (oct == 0x00)
645         str = "Use the value indicated by the Guaranteed bit rate for uplink";
646     else
647     {
648         temp32 = qos_calc_ext_bitrate(oct);
649         if (temp32 % 1000 == 0)
650             str = wmem_strdup_printf(pinfo->pool, "%u Mbps", temp32 / 1000);
651         else
652             str = wmem_strdup_printf(pinfo->pool, "%u kbps", temp32);
653     }
654     proto_tree_add_uint_format_value(subtree, hf_gsm_map_qos_guar_bitrate_upl_ext, tvb,
655         offset, 1, oct, "%s (%u)", str, oct);
656 
657     return;
658 }
659 
660 static void
dissect_gsm_map_ext4_qos_subscribed(tvbuff_t * tvb,packet_info * pinfo _U_,proto_tree * tree _U_,asn1_ctx_t * actx)661 dissect_gsm_map_ext4_qos_subscribed(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx) {
662     int offset = 0;
663     proto_tree *subtree;
664 
665     subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_ext3_qos_subscribed);
666 
667     proto_tree_add_item(subtree, hf_gsm_map_earp_pvi, tvb, offset, 1, ENC_BIG_ENDIAN);
668     proto_tree_add_item(subtree, hf_gsm_map_earp_pl, tvb, offset, 1, ENC_BIG_ENDIAN);
669     proto_tree_add_item(subtree, hf_gsm_map_earp_pci, tvb, offset, 1, ENC_BIG_ENDIAN);
670 
671 }
672 #define  ELLIPSOID_POINT 0
673 #define  ELLIPSOID_POINT_WITH_UNCERT_CIRC 1
674 #define  ELLIPSOID_POINT_WITH_UNCERT_ELLIPSE 3
675 #define  POLYGON 5
676 #define  ELLIPSOID_POINT_WITH_ALT 8
677 #define  ELLIPSOID_POINT_WITH_ALT_AND_UNCERT_ELLIPSOID 9
678 #define  ELLIPSOID_ARC 10
679 /*
680 4 3 2 1
681 0 0 0 0 Ellipsoid Point
682 0 0 0 1 Ellipsoid point with uncertainty Circle
683 0 0 1 1 Ellipsoid point with uncertainty Ellipse
684 0 1 0 1 Polygon
685 1 0 0 0 Ellipsoid point with altitude
686 1 0 0 1 Ellipsoid point with altitude and uncertainty Ellipsoid
687 1 0 1 0 Ellipsoid Arc
688 other values reserved for future use
689 */
690 
691 /* TS 23 032 Table 2a: Coding of Type of Shape */
692 #if 0
693 static const value_string type_of_shape_vals[] = {
694   { ELLIPSOID_POINT, "Ellipsoid Point"},
695   { ELLIPSOID_POINT_WITH_UNCERT_CIRC, "Ellipsoid point with uncertainty Circle"},
696   { ELLIPSOID_POINT_WITH_UNCERT_ELLIPSE, "Ellipsoid point with uncertainty Ellipse"},
697   { POLYGON, "Polygon"},
698   { ELLIPSOID_POINT_WITH_ALT, "Ellipsoid point with altitude"},
699   { ELLIPSOID_POINT_WITH_ALT_AND_UNCERT_ELLIPSOID, "Ellipsoid point with altitude and uncertainty Ellipsoid"},
700   { ELLIPSOID_ARC, "Ellipsoid Arc"},
701   { 0, NULL }
702 };
703 
704 /* 3GPP TS 23.032 7.3.1 */
705 static const value_string sign_of_latitude_vals[] = {
706   { 0, "North"},
707   { 1, "South"},
708   { 0, NULL }
709 };
710 
711 static const value_string dir_of_alt_vals[] = {
712   { 0, "Altitude expresses height"},
713   { 1, "Altitude expresses depth"},
714   { 0, NULL }
715 };
716 #endif
717 
718 static const value_string gsm_map_cbs_data_coding_scheme_coding_grp_vals[] = {
719   { 0, "Coding Group 0(Language using the GSM 7 bit default alphabet)" },
720   { 1, "Coding Group 1" },
721   { 2, "Coding Group 2" },
722   { 3, "Coding Group 3" },
723   { 4, "General Data Coding indication" },
724   { 5, "General Data Coding indication" },
725   { 6, "General Data Coding indication" },
726   { 7, "General Data Coding indication" },
727   { 8, "Reserved" },
728   { 9, "Message with User Data Header (UDH) structure" },
729   { 10,"Reserved" },
730   { 11,"Reserved" },
731   { 12,"Reserved" },
732   { 13,"Reserved" },
733   { 14,"Defined by the WAP Forum" },
734   { 15,"Data coding / message handling" },
735   { 0, NULL}
736 };
737 static value_string_ext gsm_map_cbs_data_coding_scheme_coding_grp_vals_ext = VALUE_STRING_EXT_INIT(gsm_map_cbs_data_coding_scheme_coding_grp_vals);
738 
739 /* Coding group 0
740  * Bits 3..0 indicate the language:
741  */
742 static const value_string gsm_map_cbs_coding_grp0_lang_vals[] = {
743   { 0, "German"},
744   { 1, "English"},
745   { 2, "Italian"},
746   { 3, "French"},
747   { 4, "Spanish"},
748   { 5, "Dutch"},
749   { 6, "Swedish"},
750   { 7, "Danish"},
751   { 8, "Portuguese"},
752   { 9, "Finnish"},
753   { 10, "Norwegian"},
754   { 11, "Greek"},
755   { 12, "Turkish"},
756   { 13, "Hungarian"},
757   { 14, "Polish"},
758   { 15, "Language unspecified"},
759   { 0, NULL }
760 };
761 static value_string_ext gsm_map_cbs_coding_grp0_lang_vals_ext = VALUE_STRING_EXT_INIT(gsm_map_cbs_coding_grp0_lang_vals);
762 
763 static const value_string gsm_map_cbs_coding_grp1_lang_vals[] = {
764   { 0, "GSM 7 bit default alphabet; message preceded by language indication"},
765   { 1, "UCS2; message preceded by language indication"},
766   { 2, "Reserved"},
767   { 3, "Reserved"},
768   { 4, "Reserved"},
769   { 5, "Reserved"},
770   { 6, "Reserved"},
771   { 7, "Reserved"},
772   { 8, "Reserved"},
773   { 9, "Reserved"},
774   { 10, "Reserved"},
775   { 11, "Reserved"},
776   { 12, "Reserved"},
777   { 13, "Reserved"},
778   { 14, "Reserved"},
779   { 15, "Reserved"},
780   { 0, NULL }
781 };
782 static value_string_ext gsm_map_cbs_coding_grp1_lang_vals_ext = VALUE_STRING_EXT_INIT(gsm_map_cbs_coding_grp1_lang_vals);
783 
784 static const value_string gsm_map_cbs_coding_grp2_lang_vals[] = {
785   { 0, "Czech"},
786   { 1, "Hebrew"},
787   { 2, "Arabic"},
788   { 3, "Russian"},
789   { 4, "Icelandic"},
790   { 5, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
791   { 6, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
792   { 7, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
793   { 8, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
794   { 9, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
795   { 10, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
796   { 11, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
797   { 12, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
798   { 13, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
799   { 14, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
800   { 15, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
801   { 0, NULL }
802 };
803 static value_string_ext gsm_map_cbs_coding_grp2_lang_vals_ext = VALUE_STRING_EXT_INIT(gsm_map_cbs_coding_grp2_lang_vals);
804 
805 static const value_string gsm_map_cbs_coding_grp3_lang_vals[] = {
806   { 0, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
807   { 1, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
808   { 2, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
809   { 3, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
810   { 4, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
811   { 5, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
812   { 6, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
813   { 7, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
814   { 8, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
815   { 9, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
816   { 10, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
817   { 11, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
818   { 12, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
819   { 13, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
820   { 14, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
821   { 15, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
822   { 0, NULL }
823 };
824 static value_string_ext gsm_map_cbs_coding_grp3_lang_vals_ext = VALUE_STRING_EXT_INIT(gsm_map_cbs_coding_grp3_lang_vals);
825 
826 static const true_false_string gsm_map_cbs_coding_grp4_7_comp_vals = {
827   "The text is compressed using the compression algorithm defined in 3GPP TS 23.042",
828   "The text is uncompressed"
829 };
830 
831 static const true_false_string gsm_map_cbs_coding_grp4_7_class_ind_vals = {
832   "Bits 1 to 0 have a message class meaning",
833   "Bits 1 to 0 are reserved and have no message class meaning"
834 };
835 
836 /* Bits 3 and 2 indicate the character set being used, as follows: */
837 
838 static const value_string gsm_map_cbs_coding_grp4_7_char_set_vals[] = {
839   { 0, "GSM 7 bit default alphabet"},
840   { 1, "8 bit data"},
841   { 2, "UCS2 (16 bit)"},
842   { 3, "Reserved"},
843   { 0, NULL }
844 };
845 
846 static const value_string gsm_map_cbs_coding_grp4_7_class_vals[] = {
847   { 0, "Class 0"},
848   { 1, "Class 1 Default meaning: ME-specific"},
849   { 2, "Class 2 (U)SIM specific message"},
850   { 3, "Class 3 Default meaning: TE-specific (see 3GPP TS 27.005"},
851   { 0, NULL }
852 };
853 
854 static const value_string gsm_map_cbs_coding_grp15_mess_code_vals[] = {
855   { 0, "GSM 7 bit default alphabet"},
856   { 1, "8 bit data"},
857   { 0, NULL }
858 };
859 
860 static const value_string gsm_map_cbs_coding_grp15_class_vals[] = {
861   { 0, "GSM 7 bit default alphabet"},
862   { 1, "8 bit data"},
863   { 0, NULL }
864 };
865 
866 
867 /* 3GPP TS 23.038 version 7.0.0 Release 7 */
868 guint8
dissect_cbs_data_coding_scheme(tvbuff_t * tvb,packet_info * pinfo _U_,proto_tree * tree,guint16 offset)869 dissect_cbs_data_coding_scheme(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint16 offset)
870 {
871   guint8 octet;
872   guint8 coding_grp;
873   guint8 character_set;
874 
875   octet = tvb_get_guint8(tvb,offset);
876   coding_grp = octet >>4;
877   proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp, tvb, offset, 1, ENC_BIG_ENDIAN);
878 
879   sms_encoding = SMS_ENCODING_NOT_SET;
880   switch (coding_grp){
881   case 0:
882     proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp0_lang, tvb, offset, 1, ENC_BIG_ENDIAN);
883     sms_encoding = SMS_ENCODING_7BIT;
884     break;
885   case 1:
886     proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp1_lang, tvb, offset, 1, ENC_BIG_ENDIAN);
887     if ((octet & 0x0f)== 0){
888       sms_encoding = SMS_ENCODING_7BIT_LANG;
889     }else{
890       sms_encoding = SMS_ENCODING_UCS2_LANG;
891     }
892     break;
893   case 2:
894     proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp2_lang, tvb, offset, 1, ENC_BIG_ENDIAN);
895     sms_encoding = SMS_ENCODING_7BIT;
896     break;
897   case 3:
898     proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp3_lang, tvb, offset, 1, ENC_BIG_ENDIAN);
899     sms_encoding = SMS_ENCODING_7BIT;
900     break;
901     /* Coding_grp 01xx */
902   case 4:
903       /* FALLTHRU */
904   case 5:
905       /* FALLTHRU */
906   case 6:
907       /* FALLTHRU */
908   case 7:
909       /* FALLTHRU */
910     proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_comp, tvb, offset, 1, ENC_BIG_ENDIAN);
911     proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_class_ind, tvb, offset, 1, ENC_BIG_ENDIAN);
912     proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_char_set, tvb, offset, 1, ENC_BIG_ENDIAN);
913     if ((octet & 0x10)== 0x10){
914       proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_class, tvb, offset, 1, ENC_BIG_ENDIAN);
915     }
916     /* Bits 3 and 2 indicate the character set being used, */
917     character_set = (octet&0x0c)>>2;
918     switch (character_set){
919     case 0:
920       /* GSM 7 bit default alphabet */
921       sms_encoding = SMS_ENCODING_7BIT;
922       break;
923     case 1:
924       /* 8 bit data */
925       sms_encoding = SMS_ENCODING_8BIT;
926       break;
927     case 2:
928       /* UCS2 (16 bit) */
929       sms_encoding = SMS_ENCODING_UCS2;
930       break;
931     case 3:
932       /* Reserved */
933       sms_encoding = SMS_ENCODING_NOT_SET;
934       break;
935     default:
936       break;
937     }
938     break;
939   case 8:
940     /* Reserved coding groups */
941     break;
942   case 9:
943     /* Message with User Data Header (UDH) structure:*/
944     proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_char_set, tvb, offset, 1, ENC_BIG_ENDIAN);
945     proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_class, tvb, offset, 1, ENC_BIG_ENDIAN);
946     character_set = (octet&0x0c)>>2;
947     switch (character_set){
948     case 0:
949       /* GSM 7 bit default alphabet */
950       sms_encoding = SMS_ENCODING_7BIT;
951       break;
952     case 1:
953       /* 8 bit data */
954       sms_encoding = SMS_ENCODING_8BIT;
955       break;
956     case 2:
957       /* UCS2 (16 bit) */
958       sms_encoding = SMS_ENCODING_UCS2;
959       break;
960     case 3:
961       /* Reserved */
962       sms_encoding = SMS_ENCODING_NOT_SET;
963       break;
964     default:
965       break;
966     }
967     break;
968   case 10:
969     /* FALLTHRU */
970   case 11:
971     /* FALLTHRU */
972   case 12:
973     /* FALLTHRU */
974   case 13:
975     /* FALLTHRU */
976     /* 1010..1101 Reserved coding groups */
977     break;
978   case 14:
979     /* Defined by the WAP Forum
980      * "Wireless Datagram Protocol Specification", Wireless Application Protocol Forum Ltd.
981      */
982     break;
983   case 15:
984     /* Data coding / message handling */
985     proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp15_mess_code, tvb, offset, 1, ENC_BIG_ENDIAN);
986     proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp15_class, tvb, offset, 1, ENC_BIG_ENDIAN);
987     character_set = (octet&0x04)>>2;
988     if (character_set == 0){
989       sms_encoding = SMS_ENCODING_7BIT;
990     }else{
991       sms_encoding = SMS_ENCODING_8BIT;
992     }
993     break;
994   default:
995     break;
996   }
997 
998   return sms_encoding;
999 }
1000 void
dissect_gsm_map_msisdn(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree)1001 dissect_gsm_map_msisdn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1002 {
1003   guint8      octet;
1004   guint8      na;
1005   guint8      np;
1006 
1007   proto_tree_add_item(tree, hf_gsm_map_extension, tvb, 0,1,ENC_BIG_ENDIAN);
1008   proto_tree_add_item(tree, hf_gsm_map_nature_of_number, tvb, 0,1,ENC_BIG_ENDIAN);
1009   proto_tree_add_item(tree, hf_gsm_map_number_plan, tvb, 0,1,ENC_BIG_ENDIAN);
1010 
1011   if(tvb_reported_length(tvb)==1)
1012     return;
1013 
1014   octet = tvb_get_guint8(tvb,0);
1015   /* nature of address indicator */
1016   na = (octet & 0x70)>>4;
1017   /* numbering plan indicator */
1018   np = octet & 0x0f;
1019   switch(np){
1020   case 1:
1021       /* ISDN/Telephony Numbering Plan (Rec ITU-T E.164) */
1022       switch(na){
1023       case 1:
1024           /* international number */
1025           dissect_e164_msisdn(tvb, tree, 1, tvb_reported_length(tvb)-1, E164_ENC_BCD);
1026       break;
1027       default:
1028           proto_tree_add_item(tree, hf_gsm_map_address_digits, tvb, 1, -1, ENC_BCD_DIGITS_0_9);
1029           break;
1030       }
1031       break;
1032   case 6:
1033       /* land mobile numbering plan (ITU-T Rec E.212) */
1034       dissect_e212_imsi(tvb, pinfo, tree,  1, tvb_reported_length(tvb)-1, FALSE);
1035       break;
1036   default:
1037       proto_tree_add_item(tree, hf_gsm_map_address_digits, tvb, 1, -1, ENC_BCD_DIGITS_0_9);
1038       break;
1039   }
1040 
1041 }
1042 
1043 #include "packet-gsm_map-fn.c"
1044 
1045 /* Specific translation for MAP V3 */
1046 const value_string gsm_map_V1V2_opr_code_strings[] = {
1047   {  44, "forwardSM" },
1048   {  45, "sendRoutingInfoForSM" },
1049   {  46, "forwardSM" },
1050   { 0, NULL }
1051 };
1052 /* Generic translation for MAP operation */
1053 const value_string gsm_map_opr_code_strings[] = {
1054 #include "packet-gsm_map-table.c"
1055   { 0, NULL }
1056 };
1057 
1058 #if 0
1059 static const value_string gsm_map_err_code_string_vals[] = {
1060 #include "packet-gsm_map-table.c"
1061     { 0, NULL }
1062 };
1063 #endif
1064 
1065 
1066 static const value_string gsm_map_nature_of_number_values[] = {
1067   { 0x00, "unknown" },
1068   { 0x01, "International Number" },
1069   { 0x02, "National Significant Number" },
1070   { 0x03, "Network Specific Number" },
1071   { 0x04, "Subscriber Number" },
1072   { 0x05, "Reserved" },
1073   { 0x06, "Abbreviated Number" },
1074   { 0x07, "Reserved for extension" },
1075   { 0, NULL }
1076 };
1077 static value_string_ext gsm_map_nature_of_number_values_ext = VALUE_STRING_EXT_INIT(gsm_map_nature_of_number_values);
1078 
1079 static const value_string gsm_map_number_plan_values[] = {
1080   { 0x00, "unknown" },
1081   { 0x01, "ISDN/Telephony Numbering (Rec ITU-T E.164)" },
1082   { 0x02, "spare" },
1083   { 0x03, "Data Numbering (ITU-T Rec. X.121)" },
1084   { 0x04, "Telex Numbering (ITU-T Rec. F.69)" },
1085   { 0x05, "spare" },
1086   { 0x06, "Land Mobile Numbering (ITU-T Rec. E.212)" },
1087   { 0x07, "spare" },
1088   { 0x08, "National Numbering" },
1089   { 0x09, "Private Numbering" },
1090   { 0x0a, "spare" },
1091   { 0x0b, "spare" },
1092   { 0x0c, "spare" },
1093   { 0x0d, "spare" },
1094   { 0x0e, "spare" },
1095   { 0x0f, "Reserved for extension" },
1096   { 0, NULL }
1097 };
1098 static value_string_ext gsm_map_number_plan_values_ext = VALUE_STRING_EXT_INIT(gsm_map_number_plan_values);
1099 
1100 static const true_false_string gsm_map_Ss_Status_q_bit_values = {
1101   "Quiescent",
1102   "Operative"
1103 };
1104 static const true_false_string gsm_map_Ss_Status_p_values = {
1105   "Provisioned",
1106   "Not Provisioned"
1107 };
1108 static const true_false_string gsm_map_Ss_Status_r_values = {
1109   "Registered",
1110   "Not Registered"
1111 };
1112 static const true_false_string gsm_map_Ss_Status_a_values = {
1113   "Active",
1114   "not Active"
1115 };
1116 
1117 /*
1118  * Translate the MAP operation code value to a text string
1119  * Take into account the MAP version for ForwardSM
1120  */
gsm_map_opr_code(guint32 val,proto_item * item)1121 const gchar* gsm_map_opr_code(guint32 val, proto_item *item) {
1122   switch (val) {
1123   case 44: /*mt-forwardSM*/
1124     /* FALLTHRU */
1125   case 46: /*mo-forwardSM*/
1126     if (application_context_version < 3) {
1127       proto_item_set_text(item, "%s (%d)", val_to_str_const(val, gsm_map_V1V2_opr_code_strings, "Unknown GSM-MAP opcode"), val);
1128       return val_to_str_const(val, gsm_map_V1V2_opr_code_strings, "Unknown GSM-MAP opcode");
1129     }
1130     /* Else use the default map operation translation */
1131     /* FALLTHRU */
1132   default:
1133     return val_to_str_ext_const(val, &gsm_old_GSMMAPOperationLocalvalue_vals_ext, "Unknown GSM-MAP opcode");
1134     break;
1135   }
1136 }
1137 
1138 /* Prototype for a decoding function */
1139 typedef int (* dissect_function_t)( gboolean,
1140                                     tvbuff_t *,
1141                                     int ,
1142                                     asn1_ctx_t *,
1143                                     proto_tree *,
1144                                     int);
1145 
1146 /*
1147  * Dissect Multiple Choice Message
1148  * This function is used to decode a message, when several encoding may be used.
1149  * For exemple, in the last MAP version, the Cancel Location is defined like this:
1150  * CancelLocationArg ::= [3] IMPLICIT SEQUENCE
1151  * But in the previous MAP version, it was a CHOICE between a SEQUENCE and an IMSI
1152  * As ASN1 encoders (or software) still uses the old encoding, this function allows
1153  * the decoding of both versions.
1154  * Moreover, some optimizations (or bad practice ?) in ASN1 encoder, removes the
1155  * SEQUENCE tag, when only one parameter is present in the SEQUENCE.
1156  * This explain why the function expects 3 parameters:
1157  * - a [3] SEQUENCE corresponding the recent ASN1 MAP encoding
1158  * - a SEQUENCE for old style
1159  * - and a single parameter, for old version or optimizations
1160  *
1161  * The analyze of the first ASN1 tag, indicate what kind of decoding should be used,
1162  * if the decoding function is provided (so not a NULL function)
1163  */
dissect_mc_message(tvbuff_t * tvb,int offset,asn1_ctx_t * actx,proto_tree * tree,gboolean implicit_param _U_,dissect_function_t parameter,int hf_index_param _U_,gboolean implicit_seq _U_,dissect_function_t sequence,int hf_index_seq _U_,gboolean implicit_seq3 _U_,dissect_function_t sequence3,int hf_index_seq3 _U_)1164 static int dissect_mc_message(tvbuff_t *tvb,
1165                               int offset,
1166                               asn1_ctx_t *actx,
1167                               proto_tree *tree,
1168                               gboolean implicit_param _U_, dissect_function_t parameter, int hf_index_param _U_,
1169                               gboolean implicit_seq   _U_, dissect_function_t sequence,  int hf_index_seq   _U_,
1170                               gboolean implicit_seq3 _U_, dissect_function_t sequence3, int hf_index_seq3 _U_ )
1171 {
1172   guint8 octet;
1173   gint8 bug_class;
1174   gboolean bug_pc, bug_ind_field;
1175   gint32 bug_tag;
1176   guint32 bug_len;
1177 
1178   octet = tvb_get_guint8(tvb,0);
1179   if ( (octet & 0xf) == 3) {
1180     /* XXX  asn2wrs can not yet handle tagged assignment yes so this
1181      * XXX is some conformance file magic to work around that bug
1182      */
1183     offset = get_ber_identifier(tvb, offset, &bug_class, &bug_pc, &bug_tag);
1184     offset = get_ber_length(tvb, offset, &bug_len, &bug_ind_field);
1185     if (sequence3 != NULL) {
1186       offset= (sequence3) (implicit_seq3, tvb, offset, actx, tree, hf_index_seq3);
1187     } else {
1188       proto_tree_add_expert(tree, actx->pinfo, &ei_gsm_map_unknown_sequence3, tvb, offset, -1);
1189     }
1190   } else if (octet == 0x30) {
1191     if (sequence != NULL) {
1192       offset= (sequence) (implicit_seq, tvb, 0, actx, tree, hf_index_seq);
1193     } else {
1194       proto_tree_add_expert(tree, actx->pinfo, &ei_gsm_map_unknown_sequence, tvb, offset, -1);
1195     }
1196   } else {
1197     if (parameter != NULL) {
1198       offset= (parameter) (implicit_param, tvb, offset, actx, tree, hf_index_param);
1199     } else {
1200       proto_tree_add_expert(tree, actx->pinfo, &ei_gsm_map_unknown_parameter, tvb, offset, -1);
1201     }
1202   }
1203   return offset;
1204 }
1205 
dissect_invokeData(proto_tree * tree,tvbuff_t * tvb,int offset,asn1_ctx_t * actx)1206 static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx) {
1207 
1208   switch(opcode){
1209   case  2: /*updateLocation*/
1210     offset=dissect_gsm_map_ms_UpdateLocationArg(FALSE, tvb, offset, actx, tree, -1);
1211     break;
1212   case  3: /*cancelLocation*/
1213     offset=dissect_mc_message(tvb, offset, actx, tree,
1214                               FALSE, dissect_gsm_map_Identity, hf_gsm_map_ms_identity,
1215                               FALSE, dissect_gsm_map_Identity, hf_gsm_map_ms_identity,
1216                               TRUE , dissect_gsm_map_ms_CancelLocationArg, -1);/*undefined*/
1217     break;
1218   case  4: /*provideRoamingNumber*/
1219     offset=dissect_gsm_map_ch_ProvideRoamingNumberArg(FALSE, tvb, offset, actx, tree, -1);
1220     break;
1221   case  5: /*noteSubscriberDataModified*/
1222     offset=dissect_gsm_map_ms_NoteSubscriberDataModifiedArg(FALSE, tvb, offset, actx, tree, -1);
1223     break;
1224   case  6: /*resumeCallHandling*/
1225     offset=dissect_gsm_map_ch_ResumeCallHandlingArg(FALSE, tvb, offset, actx, tree, -1);
1226     break;
1227   case  7: /*insertSubscriberData*/
1228     offset=dissect_gsm_map_ms_InsertSubscriberDataArg(FALSE, tvb, offset, actx, tree, -1);
1229     break;
1230   case  8: /*deleteSubscriberData*/
1231     offset=dissect_gsm_map_ms_DeleteSubscriberDataArg(FALSE, tvb, offset, actx, tree, -1);
1232     break;
1233   case  9: /*sendParameters*/
1234     offset = dissect_gsm_old_SendParametersArg(FALSE, tvb, offset, actx, tree, -1);
1235     break;
1236   case  10: /*registerSS*/
1237     offset=dissect_gsm_map_ss_RegisterSS_Arg(FALSE, tvb, offset, actx, tree, -1);
1238     break;
1239   case  11: /*eraseSS*/
1240     offset=dissect_gsm_map_ss_SS_ForBS_Code(FALSE, tvb, offset, actx, tree, -1);
1241     break;
1242   case 12: /*activateSS*/
1243     offset=dissect_gsm_map_ss_SS_ForBS_Code(FALSE, tvb, offset, actx, tree, -1);
1244     break;
1245   case 13: /*deactivateSS*/
1246     offset=dissect_gsm_map_ss_SS_ForBS_Code(FALSE, tvb, offset, actx, tree, -1);
1247     break;
1248   case 14: /*interrogateSS*/
1249     offset=dissect_gsm_map_ss_SS_ForBS_Code(FALSE, tvb, offset, actx, tree, -1);
1250     break;
1251   case 15: /*authenticationFailureReport*/
1252     offset=dissect_gsm_map_ms_AuthenticationFailureReportArg(FALSE, tvb, offset, actx, tree, -1);
1253     break;
1254   case 16: /*SS-protocol notifySS*/
1255     offset=dissect_gsm_ss_NotifySS_Arg(FALSE, tvb, offset, actx, tree, -1);
1256     break;
1257   case 17: /*registerPassword*/
1258     offset=dissect_gsm_map_SS_Code(FALSE, tvb, offset, actx, tree, hf_gsm_map_ss_Code);
1259     break;
1260   case 18: /*getPassword*/
1261     offset=dissect_gsm_old_GetPasswordArg(FALSE, tvb, offset, actx, tree, hf_gsm_map_getPassword);
1262     break;
1263   case 19: /* SS-Protocol processUnstructuredSS-Data (19) */
1264     offset=dissect_gsm_ss_SS_UserData(FALSE, tvb, offset, actx, tree, hf_gsm_map_ss_SS_UserData);
1265     break;
1266   case 20: /*releaseResources*/
1267     offset=dissect_gsm_map_ch_ReleaseResourcesArg(FALSE, tvb, offset, actx, tree, -1);
1268     break;
1269   case 21: /*mt-ForwardSM-VGCS*/
1270     offset=dissect_gsm_map_sm_MT_ForwardSM_VGCS_Arg(FALSE, tvb, offset, actx, tree, -1);
1271     break;
1272   case 22: /*sendRoutingInfo*/
1273       if (application_context_version == 3){
1274           offset=dissect_gsm_map_ch_SendRoutingInfoArg(FALSE, tvb, offset, actx, tree, -1);
1275       }else{
1276           offset = dissect_gsm_old_SendRoutingInfoArgV2(FALSE, tvb, offset, actx, tree, -1);
1277       }
1278     break;
1279   case 23: /*updateGprsLocation*/
1280     offset=dissect_gsm_map_ms_UpdateGprsLocationArg(FALSE, tvb, offset, actx, tree, -1);
1281     break;
1282   case 24: /*sendRoutingInfoForGprs*/
1283     offset=dissect_gsm_map_ms_SendRoutingInfoForGprsArg(FALSE, tvb, offset, actx, tree, -1);
1284     break;
1285   case 25: /*failureReport*/
1286     offset=dissect_gsm_map_ms_FailureReportArg(FALSE, tvb, offset, actx, tree, -1);
1287     break;
1288   case 26: /*noteMsPresentForGprs*/
1289     offset=dissect_gsm_map_ms_NoteMsPresentForGprsArg(FALSE, tvb, offset, actx, tree, -1);
1290     break;
1291     /* undefined 27 */
1292     /* reserved performHandover (28) */
1293   case 29: /*sendEndSignal*/
1294     offset=dissect_mc_message(tvb, offset, actx, tree,
1295                               FALSE, NULL, -1,
1296                               FALSE, dissect_gsm_old_Bss_APDU, -1,
1297                               TRUE , dissect_gsm_map_ms_SendEndSignal_Arg, -1);
1298     break;
1299     /* reserved performSubsequentHandover (30) */
1300   case 31: /*provideSIWFSNumber*/
1301     offset=dissect_gsm_old_ProvideSIWFSNumberArg(FALSE, tvb, offset, actx, tree, -1);
1302     break;
1303   case 32: /*sIWFSSignallingModify*/
1304     offset=dissect_gsm_old_SIWFSSignallingModifyArg(FALSE, tvb, offset, actx, tree, -1);
1305     break;
1306   case 33: /*processAccessSignalling*/
1307     offset=dissect_mc_message(tvb, offset, actx, tree,
1308                               FALSE, NULL, -1,
1309                               FALSE, dissect_gsm_old_Bss_APDU, -1,
1310                               TRUE , dissect_gsm_map_ms_ProcessAccessSignalling_Arg, -1);
1311     break;
1312   case 34: /*forwardAccessSignalling*/
1313     offset=dissect_mc_message(tvb, offset, actx, tree,
1314                               FALSE, NULL, -1,
1315                               FALSE, dissect_gsm_old_Bss_APDU, -1,
1316                               TRUE , dissect_gsm_map_ms_ForwardAccessSignalling_Arg, -1);
1317     break;
1318     /* reserved noteInternalHandover (35) */
1319   case 36: /*cancelVcsgLocation*/
1320     offset=dissect_gsm_map_ms_CancelVcsgLocationArg(FALSE, tvb, offset, actx, tree, -1);
1321     break;
1322   case 37: /*reset*/
1323       if (application_context_version == 1) {
1324           offset = dissect_gsm_old_ResetArgV1(FALSE, tvb, offset, actx, tree, -1);
1325       } else {
1326           offset = dissect_gsm_map_ms_ResetArg(FALSE, tvb, offset, actx, tree, -1);
1327       }
1328     break;
1329   case 38: /*forwardCheckSS-Indication*/
1330     return offset;
1331     break;
1332   case 39: /*prepareGroupCall*/
1333     offset=dissect_gsm_map_gr_PrepareGroupCallArg(FALSE, tvb, offset, actx, tree, -1);
1334     break;
1335   case 40: /*sendGroupCallEndSignal*/
1336     offset = dissect_gsm_map_gr_SendGroupCallEndSignalArg(FALSE, tvb, offset, actx, tree, -1);
1337     break;
1338   case 41: /*processGroupCallSignalling*/
1339     offset = dissect_gsm_map_gr_ProcessGroupCallSignallingArg(FALSE, tvb, offset, actx, tree, -1);
1340     break;
1341   case 42: /*forwardGroupCallSignalling*/
1342     offset=dissect_gsm_map_gr_ForwardGroupCallSignallingArg(FALSE, tvb, offset, actx, tree, -1);
1343     break;
1344   case 43: /*checkIMEI*/
1345     if (pref_ericsson_proprietary_ext) {
1346       offset=dissect_mc_message(tvb, offset, actx, tree,
1347                     FALSE, dissect_gsm_map_IMEI, hf_gsm_map_ms_imei,
1348                     FALSE, dissect_gsm_map_ericsson_EnhancedCheckIMEI_Arg, -1,
1349                     TRUE , NULL, -1); /* no [3] SEQUENCE */
1350     } else {
1351       offset=dissect_mc_message(tvb, offset, actx, tree,
1352                     FALSE, dissect_gsm_map_IMEI, hf_gsm_map_ms_imei,
1353                     FALSE, dissect_gsm_map_ms_CheckIMEI_Arg, -1,
1354                     TRUE , NULL, -1); /* no [3] SEQUENCE */
1355     }
1356     break;
1357   case 44: /*mt-forwardSM(v3) or ForwardSM(v1/v2)*/
1358     if (application_context_version == 3)
1359       offset=dissect_gsm_map_sm_MT_ForwardSM_Arg(FALSE, tvb, offset, actx, tree, -1);
1360     else {
1361       offset=dissect_gsm_old_ForwardSM_Arg(FALSE, tvb, offset, actx, tree, -1);
1362     }
1363     break;
1364   case 45: /*sendRoutingInfoForSM*/
1365     if (application_context_version < 2) {
1366       offset=dissect_gsm_old_RoutingInfoForSM_ArgV1(FALSE, tvb, offset, actx, tree, -1);
1367     } else {
1368       offset=dissect_gsm_map_sm_RoutingInfoForSM_Arg(FALSE, tvb, offset, actx, tree, -1);
1369     }
1370     break;
1371   case 46: /*mo-forwardSM(v3) or ForwardSM(v1/v2)*/
1372     if (application_context_version == 3)
1373       offset=dissect_gsm_map_sm_MO_ForwardSM_Arg(FALSE, tvb, offset, actx, tree, -1);
1374     else {
1375       offset=dissect_gsm_old_ForwardSM_Arg(FALSE, tvb, offset, actx, tree, -1);
1376     }
1377     break;
1378   case 47: /*reportSM-DeliveryStatus*/
1379     offset=dissect_gsm_map_sm_ReportSM_DeliveryStatusArg(FALSE, tvb, offset, actx, tree, -1);
1380     break;
1381   case 48: /*noteSubscriberPresent*/
1382       offset = dissect_gsm_map_IMSI(FALSE, tvb, offset, actx, tree, hf_gsm_map_imsi);
1383       break;
1384       /* reserved alertServiceCentreWithoutResult (49)
1385      * ETS 300 599: December 2000 (GSM 09.02 version 4.19.1)
1386      * -- alertServiceCentreWithoutResult must not be used in
1387      * -- version greater 1
1388      */
1389   case 49:
1390     offset = dissect_gsm_map_sm_AlertServiceCentreArg(FALSE, tvb, offset, actx, tree, -1);
1391     break;
1392   case 50: /*activateTraceMode*/
1393     offset=dissect_gsm_map_om_ActivateTraceModeArg(FALSE, tvb, offset, actx, tree, -1);
1394     break;
1395   case 51: /*deactivateTraceMode*/
1396     offset=dissect_gsm_map_om_DeactivateTraceModeArg(FALSE, tvb, offset, actx, tree, -1);
1397     break;
1398     /* reserved traceSubscriberActivity (52) */
1399 
1400   case 53: /* UpdateVcsgLocation 53 */
1401     offset=dissect_gsm_map_ms_UpdateVcsgLocationArg(FALSE, tvb, offset, actx, tree, -1);
1402     break;
1403   case 54: /*beginSubscriberActivity*/
1404     offset=dissect_gsm_old_BeginSubscriberActivityArg(FALSE, tvb, offset, actx, tree, -1);
1405     break;
1406   case 55: /*sendIdentification*/
1407     offset=dissect_mc_message(tvb, offset, actx, tree,
1408                               FALSE, dissect_gsm_map_TMSI, hf_gsm_map_tmsi,
1409                               FALSE, dissect_gsm_map_ms_SendIdentificationArg, -1,
1410                               TRUE,  NULL, -1);
1411     break;
1412   case 56: /*sendAuthenticationInfo*/
1413     offset=dissect_mc_message(tvb, offset, actx, tree,
1414                               FALSE, dissect_gsm_map_IMSI, hf_gsm_map_imsi,
1415                               FALSE, dissect_gsm_map_ms_SendAuthenticationInfoArg, -1,
1416                               TRUE,  NULL, -1);
1417     break;
1418   case 57: /*restoreData*/
1419     offset=dissect_gsm_map_ms_RestoreDataArg(FALSE, tvb, offset, actx, tree, -1);
1420     break;
1421   case 58: /*sendIMSI*/
1422     offset = dissect_gsm_map_ISDN_AddressString(FALSE, tvb, offset, actx, tree, hf_gsm_map_msisdn);
1423     break;
1424   case 59: /*processUnstructuredSS-Request*/
1425     offset=dissect_gsm_map_ss_USSD_Arg(FALSE, tvb, offset, actx, tree, -1);
1426     break;
1427   case 60: /*unstructuredSS-Request*/
1428     offset=dissect_gsm_map_ss_USSD_Arg(FALSE, tvb, offset, actx, tree, -1);
1429     break;
1430   case 61: /*unstructuredSS-Notify*/
1431     offset=dissect_gsm_map_ss_USSD_Arg(FALSE, tvb, offset, actx, tree, -1);
1432     break;
1433   case 62: /*AnyTimeSubscriptionInterrogation*/
1434     offset=dissect_gsm_map_ms_AnyTimeSubscriptionInterrogationArg(FALSE, tvb, offset, actx, tree, -1);
1435     break;
1436   case 63: /*informServiceCentre*/
1437     offset=dissect_gsm_map_sm_InformServiceCentreArg(FALSE, tvb, offset, actx, tree, -1);
1438     break;
1439   case 64: /*alertServiceCentre*/
1440     offset=dissect_gsm_map_sm_AlertServiceCentreArg(FALSE, tvb, offset, actx, tree, -1);
1441     break;
1442   case 65: /*AnyTimeModification*/
1443     offset=dissect_gsm_map_ms_AnyTimeModificationArg(FALSE, tvb, offset, actx, tree, -1);
1444     break;
1445   case 66: /*readyForSM*/
1446     offset=dissect_gsm_map_sm_ReadyForSM_Arg(FALSE, tvb, offset, actx, tree, -1);
1447     break;
1448   case 67: /*purgeMS*/
1449     offset=dissect_mc_message(tvb, offset, actx, tree,
1450                               FALSE, dissect_gsm_map_IMSI, hf_gsm_map_imsi,
1451                               FALSE, dissect_gsm_old_PurgeMSArgV2, -1, /*undefined*/
1452                               TRUE , dissect_gsm_map_ms_PurgeMS_Arg, -1);
1453     break;
1454   case 68: /*prepareHandover*/
1455     offset=dissect_mc_message(tvb, offset, actx, tree,
1456                               FALSE, NULL, -1,
1457                               FALSE, dissect_gsm_old_PrepareHO_ArgOld, -1,
1458                               TRUE, dissect_gsm_map_ms_PrepareHO_Arg, -1);
1459     break;
1460   case 69: /*prepareSubsequentHandover*/
1461     offset=dissect_mc_message(tvb, offset, actx, tree,
1462                               FALSE, NULL, -1,
1463                               FALSE, NULL, -1,
1464                               TRUE, dissect_gsm_map_ms_PrepareSubsequentHO_Arg, -1);
1465     break;
1466   case 70: /*provideSubscriberInfo*/
1467     offset=dissect_gsm_map_ms_ProvideSubscriberInfoArg(FALSE, tvb, offset, actx, tree, -1);
1468     break;
1469   case 71: /*anyTimeInterrogation*/
1470     offset=dissect_gsm_map_ms_AnyTimeInterrogationArg(FALSE, tvb, offset, actx, tree, -1);
1471     break;
1472   case 72: /*ss-InvocationNotificatio*/
1473     offset=dissect_gsm_map_ss_SS_InvocationNotificationArg(FALSE, tvb, offset, actx, tree, -1);
1474     break;
1475   case 73: /*setReportingState*/
1476     offset=dissect_gsm_map_ch_SetReportingStateArg(FALSE, tvb, offset, actx, tree, -1);
1477     break;
1478   case 74: /*statusReport*/
1479     offset=dissect_gsm_map_ch_StatusReportArg(FALSE, tvb, offset, actx, tree, -1);
1480     break;
1481   case 75: /*remoteUserFree*/
1482     offset=dissect_gsm_map_ch_RemoteUserFreeArg(FALSE, tvb, offset, actx, tree, -1);
1483     break;
1484   case 76: /*registerCC-Entry*/
1485     offset=dissect_gsm_map_ss_RegisterCC_EntryArg(FALSE, tvb, offset, actx, tree, -1);
1486     break;
1487   case 77: /*eraseCC-Entry*/
1488     offset=dissect_gsm_map_ss_EraseCC_EntryArg(FALSE, tvb, offset, actx, tree, -1);
1489     break;
1490   case 78: /*secureTransportClass1*/
1491   case 79: /*secureTransportClass1*/
1492   case 80: /*secureTransportClass1*/
1493   case 81: /*secureTransportClass1*/
1494     offset=dissect_gsm_old_SecureTransportArg(FALSE, tvb, offset, actx, tree, -1);
1495     break;
1496     /* undefined 82 */
1497   case 83: /*provideSubscriberLocation*/
1498     offset=dissect_gsm_map_lcs_ProvideSubscriberLocation_Arg(FALSE, tvb, offset, actx, tree, -1);
1499     break;
1500   case 84: /*sendGroupCallInfo*/
1501     offset=dissect_gsm_map_gr_SendGroupCallInfoArg(FALSE, tvb, offset, actx, tree, -1);
1502     break;
1503   case 85: /*sendRoutingInfoForLCS*/
1504     offset=dissect_gsm_map_lcs_RoutingInfoForLCS_Arg(FALSE, tvb, offset, actx, tree, -1);
1505     break;
1506   case 86: /*subscriberLocationReport*/
1507     offset=dissect_gsm_map_lcs_SubscriberLocationReport_Arg(FALSE, tvb, offset, actx, tree, -1);
1508     break;
1509   case 87: /*ist-Alert*/
1510     offset=dissect_gsm_map_ch_IST_AlertArg(FALSE, tvb, offset, actx, tree, -1);
1511     break;
1512   case 88: /*ist-Command*/
1513     offset=dissect_gsm_map_ch_IST_CommandArg(FALSE, tvb, offset, actx, tree, -1);
1514     break;
1515   case 89: /*noteMM-Event*/
1516     offset=dissect_gsm_map_ms_NoteMM_EventArg(FALSE, tvb, offset, actx, tree, -1);
1517     break;
1518   case 108: /*SS-protocol lcs-PeriodicTriggeredInvoke*/
1519       offset = dissect_gsm_ss_LCS_PeriodicTriggeredInvokeArg(FALSE, tvb, offset, actx, tree, -1);
1520       break;
1521   case 109: /*SS-protocol lcs-PeriodicLocationCancellation*/
1522     offset=dissect_gsm_ss_LCS_PeriodicLocationCancellationArg(FALSE, tvb, offset, actx, tree, -1);
1523     break;
1524   case 110: /*SS-protocol lcs-LocationUpdate*/
1525     offset=dissect_gsm_ss_LCS_LocationUpdateArg(FALSE, tvb, offset, actx, tree, -1);
1526     break;
1527   case 111: /*SS-protocol lcs-PeriodicLocationRequest*/
1528     offset=dissect_gsm_ss_LCS_PeriodicLocationRequestArg(FALSE, tvb, offset, actx, tree, -1);
1529     break;
1530   case 112: /*SS-protocol lcs-AreaEventCancellation*/
1531     offset=dissect_gsm_ss_LCS_AreaEventCancellationArg(FALSE, tvb, offset, actx, tree, -1);
1532     break;
1533   case 113: /*SS-protocol lcs-AreaEventReport*/
1534     offset=dissect_gsm_ss_LCS_AreaEventReportArg(FALSE, tvb, offset, actx, tree, -1);
1535     break;
1536   case 114: /*SS-protocol lcs-AreaEventRequest*/
1537     offset=dissect_gsm_ss_LCS_AreaEventRequestArg(FALSE, tvb, offset, actx, tree, -1);
1538     break;
1539   case 115: /*SS-protocol lcs-MOLR*/
1540     offset=dissect_gsm_ss_LCS_MOLRArg(FALSE, tvb, offset, actx, tree, -1);
1541     break;
1542   case 116: /*SS-protocol lcs-LocationNotification*/
1543     offset=dissect_gsm_ss_LocationNotificationArg(FALSE, tvb, offset, actx, tree, -1);
1544     break;
1545   case 117: /*SS-protocol callDeflection*/
1546     offset=dissect_gsm_ss_CallDeflectionArg(FALSE, tvb, offset, actx, tree, -1);
1547     break;
1548   case 118: /*SS-protocol userUserService*/
1549     offset=dissect_gsm_ss_UserUserServiceArg(FALSE, tvb, offset, actx, tree, -1);
1550     break;
1551   case 119: /*SS-protocol accessRegisterCCEntry*/
1552     offset=dissect_gsm_ss_AccessRegisterCCEntryArg(FALSE, tvb, offset, actx, tree, -1);
1553     break;
1554   case 120: /*SS-protocol forwardCUG-Info*/
1555     application_context_version = 3;
1556     offset=dissect_gsm_ss_ForwardCUG_InfoArg(FALSE, tvb, offset, actx, tree, -1);
1557     break;
1558   case 121: /*SS-protocol splitMPTY no Argument*/
1559     break;
1560   case 122: /*SS-protocol retrieveMPTY no Argument*/
1561     break;
1562   case 123: /*SS-protocol holdMPTY no Argument*/
1563     break;
1564   case 124: /*SS-protocol buildMPTY no Argument*/
1565     break;
1566   case 125: /*SS-protocol forwardChargeAdvice*/
1567     offset=dissect_gsm_ss_ForwardChargeAdviceArg(FALSE, tvb, offset, actx, tree, -1);
1568     break;
1569   case 126: /*SS-protocol explicitCT no Argument*/
1570     break;
1571   default:
1572     if(!dissector_try_uint_new(map_prop_arg_opcode_table, (guint8)opcode, tvb, actx->pinfo, tree, TRUE, actx->subtree.top_tree)){
1573         proto_tree_add_expert_format(tree, actx->pinfo, &ei_gsm_map_unknown_invokeData,
1574                                      tvb, offset, -1, "Unknown invokeData %d", opcode);
1575     }
1576     offset+= tvb_reported_length_remaining(tvb,offset);
1577     break;
1578   }
1579   return offset;
1580 }
1581 
1582 
dissect_returnResultData(proto_tree * tree,tvbuff_t * tvb,int offset,asn1_ctx_t * actx)1583 static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx) {
1584 
1585   switch(opcode){
1586   case  2: /*updateLocation*/
1587     offset=dissect_mc_message(tvb, offset, actx, tree,
1588                               FALSE, dissect_gsm_map_IMSI, hf_gsm_map_imsi,
1589                               FALSE, dissect_gsm_map_ms_UpdateLocationRes, -1,
1590                               TRUE , NULL, -1);
1591     break;
1592   case  3: /*cancelLocation*/
1593     offset=dissect_gsm_map_ms_CancelLocationRes(FALSE, tvb, offset, actx, tree, -1);
1594     break;
1595   case  4: /*provideRoamingNumber*/
1596     offset=dissect_mc_message(tvb, offset, actx, tree,
1597                               FALSE, dissect_gsm_map_ISDN_AddressString, hf_gsm_map_msisdn,
1598                               FALSE, dissect_gsm_map_ch_ProvideRoamingNumberRes, -1,
1599                               TRUE , NULL, -1);/*undefined*/
1600     break;
1601   case  5: /*noteSubscriberDataModified*/
1602     offset=dissect_gsm_map_ms_NoteSubscriberDataModifiedRes(FALSE, tvb, offset, actx, tree, -1);
1603     break;
1604   case  6: /*resumeCallHandling*/
1605     offset=dissect_gsm_map_ch_ResumeCallHandlingRes(FALSE, tvb, offset, actx, tree, -1);
1606     break;
1607   case  7: /*insertSubscriberData*/
1608     offset=dissect_gsm_map_ms_InsertSubscriberDataRes(FALSE, tvb, offset, actx, tree, -1);
1609     break;
1610   case  8: /*deleteSubscriberData*/
1611     offset=dissect_gsm_map_ms_DeleteSubscriberDataRes(FALSE, tvb, offset, actx, tree, -1);
1612     break;
1613   case  9: /*sendParameters*/
1614     offset = dissect_gsm_old_SentParameterList(FALSE, tvb, offset, actx, tree, -1);
1615     break;
1616   case  10: /*registerSS*/
1617     offset=dissect_gsm_map_ss_SS_Info(FALSE, tvb, offset, actx, tree, -1);
1618     break;
1619   case  11: /*eraseSS*/
1620     offset=dissect_gsm_map_ss_SS_Info(FALSE, tvb, offset, actx, tree, -1);
1621     break;
1622   case 12: /*activateSS*/
1623     offset=dissect_gsm_map_ss_SS_Info(FALSE, tvb, offset, actx, tree, -1);
1624     break;
1625   case 13: /*deactivateSS*/
1626     offset=dissect_gsm_map_ss_SS_Info(FALSE, tvb, offset, actx, tree, -1);
1627     break;
1628   case 14: /*interrogateSS*/
1629     offset=dissect_gsm_map_ss_InterrogateSS_Res(FALSE, tvb, offset, actx, tree, -1);
1630     break;
1631   case 15: /*authenticationFailureReport*/
1632     offset=dissect_gsm_map_ms_AuthenticationFailureReportRes(FALSE, tvb, offset, actx, tree, -1);
1633     break;
1634   case 17: /*registerPassword*/
1635     /* change hf_gsm_map_ss_Code to something with password */
1636     offset=dissect_gsm_old_NewPassword(FALSE, tvb, offset, actx, tree, hf_gsm_map_ss_Code);
1637     break;
1638   case 18: /*getPassword*/
1639     offset=dissect_gsm_old_CurrentPassword(FALSE, tvb, offset, actx, tree, hf_gsm_map_currentPassword);
1640     break;
1641   case 19: /* SS-Protocol processUnstructuredSS-Data (19) */
1642     offset=dissect_gsm_ss_SS_UserData(FALSE, tvb, offset, actx, tree, hf_gsm_map_ss_SS_UserData);
1643     break;
1644   case 20: /*releaseResources*/
1645     offset=dissect_gsm_map_ch_ReleaseResourcesRes(FALSE, tvb, offset, actx, tree, -1);
1646     break;
1647   case 21: /*mt-ForwardSM-VGCS*/
1648     offset=dissect_gsm_map_sm_MT_ForwardSM_VGCS_Res(FALSE, tvb, offset, actx, tree, -1);
1649     break;
1650   case 22: /*sendRoutingInfo*/
1651       if (application_context_version == 3){
1652           /* If the tag is missing use SendRoutingInfoRes_U */
1653           offset=dissect_mc_message(tvb, offset, actx, tree,
1654                                     FALSE, NULL, -1,
1655                                     FALSE, dissect_gsm_map_ch_SendRoutingInfoRes_U, -1,
1656                                     TRUE , dissect_gsm_map_ch_SendRoutingInfoRes, -1);
1657       }else{
1658           offset=dissect_mc_message(tvb, offset, actx, tree,
1659                                     FALSE, dissect_gsm_map_IMSI, hf_gsm_map_imsi,
1660                                     FALSE, dissect_gsm_old_SendRoutingInfoResV2, -1,
1661                                     TRUE , dissect_gsm_map_ch_SendRoutingInfoRes, -1);
1662       }
1663     break;
1664   case 23: /*updateGprsLocation*/
1665     offset=dissect_gsm_map_ms_UpdateGprsLocationRes(FALSE, tvb, offset, actx, tree, -1);
1666     break;
1667   case 24: /*sendRoutingInfoForGprs*/
1668     offset=dissect_gsm_map_ms_SendRoutingInfoForGprsRes(FALSE, tvb, offset, actx, tree, -1);
1669     break;
1670   case 25: /*failureReport*/
1671     offset=dissect_gsm_map_ms_FailureReportRes(FALSE, tvb, offset, actx, tree, -1);
1672     break;
1673   case 26: /*noteMsPresentForGprs*/
1674     offset=dissect_gsm_map_ms_NoteMsPresentForGprsRes(FALSE, tvb, offset, actx, tree, -1);
1675     break;
1676   case 29: /*sendEndSignal*/
1677       /* Taken from MAP-MobileServiceOperations{ 0 identified-organization (4) etsi (0) mobileDomain
1678        * (0) gsm-Network (1) modules (3) map-MobileServiceOperations (5) version9 (9) }
1679        */
1680     offset=dissect_gsm_map_ms_SendEndSignal_Res(FALSE, tvb, offset, actx, tree, -1);
1681     break;
1682   case 31: /*provideSIWFSNumber*/
1683     offset=dissect_gsm_old_ProvideSIWFSNumberRes(FALSE, tvb, offset, actx, tree, -1);
1684     break;
1685   case 32: /*provideSIWFSSignallingModify*/
1686     offset=dissect_gsm_old_SIWFSSignallingModifyRes(FALSE, tvb, offset, actx, tree, -1);
1687     break;
1688   case 36: /*cancelVcsgLocation*/
1689     offset=dissect_gsm_map_ms_CancelVcsgLocationRes(FALSE, tvb, offset, actx, tree, -1);
1690     break;
1691   case 39: /*prepareGroupCall*/
1692     offset=dissect_gsm_map_gr_PrepareGroupCallRes(FALSE, tvb, offset, actx, tree, -1);
1693     break;
1694   case 40: /*sendGroupCallEndSignal*/
1695     offset=dissect_gsm_map_gr_SendGroupCallEndSignalRes(FALSE, tvb, offset, actx, tree, -1);
1696     break;
1697   case 43: /*checkIMEI*/
1698     offset=dissect_mc_message(tvb, offset, actx, tree,
1699                               FALSE, dissect_gsm_map_ms_EquipmentStatus, hf_gsm_map_ms_equipmentStatus,
1700                               FALSE, dissect_gsm_map_ms_CheckIMEI_Res, -1,
1701                               TRUE,  NULL, -1);
1702     break;
1703   case 44: /*mt-forwardSM*/
1704     offset=dissect_gsm_map_sm_MT_ForwardSM_Res(FALSE, tvb, offset, actx, tree, -1);
1705     break;
1706   case 45: /*sendRoutingInfoForSM*/
1707     if (application_context_version < 3) {
1708       offset=dissect_gsm_old_RoutingInfoForSM_ResV2(FALSE, tvb, offset, actx, tree, -1);
1709     } else {
1710       offset=dissect_gsm_map_sm_RoutingInfoForSM_Res(FALSE, tvb, offset, actx, tree, -1);
1711     }
1712     break;
1713   case 46: /*mo-forwardSM*/
1714     offset=dissect_gsm_map_sm_MO_ForwardSM_Res(FALSE, tvb, offset, actx, tree, -1);
1715     break;
1716   case 47: /*reportSM-DeliveryStatus*/
1717     offset=dissect_mc_message(tvb, offset, actx, tree,
1718                               FALSE, dissect_gsm_map_ISDN_AddressString, hf_gsm_map_sm_storedMSISDN,
1719                               FALSE, dissect_gsm_map_sm_ReportSM_DeliveryStatusRes, -1,
1720                               FALSE, NULL, -1);/*undefined*/
1721     break;
1722   case 48: /*noteSubscriberPresent*/
1723     break;
1724   case 50: /*activateTraceMode*/
1725     offset=dissect_gsm_map_om_ActivateTraceModeRes(FALSE, tvb, offset, actx, tree, -1);
1726     break;
1727   case 51: /*deactivateTraceMode*/
1728     offset=dissect_gsm_map_om_DeactivateTraceModeRes(FALSE, tvb, offset, actx, tree, -1);
1729     break;
1730   case 53: /* UpdateVcsgLocation 53 */
1731     offset=dissect_gsm_map_ms_UpdateVcsgLocationRes(FALSE, tvb, offset, actx, tree, -1);
1732     break;
1733   case 55: /*sendIdentification */
1734     offset=dissect_mc_message(tvb, offset, actx, tree,
1735                               FALSE, dissect_gsm_map_IMSI, hf_gsm_map_imsi,
1736                               FALSE, dissect_gsm_old_SendIdentificationResV2, -1,/*undefined*/
1737                               TRUE,  dissect_gsm_map_ms_SendIdentificationRes, -1);
1738     break;
1739   case 56: /*sendAuthenticationInfo*/
1740     offset=dissect_mc_message(tvb, offset, actx, tree,
1741                               FALSE, NULL, -1,
1742                               FALSE, dissect_gsm_old_SendAuthenticationInfoResOld, -1,
1743                               TRUE , dissect_gsm_map_ms_SendAuthenticationInfoRes, -1);
1744     break;
1745   case 57: /*restoreData*/
1746     offset=dissect_gsm_map_ms_RestoreDataRes(FALSE, tvb, offset, actx, tree, -1);
1747     break;
1748   case 58: /*sendIMSI*/
1749     offset=dissect_gsm_map_IMSI(FALSE, tvb, offset, actx, tree, hf_gsm_map_ms_imsi);
1750     break;
1751   case 59: /*unstructuredSS-Request*/
1752     offset=dissect_gsm_map_ss_USSD_Res(FALSE, tvb, offset, actx, tree, -1);
1753     break;
1754   case 60: /*unstructuredSS-Request*/
1755     offset=dissect_gsm_map_ss_USSD_Res(FALSE, tvb, offset, actx, tree, -1);
1756     break;
1757   case 61: /*unstructuredSS-Notify*/
1758     /* TRUE ? */
1759     proto_tree_add_expert_format(tree, actx->pinfo, &ei_gsm_map_unknown_invokeData, tvb, offset, -1, "Unknown returnResultData blob");
1760     break;
1761   case 62: /*AnyTimeSubscriptionInterrogation*/
1762     offset=dissect_gsm_map_ms_AnyTimeSubscriptionInterrogationRes(FALSE, tvb, offset, actx, tree, -1);
1763     break;
1764   case 64: /*alertServiceCentre*/
1765     /* TRUE */
1766     break;
1767   case 65: /*AnyTimeModification*/
1768     offset=dissect_gsm_map_ms_AnyTimeModificationRes(FALSE, tvb, offset, actx, tree, -1);
1769     break;
1770   case 66: /*readyForSM*/
1771     offset=dissect_gsm_map_sm_ReadyForSM_Res(FALSE, tvb, offset, actx, tree, -1);
1772     break;
1773   case 67: /*purgeMS*/
1774     offset=dissect_gsm_map_ms_PurgeMS_Res(FALSE, tvb, offset, actx, tree, -1);
1775     break;
1776   case 68: /*prepareHandover*/
1777     offset=dissect_mc_message(tvb, offset, actx, tree,
1778                               FALSE, NULL, -1,
1779                               FALSE, dissect_gsm_old_PrepareHO_ResOld, -1,
1780                               TRUE , dissect_gsm_map_ms_PrepareHO_Res, -1);
1781     break;
1782   case 69: /*prepareSubsequentHandover*/
1783     offset=dissect_mc_message(tvb, offset, actx, tree,
1784                               FALSE, NULL, -1,
1785                               FALSE, NULL, -1,
1786                               TRUE , dissect_gsm_map_ms_PrepareSubsequentHO_Res, -1);
1787     break;
1788   case 70: /*provideSubscriberInfo*/
1789     offset=dissect_gsm_map_ms_ProvideSubscriberInfoRes(FALSE, tvb, offset, actx, tree, -1);
1790     break;
1791   case 71: /*anyTimeInterrogation*/
1792     offset=dissect_gsm_map_ms_AnyTimeInterrogationRes(FALSE, tvb, offset, actx, tree, -1);
1793     break;
1794   case 72: /*ss-InvocationNotificatio*/
1795     offset=dissect_gsm_map_ss_SS_InvocationNotificationRes(FALSE, tvb, offset, actx, tree, -1);
1796     break;
1797   case 73: /*setReportingState*/
1798     offset=dissect_gsm_map_ch_SetReportingStateRes(FALSE, tvb, offset, actx, tree, -1);
1799     break;
1800   case 74: /*statusReport*/
1801     offset=dissect_gsm_map_ch_StatusReportRes(FALSE, tvb, offset, actx, tree, -1);
1802     break;
1803   case 75: /*remoteUserFree*/
1804     offset=dissect_gsm_map_ch_RemoteUserFreeRes(FALSE, tvb, offset, actx, tree, -1);
1805     break;
1806   case 76: /*registerCC-Entry*/
1807     offset=dissect_gsm_map_ss_RegisterCC_EntryRes(FALSE, tvb, offset, actx, tree, -1);
1808     break;
1809   case 77: /*eraseCC-Entry*/
1810     offset=dissect_gsm_map_ss_EraseCC_EntryRes(FALSE, tvb, offset, actx, tree, -1);
1811     break;
1812   case 78: /*secureTransportClass1*/
1813   case 79: /*secureTransportClass2*/
1814   case 80: /*secureTransportClass3*/
1815   case 81: /*secureTransportClass4*/
1816     offset=dissect_gsm_old_SecureTransportRes(FALSE, tvb, offset, actx, tree, -1);
1817     break;
1818   case 83: /*provideSubscriberLocation*/
1819     offset=dissect_gsm_map_lcs_ProvideSubscriberLocation_Res(FALSE, tvb, offset, actx, tree, -1);
1820     break;
1821   case 84: /*sendGroupCallInfo*/
1822     offset=dissect_gsm_map_gr_SendGroupCallInfoRes(FALSE, tvb, offset, actx, tree, -1);
1823     break;
1824   case 85: /*sendRoutingInfoForLCS*/
1825     offset=dissect_gsm_map_lcs_RoutingInfoForLCS_Res(FALSE, tvb, offset, actx, tree, -1);
1826     break;
1827   case 86: /*subscriberLocationReport*/
1828     offset=dissect_gsm_map_lcs_SubscriberLocationReport_Res(FALSE, tvb, offset, actx, tree, -1);
1829     break;
1830   case 87: /*ist-Alert*/
1831     offset=dissect_gsm_map_ch_IST_AlertRes(FALSE, tvb, offset, actx, tree, -1);
1832     break;
1833   case 88: /*ist-Command*/
1834     offset=dissect_gsm_map_ch_IST_CommandRes(FALSE, tvb, offset, actx, tree, -1);
1835     break;
1836   case 89: /*noteMM-Event*/
1837     offset=dissect_gsm_map_ms_NoteMM_EventRes(FALSE, tvb, offset, actx, tree, -1);
1838     break;
1839   case 108: /*SS-protocol LCS-PeriodicTriggeredInvokeRes*/
1840       offset = dissect_gsm_ss_LCS_PeriodicTriggeredInvokeRes(FALSE, tvb, offset, actx, tree, -1);
1841       break;
1842   case 109: /*SS-protocol lcs-PeriodicLocationCancellation*/
1843     /* No parameter */
1844     break;
1845   case 110: /*SS-protocol lcs-LocationUpdate*/
1846     offset=dissect_gsm_ss_LCS_LocationUpdateRes(FALSE, tvb, offset, actx, tree, -1);
1847     break;
1848   case 111: /*SS-protocol lcs-PeriodicLocationRequest*/
1849     offset=dissect_gsm_ss_LCS_PeriodicLocationRequestRes(FALSE, tvb, offset, actx, tree, -1);
1850     break;
1851   case 112: /*SS-protocol lcs-AreaEventCancellation*/
1852     break;
1853   case 113: /*SS-protocol lcs-AreaEventReport*/
1854     break;
1855   case 114: /*SS-protocol lcs-AreaEventRequest No RESULT data*/
1856     break;
1857   case 115: /*SS-protocol lcs-MOLR*/
1858     offset=dissect_gsm_ss_LCS_MOLRRes(FALSE, tvb, offset, actx, tree, -1);
1859     break;
1860   case 116: /*SS-protocol lcs-LocationNotification*/
1861     offset=dissect_gsm_ss_LocationNotificationRes(FALSE, tvb, offset, actx, tree, -1);
1862     break;
1863   case 117: /*SS-protocol callDeflection no RESULT*/
1864     break;
1865   case 118: /*SS-protocol userUserService no RESULT*/
1866     break;
1867   case 119: /*SS-protocol accessRegisterCCEntry*/
1868     offset=dissect_gsm_map_ss_RegisterCC_EntryRes(FALSE, tvb, offset, actx, tree, -1);
1869     break;
1870   case 120: /*SS-protocol forwardCUG-Info*/
1871     /* No RETURN RESULT*/
1872     break;
1873   case 121: /*SS-protocol splitMPTY no RESULT*/
1874     break;
1875   case 122: /*SS-protocol retrieveMPTY no RESULT*/
1876     break;
1877   case 123: /*SS-protocol holdMPTY no RESULT*/
1878     break;
1879   case 124: /*SS-protocol buildMPTY no RESULT*/
1880     break;
1881   case 125: /*SS-protocol forwardChargeAdvice no RESULT*/
1882     break;
1883   case 126: /*SS-protocol explicitCT no RESULT*/
1884     break;
1885 
1886  default:
1887    if(!dissector_try_uint_new(map_prop_res_opcode_table, (guint8)opcode, tvb, actx->pinfo, tree, TRUE, actx->subtree.top_tree)){
1888         proto_tree_add_expert_format(tree, actx->pinfo, &ei_gsm_map_unknown_invokeData,
1889                                      tvb, offset, -1, "Unknown returnResultData %d", opcode);
1890    }
1891    offset+= tvb_reported_length_remaining(tvb,offset);
1892    break;
1893   }
1894   return offset;
1895 }
1896 
1897 
1898 
dissect_returnErrorData(proto_tree * tree,tvbuff_t * tvb,int offset,asn1_ctx_t * actx)1899 static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx) {
1900 
1901   switch(errorCode){
1902   case 1: /* UnknownSubscriberParam */
1903     offset=dissect_gsm_map_er_UnknownSubscriberParam(FALSE, tvb, offset, actx, tree, -1);
1904     break;
1905   case 4: /* SecureTransportErrorParam */
1906     offset=dissect_gsm_old_SecureTransportErrorParam(FALSE, tvb, offset, actx, tree, -1);
1907     break;
1908   case 5: /* UnidentifiedSubParam */
1909     offset=dissect_gsm_map_er_UnidentifiedSubParam(FALSE, tvb, offset, actx, tree, -1);
1910     break;
1911   case 6: /* AbsentSubscriberSM-Param */
1912     offset=dissect_gsm_map_er_AbsentSubscriberSM_Param(FALSE, tvb, offset, actx, tree, -1);
1913     break;
1914   case 8: /* RoamingNotAllowedParam */
1915     offset=dissect_gsm_map_er_RoamingNotAllowedParam(FALSE, tvb, offset, actx, tree, -1);
1916     break;
1917   case 9: /* IllegalSubscriberParam */
1918     offset=dissect_gsm_map_er_IllegalSubscriberParam(FALSE, tvb, offset, actx, tree, -1);
1919     break;
1920   case 10: /* BearerServNotProvParam */
1921     offset=dissect_gsm_map_er_BearerServNotProvParam(FALSE, tvb, offset, actx, tree, -1);
1922     break;
1923   case 11: /* TeleservNotProvParam */
1924     offset=dissect_gsm_map_er_TeleservNotProvParam(FALSE, tvb, offset, actx, tree, -1);
1925     break;
1926   case 12: /* IllegalEquipmentParam */
1927     offset=dissect_gsm_map_er_IllegalEquipmentParam(FALSE, tvb, offset, actx, tree, -1);
1928     break;
1929   case 13: /* CallBarredParam */
1930     offset=dissect_gsm_map_er_CallBarredParam(FALSE, tvb, offset, actx, tree, -1);
1931     break;
1932   case 14: /* ForwardingViolationParam */
1933     offset=dissect_gsm_map_er_ForwardingViolationParam(FALSE, tvb, offset, actx, tree, -1);
1934     break;
1935   case 15: /* CUG-RejectParam */
1936     offset=dissect_gsm_map_er_CUG_RejectParam(FALSE, tvb, offset, actx, tree, -1);
1937     break;
1938   case 16: /* IllegalSS-OperationParam */
1939     offset=dissect_gsm_map_er_IllegalSS_OperationParam(FALSE, tvb, offset, actx, tree, -1);
1940     break;
1941   case 17: /* SS-ErrorStatus */
1942     offset=dissect_gsm_map_ss_SS_Status(FALSE, tvb, offset, actx, tree, hf_gsm_map_ss_ss_Status);
1943     break;
1944   case 18: /* SS-NotAvailableParam */
1945     offset=dissect_gsm_map_er_SS_NotAvailableParam(FALSE, tvb, offset, actx, tree, -1);
1946     break;
1947   case 19: /* SS-SubscriptionViolationParam */
1948     offset=dissect_gsm_map_er_SS_SubscriptionViolationParam(FALSE, tvb, offset, actx, tree, -1);
1949     break;
1950   case 20: /* SS-IncompatibilityCause */
1951     offset=dissect_gsm_map_er_SS_IncompatibilityCause(FALSE, tvb, offset, actx, tree, -1);
1952     break;
1953   case 21: /* FacilityNotSupParam */
1954     offset=dissect_gsm_map_er_FacilityNotSupParam(FALSE, tvb, offset, actx, tree, -1);
1955     break;
1956   case 22: /* OngoingGroupCallParam */
1957       offset=dissect_gsm_map_er_OngoingGroupCallParam(FALSE, tvb, offset, actx, tree, -1);
1958       break;
1959   case 27: /* AbsentSubscriberParam */
1960     offset=dissect_gsm_map_er_AbsentSubscriberParam(FALSE, tvb, offset, actx, tree, -1);
1961     break;
1962   case 28: /* IncompatibleTerminalParam */
1963     offset=dissect_gsm_map_er_IncompatibleTerminalParam(FALSE, tvb, offset, actx, tree, -1);
1964     break;
1965   case 29: /* ShortTermDenialParam */
1966     offset=dissect_gsm_map_er_ShortTermDenialParam(FALSE, tvb, offset, actx, tree, -1);
1967     break;
1968   case 30: /* LongTermDenialParam */
1969     offset=dissect_gsm_map_er_LongTermDenialParam(FALSE, tvb, offset, actx, tree, -1);
1970     break;
1971   case 31: /* SubBusyForMT-SMS-Param */
1972     offset=dissect_gsm_map_er_SubBusyForMT_SMS_Param(FALSE, tvb, offset, actx, tree, -1);
1973     break;
1974   case 32: /* SM-DeliveryFailureCause */
1975     offset=dissect_gsm_map_er_SM_DeliveryFailureCause(FALSE, tvb, offset, actx, tree, -1);
1976     break;
1977   case 33: /* MessageWaitListFullParam */
1978     offset=dissect_gsm_map_er_MessageWaitListFullParam(FALSE, tvb, offset, actx, tree, -1);
1979     break;
1980   case 34: /* SystemFailureParam */
1981     offset=dissect_gsm_map_er_SystemFailureParam(FALSE, tvb, offset, actx, tree, -1);
1982     break;
1983   case 35: /* DataMissingParam */
1984     offset=dissect_gsm_map_er_DataMissingParam(FALSE, tvb, offset, actx, tree, -1);
1985     break;
1986   case 36: /* UnexpectedDataParam */
1987     offset=dissect_gsm_map_er_UnexpectedDataParam(FALSE, tvb, offset, actx, tree, -1);
1988     break;
1989   case 37: /* PW-RegistrationFailureCause */
1990     offset=dissect_gsm_map_er_PW_RegistrationFailureCause(FALSE, tvb, offset, actx, tree, -1);
1991     break;
1992   case 39: /* NoRoamingNbParam */
1993     offset=dissect_gsm_map_er_NoRoamingNbParam(FALSE, tvb, offset, actx, tree, -1);
1994     break;
1995   case 40: /* TracingBufferFullParam */
1996     offset=dissect_gsm_map_er_TracingBufferFullParam(FALSE, tvb, offset, actx, tree, -1);
1997     break;
1998   case 42: /* TargetCellOutsideGCA-Param */
1999     offset=dissect_gsm_map_er_TargetCellOutsideGCA_Param(FALSE, tvb, offset, actx, tree, -1);
2000     break;
2001   case 44: /* NumberChangedParam */
2002     offset=dissect_gsm_map_er_NumberChangedParam(FALSE, tvb, offset, actx, tree, -1);
2003     break;
2004   case 45: /* BusySubscriberParam */
2005     offset=dissect_gsm_map_er_BusySubscriberParam(FALSE, tvb, offset, actx, tree, -1);
2006     break;
2007   case 46: /* NoSubscriberReplyParam */
2008     offset=dissect_gsm_map_er_NoSubscriberReplyParam(FALSE, tvb, offset, actx, tree, -1);
2009     break;
2010   case 47: /* ForwardingFailedParam */
2011     offset=dissect_gsm_map_er_ForwardingFailedParam(FALSE, tvb, offset, actx, tree, -1);
2012     break;
2013   case 48: /* OR-NotAllowedParam */
2014     offset=dissect_gsm_map_er_OR_NotAllowedParam(FALSE, tvb, offset, actx, tree, -1);
2015     break;
2016   case 49: /* ATI-NotAllowedParam */
2017     offset=dissect_gsm_map_er_ATI_NotAllowedParam(FALSE, tvb, offset, actx, tree, -1);
2018     break;
2019   case 50: /* NoGroupCallNbParam */
2020     offset=dissect_gsm_map_er_NoGroupCallNbParam(FALSE, tvb, offset, actx, tree, -1);
2021     break;
2022   case 51: /* ResourceLimitationParam */
2023     offset=dissect_gsm_map_er_ResourceLimitationParam(FALSE, tvb, offset, actx, tree, -1);
2024     break;
2025   case 52: /* UnauthorizedRequestingNetwork-Param */
2026     offset=dissect_gsm_map_er_UnauthorizedRequestingNetwork_Param(FALSE, tvb, offset, actx, tree, -1);
2027     break;
2028   case 53: /* UnauthorizedLCSClient-Param */
2029     offset=dissect_gsm_map_er_UnauthorizedLCSClient_Param(FALSE, tvb, offset, actx, tree, -1);
2030     break;
2031   case 54: /* PositionMethodFailure-Param */
2032     offset=dissect_gsm_map_er_PositionMethodFailure_Param(FALSE, tvb, offset, actx, tree, -1);
2033     break;
2034   case 58: /* UnknownOrUnreachableLCSClient-Param */
2035     offset=dissect_gsm_map_er_UnknownOrUnreachableLCSClient_Param(FALSE, tvb, offset, actx, tree, -1);
2036     break;
2037   case 59: /* MM-EventNotSupported-Param */
2038     offset=dissect_gsm_map_er_MM_EventNotSupported_Param(FALSE, tvb, offset, actx, tree, -1);
2039     break;
2040   case 60: /* ATSI-NotAllowedParam */
2041     offset=dissect_gsm_map_er_ATSI_NotAllowedParam(FALSE, tvb, offset, actx, tree, -1);
2042     break;
2043   case 61: /* ATM-NotAllowedParam */
2044     offset=dissect_gsm_map_er_ATM_NotAllowedParam(FALSE, tvb, offset, actx, tree, -1);
2045     break;
2046   case 62: /* InformationNotAvailableParam */
2047     offset=dissect_gsm_map_er_InformationNotAvailableParam(FALSE, tvb, offset, actx, tree, -1);
2048     break;
2049   default:
2050     if(!dissector_try_uint_new(map_prop_err_opcode_table, (guint8)opcode, tvb, actx->pinfo, tree, TRUE, actx->subtree.top_tree)){
2051         proto_tree_add_expert_format(tree, actx->pinfo, &ei_gsm_map_unknown_invokeData,
2052                                      tvb, offset, -1, "Unknown returnErrorData %d", opcode);
2053     }
2054     offset+= tvb_reported_length_remaining(tvb,offset);
2055     break;
2056   }
2057   return offset;
2058 }
2059 
2060 /* Private extension container for PLMN Data */
dissect_gsm_mapext_PlmnContainer(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2061 static int dissect_gsm_mapext_PlmnContainer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2062   proto_tree    *tree;
2063   asn1_ctx_t asn1_ctx;
2064   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2065   /* create display subtree for the protocol */
2066   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_gsm_old_PlmnContainer_U, NULL, "MAP Ext. Plmn Container");
2067 
2068   return dissect_gsm_old_PlmnContainer(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2069 }
2070 
dissect_gsm_map_ericsson_ext_ExtensionType(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2071 static int dissect_gsm_map_ericsson_ext_ExtensionType(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2072     proto_tree    *tree;
2073     asn1_ctx_t asn1_ctx;
2074     asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2075     tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_gsm_map_ericsson_ExtensionType, NULL, "Ericsson Extension");
2076     return dissect_gsm_map_ericsson_ExtensionType(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2077 }
2078 
dissect_NokiaMAP_ext_SriResExtension(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2079 static int dissect_NokiaMAP_ext_SriResExtension(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2080   proto_tree    *tree;
2081   asn1_ctx_t asn1_ctx;
2082   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2083   /* create display subtree for the protocol */
2084   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_SriResExtension_U, NULL, "Nokia Extension");
2085   return dissect_NokiaMAP_Extensions_SriResExtension(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2086 }
2087 
dissect_NokiaMAP_ext_CanLocArgExt(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2088 static int dissect_NokiaMAP_ext_CanLocArgExt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2089   proto_tree    *tree;
2090   asn1_ctx_t asn1_ctx;
2091   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2092   /* create display subtree for the protocol */
2093   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_CanLocArgExt_U, NULL, "Nokia Extension");
2094 
2095   return dissect_NokiaMAP_Extensions_CanLocArgExt(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2096 }
2097 
dissect_NokiaMAP_ext_ATMargExt(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2098 static int dissect_NokiaMAP_ext_ATMargExt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2099   proto_tree    *tree;
2100   asn1_ctx_t asn1_ctx;
2101   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2102   /* create display subtree for the protocol */
2103   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_ATMargExt_U, NULL, "Nokia Extension");
2104 
2105   return dissect_NokiaMAP_Extensions_ATMargExt(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2106 }
2107 
dissect_NokiaMAP_ext_DTMargExt(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2108 static int dissect_NokiaMAP_ext_DTMargExt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2109   proto_tree    *tree;
2110   asn1_ctx_t asn1_ctx;
2111   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2112   /* create display subtree for the protocol */
2113   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_DTMargExt_U, NULL, "Nokia Extension");
2114 
2115   return dissect_NokiaMAP_Extensions_DTMargExt(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2116 }
2117 
dissect_NokiaMAP_ext_NumberPorted(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2118 static int dissect_NokiaMAP_ext_NumberPorted(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2119   asn1_ctx_t asn1_ctx;
2120   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2121 
2122   return dissect_NokiaMAP_Extensions_NumberPorted(FALSE, tvb, 0, &asn1_ctx, parent_tree, -1);
2123 }
2124 
dissect_NokiaMAP_ext_ATMresExt(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2125 static int dissect_NokiaMAP_ext_ATMresExt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2126   proto_tree    *tree;
2127   asn1_ctx_t asn1_ctx;
2128   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2129   /* create display subtree for the protocol */
2130   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_ATMresExt_U, NULL, "Nokia Extension");
2131 
2132   return dissect_NokiaMAP_Extensions_ATMresExt(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2133 }
2134 
dissect_NokiaMAP_ext_AbsentSubscriberExt(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2135 static int dissect_NokiaMAP_ext_AbsentSubscriberExt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2136   asn1_ctx_t asn1_ctx;
2137 
2138   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2139   return dissect_NokiaMAP_Extensions_AbsentSubscriberExt(FALSE, tvb, 0, &asn1_ctx, parent_tree, -1);
2140 }
2141 
dissect_NokiaMAP_ext_SriForSMArgExt(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2142 static int dissect_NokiaMAP_ext_SriForSMArgExt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2143   proto_tree    *tree;
2144   asn1_ctx_t asn1_ctx;
2145   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2146   /* create display subtree for the protocol */
2147   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_SriForSMArgExt_U, NULL, "Nokia Extension");
2148 
2149   return dissect_NokiaMAP_Extensions_SriForSMArgExt(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2150 }
2151 
dissect_NokiaMAP_ext_ReportSMDelStatArgExt(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2152 static int dissect_NokiaMAP_ext_ReportSMDelStatArgExt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2153   proto_tree    *tree;
2154   asn1_ctx_t asn1_ctx;
2155   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2156   /* create display subtree for the protocol */
2157   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_ReportSMDelStatArgExt_U, NULL, "Nokia Extension");
2158 
2159   return dissect_NokiaMAP_Extensions_ReportSMDelStatArgExt(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2160 }
2161 
dissect_NokiaMAP_ext_UdlArgExt(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2162 static int dissect_NokiaMAP_ext_UdlArgExt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2163   proto_tree    *tree;
2164   asn1_ctx_t asn1_ctx;
2165   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2166   /* create display subtree for the protocol */
2167   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_UdlArgExt_U, NULL, "Nokia Extension");
2168 
2169   return dissect_NokiaMAP_Extensions_UdlArgExt(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2170 }
2171 
dissect_NokiaMAP_ext_RoamNotAllowedExt(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2172 static int dissect_NokiaMAP_ext_RoamNotAllowedExt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2173   proto_tree    *tree;
2174   asn1_ctx_t asn1_ctx;
2175   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2176   /* create display subtree for the protocol */
2177   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_RoamNotAllowedExt_U, NULL, "Nokia Extension");
2178 
2179   return dissect_NokiaMAP_Extensions_RoamNotAllowedExt(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2180 }
2181 
dissect_NokiaMAP_ext_MO_ForwardSM_ArgExt(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2182 static int dissect_NokiaMAP_ext_MO_ForwardSM_ArgExt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2183   proto_tree    *tree;
2184   asn1_ctx_t asn1_ctx;
2185   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2186   /* create display subtree for the protocol */
2187   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_MO_ForwardSM_ArgExt_U, NULL, "Nokia Extension");
2188 
2189   return dissect_NokiaMAP_Extensions_MO_ForwardSM_ArgExt(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2190 }
2191 
dissect_NokiaMAP_ext_ErrOlcmInfoTableExt(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2192 static int dissect_NokiaMAP_ext_ErrOlcmInfoTableExt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2193   proto_tree    *tree;
2194   asn1_ctx_t asn1_ctx;
2195   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2196   /* create display subtree for the protocol */
2197   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_ErrOlcmInfoTableExt_U, NULL, "Nokia Extension");
2198 
2199   return dissect_NokiaMAP_Extensions_ErrOlcmInfoTableExt(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2200 }
2201 
dissect_NokiaMAP_ext_RoutingCategoryExt(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2202 static int dissect_NokiaMAP_ext_RoutingCategoryExt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2203   proto_tree    *tree;
2204   asn1_ctx_t asn1_ctx;
2205   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2206   /* create display subtree for the protocol */
2207   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_RoutingCategoryExt_U, NULL, "Nokia Extension");
2208 
2209   return dissect_NokiaMAP_Extensions_RoutingCategoryExt(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2210 }
2211 
dissect_NokiaMAP_ext_AnyTimeModArgExt(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2212 static int dissect_NokiaMAP_ext_AnyTimeModArgExt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2213   proto_tree    *tree;
2214   asn1_ctx_t asn1_ctx;
2215   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2216   /* create display subtree for the protocol */
2217   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_AnyTimeModArgExt_U, NULL, "Nokia Extension");
2218 
2219   return dissect_NokiaMAP_Extensions_AnyTimeModArgExt(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2220 }
2221 
dissect_NokiaMAP_ext_AccessTypeExt(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2222 static int dissect_NokiaMAP_ext_AccessTypeExt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2223   asn1_ctx_t asn1_ctx;
2224   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2225   /* create display subtree for the protocol */
2226   return dissect_NokiaMAP_Extensions_AccessTypeExt(FALSE, tvb, 0, &asn1_ctx, parent_tree, -1);
2227 }
2228 
dissect_NokiaMAP_ext_AccessSubscriptionListExt(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2229 static int dissect_NokiaMAP_ext_AccessSubscriptionListExt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2230   asn1_ctx_t asn1_ctx;
2231   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2232   /* create display subtree for the protocol */
2233   return dissect_NokiaMAP_Extensions_AccessSubscriptionListExt(FALSE, tvb, 0, &asn1_ctx, parent_tree, -1);
2234 }
2235 
dissect_NokiaMAP_ext_AllowedServiceData(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2236 static int dissect_NokiaMAP_ext_AllowedServiceData(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2237   asn1_ctx_t asn1_ctx;
2238   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2239   /* create display subtree for the protocol */
2240   return dissect_NokiaMAP_Extensions_AllowedServiceData(FALSE, tvb, 0, &asn1_ctx, parent_tree, -1);
2241 }
2242 
dissect_NokiaMAP_ext_SriExtension(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2243 static int dissect_NokiaMAP_ext_SriExtension(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2244   proto_tree    *tree;
2245   asn1_ctx_t asn1_ctx;
2246   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2247   /* create display subtree for the protocol */
2248   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_SriExtension_U, NULL, "Nokia Extension");
2249 
2250   return dissect_NokiaMAP_Extensions_SriExtension(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2251 }
2252 
dissect_NokiaMAP_ExtraSignalInfo(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2253 static int dissect_NokiaMAP_ExtraSignalInfo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2254   proto_tree    *tree;
2255   asn1_ctx_t asn1_ctx;
2256   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2257   /* create display subtree for the protocol */
2258   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_ExtraSignalInfo_U, NULL, "Nokia Extension");
2259 
2260   return dissect_NokiaMAP_Extensions_ExtraSignalInfo(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2261 }
2262 
dissect_NokiaMAP_ext_SS_DataExtension(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2263 static int dissect_NokiaMAP_ext_SS_DataExtension(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2264   proto_tree    *tree;
2265   asn1_ctx_t asn1_ctx;
2266   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2267   /* create display subtree for the protocol */
2268   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_SS_DataExtension_U, NULL, "Nokia Extension");
2269 
2270   return dissect_NokiaMAP_Extensions_SS_DataExtension(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2271 }
2272 
dissect_NokiaMAP_ext_HOExtension(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2273 static int dissect_NokiaMAP_ext_HOExtension(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2274   proto_tree    *tree;
2275   asn1_ctx_t asn1_ctx;
2276   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2277   /* create display subtree for the protocol */
2278   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_HO_Ext_U, NULL, "Nokia Extension");
2279 
2280   return dissect_NokiaMAP_Extensions_HO_Ext(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2281 }
2282 
dissect_NokiaMAP_ext_UlResExtension(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2283 static int dissect_NokiaMAP_ext_UlResExtension(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2284   proto_tree    *tree;
2285   asn1_ctx_t asn1_ctx;
2286   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2287   /* create display subtree for the protocol */
2288   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_UlResExt_U, NULL, "Nokia Extension");
2289 
2290   return dissect_NokiaMAP_Extensions_UlResExt(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2291 }
2292 
2293 
dissect_NokiaMAP_ext_IsdArgExtension(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2294 static int dissect_NokiaMAP_ext_IsdArgExtension(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2295   proto_tree    *tree;
2296   asn1_ctx_t asn1_ctx;
2297   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2298   /* create display subtree for the protocol */
2299   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_IsdArgExt_U, NULL, "Nokia Extension");
2300 
2301   return dissect_NokiaMAP_Extensions_IsdArgExt(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2302 }
2303 
dissect_NokiaMAP_ext_DsdArgExt(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data _U_)2304 static int dissect_NokiaMAP_ext_DsdArgExt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) {
2305   proto_tree    *tree;
2306   asn1_ctx_t asn1_ctx;
2307   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2308   /* create display subtree for the protocol */
2309   tree = proto_tree_add_subtree(parent_tree, tvb, 0, -1, ett_NokiaMAP_Extensions_DsdArgExt_U, NULL, "Nokia Extension");
2310 
2311   return dissect_NokiaMAP_Extensions_DsdArgExt(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2312 }
2313 
2314 static int
dissect_gsm_map_GSMMAPPDU(gboolean implicit_tag _U_,tvbuff_t * tvb,int offset,asn1_ctx_t * actx,proto_tree * tree,int hf_index _U_)2315 dissect_gsm_map_GSMMAPPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset,
2316                           asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) {
2317 
2318   char *version_ptr;
2319 
2320   opcode = 0;
2321   if (pref_application_context_version == APPLICATON_CONTEXT_FROM_TRACE) {
2322     gsm_map_private_info_t *gsm_map_priv = (gsm_map_private_info_t*)actx->value_ptr;
2323     application_context_version = 0;
2324     if (gsm_map_priv && gsm_map_priv->tcap_private != NULL){
2325       if (gsm_map_priv->tcap_private->acv==TRUE ){
2326         version_ptr = strrchr((const char*)gsm_map_priv->tcap_private->oid,'.');
2327         if (version_ptr){
2328           ws_strtoi32(version_ptr + 1, NULL, &application_context_version);
2329         }
2330       }
2331     }
2332   }else{
2333     application_context_version = pref_application_context_version;
2334   }
2335 
2336   gsmmap_pdu_type = tvb_get_guint8(tvb, offset)&0x0f;
2337   /* Get the length and add 2 */
2338   gsm_map_pdu_size = tvb_get_guint8(tvb, offset+1)+2;
2339 
2340   col_set_str(actx->pinfo->cinfo, COL_INFO, val_to_str_const(gsmmap_pdu_type, gsm_old_Component_vals, "Unknown GSM-MAP Component"));
2341   col_append_str(actx->pinfo->cinfo, COL_INFO, " ");
2342   offset = dissect_gsm_old_Component(FALSE, tvb, 0, actx, tree, hf_gsm_map_old_Component_PDU);
2343 /*
2344   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
2345                               GSMMAPPDU_choice, hf_index, ett_gsm_map_GSMMAPPDU, NULL);
2346 */
2347 
2348   return offset;
2349 }
2350 
2351 static int
dissect_gsm_map(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data)2352 dissect_gsm_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data)
2353 {
2354   proto_item  *item=NULL;
2355   proto_tree  *tree=NULL;
2356   /* Used for gsm_map TAP */
2357   static      gsm_map_tap_rec_t tap_rec;
2358   gint        op_idx;
2359   asn1_ctx_t asn1_ctx;
2360   gsm_map_private_info_t *gsm_map_priv;
2361 
2362   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2363 
2364   col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSM MAP");
2365 
2366   asn1_ctx.subtree.top_tree = parent_tree;
2367 
2368   gsm_map_priv = wmem_new0(pinfo->pool, gsm_map_private_info_t);
2369   gsm_map_priv->tcap_private = (struct tcap_private_t *)data;
2370   asn1_ctx.value_ptr = gsm_map_priv;
2371 
2372   /* create display subtree for the protocol */
2373   item = proto_tree_add_item(parent_tree, proto_gsm_map, tvb, 0, -1, ENC_NA);
2374   tree = proto_item_add_subtree(item, ett_gsm_map);
2375 
2376   dissect_gsm_map_GSMMAPPDU(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2377   try_val_to_str_idx(opcode, gsm_map_opr_code_strings, &op_idx);
2378 
2379   if (op_idx != -1) {
2380     tap_rec.invoke = (gsmmap_pdu_type == 1) ? TRUE : FALSE;
2381     tap_rec.opcode = opcode;
2382     tap_rec.size = gsm_map_pdu_size;
2383 
2384     tap_queue_packet(gsm_map_tap, pinfo, &tap_rec);
2385   }
2386 
2387   return tvb_captured_length(tvb);
2388 }
2389 
2390 static int
dissect_gsm_map_sccp(tvbuff_t * tvb,packet_info * pinfo,proto_tree * parent_tree,void * data)2391 dissect_gsm_map_sccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data)
2392 {
2393   proto_item  *item=NULL;
2394   proto_tree  *tree=NULL;
2395   /* Used for gsm_map TAP */
2396   static      gsm_map_tap_rec_t tap_rec;
2397   gint        op_idx;
2398   asn1_ctx_t asn1_ctx;
2399   gsm_map_private_info_t *gsm_map_priv;
2400 
2401   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
2402 
2403   col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSM MAP");
2404 
2405   asn1_ctx.subtree.top_tree = parent_tree;
2406 
2407   gsm_map_priv = wmem_new0(pinfo->pool, gsm_map_private_info_t);
2408   gsm_map_priv->sccp_msg_info = (sccp_msg_info_t *)data;
2409   asn1_ctx.value_ptr = gsm_map_priv;
2410 
2411   /* create display subtree for the protocol */
2412   item = proto_tree_add_item(parent_tree, proto_gsm_map, tvb, 0, -1, ENC_NA);
2413   tree = proto_item_add_subtree(item, ett_gsm_map);
2414 
2415   dissect_gsm_map_GSMMAPPDU(FALSE, tvb, 0, &asn1_ctx, tree, -1);
2416   try_val_to_str_idx(opcode, gsm_map_opr_code_strings, &op_idx);
2417 
2418   if (op_idx != -1) {
2419     tap_rec.invoke = (gsmmap_pdu_type == 1) ? TRUE : FALSE;
2420     tap_rec.opcode = opcode;
2421     tap_rec.size = gsm_map_pdu_size;
2422 
2423     tap_queue_packet(gsm_map_tap, pinfo, &tap_rec);
2424   }
2425 
2426   return tvb_captured_length(tvb);
2427 }
2428 
2429 const value_string ssCode_vals[] = {
2430   { 0x00, "allSS - all SS" },
2431   { 0x10 ,"allLineIdentificationSS - all line identification SS" },
2432   { 0x11 ,"clip - calling line identification presentation" },
2433   { 0x12 ,"clir - calling line identification restriction" },
2434   { 0x13 ,"colp - connected line identification presentation" },
2435   { 0x14 ,"colr - connected line identification restriction" },
2436   { 0x15 ,"mci - malicious call identification" },
2437   { 0x18 ,"allNameIdentificationSS - all name identification SS" },
2438   { 0x19 ,"cnap - calling name presentation" },
2439   { 0x20 ,"allForwardingSS - all forwarding SS" },
2440   { 0x21 ,"cfu - call forwarding unconditional" },
2441   { 0x28 ,"allCondForwardingSS - all conditional forwarding SS" },
2442   { 0x29 ,"cfb - call forwarding busy" },
2443   { 0x2a ,"cfnry - call forwarding on no reply" },
2444   { 0x2b ,"cfnrc - call forwarding on mobile subscriber not reachable" },
2445   { 0x24 ,"cd - call deflection" },
2446   { 0x30 ,"allCallOfferingSS - all call offering SS includes also all forwarding SS" },
2447   { 0x31 ,"ect - explicit call transfer" },
2448   { 0x32 ,"mah - mobile access hunting" },
2449   { 0x40 ,"allCallCompletionSS - all Call completion SS" },
2450   { 0x41 ,"cw - call waiting" },
2451   { 0x42 ,"hold - call hold" },
2452   { 0x43 ,"ccbs-A - completion of call to busy subscribers, originating side" },
2453   { 0x44 ,"ccbs-B - completion of call to busy subscribers, destination side" },
2454   { 0x45 ,"mc - multicall" },
2455   { 0x50 ,"allMultiPartySS - all multiparty SS" },
2456   { 0x51 ,"multiPTY - multiparty" },
2457   { 0x60 ,"allCommunityOfInterestSS - all community of interest SS" },
2458   { 0x61 ,"cug - closed user group" },
2459   { 0x70 ,"allChargingSS - all charging SS" },
2460   { 0x71 ,"aoci - advice of charge information" },
2461   { 0x72 ,"aocc - advice of charge charging" },
2462   { 0x80 ,"allAdditionalInfoTransferSS - all additional information transfer SS" },
2463   { 0x81 ,"uus1 - UUS1 user-to-user signalling" },
2464   { 0x82 ,"uus2 - UUS2 user-to-user signalling" },
2465   { 0x83 ,"uus3 - UUS3 user-to-user signalling" },
2466   { 0x90 ,"allCallRestrictionSS - all Callrestriction SS" },
2467   { 0x91 ,"barringOfOutgoingCalls" },
2468   { 0x92 ,"baoc - barring of all outgoing calls" },
2469   { 0x93 ,"boic - barring of outgoing international calls" },
2470   { 0x94 ,"boicExHC - barring of outgoing international calls except those directed to the home PLMN" },
2471   { 0x99 ,"barringOfIncomingCalls" },
2472   { 0x9a ,"baic - barring of all incoming calls" },
2473   { 0x9b ,"bicRoam - barring of incoming calls when roaming outside home PLMN Country" },
2474   { 0xf0 ,"allPLMN-specificSS" },
2475   { 0xa0 ,"allCallPrioritySS - all call priority SS" },
2476   { 0xa1 ,"emlpp - enhanced Multilevel Precedence Pre-emption (EMLPP) service" },
2477   { 0xb0 ,"allLCSPrivacyException - all LCS Privacy Exception Classes" },
2478   { 0xb1 ,"universal - allow location by any LCS client" },
2479   { 0xb2 ,"callrelated - allow location by any value added LCS client to which a call is established from the target MS" },
2480   { 0xb3 ,"callunrelated - allow location by designated external value added LCS clients" },
2481   { 0xb4 ,"plmnoperator - allow location by designated PLMN operator LCS clients" },
2482   { 0xb5 ,"serviceType - allow location by LCS clients of a designated LCS service type" },
2483   { 0xc0 ,"allMOLR-SS - all Mobile Originating Location Request Classes" },
2484   { 0xc1 ,"basicSelfLocation - allow an MS to request its own location" },
2485   { 0xc2 ,"autonomousSelfLocation - allow an MS to perform self location without interaction with the PLMN for a predetermined period of time" },
2486   { 0xc3 ,"transferToThirdParty - allow an MS to request transfer of its location to another LCS client" },
2487 
2488   { 0xf1 ,"plmn-specificSS-1" },
2489   { 0xf2 ,"plmn-specificSS-2" },
2490   { 0xf3 ,"plmn-specificSS-3" },
2491   { 0xf4 ,"plmn-specificSS-4" },
2492   { 0xf5 ,"plmn-specificSS-5" },
2493   { 0xf6 ,"plmn-specificSS-6" },
2494   { 0xf7 ,"plmn-specificSS-7" },
2495   { 0xf8 ,"plmn-specificSS-8" },
2496   { 0xf9 ,"plmn-specificSS-9" },
2497   { 0xfa ,"plmn-specificSS-a" },
2498   { 0xfb ,"plmn-specificSS-b" },
2499   { 0xfc ,"plmn-specificSS-c" },
2500   { 0xfd ,"plmn-specificSS-d" },
2501   { 0xfe ,"plmn-specificSS-e" },
2502   { 0xff ,"plmn-specificSS-f" },
2503   { 0, NULL }
2504 };
2505 
2506 static const value_string Teleservice_vals[] = {
2507   { 0x00, "allTeleservices" },
2508   { 0x10, "allSpeechTransmissionServices" },
2509   { 0x11, "telephony" },
2510   { 0x12, "emergencyCalls" },
2511   { 0x20, "allShortMessageServices" },
2512   { 0x21, "shortMessageMT-PP" },
2513   { 0x22, "shortMessageMO-PP" },
2514   { 0x60, "allFacsimileTransmissionServices" },
2515   { 0x61, "facsimileGroup3AndAlterSpeech" },
2516   { 0x62, "automaticFacsimileGroup3" },
2517   { 0x63, "facsimileGroup4" },
2518 
2519   { 0x70, "allDataTeleservices" },
2520   { 0x80, "allTeleservices-ExceptSMS" },
2521 
2522   { 0x90, "allVoiceGroupCallServices" },
2523   { 0x91, "voiceGroupCall" },
2524   { 0x92, "voiceBroadcastCall" },
2525 
2526   { 0xd0, "allPLMN-specificTS" },
2527   { 0xd1, "plmn-specificTS-1" },
2528   { 0xd2, "plmn-specificTS-2" },
2529   { 0xd3, "plmn-specificTS-3" },
2530   { 0xd4, "plmn-specificTS-4" },
2531   { 0xd5, "plmn-specificTS-5" },
2532   { 0xd6, "plmn-specificTS-6" },
2533   { 0xd7, "plmn-specificTS-7" },
2534   { 0xd8, "plmn-specificTS-8" },
2535   { 0xd9, "plmn-specificTS-9" },
2536   { 0xda, "plmn-specificTS-A" },
2537   { 0xdb, "plmn-specificTS-B" },
2538   { 0xdc, "plmn-specificTS-C" },
2539   { 0xdd, "plmn-specificTS-D" },
2540   { 0xde, "plmn-specificTS-E" },
2541   { 0xdf, "plmn-specificTS-F" },
2542   { 0, NULL }
2543 };
2544 
2545 static const value_string Bearerservice_vals[] = {
2546   { 0x00, "allBearerServices" },
2547   { 0x10, "allDataCDA-Services" },
2548   { 0x11, "dataCDA-300bps" },
2549   { 0x12, "dataCDA-1200bps" },
2550   { 0x13, "dataCDA-1200-75bps" },
2551   { 0x14, "dataCDA-2400bps" },
2552   { 0x15, "dataCDA-4800bps" },
2553   { 0x16, "dataCDA-9600bps" },
2554   { 0x17, "general-dataCDA" },
2555 
2556   { 0x18, "allDataCDS-Services" },
2557   { 0x1A, "dataCDS-1200bps" },
2558   { 0x1C, "dataCDS-2400bps" },
2559   { 0x1D, "dataCDS-4800bps" },
2560   { 0x1E, "dataCDS-9600bps" },
2561   { 0x1F, "general-dataCDS" },
2562 
2563   { 0x20, "allPadAccessCA-Services" },
2564   { 0x21, "padAccessCA-300bps" },
2565   { 0x22, "padAccessCA-1200bps" },
2566   { 0x23, "padAccessCA-1200-75bps" },
2567   { 0x24, "padAccessCA-2400bps" },
2568   { 0x25, "padAccessCA-4800bps" },
2569   { 0x26, "padAccessCA-9600bps" },
2570   { 0x27, "general-padAccessCA" },
2571 
2572   { 0x28, "allDataPDS-Services" },
2573   { 0x2C, "dataPDS-2400bps" },
2574   { 0x2D, "dataPDS-4800bps" },
2575   { 0x2E, "dataPDS-9600bps" },
2576   { 0x2F, "general-dataPDS" },
2577 
2578   { 0x30, "allAlternateSpeech-DataCDA" },
2579   { 0x38, "allAlternateSpeech-DataCDS" },
2580   { 0x40, "allSpeechFollowedByDataCDA" },
2581   { 0x48, "allSpeechFollowedByDataCDS" },
2582 
2583   { 0x50, "allDataCircuitAsynchronous" },
2584   { 0x60, "allAsynchronousServices" },
2585   { 0x58, "allDataCircuitSynchronous" },
2586   { 0x68, "allSynchronousServices" },
2587 
2588   { 0xD0, "allPLMN-specificBS" },
2589   { 0xD1, "plmn-specificBS-1" },
2590   { 0xD2, "plmn-specificBS-2" },
2591   { 0xD3, "plmn-specificBS-3" },
2592   { 0xD4, "plmn-specificBS-4" },
2593   { 0xD5, "plmn-specificBS-5" },
2594   { 0xD6, "plmn-specificBS-6" },
2595   { 0xD7, "plmn-specificBS-7" },
2596   { 0xD8, "plmn-specificBS-8" },
2597   { 0xD9, "plmn-specificBS-9" },
2598   { 0xDA, "plmn-specificBS-A" },
2599   { 0xDB, "plmn-specificBS-B" },
2600   { 0xDC, "plmn-specificBS-C" },
2601   { 0xDD, "plmn-specificBS-D" },
2602   { 0xDE, "plmn-specificBS-E" },
2603   { 0xDF, "plmn-specificBS-F" },
2604 
2605   {  0, NULL }
2606 };
2607 
2608 /* ForwardingOptions
2609 
2610 -- bit 8: notification to forwarding party
2611 -- 0 no notification
2612 -- 1 notification
2613 */
2614 static const true_false_string notification_value  = {
2615   "Notification",
2616   "No notification"
2617 };
2618 /*
2619 -- bit 7: redirecting presentation
2620 -- 0 no presentation
2621 -- 1 presentation
2622 */
2623 static const true_false_string redirecting_presentation_value  = {
2624   "Presentation",
2625   "No presentation"
2626 };
2627 /*
2628 -- bit 6: notification to calling party
2629 -- 0 no notification
2630 -- 1 notification
2631 */
2632 /*
2633 -- bit 5: 0 (unused)
2634 -- bits 43: forwarding reason
2635 -- 00 ms not reachable
2636 -- 01 ms busy
2637 -- 10 no reply
2638 -- 11 unconditional when used in a SRI Result,
2639 -- or call deflection when used in a RCH Argument
2640 */
2641 static const value_string forwarding_reason_values[] = {
2642   { 0x0, "ms not reachable" },
2643   { 0x1, "ms busy" },
2644   { 0x2, "no reply" },
2645   { 0x3, "unconditional when used in a SRI Result or call deflection when used in a RCH Argument" },
2646   {  0, NULL }
2647 };
2648 /*
2649 -- bits 21: 00 (unused)
2650 */
2651 
2652 static const value_string pdp_type_org_values[] = {
2653   { 0x0, "ETSI" },
2654   { 0x1, "IETF" },
2655   { 0xf, "Empty PDP type" },
2656   {  0, NULL }
2657 };
2658 
2659 static const value_string etsi_pdp_type_number_values[] = {
2660   { 0x0, "Reserved, used in earlier version of this protocol" },
2661   { 0x1, "PPP" },
2662   {  0, NULL }
2663 };
2664 
2665 static const value_string ietf_pdp_type_number_values[] = {
2666   { 0x21, "IPv4 Address" },
2667   { 0x57, "IPv6 Address" },
2668   {  0, NULL }
2669 };
2670 
2671 /*
2672 ChargingCharacteristics ::= OCTET STRING (SIZE (2))
2673 -- Octets are coded according to 3GPP TS 32.015.
2674 -- From 3GPP TS 32.015.
2675 --
2676 -- Descriptions for the bits of the flag set:
2677 --
2678 -- Bit 1: H (Hot billing) := '00000001'B
2679 -- Bit 2: F (Flat rate) := '00000010'B
2680 -- Bit 3: P (Prepaid service) := '00000100'B
2681 -- Bit 4: N (Normal billing) := '00001000'B
2682 -- Bit 5: - (Reserved, set to 0) := '00010000'B
2683 -- Bit 6: - (Reserved, set to 0) := '00100000'B
2684 -- Bit 7: - (Reserved, set to 0) := '01000000'B
2685 -- Bit 8: - (Reserved, set to 0) := '10000000'B
2686 */
2687 static const value_string chargingcharacteristics_values[] = {
2688   { 0x1, "H (Hot billing)" },
2689   { 0x2, "F (Flat rate)" },
2690   { 0x4, "P (Prepaid service)" },
2691   { 0x8, "N (Normal billing)" },
2692   {  0, NULL }
2693 };
2694 
2695 /* TAP STAT INFO */
2696 typedef enum
2697 {
2698   ID_COLUMN,
2699   OP_CODE_COLUMN,
2700   INVOKES_COLUMN,
2701   NUM_BYTES_FWD_COLUMN,
2702   AVG_BYTES_FWD_COLUMN,
2703   RET_RES_COLUMN,
2704   NUM_BYTES_REV_COLUMN,
2705   AVG_BYTES_REV_COLUMN,
2706   TOT_BYTES_COLUMN,
2707   AVG_BYTES_COLUMN
2708 } gsm_a_stat_columns;
2709 
2710 static stat_tap_table_item gsm_map_stat_fields[] = {
2711   {TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "ID", "%d"},
2712   {TABLE_ITEM_STRING, TAP_ALIGN_LEFT, "Operation Code", "%-25s"},
2713   {TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "Invokes", "%d"},
2714   {TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "Num Bytes", "%d"},
2715   {TABLE_ITEM_FLOAT, TAP_ALIGN_RIGHT, "Avg Bytes", "%d"},
2716   {TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "Return Result", "%d"},
2717   {TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "Num Bytes", "%d"},
2718   {TABLE_ITEM_FLOAT, TAP_ALIGN_RIGHT, "Avg Bytes", "%d"},
2719   {TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "Total Bytes", "%d"},
2720   {TABLE_ITEM_FLOAT, TAP_ALIGN_RIGHT, "Avg Bytes", "%d"},
2721 };
2722 
gsm_map_stat_init(stat_tap_table_ui * new_stat)2723 static void gsm_map_stat_init(stat_tap_table_ui* new_stat)
2724 {
2725   const char *table_name = "GSM MAP Operation Statistics";
2726   int num_fields = sizeof(gsm_map_stat_fields)/sizeof(stat_tap_table_item);
2727   stat_tap_table* table;
2728   guint i;
2729   stat_tap_table_item_type items[sizeof(gsm_map_stat_fields)/sizeof(stat_tap_table_item)];
2730 
2731   memset(items, 0, sizeof(items));
2732 
2733   items[ID_COLUMN].type = TABLE_ITEM_UINT;
2734   items[OP_CODE_COLUMN].type = TABLE_ITEM_STRING;
2735   items[INVOKES_COLUMN].type = TABLE_ITEM_UINT;
2736   items[NUM_BYTES_FWD_COLUMN].type = TABLE_ITEM_UINT;
2737   items[AVG_BYTES_FWD_COLUMN].type = TABLE_ITEM_FLOAT;
2738   items[RET_RES_COLUMN].type = TABLE_ITEM_UINT;
2739   items[NUM_BYTES_REV_COLUMN].type = TABLE_ITEM_UINT;
2740   items[AVG_BYTES_REV_COLUMN].type = TABLE_ITEM_FLOAT;
2741   items[TOT_BYTES_COLUMN].type = TABLE_ITEM_UINT;
2742   items[AVG_BYTES_COLUMN].type = TABLE_ITEM_FLOAT;
2743 
2744   table = stat_tap_find_table(new_stat, table_name);
2745   if (table) {
2746     if (new_stat->stat_tap_reset_table_cb) {
2747       new_stat->stat_tap_reset_table_cb(table);
2748     }
2749     return;
2750   }
2751 
2752   table = stat_tap_init_table(table_name, num_fields, 0, NULL);
2753   stat_tap_add_table(new_stat, table);
2754 
2755   /* Add a row for each value type */
2756   for (i = 0; i < GSM_MAP_MAX_NUM_OPR_CODES; i++)
2757   {
2758     const char *ocs = try_val_to_str(i, gsm_map_opr_code_strings);
2759     char *col_str;
2760     if (ocs) {
2761       col_str = g_strdup(ocs);
2762     } else {
2763       col_str = g_strdup_printf("Unknown op code %d", i);
2764     }
2765 
2766     items[ID_COLUMN].value.uint_value = i;
2767     items[OP_CODE_COLUMN].value.string_value = col_str;
2768     stat_tap_init_table_row(table, i, num_fields, items);
2769   }
2770 }
2771 
2772 static tap_packet_status
gsm_map_stat_packet(void * tapdata,packet_info * pinfo _U_,epan_dissect_t * edt _U_,const void * gmtr_ptr)2773 gsm_map_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *gmtr_ptr)
2774 {
2775   stat_data_t* stat_data = (stat_data_t*)tapdata;
2776   const gsm_map_tap_rec_t *gmtr = (const gsm_map_tap_rec_t *)gmtr_ptr;
2777   stat_tap_table* table;
2778   stat_tap_table_item_type *invoke_data, *fwd_bytes_data, *result_data, *rev_bytes_data, *avg_data;
2779   guint invokes, fwd_bytes, results, rev_bytes;
2780 
2781   table = g_array_index(stat_data->stat_tap_data->tables, stat_tap_table*, 0);
2782 
2783   invoke_data = stat_tap_get_field_data(table, gmtr->opcode, INVOKES_COLUMN);
2784   fwd_bytes_data = stat_tap_get_field_data(table, gmtr->opcode, NUM_BYTES_FWD_COLUMN);
2785   result_data = stat_tap_get_field_data(table, gmtr->opcode, RET_RES_COLUMN);
2786   rev_bytes_data = stat_tap_get_field_data(table, gmtr->opcode, NUM_BYTES_REV_COLUMN);
2787 
2788   if (gmtr->invoke)
2789   {
2790     invoke_data->value.uint_value++;
2791     stat_tap_set_field_data(table, gmtr->opcode, INVOKES_COLUMN, invoke_data);
2792 
2793     fwd_bytes_data->value.uint_value += gmtr->size;
2794     stat_tap_set_field_data(table, gmtr->opcode, NUM_BYTES_FWD_COLUMN, fwd_bytes_data);
2795   }
2796   else
2797   {
2798     result_data->value.uint_value++;
2799     stat_tap_set_field_data(table, gmtr->opcode, RET_RES_COLUMN, result_data);
2800 
2801     rev_bytes_data->value.uint_value += gmtr->size;
2802     stat_tap_set_field_data(table, gmtr->opcode, NUM_BYTES_REV_COLUMN, rev_bytes_data);
2803   }
2804 
2805   invokes = invoke_data->value.uint_value;
2806   fwd_bytes = fwd_bytes_data->value.uint_value;
2807   results = result_data->value.uint_value;
2808   rev_bytes = rev_bytes_data->value.uint_value;
2809 
2810   if (gmtr->invoke)
2811   {
2812     avg_data = stat_tap_get_field_data(table, gmtr->opcode, AVG_BYTES_FWD_COLUMN);
2813     avg_data->value.float_value += (float) fwd_bytes / invokes;
2814     stat_tap_set_field_data(table, gmtr->opcode, AVG_BYTES_FWD_COLUMN, avg_data);
2815   }
2816   else
2817   {
2818     avg_data = stat_tap_get_field_data(table, gmtr->opcode, AVG_BYTES_REV_COLUMN);
2819     avg_data->value.float_value += (float) rev_bytes / results;
2820     stat_tap_set_field_data(table, gmtr->opcode, AVG_BYTES_REV_COLUMN, avg_data);
2821   }
2822 
2823   avg_data = stat_tap_get_field_data(table, gmtr->opcode, AVG_BYTES_COLUMN);
2824   avg_data->value.float_value += (float) (fwd_bytes + rev_bytes) / (invokes + results);
2825   stat_tap_set_field_data(table, gmtr->opcode, AVG_BYTES_COLUMN, avg_data);
2826   return TAP_PACKET_REDRAW;
2827 }
2828 
2829 static void
gsm_map_stat_reset(stat_tap_table * table)2830 gsm_map_stat_reset(stat_tap_table* table)
2831 {
2832   guint element;
2833   stat_tap_table_item_type* item_data;
2834 
2835   for (element = 0; element < table->num_elements; element++)
2836   {
2837     item_data = stat_tap_get_field_data(table, element, INVOKES_COLUMN);
2838     item_data->value.uint_value = 0;
2839     stat_tap_set_field_data(table, element, INVOKES_COLUMN, item_data);
2840   }
2841 }
2842 
2843 static void
gsm_map_stat_free_table_item(stat_tap_table * table _U_,guint row _U_,guint column,stat_tap_table_item_type * field_data)2844 gsm_map_stat_free_table_item(stat_tap_table* table _U_, guint row _U_, guint column, stat_tap_table_item_type* field_data)
2845 {
2846   if (column != OP_CODE_COLUMN) return;
2847   g_free((char*)field_data->value.string_value);
2848 }
2849 
2850 /*--- proto_reg_handoff_gsm_map ---------------------------------------*/
range_delete_callback(guint32 ssn,gpointer ptr _U_)2851 static void range_delete_callback(guint32 ssn, gpointer ptr _U_)
2852 {
2853   if (ssn) {
2854     delete_itu_tcap_subdissector(ssn, map_handle);
2855   }
2856 }
2857 
range_add_callback(guint32 ssn,gpointer ptr _U_)2858 static void range_add_callback(guint32 ssn, gpointer ptr _U_)
2859 {
2860   if (ssn) {
2861    add_itu_tcap_subdissector(ssn, map_handle);
2862   }
2863 }
2864 
proto_reg_handoff_gsm_map(void)2865 void proto_reg_handoff_gsm_map(void) {
2866 
2867   static gboolean map_prefs_initialized = FALSE;
2868   static range_t *ssn_range;
2869 
2870   if (!map_prefs_initialized) {
2871     map_prefs_initialized = TRUE;
2872     ranap_handle = find_dissector_add_dependency("ranap", proto_gsm_map);
2873     dtap_handle = find_dissector_add_dependency("gsm_a_dtap", proto_gsm_map);
2874     gsm_sms_handle = find_dissector_add_dependency("gsm_sms", proto_gsm_map);
2875     bssap_handle = find_dissector_add_dependency("gsm_a_bssmap", proto_gsm_map);
2876 
2877     oid_add_from_string("itu(0) administration(2) japan(440)","0.2.440" );
2878     register_ber_oid_dissector_handle("0.4.0.0.1.0.1.3", map_handle, proto_gsm_map,"networkLocUpContext-v3");
2879     register_ber_oid_dissector_handle("0.4.0.0.1.0.1.2", map_handle, proto_gsm_map,"networkLocUpContext-v2" );
2880     register_ber_oid_dissector_handle("0.4.0.0.1.0.1.1", map_handle, proto_gsm_map,"networkLocUpContext-v1" );
2881     register_ber_oid_dissector_handle("0.4.0.0.1.0.2.3", map_handle, proto_gsm_map,"locationCancellationContext-v3" );
2882     register_ber_oid_dissector_handle("0.4.0.0.1.0.2.2", map_handle, proto_gsm_map,"locationCancellationContext-v2" );
2883     register_ber_oid_dissector_handle("0.4.0.0.1.0.2.1", map_handle, proto_gsm_map,"locationCancellationContext-v1" );
2884     register_ber_oid_dissector_handle("0.4.0.0.1.0.3.3", map_handle, proto_gsm_map,"roamingNumberEnquiryContext-v3" );
2885     register_ber_oid_dissector_handle("0.4.0.0.1.0.3.2", map_handle, proto_gsm_map,"roamingNumberEnquiryContext-v2" );
2886     register_ber_oid_dissector_handle("0.4.0.0.1.0.3.1", map_handle, proto_gsm_map,"roamingNumberEnquiryContext-v1" );
2887     register_ber_oid_dissector_handle("0.4.0.0.1.0.4.3", map_handle, proto_gsm_map,"istAlertingContext-v3" );
2888     register_ber_oid_dissector_handle("0.4.0.0.1.0.5.3", map_handle, proto_gsm_map,"locationInfoRetrievalContext-v3" );
2889     register_ber_oid_dissector_handle("0.4.0.0.1.0.5.2", map_handle, proto_gsm_map,"locationInfoRetrievalContext-v2" );
2890     register_ber_oid_dissector_handle("0.4.0.0.1.0.5.1", map_handle, proto_gsm_map,"locationInfoRetrievalContext-v1" );
2891     register_ber_oid_dissector_handle("0.4.0.0.1.0.6.4", map_handle, proto_gsm_map,"callControlTransferContext-v4" );
2892     register_ber_oid_dissector_handle("0.4.0.0.1.0.6.3", map_handle, proto_gsm_map,"callControlTransferContext-v3" );
2893     register_ber_oid_dissector_handle("0.4.0.0.1.0.7.3", map_handle, proto_gsm_map,"reportingContext-v3" );
2894     register_ber_oid_dissector_handle("0.4.0.0.1.0.8.3", map_handle, proto_gsm_map,"callCompletionContext-v3" );
2895     register_ber_oid_dissector_handle("0.4.0.0.1.0.9.3", map_handle, proto_gsm_map,"serviceTerminationContext-v3" );
2896     register_ber_oid_dissector_handle("0.4.0.0.1.0.10.2", map_handle, proto_gsm_map,"resetContext-v2" );
2897     register_ber_oid_dissector_handle("0.4.0.0.1.0.10.1", map_handle, proto_gsm_map,"resetContext-v1" );
2898     register_ber_oid_dissector_handle("0.4.0.0.1.0.11.3", map_handle, proto_gsm_map,"handoverControlContext-v3" );
2899     register_ber_oid_dissector_handle("0.4.0.0.1.0.11.2", map_handle, proto_gsm_map,"handoverControlContext-v2" );
2900     register_ber_oid_dissector_handle("0.4.0.0.1.0.11.1", map_handle, proto_gsm_map,"handoverControlContext-v1" );
2901     register_ber_oid_dissector_handle("0.4.0.0.1.0.12.3", map_handle, proto_gsm_map,"sIWFSAllocationContext-v3" );
2902     register_ber_oid_dissector_handle("0.4.0.0.1.0.13.3", map_handle, proto_gsm_map,"equipmentMngtContext-v3" );
2903     register_ber_oid_dissector_handle("0.4.0.0.1.0.13.2", map_handle, proto_gsm_map,"equipmentMngtContext-v2" );
2904     register_ber_oid_dissector_handle("0.4.0.0.1.0.13.1", map_handle, proto_gsm_map,"equipmentMngtContext-v1" );
2905     register_ber_oid_dissector_handle("0.4.0.0.1.0.14.3", map_handle, proto_gsm_map,"infoRetrievalContext-v3" );
2906     register_ber_oid_dissector_handle("0.4.0.0.1.0.14.2", map_handle, proto_gsm_map,"infoRetrievalContext-v2" );
2907     register_ber_oid_dissector_handle("0.4.0.0.1.0.14.1", map_handle, proto_gsm_map,"infoRetrievalContext-v1" );
2908     /* fallback to infoRetrieval(14) version1(1) and not interVlrInfoRetrieval(15) version1(1) */
2909     /*register_ber_oid_dissector_handle("0.4.0.0.1.0.15.1", map_handle, proto_gsm_map,"map-ac interVlrInfoRetrieval(15) version1(1)" );*/
2910     register_ber_oid_dissector_handle("0.4.0.0.1.0.15.2", map_handle, proto_gsm_map,"interVlrInfoRetrievalContext-v2" );
2911     register_ber_oid_dissector_handle("0.4.0.0.1.0.15.3", map_handle, proto_gsm_map,"interVlrInfoRetrievalContext-v3" );
2912     register_ber_oid_dissector_handle("0.4.0.0.1.0.16.3", map_handle, proto_gsm_map,"subscriberDataMngtContext-v3" );
2913     register_ber_oid_dissector_handle("0.4.0.0.1.0.16.2", map_handle, proto_gsm_map,"subscriberDataMngtContext-v2" );
2914     register_ber_oid_dissector_handle("0.4.0.0.1.0.16.1", map_handle, proto_gsm_map,"subscriberDataMngtContext-v1" );
2915     register_ber_oid_dissector_handle("0.4.0.0.1.0.17.3", map_handle, proto_gsm_map,"tracingContext-v3" );
2916     register_ber_oid_dissector_handle("0.4.0.0.1.0.17.2", map_handle, proto_gsm_map,"tracingContext-v2" );
2917     register_ber_oid_dissector_handle("0.4.0.0.1.0.17.1", map_handle, proto_gsm_map,"tracingContext-v1" );
2918     register_ber_oid_dissector_handle("0.4.0.0.1.0.18.2", map_handle, proto_gsm_map,"networkFunctionalSsContext-v2" );
2919     register_ber_oid_dissector_handle("0.4.0.0.1.0.18.1", map_handle, proto_gsm_map,"networkFunctionalSsContext-v1" );
2920     register_ber_oid_dissector_handle("0.4.0.0.1.0.19.2", map_handle, proto_gsm_map,"networkUnstructuredSsContext-v2" );
2921     register_ber_oid_dissector_handle("0.4.0.0.1.0.20.3", map_handle, proto_gsm_map,"shortMsgGatewayContext-v3" );
2922     register_ber_oid_dissector_handle("0.4.0.0.1.0.20.2", map_handle, proto_gsm_map,"shortMsgGatewayContext-v2" );
2923     register_ber_oid_dissector_handle("0.4.0.0.1.0.20.1", map_handle, proto_gsm_map,"shortMsgGatewayContext-v1" );
2924     register_ber_oid_dissector_handle("0.4.0.0.1.0.21.3", map_handle, proto_gsm_map,"shortMsgMO-RelayContext-v3" );
2925     register_ber_oid_dissector_handle("0.4.0.0.1.0.21.2", map_handle, proto_gsm_map,"shortMsgMO-RelayContext-v2" );
2926     register_ber_oid_dissector_handle("0.4.0.0.1.0.21.1", map_handle, proto_gsm_map,"shortMsgRelayContext-v1" );
2927     register_ber_oid_dissector_handle("0.4.0.0.1.0.22.3", map_handle, proto_gsm_map,"subscriberDataModificationNotificationContext-v3" );
2928     register_ber_oid_dissector_handle("0.4.0.0.1.0.23.2", map_handle, proto_gsm_map,"shortMsgAlertContext-v2" );
2929     register_ber_oid_dissector_handle("0.4.0.0.1.0.23.1", map_handle, proto_gsm_map,"shortMsgAlertContext-v1" );
2930     register_ber_oid_dissector_handle("0.4.0.0.1.0.24.3", map_handle, proto_gsm_map,"mwdMngtContext-v3" );
2931     register_ber_oid_dissector_handle("0.4.0.0.1.0.24.2", map_handle, proto_gsm_map,"mwdMngtContext-v2" );
2932     register_ber_oid_dissector_handle("0.4.0.0.1.0.24.1", map_handle, proto_gsm_map,"mwdMngtContext-v1" );
2933     register_ber_oid_dissector_handle("0.4.0.0.1.0.25.3", map_handle, proto_gsm_map,"shortMsgMT-RelayContext-v3" );
2934     register_ber_oid_dissector_handle("0.4.0.0.1.0.25.2", map_handle, proto_gsm_map,"shortMsgMT-RelayContext-v2" );
2935     register_ber_oid_dissector_handle("0.4.0.0.1.0.26.2", map_handle, proto_gsm_map,"imsiRetrievalContext-v2" );
2936     register_ber_oid_dissector_handle("0.4.0.0.1.0.27.2", map_handle, proto_gsm_map,"msPurgingContext-v2" );
2937     register_ber_oid_dissector_handle("0.4.0.0.1.0.27.3", map_handle, proto_gsm_map,"msPurgingContext-v3" );
2938     register_ber_oid_dissector_handle("0.4.0.0.1.0.28.3", map_handle, proto_gsm_map,"subscriberInfoEnquiryContext-v3" );
2939     register_ber_oid_dissector_handle("0.4.0.0.1.0.29.3", map_handle, proto_gsm_map,"anyTimeInfoEnquiryContext-v3" );
2940     register_ber_oid_dissector_handle("0.4.0.0.1.0.31.3", map_handle, proto_gsm_map,"groupCallControlContext-v3" );
2941     register_ber_oid_dissector_handle("0.4.0.0.1.0.32.3", map_handle, proto_gsm_map,"gprsLocationUpdateContext-v3" );
2942     register_ber_oid_dissector_handle("0.4.0.0.1.0.33.4", map_handle, proto_gsm_map,"gprsLocationInfoRetrievalContext-v4" );
2943     register_ber_oid_dissector_handle("0.4.0.0.1.0.33.3", map_handle, proto_gsm_map,"gprsLocationInfoRetrievalContext-v3" );
2944     register_ber_oid_dissector_handle("0.4.0.0.1.0.34.3", map_handle, proto_gsm_map,"failureReportContext-v3" );
2945     register_ber_oid_dissector_handle("0.4.0.0.1.0.35.3", map_handle, proto_gsm_map,"gprsNotifyContext-v3" );
2946     register_ber_oid_dissector_handle("0.4.0.0.1.0.36.3", map_handle, proto_gsm_map,"ss-InvocationNotificationContext-v3" );
2947     register_ber_oid_dissector_handle("0.4.0.0.1.0.37.3", map_handle, proto_gsm_map,"locationSvcGatewayContext-v3" );
2948     register_ber_oid_dissector_handle("0.4.0.0.1.0.38.3", map_handle, proto_gsm_map,"locationSvcEnquiryContext-v3" );
2949     register_ber_oid_dissector_handle("0.4.0.0.1.0.39.3", map_handle, proto_gsm_map,"authenticationFailureReportContext-v3" );
2950     register_ber_oid_dissector_handle("0.4.0.0.1.0.40.3", map_handle, proto_gsm_map,"secureTransportHandlingContext-v3" );
2951     register_ber_oid_dissector_handle("0.4.0.0.1.0.41.3", map_handle, proto_gsm_map,"shortMsgMT-Relay-VGCS-Context-v3" );
2952     register_ber_oid_dissector_handle("0.4.0.0.1.0.42.3", map_handle, proto_gsm_map,"mm-EventReportingContext-v3" );
2953     register_ber_oid_dissector_handle("0.4.0.0.1.0.43.3", map_handle, proto_gsm_map,"anyTimeInfoHandlingContext-v3" );
2954     register_ber_oid_dissector_handle("0.4.0.0.1.0.44.3", map_handle, proto_gsm_map,"resourceManagementContext-v3" );
2955     register_ber_oid_dissector_handle("0.4.0.0.1.0.45.3", map_handle, proto_gsm_map,"groupCallInfoRetrievalContext-v3" );
2956     /* Private extension container */
2957     register_ber_oid_dissector("1.3.12.2.1006.53.2.1.3", dissect_gsm_mapext_PlmnContainer, proto_gsm_map,"alcatel-E10-MAP-extension-PlmnContainer" );
2958     register_ber_oid_dissector("0.34.0",dissect_NokiaMAP_ext_IsdArgExtension,proto_gsm_map,"Nokia ISD Extension");
2959     register_ber_oid_dissector("0.34.1",dissect_NokiaMAP_ext_DsdArgExt,proto_gsm_map,"Nokia Dsd Extension");
2960     register_ber_oid_dissector("0.34.2",dissect_NokiaMAP_ext_UlResExtension,proto_gsm_map,"Nokia Location Update Extension");
2961     register_ber_oid_dissector("0.34.4",dissect_NokiaMAP_ext_SS_DataExtension,proto_gsm_map,"Nokia SS Data Extension");
2962     register_ber_oid_dissector("0.34.5",dissect_NokiaMAP_ext_SriExtension,proto_gsm_map,"Nokia SRI Request Extension");
2963     register_ber_oid_dissector("0.34.6",dissect_NokiaMAP_ExtraSignalInfo,proto_gsm_map,"Nokia ExtraSignalInfo Extension");
2964     register_ber_oid_dissector("0.34.7",dissect_NokiaMAP_ext_SriResExtension,proto_gsm_map,"Nokia SRI Response Extension");
2965     register_ber_oid_dissector("0.34.10",dissect_NokiaMAP_ext_CanLocArgExt,proto_gsm_map,"Nokia Cancel Location Extension");
2966     register_ber_oid_dissector("0.34.11",dissect_NokiaMAP_ext_ATMargExt,proto_gsm_map,"Nokia ATM Extension");
2967     register_ber_oid_dissector("0.34.12",dissect_NokiaMAP_ext_DTMargExt,proto_gsm_map,"Nokia DTM Extension");
2968     register_ber_oid_dissector("0.34.13",dissect_NokiaMAP_ext_NumberPorted,proto_gsm_map,"Nokia NumberPorted Extension");
2969     register_ber_oid_dissector("0.34.15",dissect_NokiaMAP_ext_HOExtension,proto_gsm_map,"Nokia HandOver Extension");
2970     register_ber_oid_dissector("0.34.16",dissect_NokiaMAP_ext_ATMresExt,proto_gsm_map,"Nokia ATMres Extension");
2971     register_ber_oid_dissector("0.34.17",dissect_NokiaMAP_ext_AbsentSubscriberExt,proto_gsm_map,"Nokia AbsentSubscriber Extension");
2972     register_ber_oid_dissector("0.34.18",dissect_NokiaMAP_ext_SriForSMArgExt,proto_gsm_map,"Nokia SriForSM Extension");
2973     register_ber_oid_dissector("0.34.19",dissect_NokiaMAP_ext_ReportSMDelStatArgExt,proto_gsm_map,"Nokia ReportSMDelStatt Extension");
2974     register_ber_oid_dissector("0.34.20",dissect_NokiaMAP_ext_UdlArgExt,proto_gsm_map,"Nokia Udl Extension");
2975     register_ber_oid_dissector("0.34.21",dissect_NokiaMAP_ext_RoamNotAllowedExt,proto_gsm_map,"Nokia RoamNotAllowed Extension");
2976     register_ber_oid_dissector("0.34.22",dissect_NokiaMAP_ext_MO_ForwardSM_ArgExt,proto_gsm_map,"Nokia MO-ForwardSM Extension");
2977     register_ber_oid_dissector("0.34.23",dissect_NokiaMAP_ext_ErrOlcmInfoTableExt,proto_gsm_map,"Nokia ErrOlcmInfoTable Extension");
2978     register_ber_oid_dissector("0.34.25",dissect_NokiaMAP_ext_RoutingCategoryExt,proto_gsm_map,"Nokia Routing Category Extension");
2979     register_ber_oid_dissector("0.34.26",dissect_NokiaMAP_ext_AnyTimeModArgExt,proto_gsm_map,"Nokia AnyTimeMod Extension");
2980 
2981     register_ber_oid_dissector("1.3.12.2.1107.3.66.1.1",dissect_NokiaMAP_ext_AccessTypeExt,proto_gsm_map,"Nokia AccessTypeExt Extension");
2982     register_ber_oid_dissector("1.3.12.2.1107.3.66.1.3",dissect_NokiaMAP_ext_AccessSubscriptionListExt,proto_gsm_map,"Nokia AccessSubscriptionListExt Extension");
2983     register_ber_oid_dissector("1.3.12.2.1107.3.66.1.6",dissect_NokiaMAP_ext_AllowedServiceData,proto_gsm_map,"Nokia AllowedServiceData Extension");
2984 
2985     register_ber_oid_dissector("1.2.826.0.1249.58.1.0",dissect_gsm_map_ericsson_ext_ExtensionType,proto_gsm_map,"Ericsson ExtensionType Extension");
2986   }
2987   else {
2988     range_foreach(ssn_range, range_delete_callback, NULL);
2989     wmem_free(wmem_epan_scope(), ssn_range);
2990   }
2991 
2992   ssn_range = range_copy(wmem_epan_scope(), global_ssn_range);
2993   range_foreach(ssn_range, range_add_callback, NULL);
2994 
2995 }
2996 
2997 /*--- proto_register_gsm_map -------------------------------------------*/
proto_register_gsm_map(void)2998 void proto_register_gsm_map(void) {
2999   module_t *gsm_map_module;
3000   expert_module_t* expert_gsm_map;
3001 
3002   /* List of fields */
3003   static hf_register_info hf[] = {
3004       { &hf_gsm_map_old_Component_PDU,
3005         { "Component", "gsm_map.old.Component",
3006           FT_UINT32, BASE_DEC, VALS(gsm_old_Component_vals), 0,
3007           NULL, HFILL }},
3008       { &hf_gsm_map_getPassword,
3009         { "getPassword", "gsm_map.getPassword",
3010           FT_UINT8, BASE_DEC, VALS(gsm_old_GetPasswordArg_vals), 0,
3011           NULL, HFILL }},
3012       { &hf_gsm_map_currentPassword,
3013         { "currentPassword", "gsm_map.currentPassword",
3014           FT_STRING, BASE_NONE, NULL, 0,
3015           NULL, HFILL }},
3016       { &hf_gsm_map_extension,
3017         { "Extension", "gsm_map.extension",
3018           FT_BOOLEAN, 8, TFS(&tfs_no_extension_extension), 0x80,
3019           NULL, HFILL }},
3020       { &hf_gsm_map_nature_of_number,
3021         { "Nature of number", "gsm_map.nature_of_number",
3022           FT_UINT8, BASE_HEX|BASE_EXT_STRING, &gsm_map_nature_of_number_values_ext, 0x70,
3023           NULL, HFILL }},
3024       { &hf_gsm_map_number_plan,
3025         { "Number plan", "gsm_map.number_plan",
3026           FT_UINT8, BASE_HEX|BASE_EXT_STRING, &gsm_map_number_plan_values_ext, 0x0f,
3027           NULL, HFILL }},
3028       { &hf_gsm_map_address_digits,
3029         { "Address digits", "gsm_map.address.digits",
3030           FT_STRING, BASE_NONE, NULL, 0,
3031           NULL, HFILL }},
3032       { &hf_gsm_map_TBCD_digits,
3033         { "TBCD digits", "gsm_map.tbcd_digits",
3034           FT_STRING, BASE_NONE, NULL, 0,
3035           NULL, HFILL }},
3036       { &hf_gsm_map_Ss_Status_unused,
3037         { "Unused", "gsm_map.unused",
3038           FT_UINT8, BASE_HEX, NULL, 0xf0,
3039           NULL, HFILL }},
3040       { &hf_gsm_map_Ss_Status_q_bit,
3041         { "Q bit", "gsm_map.ss_status_q_bit",
3042           FT_BOOLEAN, 8, TFS(&gsm_map_Ss_Status_q_bit_values), 0x08,
3043           NULL, HFILL }},
3044       { &hf_gsm_map_Ss_Status_p_bit,
3045         { "P bit", "gsm_map.ss_status_p_bit",
3046           FT_BOOLEAN, 8, TFS(&gsm_map_Ss_Status_p_values), 0x04,
3047           NULL, HFILL }},
3048       { &hf_gsm_map_Ss_Status_r_bit,
3049         { "R bit", "gsm_map.ss_status_r_bit",
3050           FT_BOOLEAN, 8, TFS(&gsm_map_Ss_Status_r_values), 0x02,
3051           NULL, HFILL }},
3052       { &hf_gsm_map_Ss_Status_a_bit,
3053         { "A bit", "gsm_map.ss_status_a_bit",
3054           FT_BOOLEAN, 8, TFS(&gsm_map_Ss_Status_a_values), 0x01,
3055           NULL, HFILL }},
3056       { &hf_gsm_map_notification_to_forwarding_party,
3057         { "Notification to forwarding party", "gsm_map.notification_to_forwarding_party",
3058           FT_BOOLEAN, 8, TFS(&notification_value), 0x80,
3059           NULL, HFILL }},
3060       { &hf_gsm_map_redirecting_presentation,
3061         { "Redirecting presentation", "gsm_map.redirecting_presentation",
3062           FT_BOOLEAN, 8, TFS(&redirecting_presentation_value), 0x40,
3063           NULL, HFILL }},
3064       { &hf_gsm_map_notification_to_calling_party,
3065         { "Notification to calling party", "gsm_map.notification_to_calling_party",
3066           FT_BOOLEAN, 8, TFS(&notification_value), 0x20,
3067           NULL, HFILL }},
3068       { &hf_gsm_map_forwarding_reason,
3069         { "Forwarding reason", "gsm_map.forwarding_reason",
3070           FT_UINT8, BASE_HEX, VALS(forwarding_reason_values), 0x0c,
3071           NULL, HFILL }},
3072       { &hf_gsm_map_pdp_type_org,
3073         { "PDP Type Organization", "gsm_map.pdp_type_org",
3074           FT_UINT8, BASE_HEX, VALS(pdp_type_org_values), 0x0f,
3075           NULL, HFILL }},
3076       { &hf_gsm_map_etsi_pdp_type_number,
3077         { "PDP Type Number", "gsm_map.pdp_type_number",
3078           FT_UINT8, BASE_HEX, VALS(etsi_pdp_type_number_values), 0,
3079           "ETSI PDP Type Number", HFILL }},
3080       { &hf_gsm_map_ietf_pdp_type_number,
3081         { "PDP Type Number", "gsm_map.ietf_pdp_type_number",
3082           FT_UINT8, BASE_HEX, VALS(ietf_pdp_type_number_values), 0,
3083           "IETF PDP Type Number", HFILL }},
3084       { &hf_gsm_map_ext_qos_subscribed_pri,
3085         { "Allocation/Retention priority", "gsm_map.ext_qos_subscribed_pri",
3086           FT_UINT8, BASE_DEC, NULL, 0xff,
3087           NULL, HFILL }},
3088       { &hf_gsm_map_qos_traffic_cls,
3089         { "Traffic class", "gsm_map.qos.traffic_cls",
3090           FT_UINT8, BASE_DEC, VALS(gsm_a_sm_qos_traffic_cls_vals), 0xe0,
3091           NULL, HFILL }},
3092       { &hf_gsm_map_qos_del_order,
3093         { "Delivery order", "gsm_map.qos.del_order",
3094           FT_UINT8, BASE_DEC, VALS(gsm_a_sm_qos_traffic_cls_vals), 0x18,
3095           NULL, HFILL }},
3096       { &hf_gsm_map_qos_del_of_err_sdu,
3097         { "Delivery of erroneous SDUs", "gsm_map.qos.del_of_err_sdu",
3098           FT_UINT8, BASE_DEC, VALS(gsm_a_sm_qos_del_of_err_sdu_vals), 0x03,
3099           NULL, HFILL }},
3100       { &hf_gsm_map_qos_ber,
3101         { "Residual Bit Error Rate (BER)", "gsm_map.qos.ber",
3102           FT_UINT8, BASE_DEC, VALS(gsm_a_sm_qos_ber_vals), 0xf0,
3103           NULL, HFILL }},
3104       { &hf_gsm_map_qos_sdu_err_rat,
3105         { "SDU error ratio", "gsm_map.qos.sdu_err_rat",
3106           FT_UINT8, BASE_DEC, VALS(gsm_a_sm_qos_sdu_err_rat_vals), 0x0f,
3107           NULL, HFILL }},
3108       { &hf_gsm_map_qos_traff_hdl_pri,
3109         { "Traffic handling priority", "gsm_map.qos.traff_hdl_pri",
3110           FT_UINT8, BASE_DEC, VALS(gsm_a_sm_qos_traff_hdl_pri_vals), 0x03,
3111           NULL, HFILL }},
3112 
3113       { &hf_gsm_map_qos_max_sdu,
3114         { "Maximum SDU size", "gsm_map.qos.max_sdu",
3115           FT_UINT32, BASE_DEC, NULL, 0x0,
3116           NULL, HFILL }},
3117       { &hf_gsm_map_max_brate_ulink,
3118         { "Maximum bit rate for uplink in kbit/s", "gsm_map.qos.max_brate_ulink",
3119           FT_UINT32, BASE_DEC, NULL, 0x0,
3120           "Maximum bit rate for uplink", HFILL }},
3121       { &hf_gsm_map_max_brate_dlink,
3122         { "Maximum bit rate for downlink in kbit/s", "gsm_map.qos.max_brate_dlink",
3123           FT_UINT32, BASE_DEC, NULL, 0x0,
3124           "Maximum bit rate for downlink", HFILL }},
3125       { &hf_gsm_map_qos_transfer_delay,
3126         { "Transfer delay (Raw data see TS 24.008 for interpretation)", "gsm_map.qos.transfer_delay",
3127           FT_UINT8, BASE_DEC, NULL, 0xfc,
3128           "Transfer delay", HFILL }},
3129       { &hf_gsm_map_guaranteed_max_brate_ulink,
3130         { "Guaranteed bit rate for uplink in kbit/s", "gsm_map.qos.brate_ulink",
3131           FT_UINT32, BASE_DEC, NULL, 0x0,
3132           "Guaranteed bit rate for uplink", HFILL }},
3133       { &hf_gsm_map_guaranteed_max_brate_dlink,
3134         { "Guaranteed bit rate for downlink in kbit/s", "gsm_map.qos.brate_dlink",
3135           FT_UINT32, BASE_DEC, NULL, 0x0,
3136           "Guaranteed bit rate for downlink", HFILL }},
3137       { &hf_gsm_map_GSNAddress_IPv4,
3138         { "GSN-Address IPv4",  "gsm_map.gsnaddress_ipv4",
3139           FT_IPv4, BASE_NONE, NULL, 0,
3140           "IPAddress IPv4", HFILL }},
3141       { &hf_gsm_map_GSNAddress_IPv6,
3142         { "GSN Address IPv6",  "gsm_map.gsnaddress_ipv6",
3143           FT_IPv6, BASE_NONE, NULL, 0,
3144           "IPAddress IPv6", HFILL }},
3145       { &hf_gsm_map_ranap_service_Handover,
3146         { "service-Handover", "gsm_map.ranap.service_Handover",
3147           FT_UINT32, BASE_DEC, VALS(ranap_Service_Handover_vals), 0,
3148           "gsm_map.ranap.Service_Handover", HFILL }},
3149       { &hf_gsm_map_IntegrityProtectionInformation,
3150         { "IntegrityProtectionInformation", "gsm_map.ranap.IntegrityProtectionInformation",
3151           FT_NONE, BASE_NONE, NULL, 0,
3152           "gsm_map.ranap.IntegrityProtectionInformation", HFILL }},
3153       { &hf_gsm_map_EncryptionInformation,
3154         { "EncryptionInformation", "gsm_map.ranap.EncryptionInformation",
3155           FT_NONE, BASE_NONE, NULL, 0,
3156           "gsm_map.ranap.EncryptionInformation", HFILL }},
3157       { &hf_gsm_map_ss_SS_UserData,
3158         { "SS-UserData", "gsm_ss.SS_UserData",
3159           FT_STRING, BASE_NONE, NULL, 0,
3160           "gsm_map.ss.SS_UserData", HFILL }},
3161       { &hf_gsm_map_cbs_coding_grp,
3162         { "Coding Group","gsm_map.cbs.coding_grp",
3163           FT_UINT8,BASE_DEC|BASE_EXT_STRING, &gsm_map_cbs_data_coding_scheme_coding_grp_vals_ext, 0xf0,
3164           NULL, HFILL }
3165       },
3166       { &hf_gsm_map_cbs_coding_grp0_lang,
3167         { "Language","gsm_map.cbs.coding_grp0_lang",
3168           FT_UINT8,BASE_DEC|BASE_EXT_STRING, &gsm_map_cbs_coding_grp0_lang_vals_ext, 0x0f,
3169           NULL, HFILL }
3170       },
3171       { &hf_gsm_map_cbs_coding_grp1_lang,
3172         { "Language","gsm_map.cbs.coding_grp1_lang",
3173           FT_UINT8,BASE_DEC|BASE_EXT_STRING, &gsm_map_cbs_coding_grp1_lang_vals_ext, 0x0f,
3174           NULL, HFILL }
3175       },
3176       { &hf_gsm_map_cbs_coding_grp2_lang,
3177         { "Language","gsm_map.cbs.coding_grp2_lang",
3178           FT_UINT8,BASE_DEC|BASE_EXT_STRING, &gsm_map_cbs_coding_grp2_lang_vals_ext, 0x0f,
3179           NULL, HFILL }
3180       },
3181       { &hf_gsm_map_cbs_coding_grp3_lang,
3182         { "Language","gsm_map.cbs.coding_grp3_lang",
3183           FT_UINT8,BASE_DEC|BASE_EXT_STRING, &gsm_map_cbs_coding_grp3_lang_vals_ext, 0x0f,
3184           NULL, HFILL }
3185       },
3186       { &hf_gsm_map_cbs_coding_grp4_7_comp,
3187         { "Compressed indicator","gsm_map.cbs.coding_grp4_7_comp",
3188           FT_BOOLEAN, 8, TFS(&gsm_map_cbs_coding_grp4_7_comp_vals), 0x20,
3189           NULL, HFILL }
3190       },
3191       { &hf_gsm_map_cbs_coding_grp4_7_class_ind,
3192         { "Message Class present","gsm_map.cbs.coding_grp4_7_class_ind",
3193           FT_BOOLEAN, 8, TFS(&gsm_map_cbs_coding_grp4_7_class_ind_vals), 0x10,
3194           NULL, HFILL }
3195       },
3196       { &hf_gsm_map_cbs_coding_grp4_7_char_set,
3197         { "Character set being used","gsm_map.cbs.coding_grp4_7_char_set",
3198           FT_UINT8,BASE_DEC, VALS(gsm_map_cbs_coding_grp4_7_char_set_vals), 0x0c,
3199           NULL, HFILL }
3200       },
3201       { &hf_gsm_map_cbs_coding_grp4_7_class,
3202         { "Message Class","gsm_map.cbs.coding_grp4_7_class",
3203           FT_UINT8,BASE_DEC, VALS(gsm_map_cbs_coding_grp4_7_class_vals), 0x03,
3204           NULL, HFILL }
3205       },
3206       { &hf_gsm_map_cbs_coding_grp15_mess_code,
3207         { "Message coding","gsm_map.cbs.cbs_coding_grp15_mess_code",
3208           FT_UINT8,BASE_DEC, VALS(gsm_map_cbs_coding_grp15_mess_code_vals), 0x04,
3209           NULL, HFILL }
3210       },
3211       { &hf_gsm_map_cbs_coding_grp15_class,
3212         { "Message Class","gsm_map.cbs.gsm_map_cbs_coding_grp15_class",
3213           FT_UINT8,BASE_DEC, VALS(gsm_map_cbs_coding_grp15_class_vals), 0x03,
3214           NULL, HFILL }
3215       },
3216       { &hf_gsm_map_tmsi,
3217         { "tmsi", "gsm_map.tmsi",
3218           FT_BYTES, BASE_NONE, NULL, 0,
3219           "gsm_map.TMSI", HFILL }},
3220 
3221       { &hf_gsm_map_ie_tag,
3222         { "Tag", "gsm_map.ie_tag",
3223           FT_UINT8, BASE_DEC, VALS(gsm_map_tag_vals), 0,
3224           "GSM 04.08 tag", HFILL }},
3225       { &hf_gsm_map_len,
3226         { "Length", "gsm_map.length",
3227           FT_UINT8, BASE_DEC, NULL, 0,
3228           NULL, HFILL }},
3229       { &hf_gsm_map_disc_par,
3230         { "Discrimination parameter", "gsm_map.disc_par",
3231           FT_UINT8, BASE_DEC, VALS(gsm_map_disc_par_vals), 0,
3232           NULL, HFILL }},
3233       { &hf_gsm_map_dlci,
3234         { "DLCI", "gsm_map.dlci",
3235           FT_UINT8, BASE_DEC, NULL, 0,
3236           "Data Link Connection Indicator", HFILL }},
3237       { &hf_gsm_apn_str,
3238         { "APN", "gsm_map.apn_str",
3239           FT_STRING, BASE_NONE, NULL, 0,
3240           NULL, HFILL }},
3241       { &hf_gsm_map_ericsson_locationInformation_rat,
3242         { "RAT", "gsm_map.ericsson.locationInformation.rat",
3243           FT_UINT8, BASE_DEC, VALS(gsm_map_ericsson_locationInformation_rat_vals), 0,
3244           "Radio Access Technology", HFILL }},
3245       { &hf_gsm_map_ericsson_locationInformation_lac,
3246         { "LAC", "gsm_map.ericsson.locationInformation.lac",
3247           FT_UINT16, BASE_DEC_HEX, NULL, 0,
3248           "Location Area Code", HFILL }},
3249       { &hf_gsm_map_ericsson_locationInformation_ci,
3250         { "CI", "gsm_map.ericsson.locationInformation.ci",
3251           FT_UINT16, BASE_DEC_HEX, NULL, 0,
3252           "Cell Identity", HFILL }},
3253       { &hf_gsm_map_ericsson_locationInformation_sac,
3254         { "SAC", "gsm_map.ericsson.locationInformation.sac",
3255           FT_UINT16, BASE_DEC_HEX, NULL, 0,
3256           "Service Area Code", HFILL }},
3257       { &hf_gsm_map_ussd_string,
3258         { "USSD String", "gsm_map.ussd_string",
3259           FT_STRING, STR_UNICODE, NULL, 0,
3260           NULL, HFILL }},
3261     { &hf_gsm_map_spare_bits,
3262         { "Spare bit(s)", "gsm_map.spare_bits",
3263         FT_UINT8, BASE_DEC, NULL, 0x0,
3264         NULL, HFILL }
3265     },
3266     { &hf_gsm_map_qos_signalling_ind,
3267     { "Signalling indication", "gsm_map.qos.signalling_ind",
3268           FT_BOOLEAN, 8, TFS(&gsm_map_qos_signalling_ind_value), 0x10,
3269           NULL, HFILL }
3270     },
3271     { &hf_gsm_map_qos_source_stat_desc,
3272     { "Source statistics description", "gsm_map.qos.source_stat_desc",
3273           FT_UINT8, BASE_DEC, NULL, 0x0f,
3274           NULL, HFILL }
3275     },
3276     { &hf_gsm_map_qos_max_bitrate_upl_ext,
3277     { "Maximum bitrate for uplink (extended)", "gsm_map.qos.max_bitrate_upl_ext",
3278           FT_UINT8, BASE_DEC, NULL, 0x0,
3279           NULL, HFILL }
3280     },
3281     { &hf_gsm_map_qos_max_bitrate_downl_ext,
3282     { "Maximum bitrate for downlink (extended)", "gsm_map.qos.max_bitrate_downl_ext",
3283           FT_UINT8, BASE_DEC, NULL, 0x0,
3284           NULL, HFILL }
3285     },
3286     { &hf_gsm_map_qos_guar_bitrate_upl_ext,
3287     { "Guaranteed bitrate for uplink (extended)", "gsm_map.qos.guar_bitrate_upl_ext",
3288           FT_UINT8, BASE_DEC, NULL, 0x0,
3289           NULL, HFILL }
3290     },
3291     { &hf_gsm_map_qos_guar_bitrate_downl_ext,
3292     { "Guaranteed bitrate for downlink (extended)", "gsm_map.qos.guar_bitrate_downl_ext",
3293           FT_UINT8, BASE_DEC, NULL, 0x0,
3294           NULL, HFILL }
3295     },
3296 /*
3297     { &hf_gsm_map_qos_max_bitrate_upl_ext2,
3298     { "Maximum bitrate for uplink (extended-2)", "gsm_map.qos.max_bitrate_upl_ext2",
3299           FT_UINT8, BASE_DEC, NULL, 0x0,
3300           NULL, HFILL }
3301     },
3302     { &hf_gsm_map_qos_max_bitrate_downl_ext2,
3303     { "Maximum bitrate for downlink (extended-2)", "gsm_map.qos.max_bitrate_downl_ext2",
3304           FT_UINT8, BASE_DEC, NULL, 0x0,
3305           NULL, HFILL }
3306     },
3307     { &hf_gsm_map_qos_guar_bitrate_upl_ext2,
3308     { "Guaranteed bitrate for uplink (extended-2)", "gsm_map.qos.guar_bitrate_upl_ext2",
3309           FT_UINT8, BASE_DEC, NULL, 0x0,
3310           NULL, HFILL }
3311     },
3312     { &hf_gsm_map_qos_guar_bitrate_downl_ext2,
3313     { "Guaranteed bitrate for downlink (extended-2)", "gsm_map.qos.guar_bitrate_downl_ext2",
3314           FT_UINT8, BASE_DEC, NULL, 0x0,
3315           NULL, HFILL }
3316     },
3317     */
3318     { &hf_gsm_map_earp_pvi,
3319     { "PVI Pre-emption Vulnerability", "gsm_map.EARP_pre_emption_par_vulnerability",
3320               FT_BOOLEAN, 8, TFS(&tfs_disabled_enabled), 0x01,
3321               NULL, HFILL }
3322     },
3323     { &hf_gsm_map_earp_pl,
3324     { "PL Priority Level", "gsm_map.EARP_priority_level",
3325               FT_UINT8, BASE_DEC, NULL, 0x3C,
3326               NULL, HFILL }
3327     },
3328     { &hf_gsm_map_earp_pci,
3329     { "PCI Pre-emption Capability", "gsm_map.EARP_pre_emption_Capability",
3330             FT_BOOLEAN, 8, TFS(&tfs_disabled_enabled), 0x40,
3331             NULL, HFILL }
3332     },
3333 
3334 #include "packet-gsm_map-hfarr.c"
3335   };
3336 
3337   /* List of subtrees */
3338   static gint *ett[] = {
3339     &ett_gsm_map,
3340     &ett_gsm_map_InvokeId,
3341     &ett_gsm_map_InvokePDU,
3342     &ett_gsm_map_ReturnResultPDU,
3343     &ett_gsm_map_ReturnErrorPDU,
3344     &ett_gsm_map_ReturnResult_result,
3345     &ett_gsm_map_ReturnError_result,
3346     &ett_gsm_map_GSMMAPPDU,
3347     &ett_gsm_map_ext_qos_subscribed,
3348     &ett_gsm_map_pdptypenumber,
3349     &ett_gsm_map_RAIdentity,
3350     &ett_gsm_map_LAIFixedLength,
3351     &ett_gsm_map_isdn_address_string,
3352     &ett_gsm_map_geo_desc,
3353     &ett_gsm_map_LongSignalInfo,
3354     &ett_gsm_map_RadioResourceInformation,
3355     &ett_gsm_map_MSNetworkCapability,
3356     &ett_gsm_map_MSRadioAccessCapability,
3357     &ett_gsm_map_externalsignalinfo,
3358     &ett_gsm_map_cbs_data_coding,
3359     &ett_gsm_map_GlobalCellId,
3360     &ett_gsm_map_GeographicalInformation,
3361     &ett_gsm_map_apn_str,
3362     &ett_gsm_map_LocationNumber,
3363     &ett_gsm_map_ericsson_locationInformation,
3364     &ett_gsm_map_extension_data,
3365     &ett_gsm_map_tbcd_digits,
3366     &ett_gsm_map_ussd_string,
3367     &ett_gsm_map_ext2_qos_subscribed,
3368     &ett_gsm_map_ext3_qos_subscribed,
3369     &ett_gsm_map_e_utranCellGlobalIdentity,
3370     &ett_gsm_map_TA_id,
3371     &ett_gsm_map_GeodeticInformation,
3372 
3373 #include "packet-gsm_map-ettarr.c"
3374   };
3375 
3376   static ei_register_info ei[] = {
3377      { &ei_gsm_map_unknown_sequence3, { "gsm_map.unknown.sequence3", PI_UNDECODED, PI_ERROR, "Unknown or not implemented [3] sequence", EXPFILL }},
3378      { &ei_gsm_map_unknown_sequence, { "gsm_map.unknown.sequence", PI_UNDECODED, PI_ERROR, "Unknown or not implemented sequence", EXPFILL }},
3379      { &ei_gsm_map_unknown_parameter, { "gsm_map.unknown.parameter", PI_UNDECODED, PI_ERROR, "Unknown or not implemented parameter", EXPFILL }},
3380      { &ei_gsm_map_unknown_invokeData, { "gsm_map.unknown.invokeData", PI_MALFORMED, PI_WARN, "Unknown invokeData", EXPFILL }},
3381      { &ei_gsm_map_undecoded, { "gsm_map.undecoded", PI_UNDECODED, PI_WARN, "If you want this decoded send the packet to Wireshark-dev", EXPFILL }},
3382   };
3383 
3384   static const enum_val_t application_context_modes[] = {
3385     {"Use Application Context from the trace", "Use application context from the trace", APPLICATON_CONTEXT_FROM_TRACE},
3386     {"Treat as AC 1", "Treat as AC 1", 1},
3387     {"Treat as AC 2", "Treat as AC 2", 2},
3388     {"Treat as AC 3", "Treat as AC 3", 3},
3389     {NULL, NULL, -1}
3390   };
3391 
3392   static tap_param gsm_map_stat_params[] = {
3393     { PARAM_FILTER, "filter", "Filter", NULL, TRUE }
3394   };
3395 
3396   static stat_tap_table_ui gsm_map_stat_table = {
3397     REGISTER_STAT_GROUP_TELEPHONY_GSM,
3398     "MAP Operation",
3399     "gsm_map",
3400     "gsm_map,operation",
3401     gsm_map_stat_init,
3402     gsm_map_stat_packet,
3403     gsm_map_stat_reset,
3404     gsm_map_stat_free_table_item,
3405     NULL,
3406     sizeof(gsm_map_stat_fields)/sizeof(stat_tap_table_item), gsm_map_stat_fields,
3407     sizeof(gsm_map_stat_params)/sizeof(tap_param), gsm_map_stat_params,
3408     NULL,
3409     0
3410   };
3411 
3412   /* Register protocol */
3413   proto_gsm_map_ms = proto_gsm_map_dialogue = proto_gsm_map = proto_register_protocol(PNAME, PSNAME, PFNAME);
3414 
3415   map_handle = register_dissector("gsm_map", dissect_gsm_map, proto_gsm_map);
3416   register_dissector("gsm_map_sccp", dissect_gsm_map_sccp, proto_gsm_map);
3417 
3418   /* Register fields and subtrees */
3419   proto_register_field_array(proto_gsm_map, hf, array_length(hf));
3420   proto_register_subtree_array(ett, array_length(ett));
3421   expert_gsm_map = expert_register_protocol(proto_gsm_map);
3422   expert_register_field_array(expert_gsm_map, ei, array_length(ei));
3423 
3424   register_dissector_table("gsm_map.v3.arg.opcode", "GSM_MAP V3 Arg Opcodes", proto_gsm_map, FT_UINT8, BASE_DEC);
3425   register_dissector_table("gsm_map.v3.res.opcode", "GSM_MAP V3 Res Opcodes", proto_gsm_map, FT_UINT8, BASE_DEC);
3426 
3427   map_prop_arg_opcode_table = register_dissector_table("gsm_map.prop.arg.opcode", "GSM_MAP Proprietary Arg Opcodes", proto_gsm_map, FT_UINT8, BASE_DEC);
3428   map_prop_res_opcode_table = register_dissector_table("gsm_map.prop.res.opcode", "GSM_MAP Proprietary Res Opcodes", proto_gsm_map, FT_UINT8, BASE_DEC);
3429   map_prop_err_opcode_table = register_dissector_table("gsm_map.prop.err.opcode", "GSM_MAP Proprietary Err Opcodes", proto_gsm_map, FT_UINT8, BASE_DEC);
3430 
3431   gsm_map_tap = register_tap("gsm_map");
3432 
3433 #include "packet-gsm_map-dis-tab.c"
3434   oid_add_from_string("ericsson-gsm-Map-Ext","1.2.826.0.1249.58.1.0" );
3435   oid_add_from_string("accessTypeNotAllowed-id","1.3.12.2.1107.3.66.1.2");
3436   /*oid_add_from_string("map-ac networkLocUp(1) version3(3)","0.4.0.0.1.0.1.3" );
3437    *
3438    * Register our configuration options, particularly our ssn:s
3439    * Set default SSNs
3440    */
3441   range_convert_str(wmem_epan_scope(), &global_ssn_range, "6-9,145,148-150", MAX_SSN);
3442 
3443   gsm_map_module = prefs_register_protocol(proto_gsm_map, proto_reg_handoff_gsm_map);
3444 
3445   prefs_register_range_preference(gsm_map_module, "tcap.ssn", "TCAP SSNs",
3446                                   "TCAP Subsystem numbers used for GSM MAP",
3447                                   &global_ssn_range, MAX_SSN);
3448 
3449   prefs_register_enum_preference(gsm_map_module, "application.context.version",
3450                                   "Application context version",
3451                                   "How to treat Application context",
3452                                   &pref_application_context_version, application_context_modes, APPLICATON_CONTEXT_FROM_TRACE);
3453 
3454   prefs_register_bool_preference(gsm_map_module, "ericsson.proprietary.extensions",
3455                                   "Dissect Ericsson proprietary extensions",
3456                                   "When enabled, dissector will use the non 3GPP standard extensions from Ericsson (that can override the standard ones)",
3457                                   &pref_ericsson_proprietary_ext);
3458 
3459   register_stat_tap_table_ui(&gsm_map_stat_table);
3460 }
3461 
3462 /*
3463  * Editor modelines
3464  *
3465  * Local Variables:
3466  * c-basic-offset: 2
3467  * tab-width: 8
3468  * indent-tabs-mode: nil
3469  * End:
3470  *
3471  * ex: set shiftwidth=2 tabstop=8 expandtab:
3472  * :indentSize=2:tabSize=8:noTabs=true:
3473  */
3474