Add more PHY attributes to MAC frames.
[obnox/wireshark/wip.git] / asn1 / gsm_map / packet-gsm_map-template.c
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  * $Id$
21  *
22  * Wireshark - Network traffic analyzer
23  * By Gerald Combs <gerald@wireshark.org>
24  * Copyright 1998 Gerald Combs
25  *
26  * This program is free software; you can redistribute it and/or
27  * modify it under the terms of the GNU General Public License
28  * as published by the Free Software Foundation; either version 2
29  * of the License, or (at your option) any later version.
30  *
31  * This program is distributed in the hope that it will be useful,
32  * but WITHOUT ANY WARRANTY; without even the implied warranty of
33  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
34  * GNU General Public License for more details.
35  *
36  * You should have received a copy of the GNU General Public License
37  * along with this program; if not, write to the Free Software
38  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
39  * References GSM MAP:
40  * ETSI TS 129 002
41  * Updated to ETSI TS 129 002 V7.5.0 (3GPP TS 29.002 V7.5.0 (2006-09) Release 7)
42  * Updated to ETSI TS 129 002 V8.4.0 (3GPP TS 29.002 V8.1.0 (2007-06) Release 8)
43  * References GSM SS
44  * References: 3GPP TS 24.080
45  */
46
47 #ifdef HAVE_CONFIG_H
48 # include "config.h"
49 #endif
50
51 #include <glib.h>
52 #include <epan/packet.h>
53 #include <epan/prefs.h>
54 #include <epan/tap.h>
55 #include <epan/emem.h>
56 #include <epan/oids.h>
57 #include <epan/expert.h>
58
59 #include <string.h>
60
61 #include <epan/asn1.h>
62 #include "packet-ber.h"
63 #include "packet-per.h"
64 #include "packet-q931.h"
65 #include "packet-gsm_map.h"
66 #include "packet-gsm_a_common.h"
67 #include "packet-tcap.h"
68 #include "packet-e164.h"
69 #include "packet-e212.h"
70 #include "packet-smpp.h"
71 #include "packet-gsm_sms.h"
72 #include "packet-ranap.h"
73
74 #define PNAME  "GSM Mobile Application"
75 #define PSNAME "GSM_MAP"
76 #define PFNAME "gsm_map"
77
78 /* Initialize the protocol and registered fields */
79 static int proto_gsm_map = -1;
80 static int proto_gsm_map_dialogue = -1;
81
82 static int hf_gsm_map_old_Component_PDU = -1;
83 static int hf_gsm_map_getPassword = -1;
84 static int hf_gsm_map_currentPassword = -1;
85 static int hf_gsm_map_extension = -1;
86 static int hf_gsm_map_nature_of_number = -1;
87 static int hf_gsm_map_number_plan = -1;
88 static int hf_gsm_map_isdn_address_digits = -1;
89 static int hf_gsm_map_address_digits = -1;
90 static int hf_gsm_map_servicecentreaddress_digits = -1;
91 static int hf_gsm_map_imsi_digits = -1;
92 static int hf_gsm_map_TBCD_digits = -1;
93 static int hf_gsm_map_Ss_Status_unused = -1;
94 static int hf_gsm_map_Ss_Status_q_bit = -1;
95 static int hf_gsm_map_Ss_Status_p_bit = -1;
96 static int hf_gsm_map_Ss_Status_r_bit = -1;
97 static int hf_gsm_map_Ss_Status_a_bit = -1;
98 static int hf_gsm_map_notification_to_forwarding_party = -1;
99 static int hf_gsm_map_redirecting_presentation = -1;
100 static int hf_gsm_map_notification_to_calling_party = -1;
101 static int hf_gsm_map_forwarding_reason = -1;
102 static int hf_gsm_map_pdp_type_org = -1;
103 static int hf_gsm_map_etsi_pdp_type_number = -1;
104 static int hf_gsm_map_ietf_pdp_type_number = -1;
105 static int hf_gsm_map_ext_qos_subscribed_pri = -1;
106
107 static int hf_gsm_map_qos_traffic_cls = -1;
108 static int hf_gsm_map_qos_del_order = -1;
109 static int hf_gsm_map_qos_del_of_err_sdu = -1;
110 static int hf_gsm_map_qos_ber = -1;
111 static int hf_gsm_map_qos_sdu_err_rat = -1;
112 static int hf_gsm_map_qos_traff_hdl_pri = -1;
113 static int hf_gsm_map_qos_max_sdu = -1;
114 static int hf_gsm_map_max_brate_ulink = -1;
115 static int hf_gsm_map_max_brate_dlink = -1;
116 static int hf_gsm_map_qos_transfer_delay = -1;
117 static int hf_gsm_map_guaranteed_max_brate_ulink = -1;
118 static int hf_gsm_map_guaranteed_max_brate_dlink = -1;
119 static int hf_gsm_map_GSNAddress_IPv4 = -1;
120 static int hf_gsm_map_GSNAddress_IPv6 = -1;
121 static int hf_gsm_map_ranap_service_Handover = -1;
122 static int hf_gsm_map_IntegrityProtectionInformation = -1;
123 static int hf_gsm_map_EncryptionInformation = -1;
124 static int hf_gsm_map_PlmnContainer_PDU = -1;
125 static int hf_gsm_map_ss_SS_UserData = -1;
126 static int hf_gsm_map_cbs_coding_grp = -1;
127 static int hf_gsm_map_cbs_coding_grp0_lang = -1;
128 static int hf_gsm_map_cbs_coding_grp1_lang = -1;
129 static int hf_gsm_map_cbs_coding_grp2_lang = -1;
130 static int hf_gsm_map_cbs_coding_grp3_lang = -1;
131 static int hf_gsm_map_cbs_coding_grp4_7_comp = -1;
132 static int hf_gsm_map_cbs_coding_grp4_7_class_ind = -1;
133 static int hf_gsm_map_cbs_coding_grp4_7_char_set = -1;
134 static int hf_gsm_map_cbs_coding_grp4_7_class = -1;
135 static int hf_gsm_map_cbs_coding_grp15_mess_code = -1;
136 static int hf_gsm_map_cbs_coding_grp15_class = -1;
137 static int hf_gsm_map_tmsi = -1;
138 static int hf_gsm_map_ie_tag = -1;
139 static int hf_gsm_map_len = -1;
140 static int hf_gsm_map_disc_par = -1;
141 static int hf_gsm_map_dlci = -1;
142
143 #include "packet-gsm_map-hf.c"
144
145 /* Initialize the subtree pointers */
146 static gint ett_gsm_map = -1;
147 static gint ett_gsm_map_InvokeId = -1;
148 static gint ett_gsm_map_InvokePDU = -1;
149 static gint ett_gsm_map_ReturnResultPDU = -1;
150 static gint ett_gsm_map_ReturnErrorPDU = -1;
151 static gint ett_gsm_map_ReturnResult_result = -1;
152 static gint ett_gsm_map_ReturnError_result = -1;
153 static gint ett_gsm_map_GSMMAPPDU = -1;
154 static gint ett_gsm_map_ext_qos_subscribed = -1;
155 static gint ett_gsm_map_pdptypenumber = -1;
156 static gint ett_gsm_map_RAIdentity = -1;
157 static gint ett_gsm_map_LAIFixedLength = -1;
158 static gint ett_gsm_map_isdn_address_string = -1;
159 static gint ett_gsm_map_geo_desc = -1;
160 static gint ett_gsm_map_LongSignalInfo = -1;
161 static gint ett_gsm_map_RadioResourceInformation =-1;
162 static gint ett_gsm_map_MSNetworkCapability =-1;
163 static gint ett_gsm_map_MSRadioAccessCapability = -1;
164 static gint ett_gsm_map_externalsignalinfo = -1;
165 static gint ett_gsm_map_cbs_data_coding = -1;
166 static gint ett_gsm_map_GlobalCellId = -1;
167 static gint ett_gsm_map_GeographicalInformation = -1;
168
169 #include "packet-gsm_map-ett.c"
170
171 static dissector_table_t        sms_dissector_table;    /* SMS TPDU */
172 static dissector_handle_t       data_handle;
173 static dissector_handle_t       ranap_handle;
174 static dissector_handle_t       dtap_handle;
175 static dissector_handle_t       map_handle;
176
177 /* Preferenc settings default */
178 #define MAX_SSN 254
179 static range_t *global_ssn_range;
180
181 /* Global variables */
182 static guint32 opcode=0;
183 static guint32 errorCode;
184 static proto_tree *top_tree;
185 static int application_context_version;
186 static guint ProtocolId;
187 static guint AccessNetworkProtocolId;
188 static const char *obj_id = NULL;
189 static int gsm_map_tap = -1;
190
191 #define SMS_ENCODING_NOT_SET    0
192 #define SMS_ENCODING_7BIT               1
193 #define SMS_ENCODING_8BIT               2
194 #define SMS_ENCODING_UCS2               3
195 #define SMS_ENCODING_7BIT_LANG  4
196 #define SMS_ENCODING_UCS2_LANG  5
197
198 static guint8 sms_encoding;
199
200 /* Forward declarations */
201 static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx);
202 static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx);
203 static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx);
204 const gchar* gsm_map_opr_code(guint32 val);
205
206 /* Value strings */
207
208 const value_string gsm_map_PDP_Type_Organisation_vals[] = {
209   {  0, "ETSI" },
210   {  1, "IETF" },
211   { 0, NULL }
212 };
213
214 const value_string gsm_map_ietf_defined_pdp_vals[] = {
215   {  0x21, "IPv4 Address" },
216   {  0x57, "IPv6 Address" },
217   { 0, NULL }
218 };
219
220 const value_string gsm_map_etsi_defined_pdp_vals[] = {
221   {  1, "PPP" },
222   { 0, NULL }
223 };
224
225 static const value_string gsm_map_tag_vals[] = {
226   {  0x4, "Bearer Capability" },
227   { 0, NULL }
228 };
229
230 static const value_string gsm_map_disc_par_vals[] = {
231   {  0, "Not Transparent" },
232   {  1, "Transparent" },
233   { 0, NULL }
234 };
235
236 const char *
237 unpack_digits(tvbuff_t *tvb, int offset) {
238
239         int length;
240         guint8 octet;
241         int i=0;
242         char *digit_str;
243
244         length = tvb_length(tvb);
245         if (length < offset)
246                 return "";
247         digit_str = (char *)ep_alloc((length - offset)*2+1);
248
249         while ( offset < length ){
250
251                 octet = tvb_get_guint8(tvb,offset);
252                 digit_str[i] = ((octet & 0x0f) + '0');
253                 i++;
254
255                 /*
256                  * unpack second value in byte
257                  */
258                 octet = octet >> 4;
259
260                 if (octet == 0x0f)      /* odd number bytes - hit filler */
261                         break;
262
263                 digit_str[i] = ((octet & 0x0f) + '0');
264                 i++;
265                 offset++;
266
267         }
268         digit_str[i]= '\0';
269         return digit_str;
270 }
271
272 /* returns value in kb/s */
273 static guint
274 gsm_map_calc_bitrate(guint8 value){
275
276         guint8 granularity;
277         guint returnvalue;
278
279         if (value == 0xff)
280                 return 0;
281
282         granularity = value >> 6;
283         returnvalue = value & 0x7f;
284         switch (granularity){
285         case 0:
286                 break;
287         case 1:
288                 returnvalue = ((returnvalue - 0x40) << 3)+64;
289                 break;
290         case 2:
291                 returnvalue = (returnvalue << 6)+576;
292                 break;
293         case 3:
294                 returnvalue = (returnvalue << 6)+576;
295                 break;
296         }
297         return returnvalue;
298
299 }
300
301 static void
302 dissect_gsm_map_ext_qos_subscribed(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx){
303         int offset = 0;
304     proto_tree *subtree;
305         guint8 octet;
306         guint16 value;
307
308         subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_ext_qos_subscribed);
309         /*  OCTET 1:
310                 Allocation/Retention Priority (This octet encodes each priority level defined in
311                 23.107 as the binary value of the priority level, declaration in 29.060)
312                 Octets 2-9 are coded according to 3GPP TS 24.008[35] Quality of Service Octets
313                 6-13.
314          */
315         /* Allocation/Retention Priority */
316         proto_tree_add_item(subtree, hf_gsm_map_ext_qos_subscribed_pri, tvb, offset, 1, FALSE);
317         offset++;
318
319         /* Quality of Service Octets 6-13.( Octet 2 - 9 Here) */
320
321         /* Traffic class, octet 6 (see 3GPP TS 23.107) Bits 8 7 6 */
322         proto_tree_add_item(subtree, hf_gsm_map_qos_traffic_cls, tvb, offset, 1, FALSE);
323         /* Delivery order, octet 6 (see 3GPP TS 23.107) Bits 5 4 */
324         proto_tree_add_item(subtree, hf_gsm_map_qos_del_order, tvb, offset, 1, FALSE);
325         /* Delivery of erroneous SDUs, octet 6 (see 3GPP TS 23.107) Bits 3 2 1 */
326         proto_tree_add_item(subtree, hf_gsm_map_qos_del_of_err_sdu, tvb, offset, 1, FALSE);
327         offset++;
328
329         /* Maximum SDU size, octet 7 (see 3GPP TS 23.107) */
330         octet = tvb_get_guint8(tvb,offset);
331         switch (octet){
332         case 0:
333                 proto_tree_add_text(subtree, tvb, offset, 1, "Subscribed Maximum SDU size/Reserved");
334                 break;
335         case 0x93:
336                 value = 1502;
337                 proto_tree_add_uint(subtree, hf_gsm_map_qos_max_sdu, tvb, offset, 1, value);
338                 break;
339         case 0x98:
340                 value = 1510;
341                 proto_tree_add_uint(subtree, hf_gsm_map_qos_max_sdu, tvb, offset, 1, value);
342                 break;
343         case 0x99:
344                 value = 1532;
345                 proto_tree_add_uint(subtree, hf_gsm_map_qos_max_sdu, tvb, offset, 1, value);
346                 break;
347         default:
348                 if (octet<0x97){
349                         value = octet * 10;
350                         proto_tree_add_uint(subtree, hf_gsm_map_qos_max_sdu, tvb, offset, 1, value);
351                 }else{
352                         proto_tree_add_text(subtree, tvb, offset, 1, "Maximum SDU size value 0x%x not defined in TS 24.008",octet);
353                 }
354         }
355         offset++;
356
357         /* Maximum bit rate for uplink, octet 8 */
358         octet = tvb_get_guint8(tvb,offset);
359         if (octet == 0 ){
360                 proto_tree_add_text(subtree, tvb, offset, 1, "Subscribed Maximum bit rate for uplink/Reserved"  );
361         }else{
362                 proto_tree_add_uint(subtree, hf_gsm_map_max_brate_ulink, tvb, offset, 1, gsm_map_calc_bitrate(octet));
363         }
364         offset++;
365         /* Maximum bit rate for downlink, octet 9 (see 3GPP TS 23.107) */
366         octet = tvb_get_guint8(tvb,offset);
367         if (octet == 0 ){
368                 proto_tree_add_text(subtree, tvb, offset, 1, "Subscribed Maximum bit rate for downlink/Reserved"  );
369         }else{
370                 proto_tree_add_uint(subtree, hf_gsm_map_max_brate_dlink, tvb, offset, 1, gsm_map_calc_bitrate(octet));
371         }
372         offset++;
373         /* Residual Bit Error Rate (BER), octet 10 (see 3GPP TS 23.107) Bits 8 7 6 5 */
374         proto_tree_add_item(subtree, hf_gsm_map_qos_ber, tvb, offset, 1, FALSE);
375         /* SDU error ratio, octet 10 (see 3GPP TS 23.107) */
376         proto_tree_add_item(subtree, hf_gsm_map_qos_sdu_err_rat, tvb, offset, 1, FALSE);
377         offset++;
378
379         /* Transfer delay, octet 11 (See 3GPP TS 23.107) Bits 8 7 6 5 4 3 */
380         proto_tree_add_item(subtree, hf_gsm_map_qos_transfer_delay, tvb, offset, 1, FALSE);
381         /* Traffic handling priority, octet 11 (see 3GPP TS 23.107) Bits 2 1 */
382         proto_tree_add_item(subtree, hf_gsm_map_qos_traff_hdl_pri, tvb, offset, 1, FALSE);
383         offset++;
384
385         /*      Guaranteed bit rate for uplink, octet 12 (See 3GPP TS 23.107)
386                 Coding is identical to that of Maximum bit rate for uplink.
387          */
388         octet = tvb_get_guint8(tvb,offset);
389         if (octet == 0 ){
390                 proto_tree_add_text(subtree, tvb, offset, 1, "Subscribed Guaranteed bit rate for uplink/Reserved"  );
391         }else{
392                 proto_tree_add_uint(subtree, hf_gsm_map_guaranteed_max_brate_ulink, tvb, offset, 1, gsm_map_calc_bitrate(octet));
393         }
394         offset++;
395
396         /*      Guaranteed bit rate for downlink, octet 13(See 3GPP TS 23.107)
397                 Coding is identical to that of Maximum bit rate for uplink.
398          */
399         octet = tvb_get_guint8(tvb,offset);
400         if (octet == 0 ){
401                 proto_tree_add_text(subtree, tvb, offset, 1, "Subscribed Guaranteed bit rate for downlink/Reserved"  );
402         }else{
403                 proto_tree_add_uint(subtree, hf_gsm_map_guaranteed_max_brate_dlink, tvb, offset, 1, gsm_map_calc_bitrate(octet));
404         }
405
406 }
407
408 #define  ELLIPSOID_POINT 0
409 #define  ELLIPSOID_POINT_WITH_UNCERT_CIRC 1
410 #define  ELLIPSOID_POINT_WITH_UNCERT_ELLIPSE 3
411 #define  POLYGON 5
412 #define  ELLIPSOID_POINT_WITH_ALT 8
413 #define  ELLIPSOID_POINT_WITH_ALT_AND_UNCERT_ELLIPSOID 9
414 #define  ELLIPSOID_ARC 10
415 /*
416 4 3 2 1
417 0 0 0 0 Ellipsoid Point
418 0 0 0 1 Ellipsoid point with uncertainty Circle
419 0 0 1 1 Ellipsoid point with uncertainty Ellipse
420 0 1 0 1 Polygon
421 1 0 0 0 Ellipsoid point with altitude
422 1 0 0 1 Ellipsoid point with altitude and uncertainty Ellipsoid
423 1 0 1 0 Ellipsoid Arc
424 other values reserved for future use
425 */
426
427 /* TS 23 032 Table 2a: Coding of Type of Shape */
428 static const value_string type_of_shape_vals[] = {
429         { ELLIPSOID_POINT,              "Ellipsoid Point"},
430         { ELLIPSOID_POINT_WITH_UNCERT_CIRC,             "Ellipsoid point with uncertainty Circle"},
431         { ELLIPSOID_POINT_WITH_UNCERT_ELLIPSE,          "Ellipsoid point with uncertainty Ellipse"},
432         { POLYGON,              "Polygon"},
433         { ELLIPSOID_POINT_WITH_ALT,             "Ellipsoid point with altitude"},
434         { ELLIPSOID_POINT_WITH_ALT_AND_UNCERT_ELLIPSOID,                "Ellipsoid point with altitude and uncertainty Ellipsoid"},
435         { ELLIPSOID_ARC,                "Ellipsoid Arc"},
436         { 0,    NULL }
437 };
438
439 /* 3GPP TS 23.032 7.3.1 */
440 static const value_string sign_of_latitude_vals[] = {
441         { 0,            "North"},
442         { 1,            "South"},
443         { 0,    NULL }
444 };
445
446 static const value_string dir_of_alt_vals[] = {
447         { 0,            "Altitude expresses height"},
448         { 1,            "Altitude expresses depth"},
449         { 0,    NULL }
450 };
451
452 static const value_string gsm_map_cbs_data_coding_scheme_coding_grp_vals[] = {
453         { 0, "Coding Group 0(Language using the GSM 7 bit default alphabet)" },
454         { 1, "Coding Group 1" },
455         { 2, "Coding Group 2" },
456         { 3, "Coding Group 3" },
457         { 4, "General Data Coding indication" },
458         { 5, "General Data Coding indication" },
459         { 6, "General Data Coding indication" },
460         { 7, "General Data Coding indication" },
461         { 8, "Reserved" },
462         { 9, "Message with User Data Header (UDH) structure" },
463         { 10,"Reserved" },
464         { 11,"Reserved" },
465         { 12,"Reserved" },
466         { 13,"Reserved" },
467         { 14,"Defined by the WAP Forum" },
468         { 15,"Data coding / message handling" },
469         { 0, NULL}
470 };
471 /* Coding group 0
472  * Bits 3..0 indicate the language:
473  */
474 static const value_string gsm_map_cbs_coding_grp0_lang_vals[] = {
475         { 0, "German"},
476         { 1, "English"},
477         { 2, "Italian"},
478         { 3, "French"},
479         { 4, "Spanish"},
480         { 5, "Dutch"},
481         { 6, "Swedish"},
482         { 7, "Danish"},
483         { 8, "Portuguese"},
484         { 9, "Finnish"},
485         { 10, "Norwegian"},
486         { 11, "Greek"},
487         { 12, "Turkish"},
488         { 13, "Hungarian"},
489         { 14, "Polish"},
490         { 15, "Language unspecified"},
491         { 0,    NULL }
492 };
493
494 static const value_string gsm_map_cbs_coding_grp1_lang_vals[] = {
495         { 0, "GSM 7 bit default alphabet; message preceded by language indication"},
496         { 1, "UCS2; message preceded by language indication"},
497         { 2, "Reserved"},
498         { 3, "Reserved"},
499         { 4, "Reserved"},
500         { 5, "Reserved"},
501         { 6, "Reserved"},
502         { 7, "Reserved"},
503         { 8, "Reserved"},
504         { 9, "Reserved"},
505         { 10, "Reserved"},
506         { 11, "Reserved"},
507         { 12, "Reserved"},
508         { 13, "Reserved"},
509         { 14, "Reserved"},
510         { 15, "Reserved"},
511         { 0,    NULL }
512 };
513 static const value_string gsm_map_cbs_coding_grp2_lang_vals[] = {
514         { 0, "Czech"},
515         { 1, "Hebrew"},
516         { 2, "Arabic"},
517         { 3, "Russian"},
518         { 4, "Icelandic"},
519         { 5, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
520         { 6, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
521         { 7, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
522         { 8, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
523         { 9, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
524         { 10, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
525         { 11, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
526         { 12, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
527         { 13, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
528         { 14, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
529         { 15, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
530         { 0,    NULL }
531 };
532 static const value_string gsm_map_cbs_coding_grp3_lang_vals[] = {
533         { 0, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
534         { 1, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
535         { 2, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
536         { 3, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
537         { 4, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
538         { 5, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
539         { 6, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
540         { 7, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
541         { 8, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
542         { 9, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
543         { 10, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
544         { 11, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
545         { 12, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
546         { 13, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
547         { 14, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
548         { 15, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
549         { 0,    NULL }
550 };
551
552 static const true_false_string gsm_map_cbs_coding_grp4_7_comp_vals = {
553   "The text is compressed using the compression algorithm defined in 3GPP TS 23.042",
554   "The text is uncompressed"
555 };
556
557 static const true_false_string gsm_map_cbs_coding_grp4_7_class_ind_vals = {
558   "Bits 1 to 0 have a message class meaning",
559   "Bits 1 to 0 are reserved and have no message class meaning"
560 };
561
562 /* Bits 3 and 2 indicate the character set being used, as follows: */
563
564 static const value_string gsm_map_cbs_coding_grp4_7_char_set_vals[] = {
565         { 0, "GSM 7 bit default alphabet"},
566         { 1, "8 bit data"},
567         { 2, "UCS2 (16 bit)"},
568         { 3, "Reserved"},
569         { 0,    NULL }
570 };
571
572 static const value_string gsm_map_cbs_coding_grp4_7_class_vals[] = {
573         { 0, "Class 0"},
574         { 1, "Class 1 Default meaning: ME-specific"},
575         { 2, "Class 2 (U)SIM specific message"},
576         { 3, "Class 3 Default meaning: TE-specific (see 3GPP TS 27.005"},
577         { 0,    NULL }
578 };
579
580 static const value_string gsm_map_cbs_coding_grp15_mess_code_vals[] = {
581         { 0, "GSM 7 bit default alphabet"},
582         { 1, "8 bit data"},
583         { 0,    NULL }
584 };
585
586 static const value_string gsm_map_cbs_coding_grp15_class_vals[] = {
587         { 0, "GSM 7 bit default alphabet"},
588         { 1, "8 bit data"},
589         { 0,    NULL }
590 };
591
592
593 /* 3GPP TS 23.038 version 7.0.0 Release 7 */
594 guint8
595 dissect_cbs_data_coding_scheme(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
596 {
597         guint8 octet;
598         guint8 coding_grp;
599         guint8 character_set;
600
601         octet = tvb_get_guint8(tvb,0);
602         coding_grp = octet >>4;
603         proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp, tvb, 0, 1, FALSE);
604
605         sms_encoding = SMS_ENCODING_NOT_SET;
606         switch (coding_grp){
607         case 0:
608                 proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp0_lang, tvb, 0, 1, FALSE);
609                 sms_encoding = SMS_ENCODING_7BIT;
610                 break;
611         case 1:
612                 proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp1_lang, tvb, 0, 1, FALSE);
613                 if ((octet & 0x0f)== 0){
614                         sms_encoding = SMS_ENCODING_7BIT_LANG;
615                 }else{
616                         sms_encoding = SMS_ENCODING_UCS2_LANG;
617                 }
618                 break;
619         case 2:
620                 proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp2_lang, tvb, 0, 1, FALSE);
621                 sms_encoding = SMS_ENCODING_7BIT;
622                 break;
623         case 3:
624                 proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp3_lang, tvb, 0, 1, FALSE);
625                 sms_encoding = SMS_ENCODING_7BIT;
626                 break;
627                 /* Coding_grp 01xx */
628         case 4:
629         case 5:
630         case 6:
631         case 7:
632                 proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_comp, tvb, 0, 1, FALSE);
633                 proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_class_ind, tvb, 0, 1, FALSE);
634                 proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_char_set, tvb, 0, 1, FALSE);
635                 if ((octet & 0x10)== 0x10){
636                         proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_class, tvb, 0, 1, FALSE);
637                 }
638                 /* Bits 3 and 2 indicate the character set being used, */
639                 character_set = (octet&0x0c)>>2;
640                 switch (character_set){
641                 case 0:
642                         /* GSM 7 bit default alphabet */
643                         sms_encoding = SMS_ENCODING_7BIT;
644                         break;
645                 case 1:
646                         /* 8 bit data */
647                         sms_encoding = SMS_ENCODING_8BIT;
648                         break;
649                 case 2:
650                         /* UCS2 (16 bit) */
651                         sms_encoding = SMS_ENCODING_UCS2;
652                         break;
653                 case 3:
654                         /* Reserved */
655                         sms_encoding = SMS_ENCODING_NOT_SET;
656                         break;
657                 default:
658                         break;
659                 }
660                 break;
661         case 8:
662                 /* Reserved coding groups */
663                 break;
664         case 9:
665                 /* Message with User Data Header (UDH) structure:*/
666                 proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_char_set, tvb, 0, 1, FALSE);
667                 proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_class, tvb, 0, 1, FALSE);
668                 character_set = (octet&0x0c)>>2;
669                 switch (character_set){
670                 case 0:
671                         /* GSM 7 bit default alphabet */
672                         sms_encoding = SMS_ENCODING_7BIT;
673                         break;
674                 case 1:
675                         /* 8 bit data */
676                         sms_encoding = SMS_ENCODING_8BIT;
677                         break;
678                 case 2:
679                         /* UCS2 (16 bit) */
680                         sms_encoding = SMS_ENCODING_UCS2;
681                         break;
682                 case 3:
683                         /* Reserved */
684                         sms_encoding = SMS_ENCODING_NOT_SET;
685                         break;
686                 default:
687                         break;
688                 }
689                 break;
690         case 10:
691         case 11:
692         case 12:
693         case 13:
694                 /* 1010..1101 Reserved coding groups */
695                 break;
696         case 14:
697                 /* Defined by the WAP Forum
698                  * "Wireless Datagram Protocol Specification", Wireless Application Protocol Forum Ltd.
699                  */
700                 break;
701         case 15:
702                 /* Data coding / message handling */
703                 proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp15_mess_code, tvb, 0, 1, FALSE);
704                 proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp15_class, tvb, 0, 1, FALSE);
705                 character_set = (octet&0x04)>>2;
706                 if (character_set == 0){
707                         sms_encoding = SMS_ENCODING_7BIT;
708                 }else{
709                         sms_encoding = SMS_ENCODING_8BIT;
710                 }
711                 break;
712         default:
713                 break;
714         }
715
716         return sms_encoding;
717 }
718 void
719 dissect_gsm_map_msisdn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
720 {
721  const char     *digit_str;
722  guint8         octet;
723  guint8         na;
724  guint8         np;
725
726  proto_tree_add_item(tree, hf_gsm_map_extension, tvb, 0,1,FALSE);
727  proto_tree_add_item(tree, hf_gsm_map_nature_of_number, tvb, 0,1,FALSE);
728  proto_tree_add_item(tree, hf_gsm_map_number_plan, tvb, 0,1,FALSE);
729
730  digit_str = unpack_digits(tvb, 1);
731
732  proto_tree_add_string(tree, hf_gsm_map_address_digits, tvb, 1, -1, digit_str);
733
734  octet = tvb_get_guint8(tvb,0);
735  na = (octet & 0x70)>>4;
736  np = octet & 0x0f;
737  if ((na == 1) && (np==1))/*International Number & E164*/
738         dissect_e164_cc(tvb, tree, 1, TRUE);
739  else if(np==6)
740         dissect_e212_mcc_mnc_in_address(tvb, pinfo, tree, 1);
741
742 }
743
744 #include "packet-gsm_map-fn.c"
745
746 /* Specific translation for MAP V3 */
747 const value_string gsm_map_V1V2_opr_code_strings[] = {
748   {  44, "forwardSM" },
749   {  45, "sendRoutingInfoForSM" },
750   {  46, "forwardSM" },
751   { 0, NULL }
752 };
753 /* Generic translation for MAP operation */
754 const value_string gsm_map_opr_code_strings[] = {
755 #include "packet-gsm_map-table.c"
756   { 0, NULL }
757 };
758 static const value_string gsm_map_err_code_string_vals[] = {
759 #include "packet-gsm_map-table.c"
760     { 0, NULL }
761 };
762 static const true_false_string gsm_map_extension_value = {
763   "No Extension",
764   "Extension"
765 };
766 static const value_string gsm_map_nature_of_number_values[] = {
767         {   0x00,       "unknown" },
768         {   0x01,       "International Number" },
769         {   0x02,       "National Significant Number" },
770         {   0x03,       "Network Specific Number" },
771         {   0x04,       "Subscriber Number" },
772         {   0x05,       "Reserved" },
773         {   0x06,       "Abbreviated Number" },
774         {   0x07,       "Reserved for extension" },
775         { 0, NULL }
776 };
777 static const value_string gsm_map_number_plan_values[] = {
778         {   0x00,       "unknown" },
779         {   0x01,       "ISDN/Telephony Numbering (Rec ITU-T E.164)" },
780         {   0x02,       "spare" },
781         {   0x03,       "Data Numbering (ITU-T Rec. X.121)" },
782         {   0x04,       "Telex Numbering (ITU-T Rec. F.69)" },
783         {   0x05,       "spare" },
784         {   0x06,       "Land Mobile Numbering (ITU-T Rec. E.212)" },
785         {   0x07,       "spare" },
786         {   0x08,       "National Numbering" },
787         {   0x09,       "Private Numbering" },
788         {   0x0f,       "Reserved for extension" },
789         { 0, NULL }
790 };
791
792 static const true_false_string gsm_map_Ss_Status_q_bit_values = {
793   "Quiescent",
794   "Operative"
795 };
796 static const true_false_string gsm_map_Ss_Status_p_values = {
797   "Provisioned",
798   "Not Provisioned"
799 };
800 static const true_false_string gsm_map_Ss_Status_r_values = {
801   "Registered",
802   "Not Registered"
803 };
804 static const true_false_string gsm_map_Ss_Status_a_values = {
805   "Active",
806   "not Active"
807 };
808
809 /*
810  * Translate the MAP operation code value to a text string
811  * Take into account the MAP version for ForwardSM
812  */
813 const gchar* gsm_map_opr_code(guint32 val) {
814   switch (val) {
815   case 44: /*mt-forwardSM*/
816   case 46: /*mo-forwardSM*/
817     if (application_context_version < 3) {
818       return val_to_str(val, gsm_map_V1V2_opr_code_strings, "Unknown GSM-MAP (%u)");
819     }
820     /* Else use the default map operation translation */
821   default:
822     return val_to_str(val, gsm_old_GSMMAPOperationLocalvalue_vals, "Unknown GSM-MAP opcode (%u)");
823     break;
824   }
825 }
826
827 /* Prototype for a decoding function */
828 typedef int (* dissect_function_t)( gboolean,
829                                     tvbuff_t *,
830                                     int ,
831                                         asn1_ctx_t *,
832                                     proto_tree *,
833                                     int);
834
835 /*
836  * Dissect Multiple Choice Message
837  * This function is used to decode a message, when several encoding may be used.
838  * For exemple, in the last MAP version, the Cancel Location is defined like this:
839  * CancelLocationArg ::= [3] IMPLICIT SEQUENCE
840  * But in the previous MAP version, it was a CHOICE between a SEQUENCE and an IMSI
841  * As ASN1 encoders (or software) still uses the old encoding, this function allows
842  * the decoding of both versions.
843  * Moreover, some optimizations (or bad practice ?) in ASN1 encoder, removes the
844  * SEQUENCE tag, when only one parameter is present in the SEQUENCE.
845  * This explain why the function expects 3 parameters:
846  * - a [3] SEQUENCE corresponding the recent ASN1 MAP encoding
847  * - a SEQUENCE for old style
848  * - and a single parameter, for old version or optimizations
849  *
850  * The analyze of the first ASN1 tag, indicate what kind of decoding should be used,
851  * if the decoding function is provided (so not a NULL function)
852  */
853 static int dissect_mc_message(tvbuff_t *tvb,
854                               int offset,
855                                   asn1_ctx_t *actx,
856                               proto_tree *tree,
857                               gboolean implicit_param _U_, dissect_function_t parameter, int hf_index_param _U_,
858                               gboolean implicit_seq   _U_, dissect_function_t sequence,  int hf_index_seq   _U_,
859                               gboolean implicit_seq3 _U_, dissect_function_t sequence3, int hf_index_seq3 _U_ )
860 {
861   guint8 octet;
862   gint8 bug_class;
863   gboolean bug_pc, bug_ind_field;
864   gint32 bug_tag;
865   guint32 bug_len;
866   proto_item *cause;
867
868   octet = tvb_get_guint8(tvb,0);
869   if ( (octet & 0xf) == 3) {
870     /* XXX  asn2wrs can not yet handle tagged assignment yes so this
871      * XXX is some conformance file magic to work around that bug
872      */
873     offset = get_ber_identifier(tvb, offset, &bug_class, &bug_pc, &bug_tag);
874     offset = get_ber_length(tvb, offset, &bug_len, &bug_ind_field);
875     if (sequence3 != NULL) {
876       offset= (sequence3) (implicit_seq3, tvb, offset, actx, tree, hf_index_seq3);
877     } else {
878       cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown or not implemented [3] sequence, cannot decode");
879       proto_item_set_expert_flags(cause, PI_UNDECODED, PI_ERROR);
880       expert_add_info_format(actx->pinfo, cause, PI_UNDECODED, PI_ERROR, "Unknown or not implemented [3] sequence");
881     }
882   } else if (octet == 0x30) {
883     if (sequence != NULL) {
884       offset= (sequence) (implicit_seq, tvb, 0, actx, tree, hf_index_seq);
885     } else {
886       cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown or not implemented sequence");
887       proto_item_set_expert_flags(cause, PI_UNDECODED, PI_ERROR);
888       expert_add_info_format(actx->pinfo, cause, PI_UNDECODED, PI_ERROR, "Unknown or not implemented sequence");
889     }
890   } else {
891     if (parameter != NULL) {
892       offset= (parameter) (implicit_param, tvb, offset, actx, tree, hf_index_param);
893     } else {
894       cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown or not implemented parameter");
895       proto_item_set_expert_flags(cause, PI_UNDECODED, PI_ERROR);
896       expert_add_info_format(actx->pinfo, cause, PI_UNDECODED, PI_ERROR, "Unknown or not implemented parameter");
897     }
898   }
899   return offset;
900 }
901
902 static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx) {
903
904   proto_item *cause;
905
906   switch(opcode){
907   case  2: /*updateLocation*/
908     offset=dissect_gsm_map_ms_UpdateLocationArg(FALSE, tvb, offset, actx, tree, -1);
909     break;
910   case  3: /*cancelLocation*/
911     offset=dissect_mc_message(tvb, offset, actx, tree,
912                               FALSE, dissect_gsm_map_Identity, hf_gsm_map_ms_identity,
913                               FALSE, dissect_gsm_map_Identity, hf_gsm_map_ms_identity,
914                               TRUE , dissect_gsm_map_ms_CancelLocationArg, -1);/*undefined*/
915     break;
916   case  4: /*provideRoamingNumber*/
917     offset=dissect_gsm_map_ch_ProvideRoamingNumberArg(FALSE, tvb, offset, actx, tree, -1);
918     break;
919   case  5: /*noteSubscriberDataModified*/
920     offset=dissect_gsm_map_ms_NoteSubscriberDataModifiedArg(FALSE, tvb, offset, actx, tree, -1);
921     break;
922   case  6: /*resumeCallHandling*/
923     offset=dissect_gsm_map_ch_ResumeCallHandlingArg(FALSE, tvb, offset, actx, tree, -1);
924     break;
925   case  7: /*insertSubscriberData*/
926     offset=dissect_gsm_map_ms_InsertSubscriberDataArg(FALSE, tvb, offset, actx, tree, -1);
927     break;
928   case  8: /*deleteSubscriberData*/
929     offset=dissect_gsm_map_ms_DeleteSubscriberDataArg(FALSE, tvb, offset, actx, tree, -1);
930     break;
931     /* TODO find out why this isn't in the ASN1 file */
932     /* reserved sendParameters (9) */
933   case  10: /*registerSS*/
934     offset=dissect_gsm_map_ss_RegisterSS_Arg(FALSE, tvb, offset, actx, tree, -1);
935     break;
936   case  11: /*eraseSS*/
937     offset=dissect_gsm_map_ss_SS_ForBS_Code(FALSE, tvb, offset, actx, tree, -1);
938     break;
939   case 12: /*activateSS*/
940     offset=dissect_gsm_map_ss_SS_ForBS_Code(FALSE, tvb, offset, actx, tree, -1);
941     break;
942   case 13: /*deactivateSS*/
943     offset=dissect_gsm_map_ss_SS_ForBS_Code(FALSE, tvb, offset, actx, tree, -1);
944     break;
945   case 14: /*interrogateSS*/
946     offset=dissect_gsm_map_ss_SS_ForBS_Code(FALSE, tvb, offset, actx, tree, -1);
947     break;
948   case 15: /*authenticationFailureReport*/
949     offset=dissect_gsm_map_ms_AuthenticationFailureReportArg(FALSE, tvb, offset, actx, tree, -1);
950     break;
951   case 16: /*SS-protocol notifySS*/
952     offset=dissect_gsm_ss_NotifySS_Arg(FALSE, tvb, offset, actx, tree, -1);
953     break;
954   case 17: /*registerPassword*/
955     offset=dissect_gsm_map_SS_Code(FALSE, tvb, offset, actx, tree, hf_gsm_map_ss_Code);
956     break;
957   case 18: /*getPassword*/
958     offset=dissect_gsm_old_GetPasswordArg(FALSE, tvb, offset, actx, tree, hf_gsm_map_getPassword);
959     break;
960   case 19: /* SS-Protocol processUnstructuredSS-Data (19) */
961     offset=dissect_gsm_ss_SS_UserData(FALSE, tvb, offset, actx, tree, hf_gsm_map_ss_SS_UserData);
962     break;
963   case 20: /*releaseResources*/
964     offset=dissect_gsm_map_ch_ReleaseResourcesArg(FALSE, tvb, offset, actx, tree, -1);
965     break;
966   case 21: /*mt-ForwardSM-VGCS*/
967     offset=dissect_gsm_map_sm_MT_ForwardSM_VGCS_Arg(FALSE, tvb, offset, actx, tree, -1);
968     break;
969   case 22: /*sendRoutingInfo*/
970           if (application_context_version == 3){
971                   offset=dissect_gsm_map_ch_SendRoutingInfoArg(FALSE, tvb, offset, actx, tree, -1);
972           }else{
973                   offset=dissect_gsm_old_SendRoutingInfoArgV2(FALSE, tvb, offset, actx, tree, -1);
974           }
975     break;
976   case 23: /*updateGprsLocation*/
977     offset=dissect_gsm_map_ms_UpdateGprsLocationArg(FALSE, tvb, offset, actx, tree, -1);
978     break;
979   case 24: /*sendRoutingInfoForGprs*/
980     offset=dissect_gsm_map_ms_SendRoutingInfoForGprsArg(FALSE, tvb, offset, actx, tree, -1);
981     break;
982   case 25: /*failureReport*/
983     offset=dissect_gsm_map_ms_FailureReportArg(FALSE, tvb, offset, actx, tree, -1);
984     break;
985   case 26: /*noteMsPresentForGprs*/
986     offset=dissect_gsm_map_ms_NoteMsPresentForGprsArg(FALSE, tvb, offset, actx, tree, -1);
987     break;
988     /* undefined 27 */
989     /* reserved performHandover (28) */
990   case 29: /*sendEndSignal*/
991     offset=dissect_mc_message(tvb, offset, actx, tree,
992                               FALSE, NULL, -1,
993                               FALSE, dissect_gsm_old_Bss_APDU, -1,
994                               TRUE , dissect_gsm_map_ms_SendEndSignal_Arg, -1);
995     break;
996     /* reserved performSubsequentHandover (30) */
997   case 31: /*provideSIWFSNumber*/
998     offset=dissect_gsm_old_ProvideSIWFSNumberArg(FALSE, tvb, offset, actx, tree, -1);
999     break;
1000   case 32: /*sIWFSSignallingModify*/
1001     offset=dissect_gsm_old_SIWFSSignallingModifyArg(FALSE, tvb, offset, actx, tree, -1);
1002     break;
1003   case 33: /*processAccessSignalling*/
1004     offset=dissect_mc_message(tvb, offset, actx, tree,
1005                               FALSE, NULL, -1,
1006                               FALSE, dissect_gsm_old_Bss_APDU, -1,
1007                               TRUE , dissect_gsm_map_ms_ProcessAccessSignalling_Arg, -1);
1008     break;
1009   case 34: /*forwardAccessSignalling*/
1010     offset=dissect_mc_message(tvb, offset, actx, tree,
1011                               FALSE, NULL, -1,
1012                               FALSE, dissect_gsm_old_Bss_APDU, -1,
1013                               TRUE , dissect_gsm_map_ms_ForwardAccessSignalling_Arg, -1);
1014     break;
1015     /* reserved noteInternalHandover (35) */
1016     /* undefined 36 */
1017   case 37: /*reset*/
1018     offset=dissect_gsm_map_ms_ResetArg(FALSE, tvb, offset, actx, tree, -1);
1019     break;
1020   case 38: /*forwardCheckSS-Indication*/
1021     return offset;
1022     break;
1023   case 39: /*prepareGroupCall*/
1024     offset=dissect_gsm_map_gr_PrepareGroupCallArg(FALSE, tvb, offset, actx, tree, -1);
1025     break;
1026   case 40: /*sendGroupCallEndSignal*/
1027     offset = dissect_gsm_map_gr_SendGroupCallEndSignalArg(FALSE, tvb, offset, actx, tree, -1);
1028     break;
1029   case 41: /*processGroupCallSignalling*/
1030     offset = dissect_gsm_map_gr_ProcessGroupCallSignallingArg(FALSE, tvb, offset, actx, tree, -1);
1031     break;
1032   case 42: /*forwardGroupCallSignalling*/
1033     offset=dissect_gsm_map_gr_ForwardGroupCallSignallingArg(FALSE, tvb, offset, actx, tree, -1);
1034     break;
1035   case 43: /*checkIMEI*/
1036     offset=dissect_mc_message(tvb, offset, actx, tree,
1037                               FALSE, dissect_gsm_map_IMEI, hf_gsm_map_ms_imei,
1038                               FALSE, dissect_gsm_map_ms_CheckIMEI_Arg, -1,
1039                               TRUE , NULL, -1); /* no [3] SEQUENCE */
1040     break;
1041   case 44: /*mt-forwardSM(v3) or ForwardSM(v1/v2)*/
1042     if (application_context_version == 3)
1043       offset=dissect_gsm_map_sm_MT_ForwardSM_Arg(FALSE, tvb, offset, actx, tree, -1);
1044     else {
1045       offset=dissect_gsm_old_ForwardSM_Arg(FALSE, tvb, offset, actx, tree, -1);
1046     }
1047     break;
1048   case 45: /*sendRoutingInfoForSM*/
1049     offset=dissect_gsm_map_sm_RoutingInfoForSM_Arg(FALSE, tvb, offset, actx, tree, -1);
1050     break;
1051   case 46: /*mo-forwardSM(v3) or ForwardSM(v1/v2)*/
1052     if (application_context_version == 3)
1053       offset=dissect_gsm_map_sm_MO_ForwardSM_Arg(FALSE, tvb, offset, actx, tree, -1);
1054     else {
1055       offset=dissect_gsm_old_ForwardSM_Arg(FALSE, tvb, offset, actx, tree, -1);
1056     }
1057     break;
1058   case 47: /*reportSM-DeliveryStatus*/
1059     offset=dissect_gsm_map_sm_ReportSM_DeliveryStatusArg(FALSE, tvb, offset, actx, tree, -1);
1060     break;
1061     /* reserved noteSubscriberPresent (48) */
1062     /* reserved alertServiceCentreWithoutResult (49)
1063          * ETS 300 599: December 2000 (GSM 09.02 version 4.19.1)
1064          * -- alertServiceCentreWithoutResult must not be used in
1065          * -- version greater 1
1066          */
1067   case 49:
1068         offset = dissect_gsm_map_sm_AlertServiceCentreArg(FALSE, tvb, offset, actx, tree, -1);
1069         break;
1070   case 50: /*activateTraceMode*/
1071     offset=dissect_gsm_map_om_ActivateTraceModeArg(FALSE, tvb, offset, actx, tree, -1);
1072     break;
1073   case 51: /*deactivateTraceMode*/
1074     offset=dissect_gsm_map_om_DeactivateTraceModeArg(FALSE, tvb, offset, actx, tree, -1);
1075     break;
1076     /* reserved traceSubscriberActivity (52) */
1077     /* undefined 53 */
1078   case 54: /*beginSubscriberActivity*/
1079     offset=dissect_gsm_old_BeginSubscriberActivityArg(FALSE, tvb, offset, actx, tree, -1);
1080     break;
1081   case 55: /*sendIdentification*/
1082     offset=dissect_mc_message(tvb, offset, actx, tree,
1083                               FALSE, dissect_gsm_map_TMSI, hf_gsm_map_tmsi,
1084                               FALSE, dissect_gsm_map_ms_SendIdentificationArg, -1,
1085                               TRUE,  NULL, -1);
1086     break;
1087   case 56: /*sendAuthenticationInfo*/
1088     offset=dissect_mc_message(tvb, offset, actx, tree,
1089                               FALSE, dissect_gsm_map_IMSI, hf_gsm_map_imsi,
1090                               FALSE, dissect_gsm_map_ms_SendAuthenticationInfoArg, -1,
1091                               TRUE,  NULL, -1);
1092     break;
1093   case 57: /*restoreData*/
1094     offset=dissect_gsm_map_ms_RestoreDataArg(FALSE, tvb, offset, actx, tree, -1);
1095     break;
1096   case 58: /*sendIMSI*/
1097     offset = dissect_gsm_map_ISDN_AddressString(FALSE, tvb, offset, actx, tree, hf_gsm_map_msisdn);
1098     break;
1099   case 59: /*processUnstructuredSS-Request*/
1100     offset=dissect_gsm_map_ss_USSD_Arg(FALSE, tvb, offset, actx, tree, -1);
1101     break;
1102   case 60: /*unstructuredSS-Request*/
1103     offset=dissect_gsm_map_ss_USSD_Arg(FALSE, tvb, offset, actx, tree, -1);
1104     break;
1105   case 61: /*unstructuredSS-Notify*/
1106     offset=dissect_gsm_map_ss_USSD_Arg(FALSE, tvb, offset, actx, tree, -1);
1107     break;
1108   case 62: /*AnyTimeSubscriptionInterrogation*/
1109     offset=dissect_gsm_map_ms_AnyTimeSubscriptionInterrogationArg(FALSE, tvb, offset, actx, tree, -1);
1110     break;
1111   case 63: /*informServiceCentre*/
1112     offset=dissect_gsm_map_sm_InformServiceCentreArg(FALSE, tvb, offset, actx, tree, -1);
1113     break;
1114   case 64: /*alertServiceCentre*/
1115     offset=dissect_gsm_map_sm_AlertServiceCentreArg(FALSE, tvb, offset, actx, tree, -1);
1116     break;
1117   case 65: /*AnyTimeModification*/
1118     offset=dissect_gsm_map_ms_AnyTimeModificationArg(FALSE, tvb, offset, actx, tree, -1);
1119     break;
1120   case 66: /*readyForSM*/
1121     offset=dissect_gsm_map_sm_ReadyForSM_Arg(FALSE, tvb, offset, actx, tree, -1);
1122     break;
1123   case 67: /*purgeMS*/
1124     offset=dissect_mc_message(tvb, offset, actx, tree,
1125                               FALSE, dissect_gsm_map_IMSI, hf_gsm_map_imsi,
1126                               FALSE, dissect_gsm_old_PurgeMSArgV2, -1, /*undefined*/
1127                               TRUE , dissect_gsm_map_ms_PurgeMS_Arg, -1);
1128     break;
1129   case 68: /*prepareHandover*/
1130     offset=dissect_mc_message(tvb, offset, actx, tree,
1131                               FALSE, NULL, -1,
1132                               FALSE, dissect_gsm_old_PrepareHO_ArgOld, -1,
1133                               TRUE, dissect_gsm_map_ms_PrepareHO_Arg, -1);
1134     break;
1135   case 69: /*prepareSubsequentHandover*/
1136     offset=dissect_mc_message(tvb, offset, actx, tree,
1137                               FALSE, NULL, -1,
1138                               FALSE, NULL, -1,
1139                               TRUE, dissect_gsm_map_ms_PrepareSubsequentHO_Arg, -1);
1140     break;
1141   case 70: /*provideSubscriberInfo*/
1142     offset=dissect_gsm_map_ms_ProvideSubscriberInfoArg(FALSE, tvb, offset, actx, tree, -1);
1143     break;
1144   case 71: /*anyTimeInterrogation*/
1145     offset=dissect_gsm_map_ms_AnyTimeInterrogationArg(FALSE, tvb, offset, actx, tree, -1);
1146     break;
1147   case 72: /*ss-InvocationNotificatio*/
1148     offset=dissect_gsm_map_ss_SS_InvocationNotificationArg(FALSE, tvb, offset, actx, tree, -1);
1149     break;
1150   case 73: /*setReportingState*/
1151     offset=dissect_gsm_map_ch_SetReportingStateArg(FALSE, tvb, offset, actx, tree, -1);
1152     break;
1153   case 74: /*statusReport*/
1154     offset=dissect_gsm_map_ch_StatusReportArg(FALSE, tvb, offset, actx, tree, -1);
1155     break;
1156   case 75: /*remoteUserFree*/
1157     offset=dissect_gsm_map_ch_RemoteUserFreeArg(FALSE, tvb, offset, actx, tree, -1);
1158     break;
1159   case 76: /*registerCC-Entry*/
1160     offset=dissect_gsm_map_ss_RegisterCC_EntryArg(FALSE, tvb, offset, actx, tree, -1);
1161     break;
1162   case 77: /*eraseCC-Entry*/
1163     offset=dissect_gsm_map_ss_EraseCC_EntryArg(FALSE, tvb, offset, actx, tree, -1);
1164     break;
1165   case 78: /*secureTransportClass1*/
1166   case 79: /*secureTransportClass1*/
1167   case 80: /*secureTransportClass1*/
1168   case 81: /*secureTransportClass1*/
1169     offset=dissect_gsm_old_SecureTransportArg(FALSE, tvb, offset, actx, tree, -1);
1170     break;
1171     /* undefined 82 */
1172   case 83: /*provideSubscriberLocation*/
1173     offset=dissect_gsm_map_lcs_ProvideSubscriberLocation_Arg(FALSE, tvb, offset, actx, tree, -1);
1174     break;
1175   case 84: /*sendGroupCallInfo*/
1176     offset=dissect_gsm_map_gr_SendGroupCallInfoArg(FALSE, tvb, offset, actx, tree, -1);
1177     break;
1178   case 85: /*sendRoutingInfoForLCS*/
1179     offset=dissect_gsm_map_lcs_RoutingInfoForLCS_Arg(FALSE, tvb, offset, actx, tree, -1);
1180     break;
1181   case 86: /*subscriberLocationReport*/
1182     offset=dissect_gsm_map_lcs_SubscriberLocationReport_Arg(FALSE, tvb, offset, actx, tree, -1);
1183     break;
1184   case 87: /*ist-Alert*/
1185     offset=dissect_gsm_map_ch_IST_AlertArg(FALSE, tvb, offset, actx, tree, -1);
1186     break;
1187   case 88: /*ist-Command*/
1188     offset=dissect_gsm_map_ch_IST_CommandArg(FALSE, tvb, offset, actx, tree, -1);
1189     break;
1190   case 89: /*noteMM-Event*/
1191     offset=dissect_gsm_map_ms_NoteMM_EventArg(FALSE, tvb, offset, actx, tree, -1);
1192     break;
1193   case 109: /*SS-protocol lcs-PeriodicLocationCancellation*/
1194     offset=dissect_gsm_ss_LCS_PeriodicLocationCancellationArg(FALSE, tvb, offset, actx, tree, -1);
1195     break;
1196   case 110: /*SS-protocol lcs-LocationUpdate*/
1197     offset=dissect_gsm_ss_LCS_LocationUpdateArg(FALSE, tvb, offset, actx, tree, -1);
1198     break;
1199   case 111: /*SS-protocol lcs-PeriodicLocationRequest*/
1200     offset=dissect_gsm_ss_LCS_PeriodicLocationRequestArg(FALSE, tvb, offset, actx, tree, -1);
1201     break;
1202   case 112: /*SS-protocol lcs-AreaEventCancellation*/
1203     offset=dissect_gsm_ss_LCS_AreaEventCancellationArg(FALSE, tvb, offset, actx, tree, -1);
1204     break;
1205   case 113: /*SS-protocol lcs-AreaEventReport*/
1206     offset=dissect_gsm_ss_LCS_AreaEventReportArg(FALSE, tvb, offset, actx, tree, -1);
1207     break;
1208   case 114: /*SS-protocol lcs-AreaEventRequest*/
1209     offset=dissect_gsm_ss_LCS_AreaEventRequestArg(FALSE, tvb, offset, actx, tree, -1);
1210     break;
1211   case 115: /*SS-protocol lcs-MOLR*/
1212     offset=dissect_gsm_ss_LCS_MOLRArg(FALSE, tvb, offset, actx, tree, -1);
1213     break;
1214   case 116: /*SS-protocol lcs-LocationNotification*/
1215     offset=dissect_gsm_ss_LocationNotificationArg(FALSE, tvb, offset, actx, tree, -1);
1216     break;
1217   case 117: /*SS-protocol callDeflection*/
1218     offset=dissect_gsm_ss_CallDeflectionArg(FALSE, tvb, offset, actx, tree, -1);
1219     break;
1220   case 118: /*SS-protocol userUserService*/
1221     offset=dissect_gsm_ss_UserUserServiceArg(FALSE, tvb, offset, actx, tree, -1);
1222     break;
1223   case 119: /*SS-protocol accessRegisterCCEntry*/
1224     offset=dissect_gsm_ss_AccessRegisterCCEntryArg(FALSE, tvb, offset, actx, tree, -1);
1225     break;
1226   case 120: /*SS-protocol forwardCUG-Info*/
1227         application_context_version = 3;
1228     offset=dissect_gsm_ss_ForwardCUG_InfoArg(FALSE, tvb, offset, actx, tree, -1);
1229     break;
1230   case 121: /*SS-protocol splitMPTY no Argument*/
1231     break;
1232   case 122: /*SS-protocol retrieveMPTY no Argument*/
1233     break;
1234   case 123: /*SS-protocol holdMPTY no Argument*/
1235     break;
1236   case 124: /*SS-protocol buildMPTY no Argument*/
1237     break;
1238   case 125: /*SS-protocol forwardChargeAdvice*/
1239     offset=dissect_gsm_ss_ForwardChargeAdviceArg(FALSE, tvb, offset, actx, tree, -1);
1240     break;
1241   case 126: /*SS-protocol explicitCT no Argument*/
1242     break;
1243   default:
1244     cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown invokeData blob");
1245     proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN);
1246     expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "Unknown invokeData %d",opcode);
1247   }
1248   return offset;
1249 }
1250
1251
1252 static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx) {
1253
1254   proto_item *cause;
1255
1256   switch(opcode){
1257   case  2: /*updateLocation*/
1258     offset=dissect_mc_message(tvb, offset, actx, tree,
1259                               FALSE, dissect_gsm_map_IMSI, hf_gsm_map_imsi,
1260                               FALSE, dissect_gsm_map_ms_UpdateLocationRes, -1,
1261                               TRUE , NULL, -1);
1262     break;
1263   case  3: /*cancelLocation*/
1264     offset=dissect_gsm_map_ms_CancelLocationRes(FALSE, tvb, offset, actx, tree, -1);
1265     break;
1266   case  4: /*provideRoamingNumber*/
1267     offset=dissect_mc_message(tvb, offset, actx, tree,
1268                               FALSE, dissect_gsm_map_ISDN_AddressString, hf_gsm_map_msisdn,
1269                               FALSE, dissect_gsm_map_ch_ProvideRoamingNumberRes, -1,
1270                               TRUE , NULL, -1);/*undefined*/
1271     break;
1272   case  5: /*noteSubscriberDataModified*/
1273     offset=dissect_gsm_map_ms_NoteSubscriberDataModifiedRes(FALSE, tvb, offset, actx, tree, -1);
1274     break;
1275   case  6: /*resumeCallHandling*/
1276     offset=dissect_gsm_map_ch_ResumeCallHandlingRes(FALSE, tvb, offset, actx, tree, -1);
1277     break;
1278   case  7: /*insertSubscriberData*/
1279     offset=dissect_gsm_map_ms_InsertSubscriberDataRes(FALSE, tvb, offset, actx, tree, -1);
1280     break;
1281   case  8: /*deleteSubscriberData*/
1282     offset=dissect_gsm_map_ms_DeleteSubscriberDataRes(FALSE, tvb, offset, actx, tree, -1);
1283     break;
1284         /* TODO find out why this isn't in the ASN1 file
1285   case  9: sendParameters
1286     offset=dissect_gsm_map_DeleteSubscriberDataArg(FALSE, tvb, offset, actx, tree, -1);
1287     break;
1288         */
1289   case  10: /*registerSS*/
1290     offset=dissect_gsm_map_ss_SS_Info(FALSE, tvb, offset, actx, tree, -1);
1291     break;
1292   case  11: /*eraseSS*/
1293     offset=dissect_gsm_map_ss_SS_Info(FALSE, tvb, offset, actx, tree, -1);
1294     break;
1295   case 12: /*activateSS*/
1296     offset=dissect_gsm_map_ss_SS_Info(FALSE, tvb, offset, actx, tree, -1);
1297     break;
1298   case 13: /*deactivateSS*/
1299     offset=dissect_gsm_map_ss_SS_Info(FALSE, tvb, offset, actx, tree, -1);
1300     break;
1301   case 14: /*interrogateSS*/
1302     offset=dissect_gsm_map_ss_InterrogateSS_Res(FALSE, tvb, offset, actx, tree, -1);
1303     break;
1304   case 15: /*authenticationFailureReport*/
1305     offset=dissect_gsm_map_ms_AuthenticationFailureReportRes(FALSE, tvb, offset, actx, tree, -1);
1306     break;
1307   case 17: /*registerPassword*/
1308     /* change hf_gsm_map_ss_Code to something with password */
1309     offset=dissect_gsm_old_NewPassword(FALSE, tvb, offset, actx, tree, hf_gsm_map_ss_Code);
1310     break;
1311   case 18: /*getPassword*/
1312     offset=dissect_gsm_old_CurrentPassword(FALSE, tvb, offset, actx, tree, hf_gsm_map_currentPassword);
1313     break;
1314   case 19: /* SS-Protocol processUnstructuredSS-Data (19) */
1315     offset=dissect_gsm_ss_SS_UserData(FALSE, tvb, offset, actx, tree, hf_gsm_map_ss_SS_UserData);
1316     break;
1317   case 20: /*releaseResources*/
1318     offset=dissect_gsm_map_ch_ReleaseResourcesRes(FALSE, tvb, offset, actx, tree, -1);
1319     break;
1320   case 21: /*mt-ForwardSM-VGCS*/
1321     offset=dissect_gsm_map_sm_MT_ForwardSM_VGCS_Res(FALSE, tvb, offset, actx, tree, -1);
1322     break;
1323   case 22: /*sendRoutingInfo*/
1324           if (application_context_version == 3){
1325                   /* If the tag is missing use SendRoutingInfoRes_U */
1326                   offset=dissect_mc_message(tvb, offset, actx, tree,
1327                               FALSE, NULL, -1,
1328                               FALSE, dissect_gsm_map_ch_SendRoutingInfoRes_U, -1,
1329                               TRUE , dissect_gsm_map_ch_SendRoutingInfoRes, -1);
1330           }else{
1331                   offset=dissect_mc_message(tvb, offset, actx, tree,
1332                               FALSE, dissect_gsm_map_IMSI, hf_gsm_map_imsi,
1333                               FALSE, dissect_gsm_old_SendRoutingInfoResV2, -1,
1334                               TRUE , dissect_gsm_map_ch_SendRoutingInfoRes, -1);
1335           }
1336     break;
1337   case 23: /*updateGprsLocation*/
1338     offset=dissect_gsm_map_ms_UpdateGprsLocationRes(FALSE, tvb, offset, actx, tree, -1);
1339     break;
1340   case 24: /*sendRoutingInfoForGprs*/
1341     offset=dissect_gsm_map_ms_SendRoutingInfoForGprsRes(FALSE, tvb, offset, actx, tree, -1);
1342     break;
1343   case 25: /*failureReport*/
1344     offset=dissect_gsm_map_ms_FailureReportRes(FALSE, tvb, offset, actx, tree, -1);
1345     break;
1346   case 26: /*noteMsPresentForGprs*/
1347     offset=dissect_gsm_map_ms_NoteMsPresentForGprsRes(FALSE, tvb, offset, actx, tree, -1);
1348     break;
1349   case 29: /*sendEndSignal*/
1350           /* Taken from MAP-MobileServiceOperations{ 0 identified-organization (4) etsi (0) mobileDomain
1351            * (0) gsm-Network (1) modules (3) map-MobileServiceOperations (5) version9 (9) }
1352            */
1353     offset=dissect_gsm_map_ms_SendEndSignal_Res(FALSE, tvb, offset, actx, tree, -1);
1354     break;
1355   case 31: /*provideSIWFSNumber*/
1356     offset=dissect_gsm_old_ProvideSIWFSNumberRes(FALSE, tvb, offset, actx, tree, -1);
1357     break;
1358   case 32: /*provideSIWFSSignallingModify*/
1359     offset=dissect_gsm_old_SIWFSSignallingModifyRes(FALSE, tvb, offset, actx, tree, -1);
1360     break;
1361   case 39: /*prepareGroupCall*/
1362     offset=dissect_gsm_map_gr_PrepareGroupCallRes(FALSE, tvb, offset, actx, tree, -1);
1363     break;
1364   case 40: /*sendGroupCallEndSignal*/
1365     offset=dissect_gsm_map_gr_SendGroupCallEndSignalRes(FALSE, tvb, offset, actx, tree, -1);
1366     break;
1367   case 43: /*checkIMEI*/
1368     offset=dissect_mc_message(tvb, offset, actx, tree,
1369                               FALSE, dissect_gsm_map_ms_EquipmentStatus, hf_gsm_map_ms_equipmentStatus,
1370                               FALSE, dissect_gsm_map_ms_CheckIMEI_Res, -1,
1371                               TRUE,  NULL, -1);
1372     break;
1373   case 44: /*mt-forwardSM*/
1374     offset=dissect_gsm_map_sm_MT_ForwardSM_Res(FALSE, tvb, offset, actx, tree, -1);
1375     break;
1376   case 45: /*sendRoutingInfoForSM*/
1377     offset=dissect_gsm_map_sm_RoutingInfoForSM_Res(FALSE, tvb, offset, actx, tree, -1);
1378     break;
1379   case 46: /*mo-forwardSM*/
1380     offset=dissect_gsm_map_sm_MO_ForwardSM_Res(FALSE, tvb, offset, actx, tree, -1);
1381     break;
1382   case 47: /*reportSM-DeliveryStatus*/
1383     offset=dissect_gsm_map_sm_ReportSM_DeliveryStatusRes(FALSE, tvb, offset, actx, tree, -1);
1384     break;
1385   case 48: /*noteSubscriberPresent*/
1386     break;
1387   case 50: /*activateTraceMode*/
1388     offset=dissect_gsm_map_om_ActivateTraceModeRes(FALSE, tvb, offset, actx, tree, -1);
1389     break;
1390   case 51: /*deactivateTraceMode*/
1391     offset=dissect_gsm_map_om_DeactivateTraceModeRes(FALSE, tvb, offset, actx, tree, -1);
1392     break;
1393   case 55: /*sendIdentification */
1394     offset=dissect_mc_message(tvb, offset, actx, tree,
1395                               FALSE, dissect_gsm_map_IMSI, hf_gsm_map_imsi,
1396                               FALSE, dissect_gsm_old_SendIdentificationResV2, -1,/*undefined*/
1397                               TRUE,  dissect_gsm_map_ms_SendIdentificationRes, -1);
1398     break;
1399   case 56: /*sendAuthenticationInfo*/
1400     offset=dissect_mc_message(tvb, offset, actx, tree,
1401                               FALSE, NULL, -1,
1402                               FALSE, dissect_gsm_old_SendAuthenticationInfoResOld, -1,
1403                               TRUE , dissect_gsm_map_ms_SendAuthenticationInfoRes, -1);
1404     break;
1405   case 57: /*restoreData*/
1406     offset=dissect_gsm_map_ms_RestoreDataRes(FALSE, tvb, offset, actx, tree, -1);
1407     break;
1408   case 58: /*sendIMSI*/
1409     offset=dissect_gsm_map_IMSI(FALSE, tvb, offset, actx, tree, hf_gsm_map_ms_imsi);
1410     break;
1411   case 59: /*unstructuredSS-Request*/
1412     offset=dissect_gsm_map_ss_USSD_Res(FALSE, tvb, offset, actx, tree, -1);
1413     break;
1414   case 60: /*unstructuredSS-Request*/
1415     offset=dissect_gsm_map_ss_USSD_Res(FALSE, tvb, offset, actx, tree, -1);
1416     break;
1417   case 61: /*unstructuredSS-Notify*/
1418     /* TRUE ? */
1419     proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnResultData blob");
1420     break;
1421   case 62: /*AnyTimeSubscriptionInterrogation*/
1422     offset=dissect_gsm_map_ms_AnyTimeSubscriptionInterrogationRes(FALSE, tvb, offset, actx, tree, -1);
1423     break;
1424   case 64: /*alertServiceCentre*/
1425     /* TRUE */
1426     break;
1427   case 65: /*AnyTimeModification*/
1428     offset=dissect_gsm_map_ms_AnyTimeModificationRes(FALSE, tvb, offset, actx, tree, -1);
1429     break;
1430   case 66: /*readyForSM*/
1431     offset=dissect_gsm_map_sm_ReadyForSM_Res(FALSE, tvb, offset, actx, tree, -1);
1432     break;
1433   case 67: /*purgeMS*/
1434     offset=dissect_gsm_map_ms_PurgeMS_Res(FALSE, tvb, offset, actx, tree, -1);
1435     break;
1436   case 68: /*prepareHandover*/
1437     offset=dissect_mc_message(tvb, offset, actx, tree,
1438                               FALSE, NULL, -1,
1439                               FALSE, dissect_gsm_old_PrepareHO_ResOld, -1,
1440                               TRUE , dissect_gsm_map_ms_PrepareHO_Res, -1);
1441     break;
1442   case 69: /*prepareSubsequentHandover*/
1443     offset=dissect_mc_message(tvb, offset, actx, tree,
1444                               FALSE, NULL, -1,
1445                               FALSE, NULL, -1,
1446                               TRUE , dissect_gsm_map_ms_PrepareSubsequentHO_Res, -1);
1447     break;
1448   case 70: /*provideSubscriberInfo*/
1449     offset=dissect_gsm_map_ms_ProvideSubscriberInfoRes(FALSE, tvb, offset, actx, tree, -1);
1450     break;
1451   case 71: /*anyTimeInterrogation*/
1452     offset=dissect_gsm_map_ms_AnyTimeInterrogationRes(FALSE, tvb, offset, actx, tree, -1);
1453     break;
1454   case 72: /*ss-InvocationNotificatio*/
1455     offset=dissect_gsm_map_ss_SS_InvocationNotificationRes(FALSE, tvb, offset, actx, tree, -1);
1456     break;
1457   case 73: /*setReportingState*/
1458     offset=dissect_gsm_map_ch_SetReportingStateRes(FALSE, tvb, offset, actx, tree, -1);
1459     break;
1460   case 74: /*statusReport*/
1461     offset=dissect_gsm_map_ch_StatusReportRes(FALSE, tvb, offset, actx, tree, -1);
1462     break;
1463   case 75: /*remoteUserFree*/
1464     offset=dissect_gsm_map_ch_RemoteUserFreeRes(FALSE, tvb, offset, actx, tree, -1);
1465     break;
1466   case 76: /*registerCC-Entry*/
1467     offset=dissect_gsm_map_ss_RegisterCC_EntryRes(FALSE, tvb, offset, actx, tree, -1);
1468     break;
1469   case 77: /*eraseCC-Entry*/
1470     offset=dissect_gsm_map_ss_EraseCC_EntryRes(FALSE, tvb, offset, actx, tree, -1);
1471     break;
1472   case 78: /*secureTransportClass1*/
1473   case 79: /*secureTransportClass2*/
1474   case 80: /*secureTransportClass3*/
1475   case 81: /*secureTransportClass4*/
1476     offset=dissect_gsm_old_SecureTransportRes(FALSE, tvb, offset, actx, tree, -1);
1477     break;
1478   case 83: /*provideSubscriberLocation*/
1479     offset=dissect_gsm_map_lcs_ProvideSubscriberLocation_Res(FALSE, tvb, offset, actx, tree, -1);
1480     break;
1481   case 84: /*sendGroupCallInfo*/
1482     offset=dissect_gsm_map_gr_SendGroupCallInfoRes(FALSE, tvb, offset, actx, tree, -1);
1483     break;
1484   case 85: /*sendRoutingInfoForLCS*/
1485     offset=dissect_gsm_map_lcs_RoutingInfoForLCS_Res(FALSE, tvb, offset, actx, tree, -1);
1486     break;
1487   case 86: /*subscriberLocationReport*/
1488     offset=dissect_gsm_map_lcs_SubscriberLocationReport_Res(FALSE, tvb, offset, actx, tree, -1);
1489     break;
1490   case 87: /*ist-Alert*/
1491     offset=dissect_gsm_map_ch_IST_AlertRes(FALSE, tvb, offset, actx, tree, -1);
1492     break;
1493   case 88: /*ist-Command*/
1494     offset=dissect_gsm_map_ch_IST_CommandRes(FALSE, tvb, offset, actx, tree, -1);
1495     break;
1496   case 89: /*noteMM-Event*/
1497     offset=dissect_gsm_map_ms_NoteMM_EventRes(FALSE, tvb, offset, actx, tree, -1);
1498     break;
1499   case 109: /*SS-protocol lcs-PeriodicLocationCancellation*/
1500           /* No parameter */
1501     break;
1502   case 110: /*SS-protocol lcs-LocationUpdate*/
1503           offset=dissect_gsm_ss_LCS_LocationUpdateRes(FALSE, tvb, offset, actx, tree, -1);
1504     break;
1505   case 111: /*SS-protocol lcs-PeriodicLocationRequest*/
1506     offset=dissect_gsm_ss_LCS_PeriodicLocationRequestRes(FALSE, tvb, offset, actx, tree, -1);
1507     break;
1508   case 112: /*SS-protocol lcs-AreaEventCancellation*/
1509     break;
1510   case 113: /*SS-protocol lcs-AreaEventReport*/
1511     break;
1512   case 114: /*SS-protocol lcs-AreaEventRequest No RESULT data*/
1513     break;
1514   case 115: /*SS-protocol lcs-MOLR*/
1515     offset=dissect_gsm_ss_LCS_MOLRRes(FALSE, tvb, offset, actx, tree, -1);
1516     break;
1517   case 116: /*SS-protocol lcs-LocationNotification*/
1518     offset=dissect_gsm_ss_LocationNotificationRes(FALSE, tvb, offset, actx, tree, -1);
1519     break;
1520   case 117: /*SS-protocol callDeflection no RESULT*/
1521     break;
1522   case 118: /*SS-protocol userUserService no RESULT*/
1523     break;
1524   case 119: /*SS-protocol accessRegisterCCEntry*/
1525     offset=dissect_gsm_map_ss_RegisterCC_EntryRes(FALSE, tvb, offset, actx, tree, -1);
1526     break;
1527   case 120: /*SS-protocol forwardCUG-Info*/
1528           /* No RETURN RESULT*/
1529     break;
1530   case 121: /*SS-protocol splitMPTY no RESULT*/
1531     break;
1532   case 122: /*SS-protocol retrieveMPTY no RESULT*/
1533     break;
1534   case 123: /*SS-protocol holdMPTY no RESULT*/
1535     break;
1536   case 124: /*SS-protocol buildMPTY no RESULT*/
1537     break;
1538   case 125: /*SS-protocol forwardChargeAdvice no RESULT*/
1539     break;
1540   case 126: /*SS-protocol explicitCT no RESULT*/
1541     break;
1542
1543  default:
1544    cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnResultData blob");
1545    proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN);
1546    expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "Unknown invokeData %d",opcode);
1547   }
1548   return offset;
1549 }
1550
1551
1552
1553 static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx) {
1554   proto_item *cause;
1555
1556   switch(errorCode){
1557   case 1: /* UnknownSubscriberParam */
1558           offset=dissect_gsm_map_er_UnknownSubscriberParam(FALSE, tvb, offset, actx, tree, -1);
1559           break;
1560   case 4: /* SecureTransportErrorParam */
1561           offset=dissect_gsm_old_SecureTransportErrorParam(FALSE, tvb, offset, actx, tree, -1);
1562           break;
1563   case 5: /* UnidentifiedSubParam */
1564           offset=dissect_gsm_map_er_UnidentifiedSubParam(FALSE, tvb, offset, actx, tree, -1);
1565           break;
1566   case 6: /* AbsentSubscriberSM-Param */
1567           offset=dissect_gsm_map_er_AbsentSubscriberSM_Param(FALSE, tvb, offset, actx, tree, -1);
1568           break;
1569   case 8: /* RoamingNotAllowedParam */
1570           offset=dissect_gsm_map_er_RoamingNotAllowedParam(FALSE, tvb, offset, actx, tree, -1);
1571           break;
1572   case 9: /* IllegalSubscriberParam */
1573           offset=dissect_gsm_map_er_IllegalSubscriberParam(FALSE, tvb, offset, actx, tree, -1);
1574           break;
1575   case 10: /* BearerServNotProvParam */
1576           offset=dissect_gsm_map_er_BearerServNotProvParam(FALSE, tvb, offset, actx, tree, -1);
1577           break;
1578   case 11: /* TeleservNotProvParam */
1579           offset=dissect_gsm_map_er_TeleservNotProvParam(FALSE, tvb, offset, actx, tree, -1);
1580           break;
1581   case 12: /* IllegalEquipmentParam */
1582           offset=dissect_gsm_map_er_IllegalEquipmentParam(FALSE, tvb, offset, actx, tree, -1);
1583           break;
1584   case 13: /* CallBarredParam */
1585           offset=dissect_gsm_map_er_CallBarredParam(FALSE, tvb, offset, actx, tree, -1);
1586           break;
1587   case 14: /* ForwardingViolationParam */
1588           offset=dissect_gsm_map_er_ForwardingViolationParam(FALSE, tvb, offset, actx, tree, -1);
1589           break;
1590   case 15: /* CUG-RejectParam */
1591           offset=dissect_gsm_map_er_CUG_RejectParam(FALSE, tvb, offset, actx, tree, -1);
1592           break;
1593   case 16: /* IllegalSS-OperationParam */
1594           offset=dissect_gsm_map_er_IllegalSS_OperationParam(FALSE, tvb, offset, actx, tree, -1);
1595           break;
1596   case 17: /* SS-ErrorStatus */
1597           offset=dissect_gsm_map_ss_SS_Status(FALSE, tvb, offset, actx, tree, hf_gsm_map_ss_ss_Status);
1598           break;
1599   case 18: /* SS-NotAvailableParam */
1600           offset=dissect_gsm_map_er_SS_NotAvailableParam(FALSE, tvb, offset, actx, tree, -1);
1601           break;
1602   case 19: /* SS-SubscriptionViolationParam */
1603           offset=dissect_gsm_map_er_SS_SubscriptionViolationParam(FALSE, tvb, offset, actx, tree, -1);
1604           break;
1605   case 20: /* SS-IncompatibilityCause */
1606           offset=dissect_gsm_map_er_SS_IncompatibilityCause(FALSE, tvb, offset, actx, tree, -1);
1607           break;
1608   case 21: /* FacilityNotSupParam */
1609           offset=dissect_gsm_map_er_FacilityNotSupParam(FALSE, tvb, offset, actx, tree, -1);
1610           break;
1611   case 22: /* OngoingGroupCallParam */
1612           offset=dissect_gsm_map_er_OngoingGroupCallParam(FALSE, tvb, offset, actx, tree, -1);
1613           break;
1614   case 27: /* AbsentSubscriberParam */
1615           offset=dissect_gsm_map_er_AbsentSubscriberParam(FALSE, tvb, offset, actx, tree, -1);
1616           break;
1617   case 28: /* IncompatibleTerminalParam */
1618           offset=dissect_gsm_map_er_IncompatibleTerminalParam(FALSE, tvb, offset, actx, tree, -1);
1619           break;
1620   case 29: /* ShortTermDenialParam */
1621           offset=dissect_gsm_map_er_ShortTermDenialParam(FALSE, tvb, offset, actx, tree, -1);
1622           break;
1623   case 30: /* LongTermDenialParam */
1624           offset=dissect_gsm_map_er_LongTermDenialParam(FALSE, tvb, offset, actx, tree, -1);
1625           break;
1626   case 31: /* SubBusyForMT-SMS-Param */
1627           offset=dissect_gsm_map_er_SubBusyForMT_SMS_Param(FALSE, tvb, offset, actx, tree, -1);
1628           break;
1629   case 32: /* SM-DeliveryFailureCause */
1630           offset=dissect_gsm_map_er_SM_DeliveryFailureCause(FALSE, tvb, offset, actx, tree, -1);
1631           break;
1632   case 33: /* MessageWaitListFullParam */
1633           offset=dissect_gsm_map_er_MessageWaitListFullParam(FALSE, tvb, offset, actx, tree, -1);
1634           break;
1635   case 34: /* SystemFailureParam */
1636           offset=dissect_gsm_map_er_SystemFailureParam(FALSE, tvb, offset, actx, tree, -1);
1637           break;
1638   case 35: /* DataMissingParam */
1639           offset=dissect_gsm_map_er_DataMissingParam(FALSE, tvb, offset, actx, tree, -1);
1640           break;
1641   case 36: /* UnexpectedDataParam */
1642           offset=dissect_gsm_map_er_UnexpectedDataParam(FALSE, tvb, offset, actx, tree, -1);
1643           break;
1644   case 37: /* PW-RegistrationFailureCause */
1645           offset=dissect_gsm_map_er_PW_RegistrationFailureCause(FALSE, tvb, offset, actx, tree, -1);
1646           break;
1647   case 39: /* NoRoamingNbParam */
1648           offset=dissect_gsm_map_er_NoRoamingNbParam(FALSE, tvb, offset, actx, tree, -1);
1649           break;
1650   case 40: /* TracingBufferFullParam */
1651           offset=dissect_gsm_map_er_TracingBufferFullParam(FALSE, tvb, offset, actx, tree, -1);
1652           break;
1653   case 42: /* TargetCellOutsideGCA-Param */
1654           offset=dissect_gsm_map_er_TargetCellOutsideGCA_Param(FALSE, tvb, offset, actx, tree, -1);
1655           break;
1656   case 44: /* NumberChangedParam */
1657           offset=dissect_gsm_map_er_NumberChangedParam(FALSE, tvb, offset, actx, tree, -1);
1658           break;
1659   case 45: /* BusySubscriberParam */
1660           offset=dissect_gsm_map_er_BusySubscriberParam(FALSE, tvb, offset, actx, tree, -1);
1661           break;
1662   case 46: /* NoSubscriberReplyParam */
1663           offset=dissect_gsm_map_er_NoSubscriberReplyParam(FALSE, tvb, offset, actx, tree, -1);
1664           break;
1665   case 47: /* ForwardingFailedParam */
1666           offset=dissect_gsm_map_er_ForwardingFailedParam(FALSE, tvb, offset, actx, tree, -1);
1667           break;
1668   case 48: /* OR-NotAllowedParam */
1669           offset=dissect_gsm_map_er_OR_NotAllowedParam(FALSE, tvb, offset, actx, tree, -1);
1670           break;
1671   case 49: /* ATI-NotAllowedParam */
1672           offset=dissect_gsm_map_er_ATI_NotAllowedParam(FALSE, tvb, offset, actx, tree, -1);
1673           break;
1674   case 50: /* NoGroupCallNbParam */
1675           offset=dissect_gsm_map_er_NoGroupCallNbParam(FALSE, tvb, offset, actx, tree, -1);
1676           break;
1677   case 51: /* ResourceLimitationParam */
1678           offset=dissect_gsm_map_er_ResourceLimitationParam(FALSE, tvb, offset, actx, tree, -1);
1679           break;
1680   case 52: /* UnauthorizedRequestingNetwork-Param */
1681           offset=dissect_gsm_map_er_UnauthorizedRequestingNetwork_Param(FALSE, tvb, offset, actx, tree, -1);
1682           break;
1683   case 53: /* UnauthorizedLCSClient-Param */
1684           offset=dissect_gsm_map_er_UnauthorizedLCSClient_Param(FALSE, tvb, offset, actx, tree, -1);
1685           break;
1686   case 54: /* PositionMethodFailure-Param */
1687           offset=dissect_gsm_map_er_PositionMethodFailure_Param(FALSE, tvb, offset, actx, tree, -1);
1688           break;
1689   case 58: /* UnknownOrUnreachableLCSClient-Param */
1690           offset=dissect_gsm_map_er_UnknownOrUnreachableLCSClient_Param(FALSE, tvb, offset, actx, tree, -1);
1691           break;
1692   case 59: /* MM-EventNotSupported-Param */
1693           offset=dissect_gsm_map_er_MM_EventNotSupported_Param(FALSE, tvb, offset, actx, tree, -1);
1694           break;
1695   case 60: /* ATSI-NotAllowedParam */
1696           offset=dissect_gsm_map_er_ATSI_NotAllowedParam(FALSE, tvb, offset, actx, tree, -1);
1697           break;
1698   case 61: /* ATM-NotAllowedParam */
1699           offset=dissect_gsm_map_er_ATM_NotAllowedParam(FALSE, tvb, offset, actx, tree, -1);
1700           break;
1701   case 62: /* InformationNotAvailableParam */
1702           offset=dissect_gsm_map_er_InformationNotAvailableParam(FALSE, tvb, offset, actx, tree, -1);
1703           break;
1704   default:
1705     cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnErrorData blob");
1706     proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN);
1707     expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "Unknown invokeData %d",errorCode);
1708     break;
1709   }
1710   return offset;
1711 }
1712
1713 /* Private extension container for PLMN Data */
1714 static void dissect_gsm_mapext_PlmnContainer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) {
1715   proto_item    *item=NULL;
1716   proto_tree    *tree=NULL;
1717   asn1_ctx_t asn1_ctx;
1718   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
1719   /* create display subtree for the protocol */
1720   if(parent_tree){
1721     item = proto_tree_add_text(parent_tree, tvb, 0, -1, "MAP Ext. Plmn Container");
1722     tree = proto_item_add_subtree(item, ett_gsm_old_PlmnContainer_U);
1723   }
1724   dissect_gsm_old_PlmnContainer(FALSE, tvb, 0, &asn1_ctx, tree, -1);
1725 }
1726
1727
1728 static guint8 gsmmap_pdu_type = 0;
1729 static guint8 gsm_map_pdu_size = 0;
1730
1731 static int
1732 dissect_gsm_map_GSMMAPPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) {
1733
1734   char *version_ptr;
1735   struct tcap_private_t * p_private_tcap;
1736
1737   opcode = 0;
1738   application_context_version = 0;
1739   if (actx->pinfo->private_data != NULL){
1740     p_private_tcap=actx->pinfo->private_data;
1741     if (p_private_tcap->acv==TRUE ){
1742       version_ptr = strrchr(p_private_tcap->oid,'.');
1743       if (version_ptr){
1744                   application_context_version = atoi(version_ptr+1);
1745           }
1746     }
1747   }
1748
1749   gsmmap_pdu_type = tvb_get_guint8(tvb, offset)&0x0f;
1750   /* Get the length and add 2 */
1751   gsm_map_pdu_size = tvb_get_guint8(tvb, offset+1)+2;
1752
1753   col_add_str(actx->pinfo->cinfo, COL_INFO, val_to_str(gsmmap_pdu_type, gsm_old_Component_vals, "Unknown GSM-MAP PDU (%u)"));
1754   col_append_fstr(actx->pinfo->cinfo, COL_INFO, " ");
1755   offset = dissect_gsm_old_Component(FALSE, tvb, 0, actx, tree, hf_gsm_map_old_Component_PDU);
1756   return offset;
1757 /*
1758   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
1759                               GSMMAPPDU_choice, hf_index, ett_gsm_map_GSMMAPPDU, NULL);
1760 */
1761
1762   return offset;
1763 }
1764
1765 static void
1766 dissect_gsm_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
1767 {
1768     proto_item          *item=NULL;
1769     proto_tree          *tree=NULL;
1770     /* Used for gsm_map TAP */
1771     static              gsm_map_tap_rec_t tap_rec;
1772     gint                op_idx;
1773         asn1_ctx_t asn1_ctx;
1774
1775         asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
1776
1777
1778     col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSM MAP");
1779
1780     top_tree = parent_tree;
1781
1782     /* create display subtree for the protocol */
1783     if(parent_tree){
1784         item = proto_tree_add_item(parent_tree, proto_gsm_map, tvb, 0, -1, FALSE);
1785         tree = proto_item_add_subtree(item, ett_gsm_map);
1786     }
1787
1788     dissect_gsm_map_GSMMAPPDU(FALSE, tvb, 0, &asn1_ctx, tree, -1);
1789     match_strval_idx(opcode, gsm_map_opr_code_strings, &op_idx);
1790
1791     tap_rec.invoke = FALSE;
1792     if ( gsmmap_pdu_type  == 1 )
1793         tap_rec.invoke = TRUE;
1794     tap_rec.opr_code_idx = op_idx;
1795     tap_rec.size = gsm_map_pdu_size;
1796
1797     tap_queue_packet(gsm_map_tap, pinfo, &tap_rec);
1798 }
1799
1800 const value_string ssCode_vals[] = {
1801   { 0x00, "allSS - all SS" },
1802   { 0x10 ,"allLineIdentificationSS - all line identification SS" },
1803   { 0x11 ,"clip - calling line identification presentation" },
1804   { 0x12 ,"clir - calling line identification restriction" },
1805   { 0x13 ,"colp - connected line identification presentation" },
1806   { 0x14 ,"colr - connected line identification restriction" },
1807   { 0x15 ,"mci - malicious call identification" },
1808   { 0x18 ,"allNameIdentificationSS - all name indentification SS" },
1809   { 0x19 ,"cnap - calling name presentation" },
1810   { 0x20 ,"allForwardingSS - all forwarding SS" },
1811   { 0x21 ,"cfu - call forwarding unconditional" },
1812   { 0x28 ,"allCondForwardingSS - all conditional forwarding SS" },
1813   { 0x29 ,"cfb - call forwarding busy" },
1814   { 0x2a ,"cfnry - call forwarding on no reply" },
1815   { 0x2b ,"cfnrc - call forwarding on mobile subscriber not reachable" },
1816   { 0x24 ,"cd - call deflection" },
1817   { 0x30 ,"allCallOfferingSS - all call offering SS includes also all forwarding SS" },
1818   { 0x31 ,"ect - explicit call transfer" },
1819   { 0x32 ,"mah - mobile access hunting" },
1820   { 0x40 ,"allCallCompletionSS - all Call completion SS" },
1821   { 0x41 ,"cw - call waiting" },
1822   { 0x42 ,"hold - call hold" },
1823   { 0x43 ,"ccbs-A - completion of call to busy subscribers, originating side" },
1824   { 0x44 ,"ccbs-B - completion of call to busy subscribers, destination side" },
1825   { 0x45 ,"mc - multicall" },
1826   { 0x50 ,"allMultiPartySS - all multiparty SS" },
1827   { 0x51 ,"multiPTY - multiparty" },
1828   { 0x60 ,"allCommunityOfInterestSS - all community of interest SS" },
1829   { 0x61 ,"cug - closed user group" },
1830   { 0x70 ,"allChargingSS - all charging SS" },
1831   { 0x71 ,"aoci - advice of charge information" },
1832   { 0x72 ,"aocc - advice of charge charging" },
1833   { 0x80 ,"allAdditionalInfoTransferSS - all additional information transfer SS" },
1834   { 0x81 ,"uus1 - UUS1 user-to-user signalling" },
1835   { 0x82 ,"uus2 - UUS2 user-to-user signalling" },
1836   { 0x83 ,"uus3 - UUS3 user-to-user signalling" },
1837   { 0x90 ,"allCallRestrictionSS - all Callrestriction SS" },
1838   { 0x91 ,"barringOfOutgoingCalls" },
1839   { 0x92 ,"baoc - barring of all outgoing calls" },
1840   { 0x93 ,"boic - barring of outgoing international calls" },
1841   { 0x94 ,"boicExHC - barring of outgoing international calls except those directed to the home PLMN" },
1842   { 0x99 ,"barringOfIncomingCalls" },
1843   { 0x9a ,"baic - barring of all incoming calls" },
1844   { 0x9b ,"bicRoam - barring of incoming calls when roaming outside home PLMN Country" },
1845   { 0xf0 ,"allPLMN-specificSS" },
1846   { 0xa0 ,"allCallPrioritySS - all call priority SS" },
1847   { 0xa1 ,"emlpp - enhanced Multilevel Precedence Pre-emption (EMLPP) service" },
1848   { 0xb0 ,"allLCSPrivacyException - all LCS Privacy Exception Classes" },
1849   { 0xb1 ,"universal - allow location by any LCS client" },
1850   { 0xb2 ,"callrelated - allow location by any value added LCS client to which a call is established from the target MS" },
1851   { 0xb3 ,"callunrelated - allow location by designated external value added LCS clients" },
1852   { 0xb4 ,"plmnoperator - allow location by designated PLMN operator LCS clients" },
1853   { 0xb5 ,"serviceType - allow location by LCS clients of a designated LCS service type" },
1854   { 0xc0 ,"allMOLR-SS - all Mobile Originating Location Request Classes" },
1855   { 0xc1 ,"basicSelfLocation - allow an MS to request its own location" },
1856   { 0xc2 ,"autonomousSelfLocation - allow an MS to perform self location without interaction with the PLMN for a predetermined period of time" },
1857   { 0xc3 ,"transferToThirdParty - allow an MS to request transfer of its location to another LCS client" },
1858
1859   { 0xf1 ,"plmn-specificSS-1" },
1860   { 0xf2 ,"plmn-specificSS-2" },
1861   { 0xf3 ,"plmn-specificSS-3" },
1862   { 0xf4 ,"plmn-specificSS-4" },
1863   { 0xf5 ,"plmn-specificSS-5" },
1864   { 0xf6 ,"plmn-specificSS-6" },
1865   { 0xf7 ,"plmn-specificSS-7" },
1866   { 0xf8 ,"plmn-specificSS-8" },
1867   { 0xf9 ,"plmn-specificSS-9" },
1868   { 0xfa ,"plmn-specificSS-a" },
1869   { 0xfb ,"plmn-specificSS-b" },
1870   { 0xfc ,"plmn-specificSS-c" },
1871   { 0xfd ,"plmn-specificSS-d" },
1872   { 0xfe ,"plmn-specificSS-e" },
1873   { 0xff ,"plmn-specificSS-f" },
1874   { 0, NULL }
1875 };
1876
1877 static const value_string Teleservice_vals[] = {
1878 {0x00, "allTeleservices" },
1879 {0x10, "allSpeechTransmissionServices" },
1880 {0x11, "telephony" },
1881 {0x12, "emergencyCalls" },
1882 {0x20, "allShortMessageServices" },
1883 {0x21, "shortMessageMT-PP" },
1884 {0x22, "shortMessageMO-PP" },
1885 {0x60, "allFacsimileTransmissionServices" },
1886 {0x61, "facsimileGroup3AndAlterSpeech" },
1887 {0x62, "automaticFacsimileGroup3" },
1888 {0x63, "facsimileGroup4" },
1889
1890 {0x70, "allDataTeleservices" },
1891 {0x80, "allTeleservices-ExeptSMS" },
1892
1893 {0x90, "allVoiceGroupCallServices" },
1894 {0x91, "voiceGroupCall" },
1895 {0x92, "voiceBroadcastCall" },
1896
1897 {0xd0, "allPLMN-specificTS" },
1898 {0xd1, "plmn-specificTS-1" },
1899 {0xd2, "plmn-specificTS-2" },
1900 {0xd3, "plmn-specificTS-3" },
1901 {0xd4, "plmn-specificTS-4" },
1902 {0xd5, "plmn-specificTS-5" },
1903 {0xd6, "plmn-specificTS-6" },
1904 {0xd7, "plmn-specificTS-7" },
1905 {0xd8, "plmn-specificTS-8" },
1906 {0xd9, "plmn-specificTS-9" },
1907 {0xda, "plmn-specificTS-A" },
1908 {0xdb, "plmn-specificTS-B" },
1909 {0xdc, "plmn-specificTS-C" },
1910 {0xdd, "plmn-specificTS-D" },
1911 {0xde, "plmn-specificTS-E" },
1912 {0xdf, "plmn-specificTS-F" },
1913   { 0, NULL }
1914 };
1915
1916 static const value_string Bearerservice_vals[] = {
1917 {0x00, "allBearerServices" },
1918 {0x10, "allDataCDA-Services" },
1919 {0x11, "dataCDA-300bps" },
1920 {0x12, "dataCDA-1200bps" },
1921 {0x13, "dataCDA-1200-75bps" },
1922 {0x14, "dataCDA-2400bps" },
1923 {0x15, "dataCDA-4800bps" },
1924 {0x16, "dataCDA-9600bps" },
1925 {0x17, "general-dataCDA" },
1926
1927 {0x18, "allDataCDS-Services" },
1928 {0x1A, "dataCDS-1200bps" },
1929 {0x1C, "dataCDS-2400bps" },
1930 {0x1D, "dataCDS-4800bps" },
1931 {0x1E, "dataCDS-9600bps" },
1932 {0x1F, "general-dataCDS" },
1933
1934 {0x20, "allPadAccessCA-Services" },
1935 {0x21, "padAccessCA-300bps" },
1936 {0x22, "padAccessCA-1200bps" },
1937 {0x23, "padAccessCA-1200-75bps" },
1938 {0x24, "padAccessCA-2400bps" },
1939 {0x25, "padAccessCA-4800bps" },
1940 {0x26, "padAccessCA-9600bps" },
1941 {0x27, "general-padAccessCA" },
1942
1943 {0x28, "allDataPDS-Services" },
1944 {0x2C, "dataPDS-2400bps" },
1945 {0x2D, "dataPDS-4800bps" },
1946 {0x2E, "dataPDS-9600bps" },
1947 {0x2F, "general-dataPDS" },
1948
1949 {0x30, "allAlternateSpeech-DataCDA" },
1950 {0x38, "allAlternateSpeech-DataCDS" },
1951 {0x40, "allSpeechFollowedByDataCDA" },
1952 {0x48, "allSpeechFollowedByDataCDS" },
1953
1954 {0x50, "allDataCircuitAsynchronous" },
1955 {0x60, "allAsynchronousServices" },
1956 {0x58, "allDataCircuitSynchronous" },
1957 {0x68, "allSynchronousServices" },
1958
1959 {0xD0, "allPLMN-specificBS" },
1960 {0xD1, "plmn-specificBS-1" },
1961 {0xD2, "plmn-specificBS-2" },
1962 {0xD3, "plmn-specificBS-3" },
1963 {0xD4, "plmn-specificBS-4" },
1964 {0xD5, "plmn-specificBS-5" },
1965 {0xD6, "plmn-specificBS-6" },
1966 {0xD7, "plmn-specificBS-7" },
1967 {0xD8, "plmn-specificBS-8" },
1968 {0xD9, "plmn-specificBS-9" },
1969 {0xDA, "plmn-specificBS-A" },
1970 {0xDB, "plmn-specificBS-B" },
1971 {0xDC, "plmn-specificBS-C" },
1972 {0xDD, "plmn-specificBS-D" },
1973 {0xDE, "plmn-specificBS-E" },
1974 {0xDF, "plmn-specificBS-F" },
1975
1976 { 0, NULL }
1977 };
1978
1979 /* ForwardingOptions
1980
1981 -- bit 8: notification to forwarding party
1982 -- 0 no notification
1983 -- 1 notification
1984 */
1985 static const true_false_string notification_value  = {
1986   "Notification",
1987   "No notification"
1988 };
1989 /*
1990 -- bit 7: redirecting presentation
1991 -- 0 no presentation
1992 -- 1 presentation
1993 */
1994 static const true_false_string redirecting_presentation_value  = {
1995   "Presentation",
1996   "No presentationn"
1997 };
1998 /*
1999 -- bit 6: notification to calling party
2000 -- 0 no notification
2001 -- 1 notification
2002 */
2003 /*
2004 -- bit 5: 0 (unused)
2005 -- bits 43: forwarding reason
2006 -- 00 ms not reachable
2007 -- 01 ms busy
2008 -- 10 no reply
2009 -- 11 unconditional when used in a SRI Result,
2010 -- or call deflection when used in a RCH Argument
2011 */
2012 static const value_string forwarding_reason_values[] = {
2013 {0x0, "ms not reachable" },
2014 {0x1, "ms busy" },
2015 {0x2, "no reply" },
2016 {0x3, "unconditional when used in a SRI Result or call deflection when used in a RCH Argument" },
2017 { 0, NULL }
2018 };
2019 /*
2020 -- bits 21: 00 (unused)
2021 */
2022
2023 static const value_string pdp_type_org_values[] = {
2024 {0x0, "ETSI" },
2025 {0x1, "IETF" },
2026 {0xf, "Empty PDP type" },
2027 { 0, NULL }
2028 };
2029
2030 static const value_string etsi_pdp_type_number_values[] = {
2031 {0x0, "Reserved, used in earlier version of this protocol" },
2032 {0x1, "PPP" },
2033 { 0, NULL }
2034 };
2035
2036 static const value_string ietf_pdp_type_number_values[] = {
2037 {0x21, "IPv4 Address" },
2038 {0x57, "IPv6 Address" },
2039 { 0, NULL }
2040 };
2041
2042 /*
2043 ChargingCharacteristics ::= OCTET STRING (SIZE (2))
2044 -- Octets are coded according to 3GPP TS 32.015.
2045 -- From 3GPP TS 32.015.
2046 --
2047 -- Descriptions for the bits of the flag set:
2048 --
2049 -- Bit 1: H (Hot billing) := '00000001'B
2050 -- Bit 2: F (Flat rate) := '00000010'B
2051 -- Bit 3: P (Prepaid service) := '00000100'B
2052 -- Bit 4: N (Normal billing) := '00001000'B
2053 -- Bit 5: - (Reserved, set to 0) := '00010000'B
2054 -- Bit 6: - (Reserved, set to 0) := '00100000'B
2055 -- Bit 7: - (Reserved, set to 0) := '01000000'B
2056 -- Bit 8: - (Reserved, set to 0) := '10000000'B
2057 */
2058 static const value_string chargingcharacteristics_values[] = {
2059 {0x1, "H (Hot billing)" },
2060 {0x2, "F (Flat rate)" },
2061 {0x4, "P (Prepaid service)" },
2062 {0x8, "N (Normal billing)" },
2063 { 0, NULL }
2064 };
2065
2066 /*--- proto_reg_handoff_gsm_map ---------------------------------------*/
2067 static void range_delete_callback(guint32 ssn)
2068 {
2069     if (ssn) {
2070         delete_itu_tcap_subdissector(ssn, map_handle);
2071     }
2072 }
2073
2074 static void range_add_callback(guint32 ssn)
2075 {
2076     if (ssn) {
2077         add_itu_tcap_subdissector(ssn, map_handle);
2078     }
2079 }
2080
2081 void proto_reg_handoff_gsm_map(void) {
2082
2083     static gboolean map_prefs_initialized = FALSE;
2084     static range_t *ssn_range;
2085
2086     if (!map_prefs_initialized) {
2087         map_prefs_initialized = TRUE;
2088         data_handle = find_dissector("data");
2089         ranap_handle = find_dissector("ranap");
2090         dtap_handle = find_dissector("gsm_a_dtap");
2091
2092         map_handle = find_dissector("gsm_map");
2093         register_ber_oid_dissector_handle("0.4.0.0.1.0.1.3", map_handle, proto_gsm_map,"networkLocUpContext-v3");
2094         register_ber_oid_dissector_handle("0.4.0.0.1.0.1.2", map_handle, proto_gsm_map,"networkLocUpContext-v2" );
2095         register_ber_oid_dissector_handle("0.4.0.0.1.0.1.1", map_handle, proto_gsm_map,"networkLocUpContext-v1" );
2096         register_ber_oid_dissector_handle("0.4.0.0.1.0.2.3", map_handle, proto_gsm_map,"locationCancellationContext-v3" );
2097         register_ber_oid_dissector_handle("0.4.0.0.1.0.2.2", map_handle, proto_gsm_map,"locationCancellationContext-v2" );
2098         register_ber_oid_dissector_handle("0.4.0.0.1.0.2.1", map_handle, proto_gsm_map,"locationCancellationContext-v1" );
2099         register_ber_oid_dissector_handle("0.4.0.0.1.0.3.3", map_handle, proto_gsm_map,"roamingNumberEnquiryContext-v3" );
2100         register_ber_oid_dissector_handle("0.4.0.0.1.0.3.2", map_handle, proto_gsm_map,"roamingNumberEnquiryContext-v2" );
2101         register_ber_oid_dissector_handle("0.4.0.0.1.0.3.1", map_handle, proto_gsm_map,"roamingNumberEnquiryContext-v1" );
2102         register_ber_oid_dissector_handle("0.4.0.0.1.0.4.3", map_handle, proto_gsm_map,"istAlertingContext-v3" );
2103         register_ber_oid_dissector_handle("0.4.0.0.1.0.5.3", map_handle, proto_gsm_map,"locationInfoRetrievalContext-v3" );
2104         register_ber_oid_dissector_handle("0.4.0.0.1.0.5.2", map_handle, proto_gsm_map,"locationInfoRetrievalContext-v2" );
2105         register_ber_oid_dissector_handle("0.4.0.0.1.0.5.1", map_handle, proto_gsm_map,"locationInfoRetrievalContext-v1" );
2106         register_ber_oid_dissector_handle("0.4.0.0.1.0.6.4", map_handle, proto_gsm_map,"callControlTransferContext-v4" );
2107         register_ber_oid_dissector_handle("0.4.0.0.1.0.6.3", map_handle, proto_gsm_map,"callControlTransferContext-v3" );
2108         register_ber_oid_dissector_handle("0.4.0.0.1.0.7.3", map_handle, proto_gsm_map,"reportingContext-v3" );
2109         register_ber_oid_dissector_handle("0.4.0.0.1.0.8.3", map_handle, proto_gsm_map,"callCompletionContext-v3" );
2110         register_ber_oid_dissector_handle("0.4.0.0.1.0.9.3", map_handle, proto_gsm_map,"serviceTerminationContext-v3" );
2111         register_ber_oid_dissector_handle("0.4.0.0.1.0.10.2", map_handle, proto_gsm_map,"resetContext-v2" );
2112         register_ber_oid_dissector_handle("0.4.0.0.1.0.10.1", map_handle, proto_gsm_map,"resetContext-v1" );
2113         register_ber_oid_dissector_handle("0.4.0.0.1.0.11.3", map_handle, proto_gsm_map,"handoverControlContext-v3" );
2114         register_ber_oid_dissector_handle("0.4.0.0.1.0.11.2", map_handle, proto_gsm_map,"handoverControlContext-v2" );
2115         register_ber_oid_dissector_handle("0.4.0.0.1.0.11.1", map_handle, proto_gsm_map,"handoverControlContext-v1" );
2116         register_ber_oid_dissector_handle("0.4.0.0.1.0.12.3", map_handle, proto_gsm_map,"sIWFSAllocationContext-v3" );
2117         register_ber_oid_dissector_handle("0.4.0.0.1.0.13.3", map_handle, proto_gsm_map,"equipmentMngtContext-v3" );
2118         register_ber_oid_dissector_handle("0.4.0.0.1.0.13.2", map_handle, proto_gsm_map,"equipmentMngtContext-v2" );
2119         register_ber_oid_dissector_handle("0.4.0.0.1.0.13.1", map_handle, proto_gsm_map,"equipmentMngtContext-v1" );
2120         register_ber_oid_dissector_handle("0.4.0.0.1.0.14.3", map_handle, proto_gsm_map,"infoRetrievalContext-v3" );
2121         register_ber_oid_dissector_handle("0.4.0.0.1.0.14.2", map_handle, proto_gsm_map,"infoRetrievalContext-v2" );
2122         register_ber_oid_dissector_handle("0.4.0.0.1.0.14.1", map_handle, proto_gsm_map,"infoRetrievalContext-v1" );
2123         /* fallback to infoRetrieval(14) version1(1) and not interVlrInfoRetrieval(15) version1(1) */
2124         /*register_ber_oid_dissector_handle("0.4.0.0.1.0.15.1", map_handle, proto_gsm_map,"map-ac interVlrInfoRetrieval(15) version1(1)" );*/
2125         register_ber_oid_dissector_handle("0.4.0.0.1.0.15.2", map_handle, proto_gsm_map,"interVlrInfoRetrievalContext-v2" );
2126         register_ber_oid_dissector_handle("0.4.0.0.1.0.15.3", map_handle, proto_gsm_map,"interVlrInfoRetrievalContext-v3" );
2127         register_ber_oid_dissector_handle("0.4.0.0.1.0.16.3", map_handle, proto_gsm_map,"subscriberDataMngtContext-v3" );
2128         register_ber_oid_dissector_handle("0.4.0.0.1.0.16.2", map_handle, proto_gsm_map,"subscriberDataMngtContext-v2" );
2129         register_ber_oid_dissector_handle("0.4.0.0.1.0.16.1", map_handle, proto_gsm_map,"subscriberDataMngtContext-v1" );
2130         register_ber_oid_dissector_handle("0.4.0.0.1.0.17.3", map_handle, proto_gsm_map,"tracingContext-v3" );
2131         register_ber_oid_dissector_handle("0.4.0.0.1.0.17.2", map_handle, proto_gsm_map,"tracingContext-v2" );
2132         register_ber_oid_dissector_handle("0.4.0.0.1.0.17.1", map_handle, proto_gsm_map,"tracingContext-v1" );
2133         register_ber_oid_dissector_handle("0.4.0.0.1.0.18.2", map_handle, proto_gsm_map,"networkFunctionalSsContext-v2" );
2134         register_ber_oid_dissector_handle("0.4.0.0.1.0.18.1", map_handle, proto_gsm_map,"networkFunctionalSsContext-v1" );
2135         register_ber_oid_dissector_handle("0.4.0.0.1.0.19.2", map_handle, proto_gsm_map,"networkUnstructuredSsContext-v2" );
2136         register_ber_oid_dissector_handle("0.4.0.0.1.0.20.3", map_handle, proto_gsm_map,"shortMsgGatewayContext-v3" );
2137         register_ber_oid_dissector_handle("0.4.0.0.1.0.20.2", map_handle, proto_gsm_map,"shortMsgGatewayContext-v2" );
2138         register_ber_oid_dissector_handle("0.4.0.0.1.0.20.1", map_handle, proto_gsm_map,"shortMsgGatewayContext-v1" );
2139         register_ber_oid_dissector_handle("0.4.0.0.1.0.21.3", map_handle, proto_gsm_map,"shortMsgMO-RelayContext-v3" );
2140         register_ber_oid_dissector_handle("0.4.0.0.1.0.21.2", map_handle, proto_gsm_map,"shortMsgMO-RelayContext-v2" );
2141         register_ber_oid_dissector_handle("0.4.0.0.1.0.21.1", map_handle, proto_gsm_map,"shortMsgMO-RelayContext-v1" );
2142         register_ber_oid_dissector_handle("0.4.0.0.1.0.22.3", map_handle, proto_gsm_map,"subscriberDataModificationNotificationContext-v3" );
2143         register_ber_oid_dissector_handle("0.4.0.0.1.0.23.2", map_handle, proto_gsm_map,"shortMsgAlertContext-v2" );
2144         register_ber_oid_dissector_handle("0.4.0.0.1.0.23.1", map_handle, proto_gsm_map,"shortMsgAlertContext-v1" );
2145         register_ber_oid_dissector_handle("0.4.0.0.1.0.24.3", map_handle, proto_gsm_map,"mwdMngtContext-v3" );
2146         register_ber_oid_dissector_handle("0.4.0.0.1.0.24.2", map_handle, proto_gsm_map,"mwdMngtContext-v2" );
2147         register_ber_oid_dissector_handle("0.4.0.0.1.0.24.1", map_handle, proto_gsm_map,"mwdMngtContext-v1" );
2148         register_ber_oid_dissector_handle("0.4.0.0.1.0.25.3", map_handle, proto_gsm_map,"shortMsgMT-RelayContext-v3" );
2149         register_ber_oid_dissector_handle("0.4.0.0.1.0.25.2", map_handle, proto_gsm_map,"shortMsgMT-RelayContext-v2" );
2150         register_ber_oid_dissector_handle("0.4.0.0.1.0.26.2", map_handle, proto_gsm_map,"imsiRetrievalContext-v2" );
2151         register_ber_oid_dissector_handle("0.4.0.0.1.0.27.2", map_handle, proto_gsm_map,"msPurgingContext-v2" );
2152         register_ber_oid_dissector_handle("0.4.0.0.1.0.27.3", map_handle, proto_gsm_map,"msPurgingContext-v3" );
2153         register_ber_oid_dissector_handle("0.4.0.0.1.0.28.3", map_handle, proto_gsm_map,"subscriberInfoEnquiryContext-v3" );
2154         register_ber_oid_dissector_handle("0.4.0.0.1.0.29.3", map_handle, proto_gsm_map,"anyTimeInfoEnquiryContext-v3" );
2155         register_ber_oid_dissector_handle("0.4.0.0.1.0.31.3", map_handle, proto_gsm_map,"groupCallControlContext-v3" );
2156         register_ber_oid_dissector_handle("0.4.0.0.1.0.32.3", map_handle, proto_gsm_map,"gprsLocationUpdateContext-v3" );
2157         register_ber_oid_dissector_handle("0.4.0.0.1.0.33.4", map_handle, proto_gsm_map,"gprsLocationInfoRetrievalContext-v4" );
2158         register_ber_oid_dissector_handle("0.4.0.0.1.0.33.3", map_handle, proto_gsm_map,"gprsLocationInfoRetrievalContext-v3" );
2159         register_ber_oid_dissector_handle("0.4.0.0.1.0.34.3", map_handle, proto_gsm_map,"failureReportContext-v3" );
2160         register_ber_oid_dissector_handle("0.4.0.0.1.0.35.3", map_handle, proto_gsm_map,"gprsNotifyContext-v3" );
2161         register_ber_oid_dissector_handle("0.4.0.0.1.0.36.3", map_handle, proto_gsm_map,"ss-InvocationNotificationContext-v3" );
2162         register_ber_oid_dissector_handle("0.4.0.0.1.0.37.3", map_handle, proto_gsm_map,"locationSvcGatewayContext-v3" );
2163         register_ber_oid_dissector_handle("0.4.0.0.1.0.38.3", map_handle, proto_gsm_map,"locationSvcEnquiryContext-v3" );
2164         register_ber_oid_dissector_handle("0.4.0.0.1.0.39.3", map_handle, proto_gsm_map,"authenticationFailureReportContext-v3" );
2165         register_ber_oid_dissector_handle("0.4.0.0.1.0.40.3", map_handle, proto_gsm_map,"secureTransportHandlingContext-v3" );
2166         register_ber_oid_dissector_handle("0.4.0.0.1.0.41.3", map_handle, proto_gsm_map,"shortMsgMT-Relay-VGCS-Context-v3" );
2167         register_ber_oid_dissector_handle("0.4.0.0.1.0.42.3", map_handle, proto_gsm_map,"mm-EventReportingContext-v3" );
2168         register_ber_oid_dissector_handle("0.4.0.0.1.0.43.3", map_handle, proto_gsm_map,"anyTimeInfoHandlingContext-v3" );
2169         register_ber_oid_dissector_handle("0.4.0.0.1.0.44.3", map_handle, proto_gsm_map,"resourceManagementContext-v3" );
2170         register_ber_oid_dissector_handle("0.4.0.0.1.0.45.3", map_handle, proto_gsm_map,"groupCallInfoRetrievalContext-v3" );
2171         /* Private extension container */
2172         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" );
2173     }
2174     else {
2175         range_foreach(ssn_range, range_delete_callback);
2176         g_free(ssn_range);
2177     }
2178
2179     ssn_range = range_copy(global_ssn_range);
2180     range_foreach(ssn_range, range_add_callback);
2181
2182 }
2183
2184 /*--- proto_register_gsm_map -------------------------------------------*/
2185 void proto_register_gsm_map(void) {
2186         module_t *gsm_map_module;
2187
2188   /* List of fields */
2189   static hf_register_info hf[] = {
2190       { &hf_gsm_map_old_Component_PDU,
2191         { "Component", "gsm_map.old.Component",
2192           FT_UINT32, BASE_DEC, VALS(gsm_old_Component_vals), 0,
2193           NULL, HFILL }},
2194       { &hf_gsm_map_getPassword,
2195         { "getPassword", "gsm_map.getPassword",
2196           FT_UINT8, BASE_DEC, VALS(gsm_old_GetPasswordArg_vals), 0,
2197           NULL, HFILL }},
2198       { &hf_gsm_map_currentPassword,
2199         { "currentPassword", "gsm_map.currentPassword",
2200           FT_STRING, BASE_NONE, NULL, 0,
2201           NULL, HFILL }},
2202       { &hf_gsm_map_extension,
2203         { "Extension", "gsm_map.extension",
2204           FT_BOOLEAN, 8, TFS(&gsm_map_extension_value), 0x80,
2205           NULL, HFILL }},
2206       { &hf_gsm_map_nature_of_number,
2207         { "Nature of number", "gsm_map.nature_of_number",
2208           FT_UINT8, BASE_HEX, VALS(gsm_map_nature_of_number_values), 0x70,
2209           NULL, HFILL }},
2210       { &hf_gsm_map_number_plan,
2211         { "Number plan", "gsm_map.number_plan",
2212           FT_UINT8, BASE_HEX, VALS(gsm_map_number_plan_values), 0x0f,
2213           NULL, HFILL }},
2214       { &hf_gsm_map_isdn_address_digits,
2215         { "ISDN Address digits", "gsm_map.isdn.address.digits",
2216           FT_STRING, BASE_NONE, NULL, 0,
2217           NULL, HFILL }},
2218       { &hf_gsm_map_address_digits,
2219         { "Address digits", "gsm_map.address.digits",
2220           FT_STRING, BASE_NONE, NULL, 0,
2221           NULL, HFILL }},
2222       { &hf_gsm_map_servicecentreaddress_digits,
2223         { "ServiceCentreAddress digits", "gsm_map.servicecentreaddress_digits",
2224           FT_STRING, BASE_NONE, NULL, 0,
2225           NULL, HFILL }},
2226       { &hf_gsm_map_imsi_digits,
2227         { "IMSI digits", "gsm_map.imsi_digits",
2228           FT_STRING, BASE_NONE, NULL, 0,
2229           NULL, HFILL }},
2230       { &hf_gsm_map_TBCD_digits,
2231         { "TBCD digits", "gsm_map.imsi_digits",
2232           FT_STRING, BASE_NONE, NULL, 0,
2233           NULL, HFILL }},
2234       { &hf_gsm_map_Ss_Status_unused,
2235         { "Unused", "gsm_map.unused",
2236           FT_UINT8, BASE_HEX, NULL, 0xf0,
2237           NULL, HFILL }},
2238       { &hf_gsm_map_Ss_Status_q_bit,
2239         { "Q bit", "gsm_map.ss_status_q_bit",
2240           FT_BOOLEAN, 8, TFS(&gsm_map_Ss_Status_q_bit_values), 0x08,
2241           NULL, HFILL }},
2242       { &hf_gsm_map_Ss_Status_p_bit,
2243         { "P bit", "gsm_map.ss_status_p_bit",
2244           FT_BOOLEAN, 8, TFS(&gsm_map_Ss_Status_p_values), 0x04,
2245           NULL, HFILL }},
2246       { &hf_gsm_map_Ss_Status_r_bit,
2247         { "R bit", "gsm_map.ss_status_r_bit",
2248           FT_BOOLEAN, 8, TFS(&gsm_map_Ss_Status_r_values), 0x02,
2249           NULL, HFILL }},
2250       { &hf_gsm_map_Ss_Status_a_bit,
2251         { "A bit", "gsm_map.ss_status_a_bit",
2252           FT_BOOLEAN, 8, TFS(&gsm_map_Ss_Status_a_values), 0x01,
2253           NULL, HFILL }},
2254       { &hf_gsm_map_notification_to_forwarding_party,
2255         { "Notification to forwarding party", "gsm_map.notification_to_forwarding_party",
2256           FT_BOOLEAN, 8, TFS(&notification_value), 0x80,
2257           NULL, HFILL }},
2258       { &hf_gsm_map_redirecting_presentation,
2259         { "Redirecting presentation", "gsm_map.redirecting_presentation",
2260           FT_BOOLEAN, 8, TFS(&redirecting_presentation_value), 0x40,
2261           NULL, HFILL }},
2262       { &hf_gsm_map_notification_to_calling_party,
2263         { "Notification to calling party", "gsm_map.notification_to_clling_party",
2264           FT_BOOLEAN, 8, TFS(&notification_value), 0x20,
2265           NULL, HFILL }},
2266       { &hf_gsm_map_forwarding_reason,
2267         { "Forwarding reason", "gsm_map.forwarding_reason",
2268           FT_UINT8, BASE_HEX, VALS(forwarding_reason_values), 0x0c,
2269           NULL, HFILL }},
2270       { &hf_gsm_map_pdp_type_org,
2271         { "PDP Type Organization", "gsm_map.pdp_type_org",
2272           FT_UINT8, BASE_HEX, VALS(pdp_type_org_values), 0x0f,
2273           NULL, HFILL }},
2274       { &hf_gsm_map_etsi_pdp_type_number,
2275         { "PDP Type Number", "gsm_map.pdp_type_org",
2276           FT_UINT8, BASE_HEX, VALS(etsi_pdp_type_number_values), 0,
2277           "ETSI PDP Type Number", HFILL }},
2278       { &hf_gsm_map_ietf_pdp_type_number,
2279         { "PDP Type Number", "gsm_map.ietf_pdp_type_number",
2280           FT_UINT8, BASE_HEX, VALS(ietf_pdp_type_number_values), 0,
2281           "IETF PDP Type Number", HFILL }},
2282       { &hf_gsm_map_ext_qos_subscribed_pri,
2283         { "Allocation/Retention priority", "gsm_map.ext_qos_subscribed_pri",
2284           FT_UINT8, BASE_DEC, NULL, 0xff,
2285           NULL, HFILL }},
2286       { &hf_gsm_map_qos_traffic_cls,
2287         { "Traffic class", "gsm_map.qos.traffic_cls",
2288           FT_UINT8, BASE_DEC, VALS(gsm_a_qos_traffic_cls_vals), 0xe0,
2289           NULL, HFILL }},
2290       { &hf_gsm_map_qos_del_order,
2291         { "Delivery order", "gsm_map.qos.del_order",
2292           FT_UINT8, BASE_DEC, VALS(gsm_a_qos_traffic_cls_vals), 0x18,
2293           NULL, HFILL }},
2294       { &hf_gsm_map_qos_del_of_err_sdu,
2295         { "Delivery of erroneous SDUs", "gsm_map.qos.del_of_err_sdu",
2296           FT_UINT8, BASE_DEC, VALS(gsm_a_qos_del_of_err_sdu_vals), 0x03,
2297           NULL, HFILL }},
2298       { &hf_gsm_map_qos_ber,
2299         { "Residual Bit Error Rate (BER)", "gsm_map.qos.ber",
2300           FT_UINT8, BASE_DEC, VALS(gsm_a_qos_ber_vals), 0xf0,
2301           NULL, HFILL }},
2302       { &hf_gsm_map_qos_sdu_err_rat,
2303         { "SDU error ratio", "gsm_map.qos.sdu_err_rat",
2304           FT_UINT8, BASE_DEC, VALS(gsm_a_qos_sdu_err_rat_vals), 0x0f,
2305           NULL, HFILL }},
2306       { &hf_gsm_map_qos_traff_hdl_pri,
2307         { "Traffic handling priority", "gsm_map.qos.traff_hdl_pri",
2308           FT_UINT8, BASE_DEC, VALS(gsm_a_qos_traff_hdl_pri_vals), 0x03,
2309           NULL, HFILL }},
2310
2311       { &hf_gsm_map_qos_max_sdu,
2312         { "Maximum SDU size", "gsm_map.qos.max_sdu",
2313           FT_UINT32, BASE_DEC, NULL, 0x0,
2314           NULL, HFILL }},
2315       { &hf_gsm_map_max_brate_ulink,
2316         { "Maximum bit rate for uplink in kbit/s", "gsm_map.qos.max_brate_ulink",
2317           FT_UINT32, BASE_DEC, NULL, 0x0,
2318           "Maximum bit rate for uplink", HFILL }},
2319       { &hf_gsm_map_max_brate_dlink,
2320         { "Maximum bit rate for downlink in kbit/s", "gsm_map.qos.max_brate_dlink",
2321           FT_UINT32, BASE_DEC, NULL, 0x0,
2322           "Maximum bit rate for downlink", HFILL }},
2323       { &hf_gsm_map_qos_transfer_delay,
2324         { "Transfer delay (Raw data see TS 24.008 for interpretation)", "gsm_map.qos.transfer_delay",
2325           FT_UINT8, BASE_DEC, NULL, 0xfc,
2326           "Transfer delay", HFILL }},
2327       { &hf_gsm_map_guaranteed_max_brate_ulink,
2328         { "Guaranteed bit rate for uplink in kbit/s", "gsm_map.qos.brate_ulink",
2329           FT_UINT32, BASE_DEC, NULL, 0x0,
2330           "Guaranteed bit rate for uplink", HFILL }},
2331       { &hf_gsm_map_guaranteed_max_brate_dlink,
2332         { "Guaranteed bit rate for downlink in kbit/s", "gsm_map.qos.brate_dlink",
2333           FT_UINT32, BASE_DEC, NULL, 0x0,
2334           "Guaranteed bit rate for downlink", HFILL }},
2335       { &hf_gsm_map_GSNAddress_IPv4,
2336         { "GSN-Address IPv4",  "gsm_map.gsnaddress_ipv4",
2337           FT_IPv4, BASE_NONE, NULL, 0,
2338           "IPAddress IPv4", HFILL }},
2339       { &hf_gsm_map_GSNAddress_IPv6,
2340         { "GSN Address IPv6",  "gsm_map.gsnaddress_ipv6",
2341           FT_IPv4, BASE_NONE, NULL, 0,
2342           "IPAddress IPv6", HFILL }},
2343       { &hf_gsm_map_ranap_service_Handover,
2344         { "service-Handover", "gsm_map.ranap.service_Handover",
2345           FT_UINT32, BASE_DEC, VALS(ranap_Service_Handover_vals), 0,
2346           "gsm_map.ranap.Service_Handover", HFILL }},
2347       { &hf_gsm_map_IntegrityProtectionInformation,
2348         { "IntegrityProtectionInformation", "gsm_map.ranap.IntegrityProtectionInformation",
2349           FT_NONE, BASE_NONE, NULL, 0,
2350           "gsm_map.ranap.IntegrityProtectionInformation", HFILL }},
2351       { &hf_gsm_map_EncryptionInformation,
2352         { "EncryptionInformation", "gsm_map.ranap.EncryptionInformation",
2353           FT_NONE, BASE_NONE, NULL, 0,
2354           "gsm_map.ranap.EncryptionInformation", HFILL }},
2355       { &hf_gsm_map_PlmnContainer_PDU,
2356         { "PlmnContainer", "gsm_map.PlmnContainer",
2357           FT_NONE, BASE_NONE, NULL, 0,
2358           "gsm_map.PlmnContainer", HFILL }},
2359       { &hf_gsm_map_ss_SS_UserData,
2360         { "SS-UserData", "gsm_ss.SS_UserData",
2361           FT_STRING, BASE_NONE, NULL, 0,
2362           "gsm_map.ss.SS_UserData", HFILL }},
2363       { &hf_gsm_map_cbs_coding_grp,
2364         { "Coding Group","gsm_map.cbs.coding_grp",
2365           FT_UINT8,BASE_DEC, VALS(gsm_map_cbs_data_coding_scheme_coding_grp_vals), 0xf0,
2366           NULL, HFILL }
2367       },
2368       { &hf_gsm_map_cbs_coding_grp0_lang,
2369         { "Language","gsm_map.cbs.coding_grp0_lang",
2370           FT_UINT8,BASE_DEC, VALS(gsm_map_cbs_coding_grp0_lang_vals), 0x0f,
2371           NULL, HFILL }
2372       },
2373       { &hf_gsm_map_cbs_coding_grp1_lang,
2374         { "Language","gsm_map.cbs.coding_grp1_lang",
2375           FT_UINT8,BASE_DEC, VALS(gsm_map_cbs_coding_grp1_lang_vals), 0x0f,
2376           NULL, HFILL }
2377       },
2378       { &hf_gsm_map_cbs_coding_grp2_lang,
2379         { "Language","gsm_map.cbs.coding_grp2_lang",
2380           FT_UINT8,BASE_DEC, VALS(gsm_map_cbs_coding_grp2_lang_vals), 0x0f,
2381           NULL, HFILL }
2382       },
2383       { &hf_gsm_map_cbs_coding_grp3_lang,
2384         { "Language","gsm_map.cbs.coding_grp3_lang",
2385           FT_UINT8,BASE_DEC, VALS(gsm_map_cbs_coding_grp3_lang_vals), 0x0f,
2386           NULL, HFILL }
2387       },
2388       { &hf_gsm_map_cbs_coding_grp4_7_comp,
2389         { "Compressed indicator","gsm_map.cbs.coding_grp4_7_comp",
2390           FT_BOOLEAN, 8, TFS(&gsm_map_cbs_coding_grp4_7_comp_vals), 0x20,
2391           NULL, HFILL }
2392       },
2393       { &hf_gsm_map_cbs_coding_grp4_7_class_ind,
2394         { "Message Class present","gsm_map.cbs.coding_grp4_7_class_ind",
2395           FT_BOOLEAN, 8, TFS(&gsm_map_cbs_coding_grp4_7_class_ind_vals), 0x10,
2396           NULL, HFILL }
2397       },
2398       { &hf_gsm_map_cbs_coding_grp4_7_char_set,
2399         { "Character set being used","gsm_map.cbs.coding_grp4_7_char_set",
2400           FT_UINT8,BASE_DEC, VALS(gsm_map_cbs_coding_grp4_7_char_set_vals), 0x0c,
2401           NULL, HFILL }
2402       },
2403       { &hf_gsm_map_cbs_coding_grp4_7_class,
2404         { "Message Class","gsm_map.cbs.coding_grp4_7_class",
2405           FT_UINT8,BASE_DEC, VALS(gsm_map_cbs_coding_grp4_7_class_vals), 0x03,
2406           NULL, HFILL }
2407       },
2408       { &hf_gsm_map_cbs_coding_grp15_mess_code,
2409         { "Message coding","gsm_map.cbs.cbs_coding_grp15_mess_code",
2410           FT_UINT8,BASE_DEC, VALS(gsm_map_cbs_coding_grp15_mess_code_vals), 0x04,
2411           NULL, HFILL }
2412       },
2413       { &hf_gsm_map_cbs_coding_grp15_class,
2414         { "Message Class","gsm_map.cbs.gsm_map_cbs_coding_grp15_class",
2415           FT_UINT8,BASE_DEC, VALS(gsm_map_cbs_coding_grp15_class_vals), 0x03,
2416           NULL, HFILL }
2417       },
2418       { &hf_gsm_map_tmsi,
2419         { "tmsi", "gsm_map.tmsi",
2420           FT_BYTES, BASE_NONE, NULL, 0,
2421           "gsm_map.TMSI", HFILL }},
2422
2423       { &hf_gsm_map_ie_tag,
2424         { "Tag", "gsm_map.ie_tag",
2425           FT_UINT8, BASE_DEC, VALS(gsm_map_tag_vals), 0,
2426           "GSM 04.08 tag", HFILL }},
2427       { &hf_gsm_map_len,
2428         { "Length", "gsm_map.length",
2429           FT_UINT8, BASE_DEC, NULL, 0,
2430           NULL, HFILL }},
2431       { &hf_gsm_map_disc_par,
2432         { "Discrimination parameter", "gsm_map.disc_par",
2433           FT_UINT8, BASE_DEC, VALS(gsm_map_disc_par_vals), 0,
2434           NULL, HFILL }},
2435       { &hf_gsm_map_dlci,
2436         { "DLCI", "gsm_map.disc_par",
2437           FT_UINT8, BASE_DEC, NULL, 0,
2438           "Data Link Connection Indicator", HFILL }},
2439
2440 #include "packet-gsm_map-hfarr.c"
2441   };
2442
2443   /* List of subtrees */
2444   static gint *ett[] = {
2445     &ett_gsm_map,
2446     &ett_gsm_map_InvokeId,
2447     &ett_gsm_map_InvokePDU,
2448     &ett_gsm_map_ReturnResultPDU,
2449     &ett_gsm_map_ReturnErrorPDU,
2450     &ett_gsm_map_ReturnResult_result,
2451     &ett_gsm_map_ReturnError_result,
2452     &ett_gsm_map_GSMMAPPDU,
2453     &ett_gsm_map_ext_qos_subscribed,
2454     &ett_gsm_map_pdptypenumber,
2455     &ett_gsm_map_RAIdentity,
2456     &ett_gsm_map_LAIFixedLength,
2457     &ett_gsm_map_isdn_address_string,
2458     &ett_gsm_map_geo_desc,
2459     &ett_gsm_map_LongSignalInfo,
2460     &ett_gsm_map_RadioResourceInformation,
2461     &ett_gsm_map_MSNetworkCapability,
2462     &ett_gsm_map_MSRadioAccessCapability,
2463     &ett_gsm_map_externalsignalinfo,
2464     &ett_gsm_map_cbs_data_coding,
2465     &ett_gsm_map_GlobalCellId,
2466     &ett_gsm_map_GeographicalInformation,
2467
2468 #include "packet-gsm_map-ettarr.c"
2469   };
2470
2471   /* Register protocol */
2472   proto_gsm_map_dialogue =proto_gsm_map = proto_register_protocol(PNAME, PSNAME, PFNAME);
2473
2474   register_dissector("gsm_map", dissect_gsm_map, proto_gsm_map);
2475
2476   /* Register fields and subtrees */
2477   proto_register_field_array(proto_gsm_map, hf, array_length(hf));
2478   proto_register_subtree_array(ett, array_length(ett));
2479
2480   sms_dissector_table = register_dissector_table("gsm_map.sms_tpdu",
2481                                                  "GSM SMS TPDU", FT_UINT8,
2482                                                  BASE_DEC);
2483
2484   gsm_map_tap = register_tap("gsm_map");
2485
2486 #include "packet-gsm_map-dis-tab.c" */
2487   oid_add_from_string("ericsson-gsm-Map-Ext","1.2.826.0.1249.58.1.0" );
2488   oid_add_from_string("accessTypeNotAllowed-id","1.3.12.2.1107.3.66.1.2");
2489   /*oid_add_from_string("map-ac networkLocUp(1) version3(3)","0.4.0.0.1.0.1.3" );
2490    *
2491    * Register our configuration options, particularly our ssn:s
2492    * Set default SSNs
2493    */
2494   range_convert_str(&global_ssn_range, "6-9", MAX_SSN);
2495
2496   gsm_map_module = prefs_register_protocol(proto_gsm_map, proto_reg_handoff_gsm_map);
2497
2498   prefs_register_range_preference(gsm_map_module, "tcap.ssn", "TCAP SSNs",
2499                                   "TCAP Subsystem numbers used for GSM MAP",
2500                                   &global_ssn_range, MAX_SSN);
2501 }