Use tvb accessors rather than directly accessing tvb struct.
[obnox/wireshark/wip.git] / asn1 / gsm_map / packet-gsm_map-template.c
index 94ee779204596147d3a1f32b7590a2a556d75be5..2ae8f3b45d082bbbd2501cabe2560d2c177e52c7 100644 (file)
@@ -12,7 +12,7 @@
 /* packet-gsm_map-template.c
  * Routines for GSM MobileApplication packet dissection
  * including GSM SS.
- * Copyright 2004 - 2009 , Anders Broman <anders.broman [AT] ericsson.com>
+ * Copyright 2004 - 2010 , Anders Broman <anders.broman [AT] ericsson.com>
  * Based on the dissector by:
  * Felix Fei <felix.fei [AT] utstar.com>
  * and Michael Lum <mlum [AT] telostech.com>
@@ -56,7 +56,6 @@
 #include <epan/oids.h>
 #include <epan/expert.h>
 
-#include <stdio.h>
 #include <string.h>
 
 #include <epan/asn1.h>
@@ -140,6 +139,7 @@ static int hf_gsm_map_ie_tag = -1;
 static int hf_gsm_map_len = -1;
 static int hf_gsm_map_disc_par = -1;
 static int hf_gsm_map_dlci = -1;
+static int hf_gsm_apn_str = -1;
 
 #include "packet-gsm_map-hf.c"
 
@@ -166,6 +166,7 @@ static gint ett_gsm_map_externalsignalinfo = -1;
 static gint ett_gsm_map_cbs_data_coding = -1;
 static gint ett_gsm_map_GlobalCellId = -1;
 static gint ett_gsm_map_GeographicalInformation = -1;
+static gint ett_gsm_map_apn_str = -1;
 
 #include "packet-gsm_map-ett.c"
 
@@ -174,7 +175,9 @@ static dissector_handle_t   data_handle;
 static dissector_handle_t      ranap_handle;
 static dissector_handle_t      dtap_handle;
 static dissector_handle_t      map_handle;
-
+static dissector_table_t       map_prop_arg_opcode_table; /* prorietary operation codes */
+static dissector_table_t       map_prop_res_opcode_table; /* prorietary operation codes */
+static dissector_table_t       map_prop_err_opcode_table; /* prorietary operation codes */
 /* Preferenc settings default */
 #define MAX_SSN 254
 static range_t *global_ssn_range;
@@ -234,7 +237,7 @@ static const value_string gsm_map_disc_par_vals[] = {
   { 0, NULL }
 };
 
-char *
+const char *
 unpack_digits(tvbuff_t *tvb, int offset) {
 
        int length;
@@ -245,7 +248,7 @@ unpack_digits(tvbuff_t *tvb, int offset) {
        length = tvb_length(tvb);
        if (length < offset)
                return "";
-       digit_str = ep_alloc((length - offset)*2+1);
+       digit_str = (char *)ep_alloc((length - offset)*2+1);
 
        while ( offset < length ){
 
@@ -314,17 +317,17 @@ dissect_gsm_map_ext_qos_subscribed(tvbuff_t *tvb, packet_info *pinfo _U_, proto_
                6-13.
         */
        /* Allocation/Retention Priority */
-       proto_tree_add_item(subtree, hf_gsm_map_ext_qos_subscribed_pri, tvb, offset, 1, FALSE);
+       proto_tree_add_item(subtree, hf_gsm_map_ext_qos_subscribed_pri, tvb, offset, 1, ENC_BIG_ENDIAN);
        offset++;
 
        /* Quality of Service Octets 6-13.( Octet 2 - 9 Here) */
 
        /* Traffic class, octet 6 (see 3GPP TS 23.107) Bits 8 7 6 */
-       proto_tree_add_item(subtree, hf_gsm_map_qos_traffic_cls, tvb, offset, 1, FALSE);
+       proto_tree_add_item(subtree, hf_gsm_map_qos_traffic_cls, tvb, offset, 1, ENC_BIG_ENDIAN);
        /* Delivery order, octet 6 (see 3GPP TS 23.107) Bits 5 4 */
-       proto_tree_add_item(subtree, hf_gsm_map_qos_del_order, tvb, offset, 1, FALSE);
+       proto_tree_add_item(subtree, hf_gsm_map_qos_del_order, tvb, offset, 1, ENC_BIG_ENDIAN);
        /* Delivery of erroneous SDUs, octet 6 (see 3GPP TS 23.107) Bits 3 2 1 */
-       proto_tree_add_item(subtree, hf_gsm_map_qos_del_of_err_sdu, tvb, offset, 1, FALSE);
+       proto_tree_add_item(subtree, hf_gsm_map_qos_del_of_err_sdu, tvb, offset, 1, ENC_BIG_ENDIAN);
        offset++;
 
        /* Maximum SDU size, octet 7 (see 3GPP TS 23.107) */
@@ -372,15 +375,15 @@ dissect_gsm_map_ext_qos_subscribed(tvbuff_t *tvb, packet_info *pinfo _U_, proto_
        }
        offset++;
        /* Residual Bit Error Rate (BER), octet 10 (see 3GPP TS 23.107) Bits 8 7 6 5 */
-       proto_tree_add_item(subtree, hf_gsm_map_qos_ber, tvb, offset, 1, FALSE);
+       proto_tree_add_item(subtree, hf_gsm_map_qos_ber, tvb, offset, 1, ENC_BIG_ENDIAN);
        /* SDU error ratio, octet 10 (see 3GPP TS 23.107) */
-       proto_tree_add_item(subtree, hf_gsm_map_qos_sdu_err_rat, tvb, offset, 1, FALSE);
+       proto_tree_add_item(subtree, hf_gsm_map_qos_sdu_err_rat, tvb, offset, 1, ENC_BIG_ENDIAN);
        offset++;
 
        /* Transfer delay, octet 11 (See 3GPP TS 23.107) Bits 8 7 6 5 4 3 */
-       proto_tree_add_item(subtree, hf_gsm_map_qos_transfer_delay, tvb, offset, 1, FALSE);
+       proto_tree_add_item(subtree, hf_gsm_map_qos_transfer_delay, tvb, offset, 1, ENC_BIG_ENDIAN);
        /* Traffic handling priority, octet 11 (see 3GPP TS 23.107) Bits 2 1 */
-       proto_tree_add_item(subtree, hf_gsm_map_qos_traff_hdl_pri, tvb, offset, 1, FALSE);
+       proto_tree_add_item(subtree, hf_gsm_map_qos_traff_hdl_pri, tvb, offset, 1, ENC_BIG_ENDIAN);
        offset++;
 
        /*      Guaranteed bit rate for uplink, octet 12 (See 3GPP TS 23.107)
@@ -427,13 +430,13 @@ other values reserved for future use
 
 /* TS 23 032 Table 2a: Coding of Type of Shape */
 static const value_string type_of_shape_vals[] = {
-       { ELLIPSOID_POINT,              "Ellipsoid Point"},
-       { ELLIPSOID_POINT_WITH_UNCERT_CIRC,             "Ellipsoid point with uncertainty Circle"},
-       { ELLIPSOID_POINT_WITH_UNCERT_ELLIPSE,          "Ellipsoid point with uncertainty Ellipse"},
-       { POLYGON,              "Polygon"},
-       { ELLIPSOID_POINT_WITH_ALT,             "Ellipsoid point with altitude"},
-       { ELLIPSOID_POINT_WITH_ALT_AND_UNCERT_ELLIPSOID,                "Ellipsoid point with altitude and uncertainty Ellipsoid"},
-       { ELLIPSOID_ARC,                "Ellipsoid Arc"},
+       { ELLIPSOID_POINT,                                                                      "Ellipsoid Point"},
+       { ELLIPSOID_POINT_WITH_UNCERT_CIRC,                                     "Ellipsoid point with uncertainty Circle"},
+       { ELLIPSOID_POINT_WITH_UNCERT_ELLIPSE,                          "Ellipsoid point with uncertainty Ellipse"},
+       { POLYGON,                                                                                      "Polygon"},
+       { ELLIPSOID_POINT_WITH_ALT,                                                     "Ellipsoid point with altitude"},
+       { ELLIPSOID_POINT_WITH_ALT_AND_UNCERT_ELLIPSOID,        "Ellipsoid point with altitude and uncertainty Ellipsoid"},
+       { ELLIPSOID_ARC,                                                                        "Ellipsoid Arc"},
        { 0,    NULL }
 };
 
@@ -469,6 +472,8 @@ static const value_string gsm_map_cbs_data_coding_scheme_coding_grp_vals[] = {
        { 15,"Data coding / message handling" },
        { 0, NULL}
 };
+static value_string_ext gsm_map_cbs_data_coding_scheme_coding_grp_vals_ext = VALUE_STRING_EXT_INIT(gsm_map_cbs_data_coding_scheme_coding_grp_vals);
+
 /* Coding group 0
  * Bits 3..0 indicate the language:
  */
@@ -491,6 +496,7 @@ static const value_string gsm_map_cbs_coding_grp0_lang_vals[] = {
        { 15, "Language unspecified"},
        { 0,    NULL }
 };
+static value_string_ext gsm_map_cbs_coding_grp0_lang_vals_ext = VALUE_STRING_EXT_INIT(gsm_map_cbs_coding_grp0_lang_vals);
 
 static const value_string gsm_map_cbs_coding_grp1_lang_vals[] = {
        { 0, "GSM 7 bit default alphabet; message preceded by language indication"},
@@ -511,6 +517,8 @@ static const value_string gsm_map_cbs_coding_grp1_lang_vals[] = {
        { 15, "Reserved"},
        { 0,    NULL }
 };
+static value_string_ext gsm_map_cbs_coding_grp1_lang_vals_ext = VALUE_STRING_EXT_INIT(gsm_map_cbs_coding_grp1_lang_vals);
+
 static const value_string gsm_map_cbs_coding_grp2_lang_vals[] = {
        { 0, "Czech"},
        { 1, "Hebrew"},
@@ -530,6 +538,8 @@ static const value_string gsm_map_cbs_coding_grp2_lang_vals[] = {
        { 15, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
        { 0,    NULL }
 };
+static value_string_ext gsm_map_cbs_coding_grp2_lang_vals_ext = VALUE_STRING_EXT_INIT(gsm_map_cbs_coding_grp2_lang_vals);
+
 static const value_string gsm_map_cbs_coding_grp3_lang_vals[] = {
        { 0, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
        { 1, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
@@ -549,6 +559,7 @@ static const value_string gsm_map_cbs_coding_grp3_lang_vals[] = {
        { 15, "Reserved for other languages using the GSM 7 bit default alphabet, with unspecified handling at the MS"},
        { 0,    NULL }
 };
+static value_string_ext gsm_map_cbs_coding_grp3_lang_vals_ext = VALUE_STRING_EXT_INIT(gsm_map_cbs_coding_grp3_lang_vals);
 
 static const true_false_string gsm_map_cbs_coding_grp4_7_comp_vals = {
   "The text is compressed using the compression algorithm defined in 3GPP TS 23.042",
@@ -601,16 +612,16 @@ dissect_cbs_data_coding_scheme(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
 
        octet = tvb_get_guint8(tvb,0);
        coding_grp = octet >>4;
-       proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp, tvb, 0, 1, FALSE);
+       proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp, tvb, 0, 1, ENC_BIG_ENDIAN);
 
        sms_encoding = SMS_ENCODING_NOT_SET;
        switch (coding_grp){
        case 0:
-               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp0_lang, tvb, 0, 1, FALSE);
+               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp0_lang, tvb, 0, 1, ENC_BIG_ENDIAN);
                sms_encoding = SMS_ENCODING_7BIT;
                break;
        case 1:
-               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp1_lang, tvb, 0, 1, FALSE);
+               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp1_lang, tvb, 0, 1, ENC_BIG_ENDIAN);
                if ((octet & 0x0f)== 0){
                        sms_encoding = SMS_ENCODING_7BIT_LANG;
                }else{
@@ -618,23 +629,27 @@ dissect_cbs_data_coding_scheme(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
                }
                break;
        case 2:
-               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp2_lang, tvb, 0, 1, FALSE);
+               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp2_lang, tvb, 0, 1, ENC_BIG_ENDIAN);
                sms_encoding = SMS_ENCODING_7BIT;
                break;
        case 3:
-               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp3_lang, tvb, 0, 1, FALSE);
+               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp3_lang, tvb, 0, 1, ENC_BIG_ENDIAN);
                sms_encoding = SMS_ENCODING_7BIT;
                break;
                /* Coding_grp 01xx */
        case 4:
+                 /* FALLTHRU */
        case 5:
+                 /* FALLTHRU */
        case 6:
+                 /* FALLTHRU */
        case 7:
-               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_comp, tvb, 0, 1, FALSE);
-               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_class_ind, tvb, 0, 1, FALSE);
-               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_char_set, tvb, 0, 1, FALSE);
+                 /* FALLTHRU */
+               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_comp, tvb, 0, 1, ENC_BIG_ENDIAN);
+               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_class_ind, tvb, 0, 1, ENC_BIG_ENDIAN);
+               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_char_set, tvb, 0, 1, ENC_BIG_ENDIAN);
                if ((octet & 0x10)== 0x10){
-                       proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_class, tvb, 0, 1, FALSE);
+                       proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_class, tvb, 0, 1, ENC_BIG_ENDIAN);
                }
                /* Bits 3 and 2 indicate the character set being used, */
                character_set = (octet&0x0c)>>2;
@@ -664,8 +679,8 @@ dissect_cbs_data_coding_scheme(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
                break;
        case 9:
                /* Message with User Data Header (UDH) structure:*/
-               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_char_set, tvb, 0, 1, FALSE);
-               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_class, tvb, 0, 1, FALSE);
+               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_char_set, tvb, 0, 1, ENC_BIG_ENDIAN);
+               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp4_7_class, tvb, 0, 1, ENC_BIG_ENDIAN);
                character_set = (octet&0x0c)>>2;
                switch (character_set){
                case 0:
@@ -689,9 +704,13 @@ dissect_cbs_data_coding_scheme(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
                }
                break;
        case 10:
+               /* FALLTHRU */
        case 11:
+               /* FALLTHRU */
        case 12:
+               /* FALLTHRU */
        case 13:
+               /* FALLTHRU */
                /* 1010..1101 Reserved coding groups */
                break;
        case 14:
@@ -701,8 +720,8 @@ dissect_cbs_data_coding_scheme(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
                break;
        case 15:
                /* Data coding / message handling */
-               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp15_mess_code, tvb, 0, 1, FALSE);
-               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp15_class, tvb, 0, 1, FALSE);
+               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp15_mess_code, tvb, 0, 1, ENC_BIG_ENDIAN);
+               proto_tree_add_item(tree, hf_gsm_map_cbs_coding_grp15_class, tvb, 0, 1, ENC_BIG_ENDIAN);
                character_set = (octet&0x04)>>2;
                if (character_set == 0){
                        sms_encoding = SMS_ENCODING_7BIT;
@@ -719,14 +738,14 @@ dissect_cbs_data_coding_scheme(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
 void
 dissect_gsm_map_msisdn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
 {
- char          *digit_str;
+ const char    *digit_str;
  guint8                octet;
  guint8                na;
  guint8                np;
 
- proto_tree_add_item(tree, hf_gsm_map_extension, tvb, 0,1,FALSE);
- proto_tree_add_item(tree, hf_gsm_map_nature_of_number, tvb, 0,1,FALSE);
- proto_tree_add_item(tree, hf_gsm_map_number_plan, tvb, 0,1,FALSE);
+ proto_tree_add_item(tree, hf_gsm_map_extension, tvb, 0,1,ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_gsm_map_nature_of_number, tvb, 0,1,ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_gsm_map_number_plan, tvb, 0,1,ENC_BIG_ENDIAN);
 
  digit_str = unpack_digits(tvb, 1);
 
@@ -738,7 +757,7 @@ dissect_gsm_map_msisdn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
  if ((na == 1) && (np==1))/*International Number & E164*/
        dissect_e164_cc(tvb, tree, 1, TRUE);
  else if(np==6)
-       dissect_e212_mcc_mnc(tvb, pinfo, tree, 1);
+       dissect_e212_mcc_mnc_in_address(tvb, pinfo, tree, 1);
 
 }
 
@@ -775,6 +794,8 @@ static const value_string gsm_map_nature_of_number_values[] = {
        {   0x07,       "Reserved for extension" },
        { 0, NULL }
 };
+static value_string_ext gsm_map_nature_of_number_values_ext = VALUE_STRING_EXT_INIT(gsm_map_nature_of_number_values);
+
 static const value_string gsm_map_number_plan_values[] = {
        {   0x00,       "unknown" },
        {   0x01,       "ISDN/Telephony Numbering (Rec ITU-T E.164)" },
@@ -789,6 +810,7 @@ static const value_string gsm_map_number_plan_values[] = {
        {   0x0f,       "Reserved for extension" },
        { 0, NULL }
 };
+static value_string_ext gsm_map_number_plan_values_ext = VALUE_STRING_EXT_INIT(gsm_map_number_plan_values);
 
 static const true_false_string gsm_map_Ss_Status_q_bit_values = {
   "Quiescent",
@@ -814,13 +836,15 @@ static const true_false_string gsm_map_Ss_Status_a_values = {
 const gchar* gsm_map_opr_code(guint32 val) {
   switch (val) {
   case 44: /*mt-forwardSM*/
+         /* FALLTHRU */
   case 46: /*mo-forwardSM*/
+         /* FALLTHRU */
     if (application_context_version < 3) {
-      return val_to_str(val, gsm_map_V1V2_opr_code_strings, "Unknown GSM-MAP (%u)");
+      return val_to_str_const(val, gsm_map_V1V2_opr_code_strings, "Unknown GSM-MAP opcode");
     }
     /* Else use the default map operation translation */
   default:
-    return val_to_str(val, gsm_old_GSMMAPOperationLocalvalue_vals, "Unknown GSM-MAP opcode (%u)");
+    return val_to_str_ext_const(val, &gsm_old_GSMMAPOperationLocalvalue_vals_ext, "Unknown GSM-MAP opcode");
     break;
   }
 }
@@ -1077,7 +1101,7 @@ static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_
     /* reserved traceSubscriberActivity (52) */
     /* undefined 53 */
   case 54: /*beginSubscriberActivity*/
-    offset=dissect_gsm_ss_BeginSubscriberActivityArg(FALSE, tvb, offset, actx, tree, -1);
+    offset=dissect_gsm_old_BeginSubscriberActivityArg(FALSE, tvb, offset, actx, tree, -1);
     break;
   case 55: /*sendIdentification*/
     offset=dissect_mc_message(tvb, offset, actx, tree,
@@ -1242,9 +1266,13 @@ static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_
   case 126: /*SS-protocol explicitCT no Argument*/
     break;
   default:
-    cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown invokeData blob");
-    proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN);
-    expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "Unknown invokeData %d",opcode);
+    if(!dissector_try_uint(map_prop_arg_opcode_table, (guint8)opcode, tvb, actx->pinfo, tree)){
+        cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown invokeData blob");
+        proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN);
+        expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "Unknown invokeData %d",opcode);
+       }
+       offset+= tvb_length_remaining(tvb,offset);
+       break;
   }
   return offset;
 }
