Replace tabs in files with editor modeline "expandtab"
[metze/wireshark/wip.git] / epan / dissectors / packet-gsm_a_common.h
index ab7b5960aebf4a94022ad9e11275043a26c0f8ed..1cdea3e3514bf4e1c7e92096e7de73029311dd53 100644 (file)
@@ -1,6 +1,4 @@
 /* packet-gsm_a_common.h
- *
- * $Id$
  *
  *   Reference [3]
  *   Mobile radio interface Layer 3 specification;
  *   (3GPP TS 24.008 version 6.7.0 Release 6)
  *   (3GPP TS 24.008 version 6.8.0 Release 6)
  *
+ *   Reference [9]
+ *   Digital cellular telecommunications system (Phase 2+);
+ *   Group Call Control (GCC) protocol
+ *   (GSM 04.68 version 8.1.0 Release 1999)
+ *
+ *   Reference [10]
+ *   Digital cellular telecommunications system (Phase 2+);
+ *   Broadcast Call Control (BCC) protocol
+ *   (3GPP TS 44.069 version 11.0.0 Release 11)
+ *
  * Copyright 2003, Michael Lum <mlum [AT] telostech.com>,
  * In association with Telos Technology Inc.
  *
+ * Added Dissection of Group Call Control (GCC) protocol.
+ * Added Dissection of Broadcast Call Control (BCC) protocol.
+ * Copyright 2015, Michail Koreshkov <michail.koreshkov [at] zte.com.cn
+ *
  * Wireshark - Network traffic analyzer
  * By Gerald Combs <gerald@wireshark.org>
  * Copyright 1998 Gerald Combs
 #ifndef __PACKET_GSM_A_COMMON_H__
 #define __PACKET_GSM_A_COMMON_H__
 
+#include <epan/proto.h>
+
 #include "packet-sccp.h"
 #include "ws_symbol_export.h"
 
 /* PROTOTYPES/FORWARDS */
 typedef guint16 (*elem_fcn)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
 typedef void (*msg_fcn)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len);
