Fix Bugs
[obnox/wireshark/wip.git] / asn1 / gsmmap / packet-gsm_map-template.c
1 /* packet-gsm_map-template.c
2  * Routines for GSM MobileApplication packet dissection
3  * Copyright 2004 - 2006 , Anders Broman <anders.broman [AT] ericsson.com>
4  * Based on the dissector by:
5  * Felix Fei <felix.fei [AT] utstar.com>
6  * and Michael Lum <mlum [AT] telostech.com>
7  *
8  * $Id$
9  *
10  * Ethereal - Network traffic analyzer
11  * By Gerald Combs <gerald@ethereal.com>
12  * Copyright 1998 Gerald Combs
13  *
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * as published by the Free Software Foundation; either version 2
17  * of the License, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
27  * References: ETSI TS 129 002
28  * Updated to ETSI TS 129 002 V6.9.0 (2005-3GPP TS 29.002 version 6.9.0 Release 6)
29  */
30
31 #ifdef HAVE_CONFIG_H
32 # include "config.h"
33 #endif
34
35 #include <glib.h>
36 #include <epan/packet.h>
37 #include <epan/prefs.h>
38 #include <epan/conversation.h>
39 #include <epan/tap.h>
40 #include <epan/emem.h>
41
42 #include <stdio.h>
43 #include <string.h>
44
45 #include "packet-ber.h"
46 #include "packet-q931.h"
47 #include "packet-gsm_map.h"
48 #include "packet-gsm_a.h"
49 #include "packet-tcap.h"
50 #include "packet-e212.h"
51
52 #define PNAME  "GSM Mobile Application"
53 #define PSNAME "GSM_MAP"
54 #define PFNAME "gsm_map"
55
56 /* Initialize the protocol and registered fields */
57 int proto_gsm_map = -1;
58 /*
59 static int hf_gsm_map_invokeCmd = -1;             / Opcode /
60 static int hf_gsm_map_invokeid = -1;              / INTEGER /
61 static int hf_gsm_map_absent = -1;                / NULL /
62 static int hf_gsm_map_invokeId = -1;              / InvokeId /
63 static int hf_gsm_map_invoke = -1;                / InvokePDU /
64 static int hf_gsm_map_returnResult = -1;          / InvokePDU /
65 static int hf_gsm_map_returnResult_result = -1;
66 static int hf_gsm_map_returnError_result = -1;
67 static int hf_gsm_map_returnError = -1;
68 static int hf_gsm_map_local_errorCode = -1;
69 static int hf_gsm_map_global_errorCode_oid = -1;
70 static int hf_gsm_map_global_errorCode = -1;
71 */
72 static int hf_gsm_map_SendAuthenticationInfoArg = -1;
73 static int hf_gsm_map_SendAuthenticationInfoRes = -1;
74 static int hf_gsm_mapSendEndSignal = -1;
75 static int hf_gsm_map_getPassword = -1;
76 static int hf_gsm_map_CheckIMEIArg = -1;
77 static int hf_gsm_map_currentPassword = -1;
78 static int hf_gsm_map_extension = -1;
79 static int hf_gsm_map_nature_of_number = -1;
80 static int hf_gsm_map_number_plan = -1;
81 static int hf_gsm_map_isdn_address_digits = -1;
82 static int hf_gsm_map_address_digits = -1;
83 static int hf_gsm_map_servicecentreaddress_digits = -1;
84 static int hf_gsm_map_imsi_digits = -1;
85 static int hf_gsm_map_Ss_Status_unused = -1;
86 static int hf_gsm_map_Ss_Status_q_bit = -1;
87 static int hf_gsm_map_Ss_Status_p_bit = -1;
88 static int hf_gsm_map_Ss_Status_r_bit = -1;
89 static int hf_gsm_map_Ss_Status_a_bit = -1;
90 static int hf_gsm_map_notification_to_forwarding_party = -1;
91 static int hf_gsm_map_redirecting_presentation = -1;
92 static int hf_gsm_map_notification_to_calling_party = -1;
93 static int hf_gsm_map_forwarding_reason = -1;
94 static int hf_gsm_map_pdp_type_org = -1;
95 static int hf_gsm_map_etsi_pdp_type_number = -1;
96 static int hf_gsm_map_ietf_pdp_type_number = -1;
97 static int hf_gsm_map_ext_qos_subscribed_pri = -1;
98
99 static int hf_gsm_map_qos_traffic_cls = -1;
100 static int hf_gsm_map_qos_del_order = -1;
101 static int hf_gsm_map_qos_del_of_err_sdu = -1;
102 static int hf_gsm_map_qos_ber = -1;
103 static int hf_gsm_map_qos_sdu_err_rat = -1;
104 static int hf_gsm_map_qos_traff_hdl_pri = -1;
105 static int hf_gsm_map_qos_max_sdu = -1;
106 static int hf_gsm_map_max_brate_ulink = -1;
107 static int hf_gsm_map_max_brate_dlink = -1;
108 static int hf_gsm_map_qos_transfer_delay = -1;
109 static int hf_gsm_map_guaranteed_max_brate_ulink = -1;
110 static int hf_gsm_map_guaranteed_max_brate_dlink = -1;
111 static int hf_gsm_map_GSNAddress_IPv4 = -1;
112 static int hf_gsm_map_GSNAddress_IPv6 = -1;
113 #include "packet-gsm_map-hf.c"
114
115 /* Initialize the subtree pointers */
116 static gint ett_gsm_map = -1;
117 static gint ett_gsm_map_InvokeId = -1;
118 static gint ett_gsm_map_InvokePDU = -1;
119 static gint ett_gsm_map_ReturnResultPDU = -1;
120 static gint ett_gsm_map_ReturnErrorPDU = -1;
121 static gint ett_gsm_map_ReturnResult_result = -1;
122 static gint ett_gsm_map_ReturnError_result = -1;
123 static gint ett_gsm_map_GSMMAPPDU = -1;
124 static gint ett_gsm_map_ext_qos_subscribed = -1;
125 static gint ett_gsm_map_pdptypenumber = -1;
126 static gint ett_gsm_map_RAIdentity = -1; 
127 static gint ett_gsm_map_LAIFixedLength = -1;
128
129 #include "packet-gsm_map-ett.c"
130
131 static dissector_table_t        sms_dissector_table;    /* SMS TPDU */
132 static dissector_handle_t data_handle;
133
134 /* Preferenc settings default */
135 #define MAX_SSN 254
136 static range_t *global_ssn_range;
137 static range_t *ssn_range;
138 dissector_handle_t      map_handle;
139
140 /* Global variables */
141 static guint32 opcode=0;
142 static guint32 errorCode;
143 static proto_tree *top_tree;
144 static int application_context_version;
145 gint protocolId;
146 gint AccessNetworkProtocolId;
147 static int gsm_map_tap = -1;
148
149 /* Forward declarations */
150 static int dissect_invokeData(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
151 static int dissect_returnResultData(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
152 static int dissect_returnErrorData(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
153
154 /* Value strings */
155
156 const value_string gsm_map_PDP_Type_Organisation_vals[] = {
157   {  0, "ETSI" },
158   {  1, "IETF" },
159   { 0, NULL }
160 };
161
162 const value_string gsm_map_ietf_defined_pdp_vals[] = {
163   {  0x21, "IPv4 Address" },
164   {  0x57, "IPv6 Address" },
165   { 0, NULL }
166 };
167
168 const value_string gsm_map_etsi_defined_pdp_vals[] = {
169   {  1, "PPP" },
170   { 0, NULL }
171 };
172
173 char*
174 unpack_digits(tvbuff_t *tvb, int offset){
175
176         int length;
177         guint8 octet;
178         int i=0;
179         char *digit_str;
180
181         length = tvb_length(tvb);
182         if (length < offset)
183                 return "";
184         digit_str = ep_alloc((length - offset)*2+1);
185
186         while ( offset < length ){
187
188                 octet = tvb_get_guint8(tvb,offset);
189                 digit_str[i] = ((octet & 0x0f) + '0');
190                 i++;
191
192                 /*
193                  * unpack second value in byte
194                  */
195                 octet = octet >> 4;
196
197                 if (octet == 0x0f)      /* odd number bytes - hit filler */
198                         break;
199
200                 digit_str[i] = ((octet & 0x0f) + '0');
201                 i++;
202                 offset++;
203
204         }
205         digit_str[i]= '\0';
206         return digit_str;
207 }
208
209 /* returns value in kb/s */
210 static guint
211 gsm_map_calc_bitrate(guint8 value){
212
213         guint8 granularity;
214         guint returnvalue; 
215
216         if (value == 0xff)
217                 return 0;
218
219         granularity = value >> 6;
220         returnvalue = value & 0x7f;
221         switch (granularity){
222         case 0:
223                 break;
224         case 1:
225                 returnvalue = ((returnvalue - 0x40) << 3)+64;
226                 break;
227         case 2:
228                 returnvalue = (returnvalue << 6)+576;
229                 break;
230         case 3:
231                 returnvalue = (returnvalue << 6)+576;
232                 break;
233         }
234         return returnvalue;
235
236 }
237
238 static void 
239 dissect_gsm_map_ext_qos_subscribed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){
240         int offset = 0;
241     proto_item *item;
242     proto_tree *subtree;
243         guint8 octet;
244         guint16 value;
245
246         item = get_ber_last_created_item();
247         subtree = proto_item_add_subtree(item, ett_gsm_map_ext_qos_subscribed);
248         /*  OCTET 1:
249                 Allocation/Retention Priority (This octet encodes each priority level defined in
250                 23.107 as the binary value of the priority level, declaration in 29.060)
251                 Octets 2-9 are coded according to 3GPP TS 24.008[35] Quality of Service Octets
252                 6-13.
253          */
254         /* Allocation/Retention Priority */
255         proto_tree_add_item(subtree, hf_gsm_map_ext_qos_subscribed_pri, tvb, offset, 1, FALSE);
256         offset++;
257
258         /* Quality of Service Octets 6-13.( Octet 2 - 9 Here) */
259
260         /* Traffic class, octet 6 (see 3GPP TS 23.107) Bits 8 7 6 */
261         proto_tree_add_item(subtree, hf_gsm_map_qos_traffic_cls, tvb, offset, 1, FALSE);
262         /* Delivery order, octet 6 (see 3GPP TS 23.107) Bits 5 4 */
263         proto_tree_add_item(subtree, hf_gsm_map_qos_del_order, tvb, offset, 1, FALSE);
264         /* Delivery of erroneous SDUs, octet 6 (see 3GPP TS 23.107) Bits 3 2 1 */
265         proto_tree_add_item(subtree, hf_gsm_map_qos_del_of_err_sdu, tvb, offset, 1, FALSE);
266         offset++;
267
268         /* Maximum SDU size, octet 7 (see 3GPP TS 23.107) */
269         octet = tvb_get_guint8(tvb,offset);
270         switch (octet){
271         case 0:
272                 proto_tree_add_text(subtree, tvb, offset, 1, "Subscribed Maximum SDU size/Reserved");
273                 break;
274         case 0x93:
275                 value = 1502;
276                 proto_tree_add_uint(subtree, hf_gsm_map_qos_max_sdu, tvb, offset, 1, value);
277                 break;
278         case 0x98:
279                 value = 1510;
280                 proto_tree_add_uint(subtree, hf_gsm_map_qos_max_sdu, tvb, offset, 1, value);
281                 break;
282         case 0x99:
283                 value = 1532;
284                 proto_tree_add_uint(subtree, hf_gsm_map_qos_max_sdu, tvb, offset, 1, value);
285                 break;
286         default:
287                 if (octet<0x97){
288                         value = octet * 10;
289                         proto_tree_add_uint(subtree, hf_gsm_map_qos_max_sdu, tvb, offset, 1, value);
290                 }else{
291                         proto_tree_add_text(subtree, tvb, offset, 1, "Maximum SDU size value 0x%x not defined in TS 24.008",octet);
292                 }                       
293         }
294         offset++;
295
296         /* Maximum bit rate for uplink, octet 8 */
297         octet = tvb_get_guint8(tvb,offset);
298         if (octet == 0 ){
299                 proto_tree_add_text(subtree, tvb, offset, 1, "Subscribed Maximum bit rate for uplink/Reserved"  );
300         }else{
301                 proto_tree_add_uint(subtree, hf_gsm_map_max_brate_ulink, tvb, offset, 1, gsm_map_calc_bitrate(octet));
302         }
303         offset++;
304         /* Maximum bit rate for downlink, octet 9 (see 3GPP TS 23.107) */
305         octet = tvb_get_guint8(tvb,offset);
306         if (octet == 0 ){
307                 proto_tree_add_text(subtree, tvb, offset, 1, "Subscribed Maximum bit rate for downlink/Reserved"  );
308         }else{
309                 proto_tree_add_uint(subtree, hf_gsm_map_max_brate_dlink, tvb, offset, 1, gsm_map_calc_bitrate(octet));
310         }
311         offset++;
312         /* Residual Bit Error Rate (BER), octet 10 (see 3GPP TS 23.107) Bits 8 7 6 5 */ 
313         proto_tree_add_item(subtree, hf_gsm_map_qos_ber, tvb, offset, 1, FALSE);
314         /* SDU error ratio, octet 10 (see 3GPP TS 23.107) */
315         proto_tree_add_item(subtree, hf_gsm_map_qos_sdu_err_rat, tvb, offset, 1, FALSE);
316         offset++;
317
318         /* Transfer delay, octet 11 (See 3GPP TS 23.107) Bits 8 7 6 5 4 3 */
319         proto_tree_add_item(subtree, hf_gsm_map_qos_transfer_delay, tvb, offset, 1, FALSE);
320         /* Traffic handling priority, octet 11 (see 3GPP TS 23.107) Bits 2 1 */
321         proto_tree_add_item(subtree, hf_gsm_map_qos_traff_hdl_pri, tvb, offset, 1, FALSE);
322         offset++;
323
324         /*      Guaranteed bit rate for uplink, octet 12 (See 3GPP TS 23.107)
325                 Coding is identical to that of Maximum bit rate for uplink.
326          */
327         octet = tvb_get_guint8(tvb,offset);
328         if (octet == 0 ){
329                 proto_tree_add_text(subtree, tvb, offset, 1, "Subscribed Guaranteed bit rate for uplink/Reserved"  );
330         }else{
331                 proto_tree_add_uint(subtree, hf_gsm_map_guaranteed_max_brate_ulink, tvb, offset, 1, gsm_map_calc_bitrate(octet));
332         }
333         offset++;
334
335         /*      Guaranteed bit rate for downlink, octet 13(See 3GPP TS 23.107)
336                 Coding is identical to that of Maximum bit rate for uplink.
337          */
338         octet = tvb_get_guint8(tvb,offset);
339         if (octet == 0 ){
340                 proto_tree_add_text(subtree, tvb, offset, 1, "Subscribed Guaranteed bit rate for downlink/Reserved"  );
341         }else{
342                 proto_tree_add_uint(subtree, hf_gsm_map_guaranteed_max_brate_dlink, tvb, offset, 1, gsm_map_calc_bitrate(octet));
343         }
344
345 }
346
347 #include "packet-gsm_map-fn.c"
348
349 const value_string gsm_map_opr_code_strings[] = {
350   {   2, "updateLocation" },
351   {   3, "cancelLocation" },
352   {   4, "provideRoamingNumber" },
353   {       5, "noteSubscriberDataModified" },    
354   {   6, "resumeCallHandling" },
355   {   7, "insertSubscriberData" },
356   {   8, "deleteSubscriberData" },
357   {   9, "sendParameters" },                                    /* map-ac infoRetrieval (14) version1 (1)*/
358   {  10, "registerSS" },
359   {  11, "eraseSS" },
360   {  12, "activateSS" },
361   {  13, "deactivateSS" },
362   {  14, "interrogateSS" },
363   {      15, "authenticationFailureReport" },   
364   {  17, "registerPassword" },
365   {  18, "getPassword" },
366   {  19, "processUnstructuredSS-Data" },                /* map-ac networkFunctionalSs (18) version1 (1) */
367   {  20, "releaseResources" },
368   {  22, "sendRoutingInfo" },
369   {  23, "updateGprsLocation" },
370   {  24, "sendRoutingInfoForGprs" },
371   {  25, "failureReport" },
372   {  26, "noteMsPresentForGprs" },
373   {  28, "performHandover" },                                   /* map-ac handoverControl (11) version1 (1)*/
374   {  29, "sendEndSignal" },
375   {  30, "performSubsequentHandover" },                 /* map-ac handoverControl (11) version1 (1) */
376   {  31, "provideSIWFSNumber" },
377   {  32, "sIWFSSignallingModify" },
378   {  33, "processAccessSignalling" },
379   {  34, "forwardAccessSignalling" },
380   {  35, "noteInternalHandover" },                              /* map-ac handoverControl (11) version1 (1) */
381   {  37, "reset" },
382   {  38, "forwardCheckSS-Indication" },
383   {  39, "prepareGroupCall" },
384   {  40, "sendGroupCallEndSignal" },
385   {  41, "processGroupCallSignalling" },
386   {  42, "forwardGroupCallSignalling" },
387   {  43, "checkIMEI" },
388   {  44, "mt-forwardSM" },
389   {  45, "sendRoutingInfoForSM" },
390   {  46, "mo-forwardSM" },
391   {  47, "reportSM-DeliveryStatus" },
392   {  48, "noteSubscriberPresent" },                             /* map-ac mwdMngt (24) version1 (1) */
393   {  49, "alertServiceCentreWithoutResult" },   /* map-ac shortMsgAlert (23) version1 (1) */
394   {  50, "activateTraceMode" },
395   {  51, "deactivateTraceMode" },
396   {  52, "traceSubscriberActivity" },                   /* map-ac handoverControl (11) version1 (1) */
397   {  54, "beginSubscriberActivity" },                   /* map-ac networkFunctionalSs (18) version1 (1) */
398   {  55, "sendIdentification" },
399   {  56, "sendAuthenticationInfo" },
400   {  57, "restoreData" },
401   {  58, "sendIMSI" },
402   {  59, "processUnstructuredSS-Request" },
403   {  60, "unstructuredSS-Request" },
404   {  61, "unstructuredSS-Notify" },
405   {  62, "anyTimeSubscriptionInterrogation" },
406   {  63, "informServiceCentre" },
407   {  64, "alertServiceCentre" },
408   {  65, "anyTimeModification" },
409   {  66, "readyForSM" },
410   {  67, "purgeMS" },
411   {  68, "prepareHandover" },
412   {  69, "prepareSubsequentHandover" },
413   {  70, "provideSubscriberInfo" },
414   {  71, "anyTimeInterrogation" },
415   {  72, "ss-InvocationNotification" },
416   {  73, "setReportingState" },
417   {  74, "statusReport" },
418   {  75, "remoteUserFree" },
419   {  76, "registerCC-Entry" },
420   {  77, "eraseCC-Entry" },
421   {  78, "secureTransportClass1" },
422   {  79, "secureTransportClass2" },
423   {  80, "secureTransportClass3" },
424   {  81, "secureTransportClass4" },
425   {  83, "provideSubscriberLocation" },
426   {  85, "sendRoutingInfoForLCS" },
427   {  86, "subscriberLocationReport" },
428   {      87, "ist-Alert" },
429   {      88, "ist-Command" },
430   {  89, "noteMM-Event" },
431   { 0, NULL }
432 };
433 static const value_string gsm_map_err_code_string_vals[] = {
434     { 1,        "Unknown Subscriber" },
435     { 3,        "Unknown MSC" },
436     { 5,        "Unidentified Subscriber" },
437     { 6,        "Absent Subscriber SM" },
438     { 7,        "Unknown Equipment" },
439     { 8,        "Roaming Not Allowed" },
440     { 9,        "Illegal Subscriber" },
441     { 10,       "Bearer Service Not Provisioned" },
442     { 11,       "Teleservice Not Provisioned" },
443     { 12,       "Illegal Equipment" },
444     { 13,       "Call Barred" },
445     { 14,       "Forwarding Violation" },
446     { 15,       "CUG Reject" },
447     { 16,       "Illegal SS Operation" },
448     { 17,       "SS Error Status" },
449     { 18,       "SS Not Available" },
450     { 19,       "SS Subscription Violation" },
451     { 20,       "SS Incompatibility" },
452     { 21,       "Facility Not Supported" },
453     { 25,       "No Handover Number Available" },
454     { 26,       "Subsequent Handover Failure" },
455     { 27,       "Absent Subscriber" },
456     { 28,       "Incompatible Terminal" },
457     { 29,       "Short Term Denial" },
458     { 30,       "Long Term Denial" },
459     { 31,       "Subscriber Busy For MT SMS" },
460     { 32,       "SM Delivery Failure" },
461     { 33,       "Message Waiting List Full" },
462     { 34,       "System Failure" },
463     { 35,       "Data Missing" },
464     { 36,       "Unexpected Data Value" },
465     { 37,       "PW Registration Failure" },
466     { 38,       "Negative PW Check" },
467     { 39,       "No Roaming Number Available" },
468     { 40,       "Tracing Buffer Full" },
469     { 42,       "Target Cell Outside Group Call Area" },
470     { 43,       "Number Of PW Attempts Violation" },
471     { 44,       "Number Changed" },
472     { 45,       "Busy Subscriber" },
473     { 46,       "No Subscriber Reply" },
474     { 47,       "Forwarding Failed" },
475     { 48,       "OR Not Allowed" },
476     { 49,       "ATI Not Allowed" },
477     { 50,       "No Group Call Number Available" },
478     { 51,       "Resource Limitation" },
479     { 52,       "Unauthorized Requesting Network" },
480     { 53,       "Unauthorized LCS Client" },
481     { 54,       "Position Method Failure" },
482     { 58,       "Unknown Or Unreachable LCS Client" },
483     { 59,       "MM Event Not Supported" },
484     { 60,       "ATSI Not Allowed" },
485     { 61,       "ATM Not Allowed" },
486     { 62,       "Information Not Available" },
487     { 71,       "Unknown Alphabet" },
488     { 72,       "USSD Busy" },
489     { 120,      "Nbr Sb Exceeded" },
490     { 121,      "Rejected By User" },
491     { 122,      "Rejected By Network" },
492     { 123,      "Deflection To Served Subscriber" },
493     { 124,      "Special Service Code" },
494     { 125,      "Invalid Deflected To Number" },
495     { 126,      "Max Number Of MPTY Participants Exceeded" },
496     { 127,      "Resources Not Available" },
497     { 0, NULL }
498 };
499 static const true_false_string gsm_map_extension_value = {
500   "No Extension",
501   "Extension"
502 };
503 static const value_string gsm_map_nature_of_number_values[] = {
504         {   0x00,       "unknown" },
505         {   0x01,       "International Number" },
506         {   0x02,       "National Significant Number" },
507         {   0x03,       "Network Specific Number" },
508         {   0x04,       "Subscriber Number" },
509         {   0x05,       "Reserved" },
510         {   0x06,       "Abbreviated Number" },
511         {   0x07,       "Reserved for extension" },
512         { 0, NULL }
513 };
514 static const value_string gsm_map_number_plan_values[] = {
515         {   0x00,       "unknown" },
516         {   0x01,       "ISDN/Telephony Numbering (Rec ITU-T E.164)" },
517         {   0x02,       "spare" },
518         {   0x03,       "Data Numbering (ITU-T Rec. X.121)" },
519         {   0x04,       "Telex Numbering (ITU-T Rec. F.69)" },
520         {   0x05,       "spare" },
521         {   0x06,       "Land Mobile Numbering (ITU-T Rec. E.212)" },
522         {   0x07,       "spare" },
523         {   0x08,       "National Numbering" },
524         {   0x09,       "Private Numbering" },
525         {   0x0f,       "Reserved for extension" },
526         { 0, NULL }
527 };
528
529 static const true_false_string gsm_map_Ss_Status_q_bit_values = {
530   "Quiescent",
531   "Operative"
532 };
533 static const true_false_string gsm_map_Ss_Status_p_values = {
534   "Provisioned",
535   "Not Provisioned"
536 };
537 static const true_false_string gsm_map_Ss_Status_r_values = {
538   "Registered",
539   "Not Registered"
540 };
541 static const true_false_string gsm_map_Ss_Status_a_values = {
542   "Active",
543   "not Active"
544 };
545
546
547 static int
548 dissect_gsm_map_Opcode(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
549   offset = dissect_ber_integer(FALSE, pinfo, tree, tvb, offset, hf_index, &opcode);
550
551   if (check_col(pinfo->cinfo, COL_INFO)){
552     col_append_fstr(pinfo->cinfo, COL_INFO, val_to_str(opcode, gsm_map_opr_code_strings, "Unknown GSM-MAP (%u)"));
553   }
554
555   return offset;
556 }
557
558 static int dissect_invokeData(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
559  
560   gint8 bug_class;
561   gboolean bug_pc, bug_ind_field;
562   gint32 bug_tag;
563   guint32 bug_len1;
564   
565   guint8 octet;
566
567   switch(opcode){
568   case  2: /*updateLocation*/   
569           offset=dissect_gsm_map_UpdateLocationArg(FALSE, tvb, offset, pinfo, tree, -1);
570     break;
571   case  3: /*cancelLocation*/
572         octet = tvb_get_guint8(tvb,0) & 0xf;
573         if ( octet == 3){ /*   */ 
574           /* XXX  asn2eth can not yet handle tagged assignment yes so this
575            * XXX is some conformance file magic to work around that bug
576            */
577           offset = get_ber_identifier(tvb, offset, &bug_class, &bug_pc, &bug_tag);
578           offset = get_ber_length(tree, tvb, offset, &bug_len1, &bug_ind_field);
579                 offset=dissect_gsm_map_CancelLocationArg(TRUE, tvb, offset, pinfo, tree, -1);
580         }else{
581     offset=dissect_gsm_map_CancelLocationArgV2(FALSE, tvb, offset, pinfo, tree, -1);
582         }
583     break;
584   case  4: /*provideRoamingNumber*/
585     offset=dissect_gsm_map_ProvideRoamingNumberArg(FALSE, tvb, offset, pinfo, tree, -1);
586     break;
587   case  6: /*resumeCallHandling*/
588     offset=dissect_gsm_map_ResumeCallHandlingArg(FALSE, tvb, offset, pinfo, tree, -1);
589     break;
590   case  7: /*insertSubscriberData*/
591     offset=dissect_gsm_map_InsertSubscriberDataArg(FALSE, tvb, offset, pinfo, tree, -1);
592     break;
593   case  8: /*deleteSubscriberData*/
594     offset=dissect_gsm_map_DeleteSubscriberDataArg(FALSE, tvb, offset, pinfo, tree, -1);
595     break;
596         /* TODO find out why this isn't in the ASN1 file
597   case  9: sendParameters
598     offset=dissect_gsm_map_DeleteSubscriberDataArg(FALSE, tvb, offset, pinfo, tree, -1);
599     break;
600         */
601   case  10: /*registerSS*/
602     offset=dissect_gsm_map_RegisterSS_Arg(FALSE, tvb, offset, pinfo, tree, -1);
603     break;
604   case  11: /*eraseSS*/
605     offset=dissect_gsm_map_SS_ForBS_Code(FALSE, tvb, offset, pinfo, tree, -1);
606     break;
607   case 12: /*activateSS*/
608     offset=dissect_gsm_map_SS_ForBS_Code(FALSE, tvb, offset, pinfo, tree, -1);
609     break;
610   case 13: /*deactivateSS*/
611     offset=dissect_gsm_map_SS_ForBS_Code(FALSE, tvb, offset, pinfo, tree, -1);
612     break;
613   case 14: /*interrogateSS*/
614     offset=dissect_gsm_map_SS_ForBS_Code(FALSE, tvb, offset, pinfo, tree, -1);
615     break;
616   case 15: /*authenticationFailureReport*/
617           offset=dissect_gsm_map_AuthenticationFailureReportArg(FALSE, tvb, offset, pinfo, tree, -1);
618           break;
619   case 17: /*registerPassword*/
620     offset=dissect_gsm_map_SS_Code(FALSE, tvb, offset, pinfo, tree, hf_gsm_map_ss_Code);
621     break;
622   case 18: /*getPassword*/
623     offset=dissect_gsm_map_GetPasswordArg(FALSE, tvb, offset, pinfo, tree, hf_gsm_map_getPassword);
624     break;
625   case 20: /*releaseResources*/
626     offset=dissect_gsm_map_ReleaseResourcesArg(FALSE, tvb, offset, pinfo, tree, -1);
627     break;
628   case 22: /*sendRoutingInfo*/
629     offset=dissect_gsm_map_SendRoutingInfoArg(FALSE, tvb, offset, pinfo, tree, -1);
630     break;
631   case 23: /*updateGprsLocation*/
632     offset=dissect_gsm_map_UpdateGprsLocationArg(FALSE, tvb, offset, pinfo, tree, -1);
633     break;
634   case 24: /*sendRoutingInfoForGprs*/
635     offset=dissect_gsm_map_SendRoutingInfoForGprsArg(FALSE, tvb, offset, pinfo, tree, -1);
636     break;
637   case 25: /*failureReport*/
638     offset=dissect_gsm_map_FailureReportArg(FALSE, tvb, offset, pinfo, tree, -1);
639     break;
640   case 26: /*noteMsPresentForGprs*/
641     offset=dissect_gsm_map_NoteMsPresentForGprsArg(FALSE, tvb, offset, pinfo, tree, -1);
642     break;
643   case 29: /*sendEndSignal*/
644         octet = tvb_get_guint8(tvb,0) & 0xf;
645         if ( octet == 3){ /* This is a V3 message ??? */ 
646           /* XXX  asn2eth can not yet handle tagged assignment yes so this
647            * XXX is some conformance file magic to work around that bug
648            */
649           offset = get_ber_identifier(tvb, offset, &bug_class, &bug_pc, &bug_tag);
650           offset = get_ber_length(tree, tvb, offset, &bug_len1, &bug_ind_field);
651                 offset=dissect_gsm_map_SendEndSignalArgV3(TRUE, tvb, offset, pinfo, tree, hf_gsm_mapSendEndSignal);
652         }else{
653                 offset=dissect_gsm_map_Bss_APDU(FALSE, tvb, offset, pinfo, tree, hf_gsm_mapSendEndSignal);
654         }
655     break;
656   case 31: /*provideSIWFSNumbe*/
657     offset=dissect_gsm_map_ProvideSIWFSNumberArg(FALSE, tvb, offset, pinfo, tree, -1);
658     break;
659   case 32: /*sIWFSSignallingModify*/
660     offset=dissect_gsm_map_SIWFSSignallingModifyArg(FALSE, tvb, offset, pinfo, tree, -1);
661     break;
662   case 33: /*processAccessSignalling*/
663         octet = tvb_get_guint8(tvb,0) & 0xf;
664         if ( octet == 3){ /* This is a V3 message ??? */ 
665           /* XXX  asn2eth can not yet handle tagged assignment yes so this
666            * XXX is some conformance file magic to work around that bug
667            */
668           offset = get_ber_identifier(tvb, offset, &bug_class, &bug_pc, &bug_tag);
669           offset = get_ber_length(tree, tvb, offset, &bug_len1, &bug_ind_field);
670                 offset = dissect_gsm_map_ProcessAccessSignallingArgV3(TRUE, tvb, offset, pinfo, tree, -1);
671         }else{
672     offset=dissect_gsm_map_Bss_APDU(FALSE, tvb, offset, pinfo, tree, -1);
673         }
674     break;
675   case 34: /*forwardAccessSignalling*/
676         octet = tvb_get_guint8(tvb,0) & 0xf;
677         if ( octet == 3){ /* This is a V3 message ??? */
678           /* XXX  asn2eth can not yet handle tagged assignment yes so this
679            * XXX is some conformance file magic to work around that bug
680            */
681           offset = get_ber_identifier(tvb, offset, &bug_class, &bug_pc, &bug_tag);
682           offset = get_ber_length(tree, tvb, offset, &bug_len1, &bug_ind_field);
683                 offset=dissect_gsm_map_ForwardAccessSignallingArgV3(TRUE, tvb, offset, pinfo, tree, -1);
684         }else{
685                  offset=dissect_gsm_map_Bss_APDU(FALSE, tvb, offset, pinfo, tree, -1);
686         }
687     break;
688   case 37: /*reset*/
689     offset=dissect_gsm_map_ResetArg(FALSE, tvb, offset, pinfo, tree, -1);
690     break;
691   case 38: /*forwardCheckSS-Indication*/
692     return offset;
693     break;
694   case 39: /*prepareGroupCall*/
695     offset=dissect_gsm_map_PrepareGroupCallArg(FALSE, tvb, offset, pinfo, tree, -1);
696     break;
697   case 40: /*sendGroupCallEndSignal*/
698     dissect_gsm_map_SendGroupCallEndSignalArg(FALSE, tvb, offset, pinfo, tree, -1);
699     break;
700   case 42: /*processGroupCallSignalling*/
701     offset=dissect_gsm_map_ProcessGroupCallSignallingArg(FALSE, tvb, offset, pinfo, tree, -1);
702     break;
703   case 43: /*checkIMEI*/
704           if (application_context_version < 3 ){
705                   offset = dissect_gsm_map_IMEI(FALSE, tvb, offset, pinfo, tree, hf_gsm_map_imei);
706           }else{
707                   offset=dissect_gsm_map_CheckIMEIArgV3(FALSE, tvb, offset, pinfo, tree, hf_gsm_map_CheckIMEIArg);
708           }
709     break;
710   case 44: /*mt-forwardSM*/
711     offset=dissect_gsm_map_Mt_forwardSM_Arg(FALSE, tvb, offset, pinfo, tree, -1);
712     break;
713   case 45: /*sendRoutingInfoForSM*/
714     offset=dissect_gsm_map_RoutingInfoForSMArg(FALSE, tvb, offset, pinfo, tree, -1);
715     break;
716   case 46: /*mo-forwardSM*/
717     offset=dissect_gsm_map_Mo_forwardSM_Arg(FALSE, tvb, offset, pinfo, tree, -1);
718     break;
719   case 47: /*reportSM-DeliveryStatus*/
720     offset=dissect_gsm_map_ReportSM_DeliveryStatusArg(FALSE, tvb, offset, pinfo, tree, -1);
721     break;
722   case 50: /*activateTraceMode*/
723     offset=dissect_gsm_map_ActivateTraceModeArg(FALSE, tvb, offset, pinfo, tree, -1);
724     break;
725   case 51: /*deactivateTraceMode*/
726     offset=dissect_gsm_map_DeactivateTraceModeArg(FALSE, tvb, offset, pinfo, tree, -1);
727     break;
728   case 55: /*sendIdentification*/
729     offset=dissect_gsm_map_SendIdentificationArg(FALSE, tvb, offset, pinfo, tree, -1);
730     break;
731   case 56: /*sendAuthenticationInfo*/
732           if (application_context_version < 3 ){
733                   offset=dissect_gsm_map_SendAuthenticationInfoArg(FALSE, tvb, offset, pinfo, tree, hf_gsm_map_SendAuthenticationInfoArg);
734           }else{
735                   offset=dissect_gsm_map_SendAuthenticationInfoArgV2(FALSE, tvb, offset, pinfo, tree, hf_gsm_map_SendAuthenticationInfoArg);
736           }
737         break;
738   case 57: /*restoreData*/
739         offset=dissect_gsm_map_RestoreDataArg(FALSE, tvb, offset, pinfo, tree, -1);
740         break;
741   case 58: /*sendIMSI*/
742         offset = dissect_gsm_map_ISDN_AddressString(FALSE, tvb, offset, pinfo, tree, hf_gsm_map_msisdn);
743         break;
744   case 59: /*processUnstructuredSS-Request*/
745     offset=dissect_gsm_map_Ussd_Arg(FALSE, tvb, offset, pinfo, tree, -1);
746     break;
747   case 60: /*unstructuredSS-Request*/
748     offset=dissect_gsm_map_Ussd_Arg(FALSE, tvb, offset, pinfo, tree, -1);
749     break;
750   case 61: /*unstructuredSS-Notify*/
751     offset=dissect_gsm_map_Ussd_Arg(FALSE, tvb, offset, pinfo, tree, -1);
752     break;
753   case 62: /*AnyTimeSubscriptionInterrogation*/
754           offset=dissect_gsm_map_AnyTimeSubscriptionInterrogationArg(FALSE, tvb, offset, pinfo, tree, -1);
755           break;
756   case 63: /*informServiceCentre*/
757     offset=dissect_gsm_map_InformServiceCentreArg(FALSE, tvb, offset, pinfo, tree, -1);
758     break;
759   case 64: /*alertServiceCentre*/
760     offset=dissect_gsm_map_AlertServiceCentreArg(FALSE, tvb, offset, pinfo, tree, -1);
761     break;
762   case 65: /*AnyTimeModification*/
763           offset=dissect_gsm_map_AnyTimeModificationArg(FALSE, tvb, offset, pinfo, tree, -1);
764           break;
765   case 66: /*readyForSM*/
766     offset=dissect_gsm_map_ReadyForSM_Arg(FALSE, tvb, offset, pinfo, tree, -1);
767     break;
768   case 67: /*purgeMS*/
769     offset=dissect_gsm_map_PurgeMSArg(FALSE, tvb, offset, pinfo, tree, -1);
770     break;
771   case 68: /*prepareHandover*/
772         octet = tvb_get_guint8(tvb,0) & 0xf;
773         if ( octet == 3){ /* This is a V3 message ??? */ 
774           /* XXX  asn2eth can not yet handle tagged assignment yes so this
775            * XXX is some conformance file magic to work around that bug
776            */
777           offset = get_ber_identifier(tvb, offset, &bug_class, &bug_pc, &bug_tag);
778           offset = get_ber_length(tree, tvb, offset, &bug_len1, &bug_ind_field);
779                 offset=dissect_gsm_map_PrepareHO_ArgV3(TRUE, tvb, offset, pinfo, tree, -1);
780         }else{
781                 offset=dissect_gsm_map_PrepareHO_Arg(FALSE, tvb, offset, pinfo, tree, -1);
782         }
783     break;
784   case 69: /*prepareSubsequentHandover*/
785     offset=dissect_gsm_map_PrepareSubsequentHOArg(FALSE, tvb, offset, pinfo, tree, -1);
786     break;
787   case 70: /*provideSubscriberInfo*/
788     offset=dissect_gsm_map_ProvideSubscriberInfoArg(FALSE, tvb, offset, pinfo, tree, -1);
789     break;
790   case 71: /*anyTimeInterrogation*/
791     offset=dissect_gsm_map_AnyTimeInterrogationArg(FALSE, tvb, offset, pinfo, tree, -1);
792     break;
793   case 72: /*ss-InvocationNotificatio*/
794     offset=dissect_gsm_map_Ss_InvocationNotificationArg(FALSE, tvb, offset, pinfo, tree, -1);
795     break;
796   case 73: /*setReportingState*/
797     offset=dissect_gsm_map_SetReportingStateArg(FALSE, tvb, offset, pinfo, tree, -1);
798     break;
799   case 74: /*statusReport*/
800     offset=dissect_gsm_map_StatusReportArg(FALSE, tvb, offset, pinfo, tree, -1);
801     break;
802   case 75: /*remoteUserFree*/
803     offset=dissect_gsm_map_RemoteUserFreeArg(FALSE, tvb, offset, pinfo, tree, -1);
804     break;
805   case 76: /*registerCC-Entry*/
806     offset=dissect_gsm_map_RegisterCC_EntryArg(FALSE, tvb, offset, pinfo, tree, -1);
807     break;
808   case 77: /*eraseCC-Entry*/
809     offset=dissect_gsm_map_EraseCC_EntryArg(FALSE, tvb, offset, pinfo, tree, -1);
810     break;
811   case 78: /*secureTransportClass1*/
812   case 79: /*secureTransportClass1*/
813   case 80: /*secureTransportClass1*/
814   case 81: /*secureTransportClass1*/
815     offset=dissect_gsm_map_SecureTransportArg(FALSE, tvb, offset, pinfo, tree, -1);
816     break;
817   case 83: /*provideSubscriberLocation*/
818     offset=dissect_gsm_map_ProvideSubscriberLocation_Arg(FALSE, tvb, offset, pinfo, tree, -1);
819     break;
820   case 85: /*sendRoutingInfoForLCS*/
821     offset=dissect_gsm_map_RoutingInfoForLCS_Arg(FALSE, tvb, offset, pinfo, tree, -1);
822     break;
823   case 86: /*subscriberLocationReport*/
824     offset=dissect_gsm_map_SubscriberLocationReport_Arg(FALSE, tvb, offset, pinfo, tree, -1);
825     break;
826   case 87: /*ist-Alert*/
827     offset=dissect_gsm_map_IST_AlertArg(FALSE, tvb, offset, pinfo, tree, -1);
828     break;
829   case 88: /*ist-Command*/
830     offset=dissect_gsm_map_IST_CommandArg(FALSE, tvb, offset, pinfo, tree, -1);
831     break;
832   case 89: /*noteMM-Event*/
833     offset=dissect_gsm_map_NoteMM_EventArg(FALSE, tvb, offset, pinfo, tree, -1);
834     break;
835   default:
836     proto_tree_add_text(tree, tvb, offset, -1, "Unknown invokeData blob");
837   }
838   return offset;
839 }
840
841
842 static int dissect_returnResultData(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
843
844  gint8 bug_class;
845  gboolean bug_pc, bug_ind_field;
846  gint32 bug_tag;
847  guint32 bug_len1;
848         
849   guint8 octet;
850   switch(opcode){
851   case  2: /*updateLocation*/
852         octet = tvb_get_guint8(tvb,offset);
853         /* As it seems like SEQUENCE OF sometimes is omitted, find out if it's there */
854         if ( octet == 0x30 ){ /* Class 0 Univerasl, P/C 1 Constructed,Tag 16 Sequence OF */
855                 offset=dissect_gsm_map_UpdateLocationRes(FALSE, tvb, offset, pinfo, tree, -1);
856         }else{ /* Try decoding with IMPLICIT flag set */ 
857                 offset=dissect_gsm_map_UpdateLocationRes(TRUE, tvb, offset, pinfo, tree, -1);
858           }
859     break;
860   case  3: /*cancelLocation*/
861     offset=dissect_gsm_map_CancelLocationRes(FALSE, tvb, offset, pinfo, tree, -1);
862     break;
863   case  4: /*provideRoamingNumber*/
864     offset=dissect_gsm_map_ProvideRoamingNumberRes(FALSE, tvb, offset, pinfo, tree, -1); /* TRUE florent */
865     break;
866   case  6: /*resumeCallHandling*/
867     offset=dissect_gsm_map_ResumeCallHandlingRes(FALSE, tvb, offset, pinfo, tree, -1);
868     break;
869   case  7: /*insertSubscriberData*/
870     offset=dissect_gsm_map_InsertSubscriberDataRes(FALSE, tvb, offset, pinfo, tree, -1);
871     break;
872   case  8: /*deleteSubscriberData*/
873     offset=dissect_gsm_map_DeleteSubscriberDataRes(FALSE, tvb, offset, pinfo, tree, -1);
874     break;
875         /* TODO find out why this isn't in the ASN1 file
876   case  9: sendParameters
877     offset=dissect_gsm_map_DeleteSubscriberDataArg(FALSE, tvb, offset, pinfo, tree, -1);
878     break;
879         */
880   case  10: /*registerSS*/
881     offset=dissect_gsm_map_SS_Info(FALSE, tvb, offset, pinfo, tree, -1);
882     break;
883   case  11: /*eraseSS*/
884     offset=dissect_gsm_map_SS_Info(FALSE, tvb, offset, pinfo, tree, -1);
885     break;
886   case 12: /*activateSS*/
887     offset=dissect_gsm_map_SS_Info(FALSE, tvb, offset, pinfo, tree, -1);
888     break;
889   case 13: /*deactivateSS*/
890     offset=dissect_gsm_map_SS_Info(FALSE, tvb, offset, pinfo, tree, -1);
891     break;
892   case 14: /*interrogateSS*/
893     offset=dissect_gsm_map_InterrogateSS_Res(FALSE, tvb, offset, pinfo, tree, -1);
894     break;
895   case 15: /*authenticationFailureReport*/
896         offset=dissect_gsm_map_AuthenticationFailureReportRes(FALSE, tvb, offset, pinfo, tree, -1);
897         break;
898   case 17: /*registerPassword*/
899     offset=dissect_gsm_map_NewPassword(FALSE, tvb, offset, pinfo, tree, hf_gsm_map_ss_Code);
900     break;
901   case 18: /*getPassword*/
902     offset=dissect_gsm_map_CurrentPassword(FALSE, tvb, offset, pinfo, tree, hf_gsm_map_currentPassword);
903     break;
904   case 20: /*releaseResources*/
905     offset=dissect_gsm_map_ReleaseResourcesRes(FALSE, tvb, offset, pinfo, tree, -1);
906     break;
907   case 22: /*sendRoutingInfo*/
908           /* This is done to get around a problem with IMPLICIT tag:s */
909         offset = get_ber_identifier(tvb, offset, &bug_class, &bug_pc, &bug_tag);
910         offset = get_ber_length(tree, tvb, offset, &bug_len1, &bug_ind_field);
911     offset=dissect_gsm_map_SendRoutingInfoRes(TRUE, tvb, offset, pinfo, tree, -1);
912     break;
913   case 23: /*updateGprsLocation*/
914     offset=dissect_gsm_map_UpdateGprsLocationRes(FALSE, tvb, offset, pinfo, tree, -1);
915     break;
916   case 24: /*sendRoutingInfoForGprs*/
917     offset=dissect_gsm_map_SendRoutingInfoForGprsRes(FALSE, tvb, offset, pinfo, tree, -1);
918     break;
919   case 25: /*failureReport*/
920     offset=dissect_gsm_map_FailureReportRes(FALSE, tvb, offset, pinfo, tree, -1);
921     break;
922   case 26: /*noteMsPresentForGprs*/
923     offset=dissect_gsm_map_NoteMsPresentForGprsRes(FALSE, tvb, offset, pinfo, tree, -1);
924     break;
925   case 29: /*sendEndSignal*/
926           /* Taken from MAP-MobileServiceOperations{ 0 identified-organization (4) etsi (0) mobileDomain 
927            * (0) gsm-Network (1) modules (3) map-MobileServiceOperations (5) version9 (9) }
928            */
929     offset=dissect_gsm_map_SendEndSignalRes(FALSE, tvb, offset, pinfo, tree, -1);
930     break;
931   case 31: /*provideSIWFSNumbe*/
932     offset=dissect_gsm_map_ProvideSIWFSNumberRes(FALSE, tvb, offset, pinfo, tree, -1);
933     break;
934   case 32: /*provideSIWFSNumbe*/
935     offset=dissect_gsm_map_SIWFSSignallingModifyRes(FALSE, tvb, offset, pinfo, tree, -1);
936     break;
937   case 39: /*prepareGroupCall*/
938     offset=dissect_gsm_map_PrepareGroupCallRes(FALSE, tvb, offset, pinfo, tree, -1);
939     break;
940   case 40: /*sendGroupCallEndSignal*/
941     dissect_gsm_map_SendGroupCallEndSignalRes(FALSE, tvb, offset, pinfo, tree, -1);
942     break;
943   case 43: /*checkIMEI*/
944     offset=dissect_gsm_map_CheckIMEIRes(FALSE, tvb, offset, pinfo, tree, -1);
945     break;
946   case 44: /*mt-forwardSM*/
947     offset=dissect_gsm_map_Mt_forwardSM_Res(FALSE, tvb, offset, pinfo, tree, -1);
948     break;
949   case 45: /*sendRoutingInfoForSM*/
950     offset=dissect_gsm_map_RoutingInfoForSM_Res(FALSE, tvb, offset, pinfo, tree, -1);
951     break;
952   case 46: /*mo-forwardSM*/
953     offset=dissect_gsm_map_Mo_forwardSM_Res(FALSE, tvb, offset, pinfo, tree, -1);
954     break;
955   case 48: /*reportSM-DeliveryStatus*/
956     offset=dissect_gsm_map_ReportSM_DeliveryStatusRes(FALSE, tvb, offset, pinfo, tree, -1);
957     break;
958   case 50: /*activateTraceMode*/
959     offset=dissect_gsm_map_ActivateTraceModeRes(FALSE, tvb, offset, pinfo, tree, -1);
960     break;
961   case 51: /*deactivateTraceMode*/
962     offset=dissect_gsm_map_DeactivateTraceModeRes(FALSE, tvb, offset, pinfo, tree, -1);
963     break;
964   case 55: /*sendIdentification
965                         * In newer versions IMSI and authenticationSetList is OPTIONAL and two new parameters added
966                         * however if the tag (3) is stripped of it should work with the 'new' def.(?) 
967                         */
968         octet = tvb_get_guint8(tvb,0) & 0xf;
969         if ( octet == 3){ /* This is a V3 message ??? */ 
970           /* XXX  asn2eth can not yet handle tagged assignment yes so this
971            * XXX is some conformance file magic to work around that bug
972            */
973           offset = get_ber_identifier(tvb, offset, &bug_class, &bug_pc, &bug_tag);
974           offset = get_ber_length(tree, tvb, offset, &bug_len1, &bug_ind_field);
975         }
976         offset=dissect_gsm_map_SendIdentificationRes(TRUE, tvb, offset, pinfo, tree, -1);
977     break;
978   case 56: /*sendAuthenticationInfo*/
979     octet = tvb_get_guint8(tvb,0) & 0xf;
980     if ( octet == 3){ /* This is a V3 message ??? */
981       /* XXX  asn2eth can not yet handle tagged assignment yes so this
982        * XXX is some conformance file magic to work around that bug
983        */
984                 offset = get_ber_identifier(tvb, offset, &bug_class, &bug_pc, &bug_tag);
985                 offset = get_ber_length(tree, tvb, offset, &bug_len1, &bug_ind_field);
986  
987                 offset=dissect_gsm_map_SendAuthenticationInfoResV3(TRUE, tvb, offset, pinfo, tree, hf_gsm_map_SendAuthenticationInfoRes);
988         }else{
989                 offset=dissect_gsm_map_SendAuthenticationInfoRes(FALSE, tvb, offset, pinfo, tree, -1);
990         }
991         break;
992   case 57: /*restoreData*/
993     offset=dissect_gsm_map_RestoreDataRes(FALSE, tvb, offset, pinfo, tree, -1);
994     break;
995   case 58: /*sendIMSI*/
996     offset=dissect_gsm_map_IMSI(FALSE, tvb, offset, pinfo, tree, hf_gsm_map_imsi);
997     break;
998   case 59: /*unstructuredSS-Request*/
999     offset=dissect_gsm_map_Ussd_Res(FALSE, tvb, offset, pinfo, tree, -1);
1000     break;
1001   case 60: /*unstructuredSS-Request*/
1002     offset=dissect_gsm_map_Ussd_Res(FALSE, tvb, offset, pinfo, tree, -1);
1003     break;
1004   case 61: /*unstructuredSS-Notify*/
1005     /* TRUE ? */
1006     proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnResultData blob");
1007     break;
1008   case 62: /*AnyTimeSubscriptionInterrogation*/
1009         offset=dissect_gsm_map_AnyTimeSubscriptionInterrogationRes(FALSE, tvb, offset, pinfo, tree, -1);
1010         break;
1011   case 65: /*AnyTimeModification*/
1012         offset=dissect_gsm_map_AnyTimeModificationRes(FALSE, tvb, offset, pinfo, tree, -1);
1013         break;
1014   case 66: /*readyForSM*/
1015     offset=dissect_gsm_map_ReadyForSM_Res(FALSE, tvb, offset, pinfo, tree, -1);
1016     break;
1017   case 67: /*purgeMS*/
1018     offset=dissect_gsm_map_PurgeMSRes(FALSE, tvb, offset, pinfo, tree, -1);
1019     break;
1020   case 68: /*prepareHandover*/
1021         octet = tvb_get_guint8(tvb,0) & 0xf;
1022         if ( octet == 3){ /* This is a V3 message ??? */
1023           /* XXX  asn2eth can not yet handle tagged assignment yes so this
1024            * XXX is some conformance file magic to work around that bug
1025            */
1026                 offset = get_ber_identifier(tvb, offset, &bug_class, &bug_pc, &bug_tag);
1027                 offset = get_ber_length(tree, tvb, offset, &bug_len1, &bug_ind_field);
1028                 offset=dissect_gsm_map_PrepareHO_ResV3(TRUE, tvb, offset, pinfo, tree, hf_gsm_mapSendEndSignal);
1029         }else{
1030                 offset=dissect_gsm_map_PrepareHO_Res(FALSE, tvb, offset, pinfo, tree, -1);
1031         }
1032     break;
1033   case 69: /*prepareSubsequentHandover*/
1034         offset=dissect_gsm_map_Bss_APDU(FALSE, tvb, offset, pinfo, tree, -1);
1035         break;
1036   case 70: /*provideSubscriberInfo*/
1037     offset=dissect_gsm_map_ProvideSubscriberInfoRes(FALSE, tvb, offset, pinfo, tree, -1);
1038     break;
1039   case 71: /*anyTimeInterrogation*/
1040     offset=dissect_gsm_map_AnyTimeInterrogationRes(FALSE, tvb, offset, pinfo, tree, -1);
1041     break;
1042   case 72: /*ss-InvocationNotificatio*/
1043     offset=dissect_gsm_map_Ss_InvocationNotificationRes(FALSE, tvb, offset, pinfo, tree, -1);
1044     break;
1045   case 73: /*setReportingState*/
1046     offset=dissect_gsm_map_SetReportingStateRes(FALSE, tvb, offset, pinfo, tree, -1);
1047     break;
1048   case 74: /*statusReport*/
1049     offset=dissect_gsm_map_StatusReportRes(FALSE, tvb, offset, pinfo, tree, -1);
1050     break;
1051   case 75: /*remoteUserFree*/
1052     offset=dissect_gsm_map_RemoteUserFreeRes(FALSE, tvb, offset, pinfo, tree, -1);
1053     break;
1054   case 76: /*registerCC-Entry*/
1055     offset=dissect_gsm_map_RegisterCC_EntryRes(FALSE, tvb, offset, pinfo, tree, -1);
1056     break;
1057   case 77: /*eraseCC-Entry*/
1058     offset=dissect_gsm_map_EraseCC_EntryRes(FALSE, tvb, offset, pinfo, tree, -1);
1059     break;
1060   case 78: /*secureTransportClass1*/
1061   case 79: /*secureTransportClass2*/
1062   case 80: /*secureTransportClass3*/
1063   case 81: /*secureTransportClass4*/
1064     offset=dissect_gsm_map_SecureTransportRes(FALSE, tvb, offset, pinfo, tree, -1);
1065     break;
1066   case 83: /*provideSubscriberLocation*/
1067     offset=dissect_gsm_map_ProvideSubscriberLocation_Res(FALSE, tvb, offset, pinfo, tree, -1);
1068     break;
1069   case 85: /*sendRoutingInfoForLCS*/
1070     offset=dissect_gsm_map_RoutingInfoForLCS_Arg(FALSE, tvb, offset, pinfo, tree, -1);
1071     break;
1072   case 86: /*subscriberLocationReport*/
1073     offset=dissect_gsm_map_SubscriberLocationReport_Res(FALSE, tvb, offset, pinfo, tree, -1);
1074     break;
1075   case 87: /*ist-Alert*/
1076     offset=dissect_gsm_map_IST_AlertRes(FALSE, tvb, offset, pinfo, tree, -1);
1077     break;
1078   case 88: /*ist-Command*/
1079     offset=dissect_gsm_map_IST_CommandRes(FALSE, tvb, offset, pinfo, tree, -1);
1080     break;
1081   case 89: /*noteMM-Event*/
1082     offset=dissect_gsm_map_NoteMM_EventRes(FALSE, tvb, offset, pinfo, tree, -1);
1083     break;
1084  default:
1085     proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnResultData blob");
1086   }
1087   return offset;
1088 }
1089
1090
1091
1092 static int dissect_returnErrorData(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1093         
1094   switch(errorCode){
1095   case 1: /* UnknownSubscriberParam */
1096           offset=dissect_gsm_map_UnknownSubscriberParam(FALSE, tvb, offset, pinfo, tree, -1);
1097           break;
1098   case 4: /* SecureTransportErrorParam */
1099           offset=dissect_gsm_map_SecureTransportErrorParam(FALSE, tvb, offset, pinfo, tree, -1);
1100           break;
1101   case 5: /* UnidentifiedSubParam */
1102           offset=dissect_gsm_map_UnidentifiedSubParam(FALSE, tvb, offset, pinfo, tree, -1);
1103           break;
1104   case 6: /* AbsentSubscriberSM-Param */
1105           offset=dissect_gsm_map_AbsentSubscriberSM_Param(FALSE, tvb, offset, pinfo, tree, -1);
1106           break;
1107   case 8: /* RoamingNotAllowedParam */
1108           offset=dissect_gsm_map_RoamingNotAllowedParam(FALSE, tvb, offset, pinfo, tree, -1);
1109           break;
1110   case 9: /* IllegalSubscriberParam */
1111           offset=dissect_gsm_map_IllegalSubscriberParam(FALSE, tvb, offset, pinfo, tree, -1);
1112           break;
1113   case 10: /* BearerServNotProvParam */
1114           offset=dissect_gsm_map_BearerServNotProvParam(FALSE, tvb, offset, pinfo, tree, -1);
1115           break;
1116   case 11: /* TeleservNotProvParam */
1117           offset=dissect_gsm_map_TeleservNotProvParam(FALSE, tvb, offset, pinfo, tree, -1);
1118           break;
1119   case 12: /* IllegalEquipmentParam */
1120           offset=dissect_gsm_map_IllegalEquipmentParam(FALSE, tvb, offset, pinfo, tree, -1);
1121           break;
1122   case 13: /* CallBarredParam */
1123           offset=dissect_gsm_map_CallBarredParam(FALSE, tvb, offset, pinfo, tree, -1);
1124           break;
1125   case 14: /* ForwardingViolationParam */
1126           offset=dissect_gsm_map_ForwardingViolationParam(FALSE, tvb, offset, pinfo, tree, -1);
1127           break;
1128   case 15: /* CUG-RejectParam */
1129           offset=dissect_gsm_map_CUG_RejectParam(FALSE, tvb, offset, pinfo, tree, -1);
1130           break;
1131   case 16: /* IllegalSS-OperationParam */
1132           offset=dissect_gsm_map_IllegalSS_OperationParam(FALSE, tvb, offset, pinfo, tree, -1);
1133           break;
1134   case 18: /* SS-NotAvailableParam */
1135           offset=dissect_gsm_map_SS_NotAvailableParam(FALSE, tvb, offset, pinfo, tree, -1);
1136           break;
1137   case 19: /* SS-SubscriptionViolationParam */
1138           offset=dissect_gsm_map_SS_SubscriptionViolationParam(FALSE, tvb, offset, pinfo, tree, -1);
1139           break;
1140   case 20: /* SS-IncompatibilityCause */
1141           offset=dissect_gsm_map_SS_IncompatibilityCause(FALSE, tvb, offset, pinfo, tree, -1);
1142           break;
1143   case 21: /* FacilityNotSupParam */
1144           offset=dissect_gsm_map_FacilityNotSupParam(FALSE, tvb, offset, pinfo, tree, -1);
1145           break;
1146   case 27: /* AbsentSubscriberParam */
1147           offset=dissect_gsm_map_AbsentSubscriberParam(FALSE, tvb, offset, pinfo, tree, -1);
1148           break;
1149   case 28: /* IncompatibleTerminalParam */
1150           offset=dissect_gsm_map_IncompatibleTerminalParam(FALSE, tvb, offset, pinfo, tree, -1);
1151           break;
1152   case 29: /* ShortTermDenialParam */
1153           offset=dissect_gsm_map_ShortTermDenialParam(FALSE, tvb, offset, pinfo, tree, -1);
1154           break;
1155   case 30: /* LongTermDenialParam */
1156           offset=dissect_gsm_map_LongTermDenialParam(FALSE, tvb, offset, pinfo, tree, -1);
1157           break;
1158   case 31: /* SubBusyForMT-SMS-Param */
1159           offset=dissect_gsm_map_SubBusyForMT_SMS_Param(FALSE, tvb, offset, pinfo, tree, -1);
1160           break;
1161   case 32: /* SM-DeliveryFailureCause */
1162           offset=dissect_gsm_map_SM_DeliveryFailureCause(FALSE, tvb, offset, pinfo, tree, -1);
1163           break;
1164   case 33: /* MessageWaitListFullParam */
1165           offset=dissect_gsm_map_MessageWaitListFullParam(FALSE, tvb, offset, pinfo, tree, -1);
1166           break;
1167   case 34: /* SystemFailureParam */
1168           offset=dissect_gsm_map_SystemFailureParam(FALSE, tvb, offset, pinfo, tree, -1);
1169           break;
1170   case 35: /* DataMissingParam */
1171           offset=dissect_gsm_map_DataMissingParam(FALSE, tvb, offset, pinfo, tree, -1);
1172           break;
1173   case 36: /* UnexpectedDataParam */
1174           offset=dissect_gsm_map_UnexpectedDataParam(FALSE, tvb, offset, pinfo, tree, -1);
1175           break;
1176   case 37: /* PW-RegistrationFailureCause */
1177           offset=dissect_gsm_map_PW_RegistrationFailureCause(FALSE, tvb, offset, pinfo, tree, -1);
1178           break;
1179   case 39: /* NoRoamingNbParam */
1180           offset=dissect_gsm_map_NoRoamingNbParam(FALSE, tvb, offset, pinfo, tree, -1);
1181           break;
1182   case 40: /* TracingBufferFullParam */
1183           offset=dissect_gsm_map_TracingBufferFullParam(FALSE, tvb, offset, pinfo, tree, -1);
1184           break;
1185   case 42: /* TargetCellOutsideGCA-Param */
1186           offset=dissect_gsm_map_TargetCellOutsideGCA_Param(FALSE, tvb, offset, pinfo, tree, -1);
1187           break;
1188   case 44: /* NumberChangedParam */
1189           offset=dissect_gsm_map_NumberChangedParam(FALSE, tvb, offset, pinfo, tree, -1);
1190           break;
1191   case 45: /* BusySubscriberParam */
1192           offset=dissect_gsm_map_BusySubscriberParam(FALSE, tvb, offset, pinfo, tree, -1);
1193           break;
1194   case 46: /* NoSubscriberReplyParam */
1195           offset=dissect_gsm_map_NoSubscriberReplyParam(FALSE, tvb, offset, pinfo, tree, -1);
1196           break;
1197   case 47: /* ForwardingFailedParam */
1198           offset=dissect_gsm_map_ForwardingFailedParam(FALSE, tvb, offset, pinfo, tree, -1);
1199           break;
1200   case 48: /* OR-NotAllowedParam */
1201           offset=dissect_gsm_map_OR_NotAllowedParam(FALSE, tvb, offset, pinfo, tree, -1);
1202           break;
1203   case 49: /* ATI-NotAllowedParam */
1204           offset=dissect_gsm_map_ATI_NotAllowedParam(FALSE, tvb, offset, pinfo, tree, -1);
1205           break;
1206   case 50: /* NoGroupCallNbParam */
1207           offset=dissect_gsm_map_NoGroupCallNbParam(FALSE, tvb, offset, pinfo, tree, -1);
1208           break;
1209   case 51: /* ResourceLimitationParam */
1210           offset=dissect_gsm_map_ResourceLimitationParam(FALSE, tvb, offset, pinfo, tree, -1);
1211           break;
1212   case 52: /* UnauthorizedRequestingNetwork-Param */
1213           offset=dissect_gsm_map_UnauthorizedRequestingNetwork_Param(FALSE, tvb, offset, pinfo, tree, -1);
1214           break;
1215   case 53: /* UnauthorizedLCSClient-Param */
1216           offset=dissect_gsm_map_UnauthorizedLCSClient_Param(FALSE, tvb, offset, pinfo, tree, -1);
1217           break;
1218   case 54: /* PositionMethodFailure-Param */
1219           offset=dissect_gsm_map_PositionMethodFailure_Param(FALSE, tvb, offset, pinfo, tree, -1);
1220           break;
1221   case 58: /* UnknownOrUnreachableLCSClient-Param */
1222           offset=dissect_gsm_map_UnknownOrUnreachableLCSClient_Param(FALSE, tvb, offset, pinfo, tree, -1);
1223           break;
1224   case 59: /* MM-EventNotSupported-Param */
1225           offset=dissect_gsm_map_MM_EventNotSupported_Param(FALSE, tvb, offset, pinfo, tree, -1);
1226           break;
1227   case 60: /* ATSI-NotAllowedParam */
1228           offset=dissect_gsm_map_ATSI_NotAllowedParam(FALSE, tvb, offset, pinfo, tree, -1);
1229           break;
1230   case 61: /* ATM-NotAllowedParam */
1231           offset=dissect_gsm_map_ATM_NotAllowedParam(FALSE, tvb, offset, pinfo, tree, -1);
1232           break;
1233   case 62: /* InformationNotAvailableParam */
1234           offset=dissect_gsm_map_InformationNotAvailableParam(FALSE, tvb, offset, pinfo, tree, -1);
1235           break;
1236   default:
1237           proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnErrorData blob");
1238           break;
1239   }
1240   return offset;
1241 }
1242 static guint8 gsmmap_pdu_type = 0;
1243 static guint8 gsm_map_pdu_size = 0;
1244
1245 static int
1246 dissect_gsm_map_GSMMAPPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo , proto_tree *tree, int hf_index) {
1247
1248   char *version_ptr;
1249
1250   opcode = 0;
1251   application_context_version = 0;
1252   if (pinfo->private_data != NULL){
1253     version_ptr = strrchr(pinfo->private_data,'.');
1254         if (version_ptr) {
1255                 application_context_version = atoi(version_ptr+1);
1256         }
1257   }
1258
1259   gsmmap_pdu_type = tvb_get_guint8(tvb, offset)&0x0f;
1260   /* Get the length and add 2 */
1261   gsm_map_pdu_size = tvb_get_guint8(tvb, offset+1)+2;
1262
1263   if (check_col(pinfo->cinfo, COL_INFO)){
1264     col_set_str(pinfo->cinfo, COL_INFO, val_to_str(gsmmap_pdu_type, gsm_map_Component_vals, "Unknown GSM-MAP PDU (%u)"));
1265         col_append_fstr(pinfo->cinfo, COL_INFO, " ");
1266   }
1267   offset = dissect_gsm_map_Component(FALSE, tvb, 0, pinfo, tree, hf_gsm_map_Component_PDU);
1268   return offset;
1269 /*
1270   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
1271                               GSMMAPPDU_choice, hf_index, ett_gsm_map_GSMMAPPDU, NULL);
1272 */
1273
1274   return offset;
1275 }
1276
1277
1278
1279
1280 static void
1281 dissect_gsm_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
1282 {
1283     proto_item          *item=NULL;
1284     proto_tree          *tree=NULL;
1285     /* Used for gsm_map TAP */
1286     static              gsm_map_tap_rec_t tap_rec;
1287     gint                op_idx;
1288
1289
1290     if (check_col(pinfo->cinfo, COL_PROTOCOL))
1291     {
1292         col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSM MAP");
1293     }
1294
1295     top_tree = parent_tree;
1296
1297     /* create display subtree for the protocol */
1298     if(parent_tree){
1299         item = proto_tree_add_item(parent_tree, proto_gsm_map, tvb, 0, -1, FALSE);
1300         tree = proto_item_add_subtree(item, ett_gsm_map);
1301     }
1302
1303     dissect_gsm_map_GSMMAPPDU(FALSE, tvb, 0, pinfo, tree, -1);
1304     match_strval_idx(opcode, gsm_map_opr_code_strings, &op_idx);
1305
1306     tap_rec.invoke = FALSE;
1307     if ( gsmmap_pdu_type  == 1 )
1308         tap_rec.invoke = TRUE;
1309     tap_rec.opr_code_idx = op_idx;
1310     tap_rec.size = gsm_map_pdu_size;
1311
1312     tap_queue_packet(gsm_map_tap, pinfo, &tap_rec);
1313 }
1314
1315 const value_string ssCode_vals[] = {
1316   { 0x00, "allSS - all SS" },
1317   { 0x10 ,"allLineIdentificationSS - all line identification SS" },
1318   { 0x11 ,"clip - calling line identification presentation" },
1319   { 0x12 ,"clir - calling line identification restriction" },
1320   { 0x13 ,"colp - connected line identification presentation" },
1321   { 0x14 ,"colr - connected line identification restriction" },
1322   { 0x15 ,"mci - malicious call identification" },
1323   { 0x18 ,"allNameIdentificationSS - all name indentification SS" },
1324   { 0x19 ,"cnap - calling name presentation" },
1325   { 0x20 ,"allForwardingSS - all forwarding SS" },
1326   { 0x21 ,"cfu - call forwarding unconditional" },
1327   { 0x28 ,"allCondForwardingSS - all conditional forwarding SS" },
1328   { 0x29 ,"cfb - call forwarding busy" },
1329   { 0x2a ,"cfnry - call forwarding on no reply" },
1330   { 0x2b ,"cfnrc - call forwarding on mobile subscriber not reachable" },
1331   { 0x24 ,"cd - call deflection" },
1332   { 0x30 ,"allCallOfferingSS - all call offering SS includes also all forwarding SS" },
1333   { 0x31 ,"ect - explicit call transfer" },
1334   { 0x32 ,"mah - mobile access hunting" },
1335   { 0x40 ,"allCallCompletionSS - all Call completion SS" },
1336   { 0x41 ,"cw - call waiting" },
1337   { 0x42 ,"hold - call hold" },
1338   { 0x43 ,"ccbs-A - completion of call to busy subscribers, originating side" },
1339   { 0x44 ,"ccbs-B - completion of call to busy subscribers, destination side" },
1340   { 0x45 ,"mc - multicall" },
1341   { 0x50 ,"allMultiPartySS - all multiparty SS" },
1342   { 0x51 ,"multiPTY - multiparty" },
1343   { 0x60 ,"allCommunityOfInterestSS - all community of interest SS" },
1344   { 0x61 ,"cug - closed user group" },
1345   { 0x70 ,"allChargingSS - all charging SS" },
1346   { 0x71 ,"aoci - advice of charge information" },
1347   { 0x72 ,"aocc - advice of charge charging" },
1348   { 0x80 ,"allAdditionalInfoTransferSS - all additional information transfer SS" },
1349   { 0x81 ,"uus1 - UUS1 user-to-user signalling" },
1350   { 0x82 ,"uus2 - UUS2 user-to-user signalling" },
1351   { 0x83 ,"uus3 - UUS3 user-to-user signalling" },
1352   { 0x90 ,"allCallRestrictionSS - all Callrestriction SS" },
1353   { 0x91 ,"barringOfOutgoingCalls" },
1354   { 0x92 ,"baoc - barring of all outgoing calls" },
1355   { 0x93 ,"boic - barring of outgoing international calls" },
1356   { 0x94 ,"boicExHC - barring of outgoing international calls except those directed to the home PLMN" },
1357   { 0x99 ,"barringOfIncomingCalls" },
1358   { 0x9a ,"baic - barring of all incoming calls" },
1359   { 0x9b ,"bicRoam - barring of incoming calls when roaming outside home PLMN Country" },
1360   { 0xf0 ,"allPLMN-specificSS" },
1361   { 0xa0 ,"allCallPrioritySS - all call priority SS" },
1362   { 0xa1 ,"emlpp - enhanced Multilevel Precedence Pre-emption (EMLPP) service" },
1363   { 0xb0 ,"allLCSPrivacyException - all LCS Privacy Exception Classes" },
1364   { 0xb1 ,"universal - allow location by any LCS client" },
1365   { 0xb2 ,"callrelated - allow location by any value added LCS client to which a call is established from the target MS" },
1366   { 0xb3 ,"callunrelated - allow location by designated external value added LCS clients" },
1367   { 0xb4 ,"plmnoperator - allow location by designated PLMN operator LCS clients" },
1368   { 0xc0 ,"allMOLR-SS - all Mobile Originating Location Request Classes" },
1369   { 0xc1 ,"basicSelfLocation - allow an MS to request its own location" },
1370   { 0xc2 ,"autonomousSelfLocation - allow an MS to perform self location without interaction with the PLMN for a predetermined period of time" },
1371   { 0xc3 ,"transferToThirdParty - allow an MS to request transfer of its location to another LCS client" },
1372
1373   { 0xf1 ,"plmn-specificSS-1" },
1374   { 0xf2 ,"plmn-specificSS-2" },
1375   { 0xf3 ,"plmn-specificSS-3" },
1376   { 0xf4 ,"plmn-specificSS-4" },
1377   { 0xf5 ,"plmn-specificSS-5" },
1378   { 0xf6 ,"plmn-specificSS-6" },
1379   { 0xf7 ,"plmn-specificSS-7" },
1380   { 0xf8 ,"plmn-specificSS-8" },
1381   { 0xf9 ,"plmn-specificSS-9" },
1382   { 0xfa ,"plmn-specificSS-a" },
1383   { 0xfb ,"plmn-specificSS-b" },
1384   { 0xfc ,"plmn-specificSS-c" },
1385   { 0xfd ,"plmn-specificSS-d" },
1386   { 0xfe ,"plmn-specificSS-e" },
1387   { 0xff ,"plmn-specificSS-f" },
1388   { 0, NULL }
1389 };
1390
1391 static const value_string Teleservice_vals[] = {
1392 {0x00, "allTeleservices" },
1393 {0x10, "allSpeechTransmissionServices" },
1394 {0x11, "telephony" },
1395 {0x12, "emergencyCalls" },
1396 {0x20, "allShortMessageServices" },
1397 {0x21, "shortMessageMT-PP" },
1398 {0x22, "shortMessageMO-PP" },
1399 {0x60, "allFacsimileTransmissionServices" },
1400 {0x61, "facsimileGroup3AndAlterSpeech" },
1401 {0x62, "automaticFacsimileGroup3" },
1402 {0x63, "facsimileGroup4" },
1403
1404 {0x70, "allDataTeleservices" },
1405 {0x80, "allTeleservices-ExeptSMS" },
1406
1407 {0x90, "allVoiceGroupCallServices" },
1408 {0x91, "voiceGroupCall" },
1409 {0x92, "voiceBroadcastCall" },
1410
1411 {0xd0, "allPLMN-specificTS" },
1412 {0xd1, "plmn-specificTS-1" },
1413 {0xd2, "plmn-specificTS-2" },
1414 {0xd3, "plmn-specificTS-3" },
1415 {0xd4, "plmn-specificTS-4" },
1416 {0xd5, "plmn-specificTS-5" },
1417 {0xd6, "plmn-specificTS-6" },
1418 {0xd7, "plmn-specificTS-7" },
1419 {0xd8, "plmn-specificTS-8" },
1420 {0xd9, "plmn-specificTS-9" },
1421 {0xda, "plmn-specificTS-A" },
1422 {0xdb, "plmn-specificTS-B" },
1423 {0xdc, "plmn-specificTS-C" },
1424 {0xdd, "plmn-specificTS-D" },
1425 {0xde, "plmn-specificTS-E" },
1426 {0xdf, "plmn-specificTS-F" },
1427   { 0, NULL }
1428 };
1429
1430 static const value_string Bearerservice_vals[] = {
1431 {0x00, "allBearerServices" },
1432 {0x10, "allDataCDA-Services" },
1433 {0x11, "dataCDA-300bps" },
1434 {0x12, "dataCDA-1200bps" },
1435 {0x13, "dataCDA-1200-75bps" },
1436 {0x14, "dataCDA-2400bps" },
1437 {0x15, "dataCDA-4800bps" },
1438 {0x16, "dataCDA-9600bps" },
1439 {0x17, "general-dataCDA" },
1440
1441 {0x18, "allDataCDS-Services" },
1442 {0x1A, "dataCDS-1200bps" },
1443 {0x1C, "dataCDS-2400bps" },
1444 {0x1D, "dataCDS-4800bps" },
1445 {0x1E, "dataCDS-9600bps" },
1446 {0x1F, "general-dataCDS" },
1447
1448 {0x20, "allPadAccessCA-Services" },
1449 {0x21, "padAccessCA-300bps" },
1450 {0x22, "padAccessCA-1200bps" },
1451 {0x23, "padAccessCA-1200-75bps" },
1452 {0x24, "padAccessCA-2400bps" },
1453 {0x25, "padAccessCA-4800bps" },
1454 {0x26, "padAccessCA-9600bps" },
1455 {0x27, "general-padAccessCA" },
1456
1457 {0x28, "allDataPDS-Services" },
1458 {0x2C, "dataPDS-2400bps" },
1459 {0x2D, "dataPDS-4800bps" },
1460 {0x2E, "dataPDS-9600bps" },
1461 {0x2F, "general-dataPDS" },
1462
1463 {0x30, "allAlternateSpeech-DataCDA" },
1464 {0x38, "allAlternateSpeech-DataCDS" },
1465 {0x40, "allSpeechFollowedByDataCDA" },
1466 {0x48, "allSpeechFollowedByDataCDS" },
1467
1468 {0x50, "allDataCircuitAsynchronous" },
1469 {0x60, "allAsynchronousServices" },
1470 {0x58, "allDataCircuitSynchronous" },
1471 {0x68, "allSynchronousServices" },
1472
1473 {0xD0, "allPLMN-specificBS" },
1474 {0xD1, "plmn-specificBS-1" },
1475 {0xD2, "plmn-specificBS-2" },
1476 {0xD3, "plmn-specificBS-3" },
1477 {0xD4, "plmn-specificBS-4" },
1478 {0xD5, "plmn-specificBS-5" },
1479 {0xD6, "plmn-specificBS-6" },
1480 {0xD7, "plmn-specificBS-7" },
1481 {0xD8, "plmn-specificBS-8" },
1482 {0xD9, "plmn-specificBS-9" },
1483 {0xDA, "plmn-specificBS-A" },
1484 {0xDB, "plmn-specificBS-B" },
1485 {0xDC, "plmn-specificBS-C" },
1486 {0xDD, "plmn-specificBS-D" },
1487 {0xDE, "plmn-specificBS-E" },
1488 {0xDF, "plmn-specificBS-F" },
1489
1490 { 0, NULL }
1491 };
1492
1493 /* ForwardingOptions 
1494
1495 -- bit 8: notification to forwarding party
1496 -- 0 no notification
1497 -- 1 notification
1498 */
1499 static const true_false_string notification_value  = {
1500   "Notification",
1501   "No notification"
1502 };
1503 /*
1504 -- bit 7: redirecting presentation
1505 -- 0 no presentation
1506 -- 1 presentation
1507 */
1508 static const true_false_string redirecting_presentation_value  = {
1509   "Presentation",
1510   "No presentationn"
1511 };
1512 /*
1513 -- bit 6: notification to calling party
1514 -- 0 no notification
1515 -- 1 notification
1516 */
1517 /*
1518 -- bit 5: 0 (unused)
1519 -- bits 43: forwarding reason
1520 -- 00 ms not reachable
1521 -- 01 ms busy
1522 -- 10 no reply
1523 -- 11 unconditional when used in a SRI Result,
1524 -- or call deflection when used in a RCH Argument
1525 */
1526 static const value_string forwarding_reason_values[] = {
1527 {0x0, "ms not reachable" },
1528 {0x1, "ms busy" },
1529 {0x2, "no reply" },
1530 {0x3, "unconditional when used in a SRI Result or call deflection when used in a RCH Argument" },
1531 { 0, NULL }
1532 };
1533 /*
1534 -- bits 21: 00 (unused)
1535 */
1536
1537 static const value_string pdp_type_org_values[] = {
1538 {0x0, "ETSI" },
1539 {0x1, "IETF" },
1540 {0xf, "Empty PDP type" },
1541 { 0, NULL }
1542 };
1543
1544 static const value_string etsi_pdp_type_number_values[] = {
1545 {0x0, "Reserved, used in earlier version of this protocol" },
1546 {0x1, "PPP" },
1547 { 0, NULL }
1548 };
1549
1550 static const value_string ietf_pdp_type_number_values[] = {
1551 {0x21, "IPv4 Address" },
1552 {0x57, "IPv6 Address" },
1553 { 0, NULL }
1554 };
1555
1556 /*
1557 ChargingCharacteristics ::= OCTET STRING (SIZE (2))
1558 -- Octets are coded according to 3GPP TS 32.015.
1559 -- From 3GPP TS 32.015.
1560 --
1561 -- Descriptions for the bits of the flag set:
1562 --
1563 -- Bit 1: H (Hot billing) := '00000001'B
1564 -- Bit 2: F (Flat rate) := '00000010'B
1565 -- Bit 3: P (Prepaid service) := '00000100'B
1566 -- Bit 4: N (Normal billing) := '00001000'B
1567 -- Bit 5: - (Reserved, set to 0) := '00010000'B
1568 -- Bit 6: - (Reserved, set to 0) := '00100000'B
1569 -- Bit 7: - (Reserved, set to 0) := '01000000'B
1570 -- Bit 8: - (Reserved, set to 0) := '10000000'B
1571 */
1572 static const value_string chargingcharacteristics_values[] = {
1573 {0x1, "H (Hot billing)" },
1574 {0x2, "F (Flat rate)" },
1575 {0x4, "P (Prepaid service)" },
1576 {0x8, "N (Normal billing)" },
1577 { 0, NULL }
1578 };
1579 /*--- proto_reg_handoff_gsm_map ---------------------------------------*/
1580 static void range_delete_callback(guint32 ssn)
1581 {
1582     if (ssn) {
1583         delete_itu_tcap_subdissector(ssn, map_handle);
1584     }
1585 }
1586
1587 static void range_add_callback(guint32 ssn)
1588 {
1589     if (ssn) {
1590         add_itu_tcap_subdissector(ssn, map_handle);
1591     }
1592 }
1593
1594 void proto_reg_handoff_gsm_map(void) {
1595
1596     static int map_prefs_initialized = FALSE;
1597     data_handle = find_dissector("data");
1598
1599     if (!map_prefs_initialized) {
1600         map_prefs_initialized = TRUE;
1601         map_handle = create_dissector_handle(dissect_gsm_map, proto_gsm_map);
1602   register_ber_oid_dissector_handle("0.4.0.0.1.0.1.3", map_handle, proto_gsm_map, "itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) networkLocUp(1) version3(3)");  
1603   register_ber_oid_dissector_handle("0.4.0.0.1.0.1.2", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) networkLocUp(1) version2(2)" );
1604   register_ber_oid_dissector_handle("0.4.0.0.1.0.2.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) locationCancel(2) version3(3)" );
1605   register_ber_oid_dissector_handle("0.4.0.0.1.0.2.2", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) locationCancel(2) version2(2)" );
1606   register_ber_oid_dissector_handle("0.4.0.0.1.0.2.1", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) locationCancel(2) version1(1)" );
1607   register_ber_oid_dissector_handle("0.4.0.0.1.0.3.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) roamingNbEnquiry(3) version3(3)" );
1608   register_ber_oid_dissector_handle("0.4.0.0.1.0.3.2", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) roamingNbEnquiry(3) version2(2)" );
1609   register_ber_oid_dissector_handle("0.4.0.0.1.0.3.1", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) roamingNbEnquiry(3) version1(1)" );
1610   register_ber_oid_dissector_handle("0.4.0.0.1.0.5.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) locInfoRetrieval(5) version3(3)" );
1611   register_ber_oid_dissector_handle("0.4.0.0.1.0.5.2", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) locInfoRetrieval(5) version2(2)" );
1612   register_ber_oid_dissector_handle("0.4.0.0.1.0.5.1", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) locInfoRetrieval(5) version1(1)" );
1613   register_ber_oid_dissector_handle("0.4.0.0.1.0.6.4", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) callControlTransfer(6) version4(4)" );
1614   register_ber_oid_dissector_handle("0.4.0.0.1.0.7.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) reporting(7) version3(3)" );
1615   register_ber_oid_dissector_handle("0.4.0.0.1.0.8.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) callCompletion(8) version3(3)" );
1616   register_ber_oid_dissector_handle("0.4.0.0.1.0.10.2", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) reset(10) version2(2)" );
1617   register_ber_oid_dissector_handle("0.4.0.0.1.0.10.1", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) reset(10) version1(1)" );
1618   register_ber_oid_dissector_handle("0.4.0.0.1.0.11.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) handoverControl(11) version3(3)" );
1619   register_ber_oid_dissector_handle("0.4.0.0.1.0.11.2", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) handoverControl(11) version2(2)" );
1620   register_ber_oid_dissector_handle("0.4.0.0.1.0.11.1", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) handoverControl(11) version1(1)" );
1621   register_ber_oid_dissector_handle("0.4.0.0.1.0.12.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) sIWFSAllocation(12) version3(3)" );
1622   register_ber_oid_dissector_handle("0.4.0.0.1.0.13.2", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) equipmentMngt(13) version2(2)" );
1623   register_ber_oid_dissector_handle("0.4.0.0.1.0.13.1", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) equipmentMngt(13) version1(1)" );
1624   register_ber_oid_dissector_handle("0.4.0.0.1.0.14.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) infoRetrieval(14) version3(3)" );
1625   register_ber_oid_dissector_handle("0.4.0.0.1.0.14.2", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) infoRetrieval(14) version2(2)" );
1626   register_ber_oid_dissector_handle("0.4.0.0.1.0.14.1", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) infoRetrieval(14) version1(1)" );
1627   register_ber_oid_dissector_handle("0.4.0.0.1.0.15.1", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) interVlrInfoRetrieval(15) version1(1)" );
1628   register_ber_oid_dissector_handle("0.4.0.0.1.0.15.2", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) interVlrInfoRetrieval(15) version2(2)" );
1629   register_ber_oid_dissector_handle("0.4.0.0.1.0.15.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) interVlrInfoRetrieval(15) version3(3)" );
1630   register_ber_oid_dissector_handle("0.4.0.0.1.0.16.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) subscriberDataMngt(16) version3(3)" );
1631   register_ber_oid_dissector_handle("0.4.0.0.1.0.16.2", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) subscriberDataMngt(16) version2(2)" );
1632   register_ber_oid_dissector_handle("0.4.0.0.1.0.16.1", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) subscriberDataMngt(16) version1(1)" );
1633   register_ber_oid_dissector_handle("0.4.0.0.1.0.17.2", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) tracing(17) version2(2)" );
1634   register_ber_oid_dissector_handle("0.4.0.0.1.0.17.1", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) tracing(17) version1(1)" );
1635   register_ber_oid_dissector_handle("0.4.0.0.1.0.18.2", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) networkFunctionalSs(18) version2(2)" );
1636   register_ber_oid_dissector_handle("0.4.0.0.1.0.18.1", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) networkFunctionalSs(18) version1(1)" );
1637   register_ber_oid_dissector_handle("0.4.0.0.1.0.19.1", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) networkUnstructuredSs(19) version2(2)" );
1638   register_ber_oid_dissector_handle("0.4.0.0.1.0.20.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) shortMsgGateway(20) version3(3)" );
1639   register_ber_oid_dissector_handle("0.4.0.0.1.0.20.2", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) shortMsgGateway(20) version2(2)" );
1640   register_ber_oid_dissector_handle("0.4.0.0.1.0.20.1", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) shortMsgGateway(20) version1(1)" );
1641   register_ber_oid_dissector_handle("0.4.0.0.1.0.21.2", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) shortMsgMO-Relay(21) version2(2)" );
1642   register_ber_oid_dissector_handle("0.4.0.0.1.0.21.1", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) --shortMsgRelay--21 version1(1)" );
1643   register_ber_oid_dissector_handle("0.4.0.0.1.0.22.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) subscriberDataModificationNotification(22) version3(3)" );
1644   register_ber_oid_dissector_handle("0.4.0.0.1.0.23.2", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) shortMsgAlert(23) version2(2)" );
1645   register_ber_oid_dissector_handle("0.4.0.0.1.0.23.1", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) shortMsgAlert(23) version1(1)" );
1646   register_ber_oid_dissector_handle("0.4.0.0.1.0.24.2", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) mwdMngt(24) version2(2)" );
1647   register_ber_oid_dissector_handle("0.4.0.0.1.0.24.1", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) mwdMngt(24) version1(1)" );
1648   register_ber_oid_dissector_handle("0.4.0.0.1.0.25.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) shortMsgMT-Relay(25) version3(3)" );
1649   register_ber_oid_dissector_handle("0.4.0.0.1.0.25.2", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) shortMsgMT-Relay(25) version2(2)" );
1650   register_ber_oid_dissector_handle("0.4.0.0.1.0.26.2", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) imsiRetrieval(26) version2(2)" );
1651   register_ber_oid_dissector_handle("0.4.0.0.1.0.25.1", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) msPurging(27) version2(2)" );
1652   register_ber_oid_dissector_handle("0.4.0.0.1.0.29.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) anyTimeInfoEnquiry(29) version3(3)" );
1653   register_ber_oid_dissector_handle("0.4.0.0.1.0.31.2", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) oupCallControl(31) version3(3)" );
1654   register_ber_oid_dissector_handle("0.4.0.0.1.0.32.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) gprsLocationUpdate(32) version3(3)" );
1655   register_ber_oid_dissector_handle("0.4.0.0.1.0.33.4", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) rsLocationInfoRetrieval(33) version4(4)" );
1656   register_ber_oid_dissector_handle("0.4.0.0.1.0.34.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) failureReport(34) version3(3)" );
1657   register_ber_oid_dissector_handle("0.4.0.0.1.0.36.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) ss-InvocationNotification(36) version3(3)" );
1658   register_ber_oid_dissector_handle("0.4.0.0.1.0.37.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) locationSvcGateway(37) version3(3)" );
1659   register_ber_oid_dissector_handle("0.4.0.0.1.0.38.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) locationSvcEnquiry(38) version3(3)" );
1660   register_ber_oid_dissector_handle("0.4.0.0.1.0.39.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) authenticationFailureReport(39) version3(3)" );
1661   register_ber_oid_dissector_handle("0.4.0.0.1.0.40.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) secureTransportHandling(40) version3(3)" );
1662   register_ber_oid_dissector_handle("0.4.0.0.1.0.42.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) mm-EventReporting(42) version3(3)" );
1663   register_ber_oid_dissector_handle("0.4.0.0.1.0.43.3", map_handle, proto_gsm_map,"itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) anyTimeInfoHandling(43) version3(3)" );
1664     }
1665     else {
1666         range_foreach(ssn_range, range_delete_callback);
1667     }
1668
1669     g_free(ssn_range);
1670     ssn_range = range_copy(global_ssn_range);
1671
1672     range_foreach(ssn_range, range_add_callback);
1673
1674 }
1675
1676 /*--- proto_register_gsm_map -------------------------------------------*/
1677 void proto_register_gsm_map(void) {
1678         module_t *gsm_map_module;
1679
1680   /* List of fields */
1681   static hf_register_info hf[] = {
1682           /*
1683     { &hf_gsm_map_invokeCmd,
1684       { "invokeCmd", "gsm_map.invokeCmd",
1685         FT_UINT32, BASE_DEC, VALS(gsm_map_opr_code_strings), 0,
1686         "InvokePDU/invokeCmd", HFILL }},
1687     { &hf_gsm_map_invokeid,
1688       { "invokeid", "gsm_map.invokeid",
1689         FT_INT32, BASE_DEC, NULL, 0,
1690         "InvokeId/invokeid", HFILL }},
1691     { &hf_gsm_map_absent,
1692       { "absent", "gsm_map.absent",
1693         FT_NONE, BASE_NONE, NULL, 0,
1694         "InvokeId/absent", HFILL }},
1695     { &hf_gsm_map_invokeId,
1696       { "invokeId", "gsm_map.invokeId",
1697         FT_UINT32, BASE_DEC, VALS(InvokeId_vals), 0,
1698         "InvokePDU/invokeId", HFILL }},
1699     { &hf_gsm_map_invoke,
1700       { "invoke", "gsm_map.invoke",
1701         FT_NONE, BASE_NONE, NULL, 0,
1702         "GSMMAPPDU/invoke", HFILL }},
1703     { &hf_gsm_map_returnResult,
1704       { "returnResult", "gsm_map.returnResult",
1705         FT_NONE, BASE_NONE, NULL, 0,
1706         "GSMMAPPDU/returnResult", HFILL }},
1707         {&hf_gsm_map_returnResult_result,
1708       { "returnResult_result", "gsm_map.returnresultresult",
1709         FT_BYTES, BASE_NONE, NULL, 0,
1710         "returnResult_result", HFILL }},
1711         {&hf_gsm_map_returnError_result,
1712       { "returnError_result", "gsm_map.returnerrorresult",
1713         FT_UINT32, BASE_DEC, NULL, 0,
1714         "returnError_result", HFILL }},
1715         {&hf_gsm_map_returnError,
1716       { "returnError", "gsm_map.returnError",
1717         FT_NONE, BASE_NONE, NULL, 0,
1718         "GSMMAPPDU/returnError", HFILL }},
1719         {&hf_gsm_map_local_errorCode,
1720       { "Local Error Code", "gsm_map.localerrorCode",
1721         FT_UINT32, BASE_DEC, VALS(gsm_map_err_code_string_vals), 0,
1722         "localerrorCode", HFILL }},
1723         {&hf_gsm_map_global_errorCode_oid,
1724       { "Global Error Code OID", "gsm_map.hlobalerrorCodeoid",
1725         FT_STRING, BASE_NONE, NULL, 0,
1726         "globalerrorCodeoid", HFILL }},
1727         {&hf_gsm_map_global_errorCode,
1728       { "Global Error Code", "gsm_map.globalerrorCode",
1729         FT_UINT32, BASE_DEC, NULL, 0,
1730         "globalerrorCode", HFILL }},
1731     { &hf_gsm_map_getPassword,
1732       { "Password", "gsm_map.password",
1733         FT_UINT8, BASE_DEC, VALS(gsm_map_GetPasswordArg_vals), 0,
1734         "Password", HFILL }},
1735
1736                 */
1737         { &hf_gsm_map_SendAuthenticationInfoArg,
1738       { "SendAuthenticationInfoArg", "gsm_map.SendAuthenticationInfoArg",
1739         FT_BYTES, BASE_NONE, NULL, 0,
1740         "SendAuthenticationInfoArg", HFILL }},
1741         { &hf_gsm_map_SendAuthenticationInfoRes,
1742       { "SendAuthenticationInfoRes", "gsm_map.SendAuthenticationInfoRes",
1743         FT_BYTES, BASE_NONE, NULL, 0,
1744         "SendAuthenticationInfoRes", HFILL }},
1745     { &hf_gsm_map_currentPassword,
1746       { "currentPassword", "gsm_map.currentPassword",
1747         FT_STRING, BASE_NONE, NULL, 0,
1748         "", HFILL }},
1749         { &hf_gsm_mapSendEndSignal,
1750       { "mapSendEndSignalArg", "gsm_map.mapsendendsignalarg",
1751         FT_BYTES, BASE_NONE, NULL, 0,
1752         "mapSendEndSignalArg", HFILL }},
1753         { &hf_gsm_map_CheckIMEIArg,
1754       { "gsm_CheckIMEIArg", "gsm_map.CheckIMEIArg",
1755         FT_BYTES, BASE_NONE, NULL, 0,
1756         "gsm_CheckIMEIArg", HFILL }},
1757     { &hf_gsm_map_extension,
1758       { "Extension", "gsm_map.extension",
1759         FT_BOOLEAN, 8, TFS(&gsm_map_extension_value), 0x80,
1760         "Extension", HFILL }},
1761     { &hf_gsm_map_nature_of_number,
1762       { "Nature of number", "gsm_map.nature_of_number",
1763         FT_UINT8, BASE_HEX, VALS(gsm_map_nature_of_number_values), 0x70,
1764         "Nature of number", HFILL }},
1765     { &hf_gsm_map_number_plan,
1766       { "Number plan", "gsm_map.number_plan",
1767         FT_UINT8, BASE_HEX, VALS(gsm_map_number_plan_values), 0x0f,
1768         "Number plan", HFILL }},
1769         { &hf_gsm_map_isdn_address_digits,
1770       { "ISDN Address digits", "gsm_map.isdn.address.digits",
1771         FT_STRING, BASE_NONE, NULL, 0,
1772         "ISDN Address digits", HFILL }},
1773         { &hf_gsm_map_address_digits,
1774       { "Address digits", "gsm_map.address.digits",
1775         FT_STRING, BASE_NONE, NULL, 0,
1776         "Address digits", HFILL }},
1777         { &hf_gsm_map_servicecentreaddress_digits,
1778       { "ServiceCentreAddress digits", "gsm_map.servicecentreaddress_digits",
1779         FT_STRING, BASE_NONE, NULL, 0,
1780         "ServiceCentreAddress digits", HFILL }},
1781         { &hf_gsm_map_imsi_digits,
1782       { "Imsi digits", "gsm_map.imsi_digits",
1783         FT_STRING, BASE_NONE, NULL, 0,
1784         "Imsi digits", HFILL }},
1785         { &hf_gsm_map_Ss_Status_unused,
1786       { "Unused", "gsm_map.unused",
1787         FT_UINT8, BASE_HEX, NULL, 0xf0,
1788         "Unused", HFILL }},
1789         { &hf_gsm_map_Ss_Status_q_bit,
1790       { "Q bit", "gsm_map.ss_status_q_bit",
1791         FT_BOOLEAN, 8, TFS(&gsm_map_Ss_Status_q_bit_values), 0x08,
1792         "Q bit", HFILL }},
1793         { &hf_gsm_map_Ss_Status_p_bit,
1794       { "P bit", "gsm_map.ss_status_p_bit",
1795         FT_BOOLEAN, 8, TFS(&gsm_map_Ss_Status_p_values), 0x04,
1796         "P bit", HFILL }},
1797         { &hf_gsm_map_Ss_Status_r_bit,
1798       { "R bit", "gsm_map.ss_status_r_bit",
1799         FT_BOOLEAN, 8, TFS(&gsm_map_Ss_Status_r_values), 0x02,
1800         "R bit", HFILL }},
1801         { &hf_gsm_map_Ss_Status_a_bit,
1802       { "A bit", "gsm_map.ss_status_a_bit",
1803         FT_BOOLEAN, 8, TFS(&gsm_map_Ss_Status_a_values), 0x01,
1804         "A bit", HFILL }},
1805         { &hf_gsm_map_notification_to_forwarding_party,
1806       { "Notification to forwarding party", "gsm_map.notification_to_forwarding_party",
1807         FT_BOOLEAN, 8, TFS(&notification_value), 0x80,
1808         "Notification to forwarding party", HFILL }},
1809         { &hf_gsm_map_redirecting_presentation,
1810       { "Redirecting presentation", "gsm_map.redirecting_presentation",
1811         FT_BOOLEAN, 8, TFS(&redirecting_presentation_value), 0x40,
1812         "Redirecting presentation", HFILL }},
1813         { &hf_gsm_map_notification_to_calling_party,
1814       { "Notification to calling party", "gsm_map.notification_to_clling_party",
1815         FT_BOOLEAN, 8, TFS(&notification_value), 0x20,
1816         "Notification to calling party", HFILL }},
1817     { &hf_gsm_map_forwarding_reason,
1818       { "Forwarding reason", "gsm_map.forwarding_reason",
1819         FT_UINT8, BASE_HEX, VALS(forwarding_reason_values), 0x0c,
1820         "forwarding reason", HFILL }},
1821     { &hf_gsm_map_pdp_type_org,
1822       { "PDP Type Organization", "gsm_map.pdp_type_org",
1823         FT_UINT8, BASE_HEX, VALS(pdp_type_org_values), 0x0f,
1824         "PDP Type Organization", HFILL }},
1825     { &hf_gsm_map_etsi_pdp_type_number,
1826       { "PDP Type Number", "gsm_map.pdp_type_org",
1827         FT_UINT8, BASE_HEX, VALS(etsi_pdp_type_number_values), 0,
1828         "ETSI PDP Type Number", HFILL }},
1829     { &hf_gsm_map_ietf_pdp_type_number,
1830       { "PDP Type Number", "gsm_map.ietf_pdp_type_number",
1831         FT_UINT8, BASE_HEX, VALS(ietf_pdp_type_number_values), 0,
1832         "IETF PDP Type Number", HFILL }},
1833     { &hf_gsm_map_ext_qos_subscribed_pri,
1834       { "Allocation/Retention priority", "gsm_map.ext_qos_subscribed_pri",
1835         FT_UINT8, BASE_DEC, NULL, 0xff,
1836         "Allocation/Retention priority", HFILL }},
1837     { &hf_gsm_map_qos_traffic_cls,
1838       { "Traffic class", "gsm_map.qos.traffic_cls",
1839         FT_UINT8, BASE_DEC, VALS(gsm_a_qos_traffic_cls_vals), 0xe0,
1840         "Traffic class", HFILL }},
1841     { &hf_gsm_map_qos_del_order,
1842       { "Delivery order", "gsm_map.qos.del_order",
1843         FT_UINT8, BASE_DEC, VALS(gsm_a_qos_traffic_cls_vals), 0x18,
1844         "Delivery order", HFILL }},
1845     { &hf_gsm_map_qos_del_of_err_sdu,
1846       { "Delivery of erroneous SDUs", "gsm_map.qos.del_of_err_sdu",
1847         FT_UINT8, BASE_DEC, VALS(gsm_a_qos_del_of_err_sdu_vals), 0x03,
1848         "Delivery of erroneous SDUs", HFILL }},
1849     { &hf_gsm_map_qos_ber,
1850       { "Residual Bit Error Rate (BER)", "gsm_map.qos.ber",
1851         FT_UINT8, BASE_DEC, VALS(gsm_a_qos_ber_vals), 0xf0,
1852         "Residual Bit Error Rate (BER)", HFILL }},
1853     { &hf_gsm_map_qos_sdu_err_rat,
1854       { "SDU error ratio", "gsm_map.qos.sdu_err_rat",
1855         FT_UINT8, BASE_DEC, VALS(gsm_a_qos_sdu_err_rat_vals), 0x0f,
1856         "SDU error ratio", HFILL }},
1857     { &hf_gsm_map_qos_traff_hdl_pri,
1858       { "Traffic handling priority", "gsm_map.qos.traff_hdl_pri",
1859         FT_UINT8, BASE_DEC, VALS(gsm_a_qos_traff_hdl_pri_vals), 0x03,
1860         "Traffic handling priority", HFILL }},
1861
1862     { &hf_gsm_map_qos_max_sdu,
1863       { "Maximum SDU size", "gsm_map.qos.max_sdu",
1864         FT_UINT32, BASE_DEC, NULL, 0x0,
1865         "Maximum SDU size", HFILL }},           
1866     { &hf_gsm_map_max_brate_ulink,
1867       { "Maximum bit rate for uplink in kbit/s", "gsm_map.qos.max_brate_ulink",
1868         FT_UINT32, BASE_DEC, NULL, 0x0,
1869         "Maximum bit rate for uplink", HFILL }},
1870     { &hf_gsm_map_max_brate_dlink,
1871       { "Maximum bit rate for downlink in kbit/s", "gsm_map.qos.max_brate_dlink",
1872         FT_UINT32, BASE_DEC, NULL, 0x0,
1873         "Maximum bit rate for downlink", HFILL }},
1874     { &hf_gsm_map_qos_transfer_delay,
1875       { "Transfer delay (Raw data see TS 24.008 for interpretation)", "gsm_map.qos.transfer_delay",
1876         FT_UINT8, BASE_DEC, NULL, 0xfc,
1877         "Transfer delay", HFILL }},
1878     { &hf_gsm_map_guaranteed_max_brate_ulink,
1879       { "Guaranteed bit rate for uplink in kbit/s", "gsm_map.qos.brate_ulink",
1880         FT_UINT32, BASE_DEC, NULL, 0x0,
1881         "Guaranteed bit rate for uplink", HFILL }},
1882     { &hf_gsm_map_guaranteed_max_brate_dlink,
1883       { "Guaranteed bit rate for downlink in kbit/s", "gsm_map.qos.brate_dlink",
1884         FT_UINT32, BASE_DEC, NULL, 0x0,
1885         "Guaranteed bit rate for downlink", HFILL }},
1886    { &hf_gsm_map_GSNAddress_IPv4,
1887       { "GSN-Address IPv4",  "gsm_map.gsnaddress_ipv4",
1888           FT_IPv4, BASE_NONE, NULL, 0,
1889           "IPAddress IPv4", HFILL }},
1890    { &hf_gsm_map_GSNAddress_IPv6,
1891       { "GSN Address IPv6",  "gsm_map.gsnaddress_ipv6",
1892           FT_IPv4, BASE_NONE, NULL, 0,
1893           "IPAddress IPv6", HFILL }},
1894
1895 #include "packet-gsm_map-hfarr.c"
1896   };
1897
1898   /* List of subtrees */
1899   static gint *ett[] = {
1900     &ett_gsm_map,
1901     &ett_gsm_map_InvokeId,
1902     &ett_gsm_map_InvokePDU,
1903     &ett_gsm_map_ReturnResultPDU,
1904         &ett_gsm_map_ReturnErrorPDU,
1905     &ett_gsm_map_ReturnResult_result,
1906         &ett_gsm_map_ReturnError_result,
1907     &ett_gsm_map_GSMMAPPDU,
1908         &ett_gsm_map_ext_qos_subscribed,
1909         &ett_gsm_map_pdptypenumber,
1910         &ett_gsm_map_RAIdentity,
1911         &ett_gsm_map_LAIFixedLength,
1912
1913 #include "packet-gsm_map-ettarr.c"
1914   };
1915
1916   /* Register protocol */
1917   proto_gsm_map = proto_register_protocol(PNAME, PSNAME, PFNAME);
1918 /*XXX  register_dissector("gsm_map", dissect_gsm_map, proto_gsm_map);*/
1919   /* Register fields and subtrees */
1920   proto_register_field_array(proto_gsm_map, hf, array_length(hf));
1921   proto_register_subtree_array(ett, array_length(ett));
1922
1923   sms_dissector_table = register_dissector_table("gsm_map.sms_tpdu", 
1924                                                  "GSM SMS TPDU", FT_UINT8,
1925                                                  BASE_DEC);
1926
1927   gsm_map_tap = register_tap("gsm_map");
1928   /*register_ber_oid_name("0.4.0.0.1.0.1.3","itu-t(0) identified-organization(4) etsi(0) mobileDomain(0) gsm-Network(1) map-ac(0) networkLocUp(1) version3(3)" );
1929    *
1930    * Register our configuration options, particularly our ssn:s
1931    * Set default SSNs
1932    */
1933   range_convert_str(&global_ssn_range, "6-9", MAX_SSN);
1934   ssn_range = range_empty();
1935
1936
1937   gsm_map_module = prefs_register_protocol(proto_gsm_map, proto_reg_handoff_gsm_map);
1938
1939   prefs_register_range_preference(gsm_map_module, "tcap.ssn", "TCAP SSNs",
1940                                   "TCAP Subsystem numbers used for GSM MAP",
1941                                   &global_ssn_range, MAX_SSN);
1942 }
1943
1944