@@ -1265,7 +1293,10 @@ static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset,
     offset=dissect_gsm_map_ms_CancelLocationRes(FALSE, tvb, offset, actx, tree, -1);
     break;
   case  4: /*provideRoamingNumber*/
-    offset=dissect_gsm_map_ch_ProvideRoamingNumberRes(FALSE, tvb, offset, actx, tree, -1);
+    offset=dissect_mc_message(tvb, offset, actx, tree,
+                             FALSE, dissect_gsm_map_ISDN_AddressString, hf_gsm_map_msisdn,
+                             FALSE, dissect_gsm_map_ch_ProvideRoamingNumberRes, -1,
+                             TRUE , NULL, -1);/*undefined*/
     break;
   case  5: /*noteSubscriberDataModified*/
     offset=dissect_gsm_map_ms_NoteSubscriberDataModifiedRes(FALSE, tvb, offset, actx, tree, -1);
@@ -1378,7 +1409,11 @@ static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset,
     offset=dissect_gsm_map_sm_MO_ForwardSM_Res(FALSE, tvb, offset, actx, tree, -1);
     break;
   case 47: /*reportSM-DeliveryStatus*/
-    offset=dissect_gsm_map_sm_ReportSM_DeliveryStatusRes(FALSE, tvb, offset, actx, tree, -1);
+    offset=dissect_mc_message(tvb, offset, actx, tree,
+                             FALSE, dissect_gsm_map_ISDN_AddressString, hf_gsm_map_sm_storedMSISDN,
+                             FALSE, NULL, -1,
+                             FALSE , dissect_gsm_map_sm_ReportSM_DeliveryStatusRes, -1);/*undefined*/
+
     break;
   case 48: /*noteSubscriberPresent*/
     break;
@@ -1539,9 +1574,13 @@ static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset,
     break;
 
  default:
-   cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnResultData blob");
-   proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN);
-   expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "Unknown invokeData %d",opcode);
+   if(!dissector_try_uint(map_prop_res_opcode_table, (guint8)opcode, tvb, actx->pinfo, tree)){
+       cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnResultData blob");
+       proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN);
+       expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "Unknown invokeData %d",opcode);
+   }
+   offset+= tvb_length_remaining(tvb,offset);
+   break;
   }
   return offset;
 }
@@ -1607,8 +1646,8 @@ static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset,
          offset=dissect_gsm_map_er_FacilityNotSupParam(FALSE, tvb, offset, actx, tree, -1);
          break;
   case 22: /* OngoingGroupCallParam */
-          offset=dissect_gsm_map_er_OngoingGroupCallParam(FALSE, tvb, offset, actx, tree, -1);
-          break;
+      offset=dissect_gsm_map_er_OngoingGroupCallParam(FALSE, tvb, offset, actx, tree, -1);
+      break;
   case 27: /* AbsentSubscriberParam */
          offset=dissect_gsm_map_er_AbsentSubscriberParam(FALSE, tvb, offset, actx, tree, -1);
          break;
@@ -1700,9 +1739,12 @@ static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset,
          offset=dissect_gsm_map_er_InformationNotAvailableParam(FALSE, tvb, offset, actx, tree, -1);
          break;
   default:
-    cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnErrorData blob");
-    proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN);
-    expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "Unknown invokeData %d",errorCode);
+    if(!dissector_try_uint(map_prop_err_opcode_table, (guint8)opcode, tvb, actx->pinfo, tree)){
+        cause=proto_tree_add_text(tree, tvb, offset, -1, "Unknown returnErrorData blob");
+        proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN);
+        expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "Unknown invokeData %d",errorCode);
+    }
+       offset+= tvb_length_remaining(tvb,offset);
     break;
   }
   return offset;
@@ -1748,12 +1790,9 @@ dissect_gsm_map_GSMMAPPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset,
   /* Get the length and add 2 */
   gsm_map_pdu_size = tvb_get_guint8(tvb, offset+1)+2;
 
-  if (check_col(actx->pinfo->cinfo, COL_INFO)){
-    col_add_str(actx->pinfo->cinfo, COL_INFO, val_to_str(gsmmap_pdu_type, gsm_old_Component_vals, "Unknown GSM-MAP PDU (%u)"));
-       col_append_fstr(actx->pinfo->cinfo, COL_INFO, " ");
-  }
+  col_add_str(actx->pinfo->cinfo, COL_INFO, val_to_str_const(gsmmap_pdu_type, gsm_old_Component_vals, "Unknown GSM-MAP Component"));
+  col_append_fstr(actx->pinfo->cinfo, COL_INFO, " ");
   offset = dissect_gsm_old_Component(FALSE, tvb, 0, actx, tree, hf_gsm_map_old_Component_PDU);
-  return offset;
 /*
   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
                               GSMMAPPDU_choice, hf_index, ett_gsm_map_GSMMAPPDU, NULL);
@@ -1774,7 +1813,6 @@ dissect_gsm_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
 
        asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
 
-
     col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSM MAP");
 
     top_tree = parent_tree;
@@ -1805,7 +1843,7 @@ const value_string ssCode_vals[] = {
   { 0x13 ,"colp - connected line identification presentation" },
   { 0x14 ,"colr - connected line identification restriction" },
   { 0x15 ,"mci - malicious call identification" },
-  { 0x18 ,"allNameIdentificationSS - all name indentification SS" },
+  { 0x18 ,"allNameIdentificationSS - all name identification SS" },
   { 0x19 ,"cnap - calling name presentation" },
   { 0x20 ,"allForwardingSS - all forwarding SS" },
   { 0x21 ,"cfu - call forwarding unconditional" },
@@ -2084,7 +2122,7 @@ void proto_reg_handoff_gsm_map(void) {
     static range_t *ssn_range;
 
     if (!map_prefs_initialized) {
-       map_prefs_initialized = TRUE;
+        map_prefs_initialized = TRUE;
         data_handle = find_dissector("data");
         ranap_handle = find_dissector("ranap");
         dtap_handle = find_dissector("gsm_a_dtap");
@@ -2138,7 +2176,7 @@ void proto_reg_handoff_gsm_map(void) {
         register_ber_oid_dissector_handle("0.4.0.0.1.0.20.1", map_handle, proto_gsm_map,"shortMsgGatewayContext-v1" );
         register_ber_oid_dissector_handle("0.4.0.0.1.0.21.3", map_handle, proto_gsm_map,"shortMsgMO-RelayContext-v3" );
         register_ber_oid_dissector_handle("0.4.0.0.1.0.21.2", map_handle, proto_gsm_map,"shortMsgMO-RelayContext-v2" );
-        register_ber_oid_dissector_handle("0.4.0.0.1.0.21.1", map_handle, proto_gsm_map,"shortMsgMO-RelayContext-v1" );
+        register_ber_oid_dissector_handle("0.4.0.0.1.0.21.1", map_handle, proto_gsm_map,"shortMsgRelayContext-v1" );
         register_ber_oid_dissector_handle("0.4.0.0.1.0.22.3", map_handle, proto_gsm_map,"subscriberDataModificationNotificationContext-v3" );
         register_ber_oid_dissector_handle("0.4.0.0.1.0.23.2", map_handle, proto_gsm_map,"shortMsgAlertContext-v2" );
         register_ber_oid_dissector_handle("0.4.0.0.1.0.23.1", map_handle, proto_gsm_map,"shortMsgAlertContext-v1" );
@@ -2205,11 +2243,11 @@ void proto_register_gsm_map(void) {
           NULL, HFILL }},
       { &hf_gsm_map_nature_of_number,
         { "Nature of number", "gsm_map.nature_of_number",
-          FT_UINT8, BASE_HEX, VALS(gsm_map_nature_of_number_values), 0x70,
+          FT_UINT8, BASE_HEX|BASE_EXT_STRING, &gsm_map_nature_of_number_values_ext, 0x70,
           NULL, HFILL }},
       { &hf_gsm_map_number_plan,
         { "Number plan", "gsm_map.number_plan",
-          FT_UINT8, BASE_HEX, VALS(gsm_map_number_plan_values), 0x0f,
+          FT_UINT8, BASE_HEX|BASE_EXT_STRING, &gsm_map_number_plan_values_ext, 0x0f,
           NULL, HFILL }},
       { &hf_gsm_map_isdn_address_digits,
         { "ISDN Address digits", "gsm_map.isdn.address.digits",
@@ -2362,27 +2400,27 @@ void proto_register_gsm_map(void) {
           "gsm_map.ss.SS_UserData", HFILL }},
       { &hf_gsm_map_cbs_coding_grp,
         { "Coding Group","gsm_map.cbs.coding_grp",
-          FT_UINT8,BASE_DEC, VALS(gsm_map_cbs_data_coding_scheme_coding_grp_vals), 0xf0,
+          FT_UINT8,BASE_DEC|BASE_EXT_STRING, &gsm_map_cbs_data_coding_scheme_coding_grp_vals_ext, 0xf0,
           NULL, HFILL }
       },
       { &hf_gsm_map_cbs_coding_grp0_lang,
         { "Language","gsm_map.cbs.coding_grp0_lang",
-          FT_UINT8,BASE_DEC, VALS(gsm_map_cbs_coding_grp0_lang_vals), 0x0f,
+          FT_UINT8,BASE_DEC|BASE_EXT_STRING, &gsm_map_cbs_coding_grp0_lang_vals_ext, 0x0f,
           NULL, HFILL }
       },
       { &hf_gsm_map_cbs_coding_grp1_lang,
         { "Language","gsm_map.cbs.coding_grp1_lang",
-          FT_UINT8,BASE_DEC, VALS(gsm_map_cbs_coding_grp1_lang_vals), 0x0f,
+          FT_UINT8,BASE_DEC|BASE_EXT_STRING, &gsm_map_cbs_coding_grp1_lang_vals_ext, 0x0f,
           NULL, HFILL }
       },
       { &hf_gsm_map_cbs_coding_grp2_lang,
         { "Language","gsm_map.cbs.coding_grp2_lang",
-          FT_UINT8,BASE_DEC, VALS(gsm_map_cbs_coding_grp2_lang_vals), 0x0f,
+          FT_UINT8,BASE_DEC|BASE_EXT_STRING, &gsm_map_cbs_coding_grp2_lang_vals_ext, 0x0f,
           NULL, HFILL }
       },
       { &hf_gsm_map_cbs_coding_grp3_lang,
         { "Language","gsm_map.cbs.coding_grp3_lang",
-          FT_UINT8,BASE_DEC, VALS(gsm_map_cbs_coding_grp3_lang_vals), 0x0f,
+          FT_UINT8,BASE_DEC|BASE_EXT_STRING, &gsm_map_cbs_coding_grp3_lang_vals_ext, 0x0f,
           NULL, HFILL }
       },
       { &hf_gsm_map_cbs_coding_grp4_7_comp,
@@ -2436,6 +2474,10 @@ void proto_register_gsm_map(void) {
         { "DLCI", "gsm_map.disc_par",
           FT_UINT8, BASE_DEC, NULL, 0,
           "Data Link Connection Indicator", HFILL }},
+      { &hf_gsm_apn_str,
+        { "APN", "gsm_map.apn_str",
+          FT_STRING, BASE_NONE, NULL, 0,
+          NULL, HFILL }},
 
 #include "packet-gsm_map-hfarr.c"
   };
@@ -2464,6 +2506,7 @@ void proto_register_gsm_map(void) {
     &ett_gsm_map_cbs_data_coding,
     &ett_gsm_map_GlobalCellId,
     &ett_gsm_map_GeographicalInformation,
+       &ett_gsm_map_apn_str,
 
 #include "packet-gsm_map-ettarr.c"
   };
@@ -2481,6 +2524,10 @@ void proto_register_gsm_map(void) {
                                                 "GSM SMS TPDU", FT_UINT8,
                                                 BASE_DEC);
 
+  map_prop_arg_opcode_table = register_dissector_table("gsm_map.prop.arg.opcode", "Proprietary Opcodes", FT_UINT8, BASE_DEC);
+  map_prop_res_opcode_table = register_dissector_table("gsm_map.prop.res.opcode", "Proprietary Opcodes", FT_UINT8, BASE_DEC);
+  map_prop_err_opcode_table = register_dissector_table("gsm_map.prop.err.opcode", "Proprietary Opcodes", FT_UINT8, BASE_DEC);
+
   gsm_map_tap = register_tap("gsm_map");
 
 #include "packet-gsm_map-dis-tab.c" */