-#if 0
-/* XXX moved to tvbuff.h, clean up later */
-typedef struct dgt_set_t
-{
-    unsigned char out[15];
-}
-dgt_set_t;
-#endif
 int my_dgt_tbcd_unpack(
     char      *out,       /* ASCII pattern out */
     guchar    *in,        /* packed pattern in */
@@ -159,7 +165,6 @@ extern value_string_ext gmr1_ie_rr_strings_ext;
 extern elem_fcn gmr1_ie_rr_func[];
 extern gint ett_gmr1_ie_rr[];
 
-extern sccp_msg_info_t* sccp_msg;
 extern sccp_assoc_info_t* sccp_assoc;
 
 extern int gsm_a_tap;
@@ -211,7 +216,7 @@ extern const char* get_gsm_a_msg_string(int pdu_type, int idx);
 #define IS_UPLINK_UNKNOWN   2
 
 /* Defines for handling half octet mandatory V IEs
- * Named LEFT and RIGHT (as displayed) because the GSM definitions and our internal representation 
+ * Named LEFT and RIGHT (as displayed) because the GSM definitions and our internal representation
  * have the bits numbered in opposite senses
  */
 #define LEFT_NIBBLE     (2)
@@ -220,48 +225,17 @@ extern const char* get_gsm_a_msg_string(int pdu_type, int idx);
 /* FUNCTIONS */
 
 /* ELEMENT FUNCTIONS */
-
-#define EXTRANEOUS_DATA_CHECK(edc_len, edc_max_len) \
-    if ((edc_len) > (edc_max_len)) \
-    { \
-        proto_tree_add_text(tree, tvb, \
-            curr_offset, (edc_len) - (edc_max_len), "Extraneous Data"); \
-        curr_offset += ((edc_len) - (edc_max_len)); \
-    }
-
-#define EXTRANEOUS_DATA_CHECK_EXPERT(edc_len, edc_max_len, pinfo) \
+#define EXTRANEOUS_DATA_CHECK(edc_len, edc_max_len, pinfo, ei) \
     if ((edc_len) > (edc_max_len)) \
     { \
-        proto_item *expert_item; \
-        expert_item = proto_tree_add_text(tree, tvb, \
-            curr_offset, (edc_len) - (edc_max_len), "Extraneous Data, dissector bug or later version spec(report to wireshark.org)"); \
-        expert_add_info_format(pinfo, expert_item, PI_PROTOCOL, PI_NOTE, "Extraneous Data, dissector bug or later version spec(report to wireshark.org)"); \
-        PROTO_ITEM_SET_GENERATED(expert_item); \
+        proto_tree_add_expert(tree, pinfo, ei, tvb, curr_offset, (edc_len) - (edc_max_len)); \
         curr_offset += ((edc_len) - (edc_max_len)); \
     }
 
-#define SHORT_DATA_CHECK(sdc_len, sdc_min_len) \
-    if ((sdc_len) < (sdc_min_len)) \
-    { \
-        proto_tree_add_text(tree, tvb, \
-            curr_offset, (sdc_len), "Short Data (?)"); \
-        curr_offset += (sdc_len); \
-        return(curr_offset - offset); \
-    }
-
-#define EXACT_DATA_CHECK(edc_len, edc_eq_len) \
-    if ((edc_len) != (edc_eq_len)) \
-    { \
-        proto_tree_add_text(tree, tvb, \
-            curr_offset, (edc_len), "Unexpected Data Length"); \
-        curr_offset += (edc_len); \
-        return(curr_offset - offset); \
-    }
-
 #define NO_MORE_DATA_CHECK(nmdc_len) \
-    if ((nmdc_len) == (curr_offset - offset)) return(nmdc_len);
+    if ((nmdc_len) <= (curr_offset - offset)) return(nmdc_len);
 
-#define SET_ELEM_VARS(SEV_pdu_type, SEV_elem_names_ext, SEV_elem_ett, SEV_elem_funcs) \
+#define SET_ELEM_VARS(SEV_pdu_type, SEV_elem_names_ext, SEV_elem_ett, SEV_elem_funcs, ei_unknown) \
     switch (SEV_pdu_type) \
     { \
     case GSM_A_PDU_TYPE_BSSMAP: \
@@ -340,7 +314,7 @@ extern const char* get_gsm_a_msg_string(int pdu_type, int idx);
         SEV_elem_funcs = gmr1_ie_rr_func; \
         break; \
     default: \
-        proto_tree_add_text(tree, \
+        proto_tree_add_expert_format(tree, pinfo, ei_unknown, \
             tvb, curr_offset, -1, \
             "Unknown PDU type (%u) gsm_a_common", SEV_pdu_type); \
         return(consumed); \
@@ -404,7 +378,7 @@ WS_DLL_PUBLIC guint16 elem_v(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo
 /*
  * Short Value (V_SHORT) element dissector
  *
- * nibble used in this functions to indicate left or right nibble of the octet 
+ * nibble used in this functions to indicate left or right nibble of the octet
  * This is expected to be used right nibble first, as the tables of 24.008.
  */
 WS_DLL_PUBLIC guint16 elem_v_short(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gint pdu_type, int idx, guint32 offset, guint32 nibble);
@@ -418,7 +392,7 @@ WS_DLL_PUBLIC guint16 elem_v_short(tvbuff_t *tvb, proto_tree *tree, packet_info
  *      Is there a better approach ?
  */
 
-#define ELEM_MAND_TLV(EMT_iei, EMT_pdu_type, EMT_elem_idx, EMT_elem_name_addition) \
+#define ELEM_MAND_TLV(EMT_iei, EMT_pdu_type, EMT_elem_idx, EMT_elem_name_addition, ei_mandatory) \
 {\
     if ((consumed = elem_tlv(tvb, tree, pinfo, (guint8) EMT_iei, EMT_pdu_type, EMT_elem_idx, curr_offset, curr_len, EMT_elem_name_addition)) > 0) \
     { \
@@ -427,7 +401,7 @@ WS_DLL_PUBLIC guint16 elem_v_short(tvbuff_t *tvb, proto_tree *tree, packet_info
     } \
     else \
     { \
-        proto_tree_add_text(tree, \
+        proto_tree_add_expert_format(tree, pinfo, &ei_mandatory, \
             tvb, curr_offset, 0, \
             "Missing Mandatory element (0x%02x) %s%s, rest of dissection is suspect", \
             EMT_iei, \
@@ -443,7 +417,7 @@ WS_DLL_PUBLIC guint16 elem_v_short(tvbuff_t *tvb, proto_tree *tree, packet_info
  * octet 2 0/1 ext  length
  * octet 2a length
  */
-#define ELEM_MAND_TELV(EMT_iei, EMT_pdu_type, EMT_elem_idx, EMT_elem_name_addition) \
+#define ELEM_MAND_TELV(EMT_iei, EMT_pdu_type, EMT_elem_idx, EMT_elem_name_addition, ei_mandatory) \
 {\
     if ((consumed = elem_telv(tvb, tree, pinfo, (guint8) EMT_iei, EMT_pdu_type, EMT_elem_idx, curr_offset, curr_len, EMT_elem_name_addition)) > 0) \
     { \
@@ -452,7 +426,7 @@ WS_DLL_PUBLIC guint16 elem_v_short(tvbuff_t *tvb, proto_tree *tree, packet_info
     } \
     else \
     { \
-        proto_tree_add_text(tree, \
+        proto_tree_add_expert_format(tree, pinfo, &ei_mandatory, \
             tvb, curr_offset, 0, \
             "Missing Mandatory element (0x%02x) %s%s, rest of dissection is suspect", \
             EMT_iei, \
@@ -463,7 +437,7 @@ WS_DLL_PUBLIC guint16 elem_v_short(tvbuff_t *tvb, proto_tree *tree, packet_info
     if ((signed)curr_len <= 0) return;      \
 }
 
-#define ELEM_MAND_TLV_E(EMT_iei, EMT_pdu_type, EMT_elem_idx, EMT_elem_name_addition) \
+#define ELEM_MAND_TLV_E(EMT_iei, EMT_pdu_type, EMT_elem_idx, EMT_elem_name_addition, ei_mandatory) \
 {\
     if ((consumed = elem_tlv_e(tvb, tree, pinfo, (guint8) EMT_iei, EMT_pdu_type, EMT_elem_idx, curr_offset, curr_len, EMT_elem_name_addition)) > 0) \
     { \
@@ -472,7 +446,7 @@ WS_DLL_PUBLIC guint16 elem_v_short(tvbuff_t *tvb, proto_tree *tree, packet_info
     } \
     else \
     { \
-        proto_tree_add_text(tree, \
+        proto_tree_add_expert_format(tree, pinfo, &ei_mandatory, \
             tvb, curr_offset, 0, \
             "Missing Mandatory element (0x%02x) %s%s, rest of dissection is suspect", \
             EMT_iei, \
@@ -512,7 +486,7 @@ WS_DLL_PUBLIC guint16 elem_v_short(tvbuff_t *tvb, proto_tree *tree, packet_info
     if ((signed)curr_len <= 0) return;      \
 }
 
-#define ELEM_MAND_TV(EMT_iei, EMT_pdu_type, EMT_elem_idx, EMT_elem_name_addition) \
+#define ELEM_MAND_TV(EMT_iei, EMT_pdu_type, EMT_elem_idx, EMT_elem_name_addition, ei_mandatory) \
 {\
     if ((consumed = elem_tv(tvb, tree, pinfo, (guint8) EMT_iei, EMT_pdu_type, EMT_elem_idx, curr_offset, EMT_elem_name_addition)) > 0) \
     { \
@@ -521,7 +495,7 @@ WS_DLL_PUBLIC guint16 elem_v_short(tvbuff_t *tvb, proto_tree *tree, packet_info
     } \
     else \
     { \
-        proto_tree_add_text(tree, \
+        proto_tree_add_expert_format(tree, pinfo, &ei_mandatory,\
             tvb, curr_offset, 0, \
             "Missing Mandatory element (0x%02x) %s%s, rest of dissection is suspect", \
             EMT_iei, \
@@ -647,10 +621,6 @@ typedef struct _gsm_a_tap_rec_t {
     gsm_a_pd_str_e  protocol_disc;
 } gsm_a_tap_rec_t;
 
-void dissect_bssmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-
-void dissect_bssmap_le(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-
 void bssmap_old_bss_to_new_bss_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo);
 void bssmap_new_bss_to_old_bss_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo);
 
@@ -704,7 +674,7 @@ guint16 de_gmm_ms_radio_acc_cap(tvbuff_t *tvb, proto_tree *tree, packet_info *pi
 guint16 de_gmm_voice_domain_pref(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
 
 guint16 de_sup_codec_list(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
+
 
 WS_DLL_PUBLIC
 guint16 de_rr_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
@@ -780,6 +750,8 @@ extern const value_string tighter_cap_level_vals[];
 extern value_string_ext gsm_a_rr_rxlev_vals_ext;
 extern const value_string gsm_a_gm_type_of_ciph_alg_vals[];
 
+extern value_string_ext nas_eps_emm_cause_values_ext;
+
 typedef enum
 {
     /* Common Information Elements [3] 10.5.1 */
@@ -941,17 +913,25 @@ typedef enum
     BE_UDEF_130,                        /* Undefined */
     BE_KC128,                           /* Kc128 */
     BE_CSG_ID,                          /* CSG Identifier */
-       BE_REDIR_ATT_FLG,                   /* Redirect Attempt Flag               3.2.2.111    */
-       BE_REROUTE_REJ_CAUSE,               /* Reroute Reject Cause                3.2.2.112    */
-       BE_SEND_SEQN,                       /* Send Sequence Number                3.2.2.113    */
-       BE_REROUTE_OUTCOME,                 /* Reroute complete outcome            3.2.2.114    */
-       BE_GLOBAL_CALL_REF,                 /* Global Call Reference               3.2.2.115    */
-       BE_LCLS_CONF,                       /* LCLS-Configuration                  3.2.2.116    */
-       BE_LCLS_CON_STATUS_CONTROL,         /* LCLS-Connection-Status-Control      3.2.2.117    */
-       BE_LCLS_CORR_NOT_NEEDED,            /* LCLS-Correlation-Not-Needed         3.2.2.118    */
-       BE_LCLS_BSS_STATUS,                 /* LCLS-BSS-Status                     3.2.2.119    */
-       BE_LCLS_BREAK_REQ,                  /* LCLS-Break-Request                  3.2.2.120    */
-       BE_CSFB_IND                         /* CSFB Indication                     3.2.2.121    */
+    BE_REDIR_ATT_FLG,                   /* Redirect Attempt Flag               3.2.2.111    */
+    BE_REROUTE_REJ_CAUSE,               /* Reroute Reject Cause                3.2.2.112    */
+    BE_SEND_SEQN,                       /* Send Sequence Number                3.2.2.113    */
+    BE_REROUTE_OUTCOME,                 /* Reroute complete outcome            3.2.2.114    */
+    BE_GLOBAL_CALL_REF,                 /* Global Call Reference               3.2.2.115    */
+    BE_LCLS_CONF,                       /* LCLS-Configuration                  3.2.2.116    */
+    BE_LCLS_CON_STATUS_CONTROL,         /* LCLS-Connection-Status-Control      3.2.2.117    */
+    BE_LCLS_CORR_NOT_NEEDED,            /* LCLS-Correlation-Not-Needed         3.2.2.118    */
+    BE_LCLS_BSS_STATUS,                 /* LCLS-BSS-Status                     3.2.2.119    */
+    BE_LCLS_BREAK_REQ,                  /* LCLS-Break-Request                  3.2.2.120    */
+    BE_CSFB_IND,                        /* CSFB Indication                     3.2.2.121    */
+#if 0
+    BE_CS_TO_PS_SRVCC,                  /* CS to PS SRVCC                      3.2.2.122    */
+    BE_SRC_ENB_2_TGT_ENB_TRANSP_INF,    /* Source eNB to target eNB transparent information (E-UTRAN)" 3.2.2.123    */
+    BE_CS_TO_PS_SRVCC_IND,              /* CS to PS SRVCC Indication           3.2.2.124    */
+    BE_CN_TO_MS_TRANSP,                 /* CN to MS transparent information    3.2.2.125    */
+#endif
+    BE_SELECTED_PLMN_ID,                /* Selected PLMN ID                    3.2.2.126    */
+    BE_NONE                             /* NONE */
 }
 bssmap_elem_idx_t;
 
@@ -1117,6 +1097,19 @@ typedef enum
     DE_TP_EPC_ELLIPSOID_POINT_WITH_ALT, /* ellipsoidPointWithAltitude */
     DE_TP_EPC_HORIZONTAL_VELOCITY,      /* horizontalVelocity */
     DE_TP_EPC_GNSS_TOD_MSEC,            /* gnss-TOD-msec */
+    /* Group Call Control Service Information Elements ETSI TS 100 948 V8.1.0 (GSM 04.68 version 8.1.0 Release 1999) */
+    DE_GCC_CALL_REF,                    /* Call Reference */
+    DE_GCC_CALL_STATE,                  /* Call state */
+    DE_GCC_CAUSE,                       /* Cause */
+    DE_GCC_ORIG_IND,                    /* Originator indication */
+    DE_GCC_STATE_ATTR,                  /* State attributes */
+    /* Broadcast Call Control Information Elements ETSI TS 144 069 V10.0.0 (3GPP TS 44.069 version 10.0.0 Release 10) */
+    DE_BCC_CALL_REF,                    /* Call Reference */
+    DE_BCC_CALL_STATE,                  /* Call state */
+    DE_BCC_CAUSE,                       /* Cause */
+    DE_BCC_ORIG_IND,                    /* Originator indication */
+    DE_BCC_STATE_ATTR,                  /* State attributes */
+    DE_BCC_COMPR_OTDI,                  /* Compressed otdi */
     DE_NONE                             /* NONE */
 }
 dtap_elem_idx_t;
@@ -1166,6 +1159,7 @@ typedef enum
     DE_PRO_CONF_OPT,                /* Protocol Configuration Options */
     DE_PD_PRO_ADDR,                 /* Packet Data Protocol Address */
     DE_QOS,                         /* Quality Of Service */
+    DE_RE_ATTEMPT_IND,              /* Re-attempt indicator */
     DE_SM_CAUSE,                    /* SM Cause */
     DE_SM_CAUSE_2,                  /* SM Cause 2 */
     DE_LINKED_TI,                   /* Linked TI */
@@ -1180,6 +1174,7 @@ typedef enum
     DE_REQ_TYPE,                    /* Request type */
     DE_SM_NOTIF_IND,                /* Notification indicator */
     DE_SM_CONNECTIVITY_TYPE,        /* Connectivity type */
+    DE_SM_WLAN_OFFLOAD_ACCEPT,      /* WLAN offload acceptability */
     /* GPRS Common Information Elements [8] 10.5.7 */
     DE_PDP_CONTEXT_STAT,            /* [8] 10.5.7.1     PDP Context Status */
     DE_RAD_PRIO,                    /* [8] 10.5.7.2     Radio Priority */
@@ -1370,6 +1365,7 @@ typedef enum
     DE_EMM_NONCE,               /* 9.9.3.25 Nonce */
     DE_EMM_PAGING_ID,           /* 9.9.3.25A Paging identity */
     DE_EMM_P_TMSI_SIGN,         /* 9.9.3.26 P-TMSI signature, See subclause 10.5.5.8 in 3GPP TS 24.008 [6]. */
+    DE_EMM_EXT_CAUSE,           /* 9.9.3.26A Extended EMM cause */
     DE_EMM_SERV_TYPE,           /* 9.9.3.27 Service type */
     DE_EMM_SHORT_MAC,           /* 9.9.3.28 Short MAC */
     DE_EMM_TZ,                  /* 9.9.3.29 Time zone, See subclause 10.5.3.8 in 3GPP TS 24.008 [6]. */
@@ -1436,9 +1432,25 @@ typedef enum
     DE_SGSAP_TAID,                                  /* 9.4.21a Tracking Area Identity */
     DE_SGSAP_ECGI,                                  /* 9.4.3a E-UTRAN Cell Global Identity */
     DE_SGSAP_UE_EMM_MODE,                           /* 9.4.21c UE EMM mode*/
+    DE_SGSAP_ADD_PAGING_IND,                        /* 9.4.25 Additional paging indicators */
+    DE_SGSAP_TMSI_BASED_NRI_CONT,                   /* 9.4.26 TMSI based NRI container */
+    DE_SGSAP_SELECTED_CS_DMN_OP,                    /* 9.4.27 Selected CS domain operator */
 
     DE_SGAP_NONE                            /* NONE */
 }
 sgsap_elem_idx_t;
 
 #endif /* __PACKET_GSM_A_COMMON_H__ */
+
+/*
+ * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */