forgotten cleanup
[metze/wireshark/wip.git] / epan / dissectors / packet-gsm_a_common.h
1 /* packet-gsm_a_common.h
2  *
3  * $Id$
4  *
5  *   Reference [3]
6  *   Mobile radio interface Layer 3 specification;
7  *   Core network protocols;
8  *   Stage 3
9  *   (3GPP TS 24.008 version 4.7.0 Release 4)
10  *   (ETSI TS 124 008 V6.8.0 (2005-03))
11  *
12  *   Reference [5]
13  *   Point-to-Point (PP) Short Message Service (SMS)
14  *   support on mobile radio interface
15  *   (3GPP TS 24.011 version 4.1.1 Release 4)
16  *
17  *   Reference [7]
18  *   Mobile radio interface Layer 3 specification;
19  *   Core network protocols;
20  *   Stage 3
21  *   (3GPP TS 24.008 version 5.9.0 Release 5)
22  *
23  *   Reference [8]
24  *   Mobile radio interface Layer 3 specification;
25  *   Core network protocols;
26  *   Stage 3
27  *   (3GPP TS 24.008 version 6.7.0 Release 6)
28  *   (3GPP TS 24.008 version 6.8.0 Release 6)
29  *
30  * Copyright 2003, Michael Lum <mlum [AT] telostech.com>,
31  * In association with Telos Technology Inc.
32  *
33  * Wireshark - Network traffic analyzer
34  * By Gerald Combs <gerald@wireshark.org>
35  * Copyright 1998 Gerald Combs
36  *
37  * This program is free software; you can redistribute it and/or
38  * modify it under the terms of the GNU General Public License
39  * as published by the Free Software Foundation; either version 2
40  * of the License, or (at your option) any later version.
41  *
42  * This program is distributed in the hope that it will be useful,
43  * but WITHOUT ANY WARRANTY; without even the implied warranty of
44  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
45  * GNU General Public License for more details.
46  *
47  * You should have received a copy of the GNU General Public License
48  * along with this program; if not, write to the Free Software
49  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
50  */
51 #ifndef __PACKET_GSM_A_COMMON_H__
52 #define __PACKET_GSM_A_COMMON_H__
53
54 #include "packet-sccp.h"
55 #include "ws_symbol_export.h"
56
57 /* PROTOTYPES/FORWARDS */
58 typedef guint16 (*elem_fcn)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
59 typedef void (*msg_fcn)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len);
60 #if 0
61 /* XXX moved to tvbuff.h, clean up later */
62 typedef struct dgt_set_t
63 {
64     unsigned char out[15];
65 }
66 dgt_set_t;
67 #endif
68 int my_dgt_tbcd_unpack(
69     char      *out,       /* ASCII pattern out */
70     guchar    *in,        /* packed pattern in */
71     int        num_octs,   /* Number of octets to unpack */
72     dgt_set_t *dgt    /* Digit definitions */
73     );
74
75 /* globals needed as a result of spltting the packet-gsm_a.c into several files
76  * until further restructuring can take place to make them more modular
77  */
78
79 /* common PD values */
80 extern const value_string protocol_discriminator_vals[];
81 extern const value_string gsm_a_pd_short_str_vals[];
82
83 extern guint16 de_cld_party_bcd_num(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
84
85 /* Needed to share the packet-gsm_a_common.c functions */
86 extern value_string_ext gsm_bssmap_elem_strings_ext;
87 extern gint ett_gsm_bssmap_elem[];
88 extern elem_fcn bssmap_elem_fcn[];
89 extern int hf_gsm_a_bssmap_elem_id;
90
91 extern value_string_ext gsm_dtap_elem_strings_ext;
92 extern gint ett_gsm_dtap_elem[];
93 extern elem_fcn dtap_elem_fcn[];
94 extern int hf_gsm_a_dtap_elem_id;
95
96 extern value_string_ext gsm_rp_elem_strings_ext;
97 extern gint ett_gsm_rp_elem[];
98 extern elem_fcn rp_elem_fcn[];
99 extern int hf_gsm_a_rp_elem_id;
100
101 extern value_string_ext gsm_rr_elem_strings_ext;
102 extern gint ett_gsm_rr_elem[];
103 extern elem_fcn rr_elem_fcn[];
104 extern int hf_gsm_a_rr_elem_id;
105 extern void get_rr_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf_idx, msg_fcn *msg_fcn);
106
107 extern value_string_ext gsm_common_elem_strings_ext;
108 extern gint ett_gsm_common_elem[];
109 extern elem_fcn common_elem_fcn[];
110 extern int hf_gsm_a_common_elem_id;
111
112 extern value_string_ext gsm_gm_elem_strings_ext;
113 extern gint ett_gsm_gm_elem[];
114 extern elem_fcn gm_elem_fcn[];
115 extern int hf_gsm_a_gm_elem_id;
116 extern void get_gmm_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf_idx, msg_fcn *msg_fcn);
117 extern void get_sm_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf_idx, msg_fcn *msg_fcn);
118
119 extern value_string_ext gsm_bsslap_elem_strings_ext;
120 extern gint ett_gsm_bsslap_elem[];
121 extern elem_fcn bsslap_elem_fcn[];
122 extern int hf_gsm_a_bsslap_elem_id;
123
124 extern value_string_ext gsm_bssmap_le_elem_strings_ext;
125 extern gint ett_gsm_bssmap_le_elem[];
126 extern elem_fcn bssmap_le_elem_fcn[];
127 extern int hf_gsm_bssmap_le_elem_id;
128
129 extern value_string_ext nas_eps_common_elem_strings_ext;
130 extern gint ett_nas_eps_common_elem[];
131 extern elem_fcn nas_eps_common_elem_fcn[];
132 extern int hf_nas_eps_common_elem_id;
133
134 extern value_string_ext nas_emm_elem_strings_ext;
135 extern gint ett_nas_eps_emm_elem[];
136 extern elem_fcn emm_elem_fcn[];
137 extern int hf_nas_eps_emm_elem_id;
138
139 extern value_string_ext nas_esm_elem_strings_ext;
140 extern gint ett_nas_eps_esm_elem[];
141 extern elem_fcn esm_elem_fcn[];
142 extern int hf_nas_eps_esm_elem_id;
143
144 extern value_string_ext sgsap_elem_strings_ext;
145 extern gint ett_sgsap_elem[];
146 extern elem_fcn sgsap_elem_fcn[];
147 extern int hf_sgsap_elem_id;
148
149 extern value_string_ext bssgp_elem_strings_ext;
150 extern gint ett_bssgp_elem[];
151 extern elem_fcn bssgp_elem_fcn[];
152 extern int hf_bssgp_elem_id;
153
154 extern value_string_ext gmr1_ie_common_strings_ext;
155 extern elem_fcn gmr1_ie_common_func[];
156 extern gint ett_gmr1_ie_common[];
157
158 extern value_string_ext gmr1_ie_rr_strings_ext;
159 extern elem_fcn gmr1_ie_rr_func[];
160 extern gint ett_gmr1_ie_rr[];
161
162 extern sccp_msg_info_t* sccp_msg;
163 extern sccp_assoc_info_t* sccp_assoc;
164
165 extern int gsm_a_tap;
166 extern packet_info *gsm_a_dtap_pinfo;
167
168 /* TS 23 032 */
169 void dissect_geographical_description(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
170 guint16 dissect_description_of_velocity(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
171
172
173 /* common field values */
174 extern int hf_gsm_a_extension;
175 extern int hf_gsm_a_tmsi;
176 extern int hf_gsm_a_L3_protocol_discriminator;
177 extern int hf_gsm_a_call_prio;
178 extern int hf_gsm_a_b8spare;
179 extern int hf_gsm_a_skip_ind;
180 extern int hf_gsm_a_rr_chnl_needed_ch1;
181 extern int hf_gsm_a_rr_t3212;
182 extern int hf_gsm_a_gm_rac;
183 extern int hf_gsm_a_spare_bits;
184 extern int hf_gsm_a_lac;
185
186 /* flags for the packet-gsm_a_common routines */
187 #define GSM_A_PDU_TYPE_BSSMAP       0  /* BSSAP_PDU_TYPE_BSSMAP i.e. 0 - until split complete at least! */
188 #define GSM_A_PDU_TYPE_DTAP         1  /* BSSAP_PDU_TYPE_DTAP i.e. 1   - until split complete at least! */
189 #define GSM_A_PDU_TYPE_RP           2
190 #define GSM_A_PDU_TYPE_RR           3
191 #define GSM_A_PDU_TYPE_COMMON       4
192 #define GSM_A_PDU_TYPE_GM           5
193 #define GSM_A_PDU_TYPE_BSSLAP       6
194 #define GSM_A_PDU_TYPE_SACCH        7
195 #define GSM_PDU_TYPE_BSSMAP_LE      8
196 #define NAS_PDU_TYPE_COMMON         9
197 #define NAS_PDU_TYPE_EMM            10
198 #define NAS_PDU_TYPE_ESM            11
199 #define SGSAP_PDU_TYPE              12
200 #define BSSGP_PDU_TYPE              13
201 #define GMR1_IE_COMMON              14
202 #define GMR1_IE_RR                  15
203
204 extern const char* get_gsm_a_msg_string(int pdu_type, int idx);
205
206 /*
207  * this should be set on a per message basis, if possible
208  */
209 #define IS_UPLINK_FALSE     0
210 #define IS_UPLINK_TRUE      1
211 #define IS_UPLINK_UNKNOWN   2
212
213 /* Defines for handling half octet mandatory V IEs
214  * Named LEFT and RIGHT (as displayed) because the GSM definitions and our internal representation 
215  * have the bits numbered in opposite senses
216  */
217 #define LEFT_NIBBLE     (2)
218 #define RIGHT_NIBBLE    (1)
219
220 /* FUNCTIONS */
221
222 /* ELEMENT FUNCTIONS */
223
224 #define EXTRANEOUS_DATA_CHECK(edc_len, edc_max_len) \
225     if ((edc_len) > (edc_max_len)) \
226     { \
227         proto_tree_add_text(tree, tvb, \
228             curr_offset, (edc_len) - (edc_max_len), "Extraneous Data"); \
229         curr_offset += ((edc_len) - (edc_max_len)); \
230     }
231
232 #define EXTRANEOUS_DATA_CHECK_EXPERT(edc_len, edc_max_len, pinfo, ei) \
233     if ((edc_len) > (edc_max_len)) \
234     { \
235         proto_tree_add_expert(tree, pinfo, ei, tvb, curr_offset, (edc_len) - (edc_max_len)); \
236         curr_offset += ((edc_len) - (edc_max_len)); \
237     }
238
239 #define SHORT_DATA_CHECK(sdc_len, sdc_min_len) \
240     if ((sdc_len) < (sdc_min_len)) \
241     { \
242         proto_tree_add_text(tree, tvb, \
243             curr_offset, (sdc_len), "Short Data (?)"); \
244         curr_offset += (sdc_len); \
245         return(curr_offset - offset); \
246     }
247
248 #define EXACT_DATA_CHECK(edc_len, edc_eq_len) \
249     if ((edc_len) != (edc_eq_len)) \
250     { \
251         proto_tree_add_text(tree, tvb, \
252             curr_offset, (edc_len), "Unexpected Data Length"); \
253         curr_offset += (edc_len); \
254         return(curr_offset - offset); \
255     }
256
257 #define NO_MORE_DATA_CHECK(nmdc_len) \
258     if ((nmdc_len) == (curr_offset - offset)) return(nmdc_len);
259
260 #define SET_ELEM_VARS(SEV_pdu_type, SEV_elem_names_ext, SEV_elem_ett, SEV_elem_funcs) \
261     switch (SEV_pdu_type) \
262     { \
263     case GSM_A_PDU_TYPE_BSSMAP: \
264         SEV_elem_names_ext = gsm_bssmap_elem_strings_ext; \
265         SEV_elem_ett = ett_gsm_bssmap_elem; \
266         SEV_elem_funcs = bssmap_elem_fcn; \
267         break; \
268     case GSM_A_PDU_TYPE_DTAP: \
269         SEV_elem_names_ext = gsm_dtap_elem_strings_ext; \
270         SEV_elem_ett = ett_gsm_dtap_elem; \
271         SEV_elem_funcs = dtap_elem_fcn; \
272         break; \
273     case GSM_A_PDU_TYPE_RP: \
274         SEV_elem_names_ext = gsm_rp_elem_strings_ext; \
275         SEV_elem_ett = ett_gsm_rp_elem; \
276         SEV_elem_funcs = rp_elem_fcn; \
277         break; \
278     case GSM_A_PDU_TYPE_RR: \
279         SEV_elem_names_ext = gsm_rr_elem_strings_ext; \
280         SEV_elem_ett = ett_gsm_rr_elem; \
281         SEV_elem_funcs = rr_elem_fcn; \
282         break; \
283     case GSM_A_PDU_TYPE_COMMON: \
284         SEV_elem_names_ext = gsm_common_elem_strings_ext; \
285         SEV_elem_ett = ett_gsm_common_elem; \
286         SEV_elem_funcs = common_elem_fcn; \
287         break; \
288     case GSM_A_PDU_TYPE_GM: \
289         SEV_elem_names_ext = gsm_gm_elem_strings_ext; \
290         SEV_elem_ett = ett_gsm_gm_elem; \
291         SEV_elem_funcs = gm_elem_fcn; \
292         break; \
293     case GSM_A_PDU_TYPE_BSSLAP: \
294         SEV_elem_names_ext = gsm_bsslap_elem_strings_ext; \
295         SEV_elem_ett = ett_gsm_bsslap_elem; \
296         SEV_elem_funcs = bsslap_elem_fcn; \
297         break; \
298     case GSM_PDU_TYPE_BSSMAP_LE: \
299         SEV_elem_names_ext = gsm_bssmap_le_elem_strings_ext; \
300         SEV_elem_ett = ett_gsm_bssmap_le_elem; \
301         SEV_elem_funcs = bssmap_le_elem_fcn; \
302         break; \
303     case NAS_PDU_TYPE_COMMON: \
304         SEV_elem_names_ext = nas_eps_common_elem_strings_ext; \
305         SEV_elem_ett = ett_nas_eps_common_elem; \
306         SEV_elem_funcs = nas_eps_common_elem_fcn; \
307         break; \
308     case NAS_PDU_TYPE_EMM: \
309         SEV_elem_names_ext = nas_emm_elem_strings_ext; \
310         SEV_elem_ett = ett_nas_eps_emm_elem; \
311         SEV_elem_funcs = emm_elem_fcn; \
312         break; \
313     case NAS_PDU_TYPE_ESM: \
314         SEV_elem_names_ext = nas_esm_elem_strings_ext; \
315         SEV_elem_ett = ett_nas_eps_esm_elem; \
316         SEV_elem_funcs = esm_elem_fcn; \
317         break; \
318     case SGSAP_PDU_TYPE: \
319         SEV_elem_names_ext = sgsap_elem_strings_ext; \
320         SEV_elem_ett = ett_sgsap_elem; \
321         SEV_elem_funcs = sgsap_elem_fcn; \
322         break; \
323     case BSSGP_PDU_TYPE: \
324         SEV_elem_names_ext = bssgp_elem_strings_ext; \
325         SEV_elem_ett = ett_bssgp_elem; \
326         SEV_elem_funcs = bssgp_elem_fcn; \
327         break; \
328     case GMR1_IE_COMMON: \
329         SEV_elem_names_ext = gmr1_ie_common_strings_ext; \
330         SEV_elem_ett = ett_gmr1_ie_common; \
331         SEV_elem_funcs = gmr1_ie_common_func; \
332         break; \
333     case GMR1_IE_RR: \
334         SEV_elem_names_ext = gmr1_ie_rr_strings_ext; \
335         SEV_elem_ett = ett_gmr1_ie_rr; \
336         SEV_elem_funcs = gmr1_ie_rr_func; \
337         break; \
338     default: \
339         proto_tree_add_text(tree, \
340             tvb, curr_offset, -1, \
341             "Unknown PDU type (%u) gsm_a_common", SEV_pdu_type); \
342         return(consumed); \
343     }
344
345 /*
346  * Type Length Value (TLV) element dissector
347  */
348 WS_DLL_PUBLIC guint16 elem_tlv(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint8 iei, gint pdu_type, int idx, guint32 offset, guint len, const gchar *name_add);
349
350 /*
351  * Type Extendable Length Value (TLVE) element dissector
352  */
353 guint16 elem_telv(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint8 iei, gint pdu_type, int idx, guint32 offset, guint len, const gchar *name_add);
354
355 /*
356  * Type Length Value (TLV-E) element dissector
357  */
358 guint16 elem_tlv_e(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint8 iei, gint pdu_type, int idx, guint32 offset, guint len, const gchar *name_add);
359
360 /*
361  * Type Value (TV) element dissector
362  *
363  * Length cannot be used in these functions, big problem if a element dissector
364  * is not defined for these.
365  */
366 WS_DLL_PUBLIC guint16 elem_tv(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint8 iei, gint pdu_type, int idx, guint32 offset, const gchar *name_add);
367
368 /*
369  * Type Value (TV) element dissector
370  * Where top half nibble is IEI and bottom half nibble is value.
371  *
372  * Length cannot be used in these functions, big problem if a element dissector
373  * is not defined for these.
374  */
375 WS_DLL_PUBLIC guint16 elem_tv_short(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint8 iei, gint pdu_type, int idx, guint32 offset, const gchar *name_add);
376
377 /*
378  * Type (T) element dissector
379  */
380 WS_DLL_PUBLIC guint16 elem_t(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint8 iei, gint pdu_type, int idx, guint32 offset, const gchar *name_add);
381
382 /*
383  * Length Value (LV) element dissector
384  */
385 WS_DLL_PUBLIC guint16 elem_lv(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gint pdu_type, int idx, guint32 offset, guint len, const gchar *name_add);
386
387 /*
388  * Length Value (LV-E) element dissector
389  */
390 guint16 elem_lv_e(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gint pdu_type, int idx, guint32 offset, guint len, const gchar *name_add);
391
392 /*
393  * Value (V) element dissector
394  *
395  * Length cannot be used in these functions, big problem if a element dissector
396  * is not defined for these.
397  */
398 WS_DLL_PUBLIC guint16 elem_v(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gint pdu_type, int idx, guint32 offset, const gchar *name_add);
399
400 /*
401  * Short Value (V_SHORT) element dissector
402  *
403  * nibble used in this functions to indicate left or right nibble of the octet 
404  * This is expected to be used right nibble first, as the tables of 24.008.
405  */
406 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);
407
408
409 /* XXX: Most (if not all) the functions which make use of the following macros have the variables 'consumed',
410  *      'curr_offset', and 'cur_len' declared as *unsigned*.  This means that the 'if (curr_len <= 0)' statement
411  *      originally at the end of each of the macros would always be FALSE since an unsigned cannot be less than 0.
412  *      I've chosen to change the statement to 'if ((signed)curr_len <= 0)'. (Although this may be a bit of a
413  *      hack, it seems simpler than changing declarations to signed in all the places these macros are used).
414  *      Is there a better approach ?
415  */
416
417 #define ELEM_MAND_TLV(EMT_iei, EMT_pdu_type, EMT_elem_idx, EMT_elem_name_addition) \
418 {\
419     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) \
420     { \
421         curr_offset += consumed; \
422         curr_len -= consumed; \
423     } \
424     else \
425     { \
426         proto_tree_add_text(tree, \
427             tvb, curr_offset, 0, \
428             "Missing Mandatory element (0x%02x) %s%s, rest of dissection is suspect", \
429             EMT_iei, \
430             get_gsm_a_msg_string(EMT_pdu_type, EMT_elem_idx), \
431             (EMT_elem_name_addition == NULL) ? "" : EMT_elem_name_addition \
432             ); \
433     } \
434     if ((signed)curr_len <= 0) return;      \
435 }
436 /* This is a version where the length field can be one or two octets depending
437  * if the extension bit is set or not (TS 48.016 p 10.1.2).
438  *         8        7 6 5 4 3 2 1
439  * octet 2 0/1 ext  length
440  * octet 2a length
441  */
442 #define ELEM_MAND_TELV(EMT_iei, EMT_pdu_type, EMT_elem_idx, EMT_elem_name_addition) \
443 {\
444     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) \
445     { \
446         curr_offset += consumed; \
447         curr_len -= consumed; \
448     } \
449     else \
450     { \
451         proto_tree_add_text(tree, \
452             tvb, curr_offset, 0, \
453             "Missing Mandatory element (0x%02x) %s%s, rest of dissection is suspect", \
454             EMT_iei, \
455             get_gsm_a_msg_string(EMT_pdu_type, EMT_elem_idx), \
456             (EMT_elem_name_addition == NULL) ? "" : EMT_elem_name_addition \
457             ); \
458     } \
459     if ((signed)curr_len <= 0) return;      \
460 }
461
462 #define ELEM_MAND_TLV_E(EMT_iei, EMT_pdu_type, EMT_elem_idx, EMT_elem_name_addition) \
463 {\
464     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) \
465     { \
466         curr_offset += consumed; \
467         curr_len -= consumed; \
468     } \
469     else \
470     { \
471         proto_tree_add_text(tree, \
472             tvb, curr_offset, 0, \
473             "Missing Mandatory element (0x%02x) %s%s, rest of dissection is suspect", \
474             EMT_iei, \
475             get_gsm_a_msg_string(EMT_pdu_type, EMT_elem_idx), \
476             (EMT_elem_name_addition == NULL) ? "" : EMT_elem_name_addition \
477             ); \
478     } \
479     if ((signed)curr_len <= 0) return;      \
480 }
481 #define ELEM_OPT_TLV(EOT_iei, EOT_pdu_type, EOT_elem_idx, EOT_elem_name_addition) \
482 {\
483     if ((consumed = elem_tlv(tvb, tree, pinfo, (guint8) EOT_iei, EOT_pdu_type, EOT_elem_idx, curr_offset, curr_len, EOT_elem_name_addition)) > 0) \
484     { \
485         curr_offset += consumed; \
486         curr_len -= consumed; \
487     } \
488         if ((signed)curr_len <= 0) return;      \
489 }
490
491 #define ELEM_OPT_TELV(EOT_iei, EOT_pdu_type, EOT_elem_idx, EOT_elem_name_addition) \
492 {\
493     if ((consumed = elem_telv(tvb, tree, pinfo, (guint8) EOT_iei, EOT_pdu_type, EOT_elem_idx, curr_offset, curr_len, EOT_elem_name_addition)) > 0) \
494     { \
495         curr_offset += consumed; \
496         curr_len -= consumed; \
497     } \
498         if ((signed)curr_len <= 0) return;      \
499 }
500
501 #define ELEM_OPT_TLV_E(EOT_iei, EOT_pdu_type, EOT_elem_idx, EOT_elem_name_addition) \
502 {\
503     if ((consumed = elem_tlv_e(tvb, tree, pinfo, (guint8) EOT_iei, EOT_pdu_type, EOT_elem_idx, curr_offset, curr_len, EOT_elem_name_addition)) > 0) \
504     { \
505         curr_offset += consumed; \
506         curr_len -= consumed; \
507     } \
508     if ((signed)curr_len <= 0) return;      \
509 }
510
511 #define ELEM_MAND_TV(EMT_iei, EMT_pdu_type, EMT_elem_idx, EMT_elem_name_addition) \
512 {\
513     if ((consumed = elem_tv(tvb, tree, pinfo, (guint8) EMT_iei, EMT_pdu_type, EMT_elem_idx, curr_offset, EMT_elem_name_addition)) > 0) \
514     { \
515         curr_offset += consumed; \
516         curr_len -= consumed; \
517     } \
518     else \
519     { \
520         proto_tree_add_text(tree, \
521             tvb, curr_offset, 0, \
522             "Missing Mandatory element (0x%02x) %s%s, rest of dissection is suspect", \
523             EMT_iei, \
524             get_gsm_a_msg_string(EMT_pdu_type, EMT_elem_idx), \
525             (EMT_elem_name_addition == NULL) ? "" : EMT_elem_name_addition \
526         ); \
527     } \
528     if ((signed)curr_len <= 0) return;      \
529 }
530
531 #define ELEM_OPT_TV(EOT_iei, EOT_pdu_type, EOT_elem_idx, EOT_elem_name_addition) \
532 {\
533     if ((consumed = elem_tv(tvb, tree, pinfo, (guint8) EOT_iei, EOT_pdu_type, EOT_elem_idx, curr_offset, EOT_elem_name_addition)) > 0) \
534     { \
535         curr_offset += consumed; \
536         curr_len -= consumed; \
537     } \
538         if ((signed)curr_len <= 0) return;      \
539 }
540
541 #define ELEM_OPT_TV_SHORT(EOT_iei, EOT_pdu_type, EOT_elem_idx, EOT_elem_name_addition) \
542 {\
543     if ((consumed = elem_tv_short(tvb, tree, pinfo, EOT_iei, EOT_pdu_type, EOT_elem_idx, curr_offset, EOT_elem_name_addition)) > 0) \
544     { \
545         curr_offset += consumed; \
546         curr_len -= consumed; \
547     } \
548     if ((signed)curr_len <= 0) return;      \
549 }
550
551 #define ELEM_OPT_T(EOT_iei, EOT_pdu_type, EOT_elem_idx, EOT_elem_name_addition) \
552 {\
553     if ((consumed = elem_t(tvb, tree, pinfo, (guint8) EOT_iei, EOT_pdu_type, EOT_elem_idx, curr_offset, EOT_elem_name_addition)) > 0) \
554     { \
555         curr_offset += consumed; \
556         curr_len -= consumed; \
557     } \
558     if ((signed)curr_len <= 0) return;      \
559 }
560
561 #define ELEM_MAND_LV(EML_pdu_type, EML_elem_idx, EML_elem_name_addition) \
562 {\
563     if ((consumed = elem_lv(tvb, tree, pinfo, EML_pdu_type, EML_elem_idx, curr_offset, curr_len, EML_elem_name_addition)) > 0) \
564     { \
565         curr_offset += consumed; \
566         curr_len -= consumed; \
567     } \
568     else \
569     { \
570         /* Mandatory, but nothing we can do */ \
571     } \
572     if ((signed)curr_len <= 0) return;      \
573 }
574
575 #define ELEM_MAND_LV_E(EML_pdu_type, EML_elem_idx, EML_elem_name_addition) \
576 {\
577     if ((consumed = elem_lv_e(tvb, tree, pinfo, EML_pdu_type, EML_elem_idx, curr_offset, curr_len, EML_elem_name_addition)) > 0) \
578     { \
579         curr_offset += consumed; \
580         curr_len -= consumed; \
581     } \
582     else \
583     { \
584         /* Mandatory, but nothing we can do */ \
585     } \
586     if ((signed)curr_len <= 0) return;      \
587 }
588
589 #define ELEM_MAND_V(EMV_pdu_type, EMV_elem_idx, EMV_elem_name_addition) \
590 {\
591     if ((consumed = elem_v(tvb, tree, pinfo, EMV_pdu_type, EMV_elem_idx, curr_offset, EMV_elem_name_addition)) > 0) \
592     { \
593         curr_offset += consumed; \
594         curr_len -= consumed; \
595     } \
596     else \
597     { \
598         /* Mandatory, but nothing we can do */ \
599     } \
600     if ((signed)curr_len <= 0) return;      \
601 }
602
603 #define ELEM_MAND_VV_SHORT(EMV_pdu_type1, EMV_elem_idx1, EMV_pdu_type2, EMV_elem_idx2) \
604 {\
605     elem_v_short(tvb, tree, pinfo, EMV_pdu_type1, EMV_elem_idx1, curr_offset, RIGHT_NIBBLE); \
606     elem_v_short(tvb, tree, pinfo, EMV_pdu_type2, EMV_elem_idx2, curr_offset, LEFT_NIBBLE); \
607     curr_offset ++ ; /* consumed length is 1, regardless of contents */ \
608     curr_len -- ; \
609     if ((signed)curr_len <= 0) return;      \
610 }
611
612 /*
613  * this enum must be kept in-sync with 'gsm_a_pd_str'
614  * it is used as an index into the array
615  */
616 typedef enum
617 {
618     PD_GCC = 0,
619     PD_BCC,
620     PD_RSVD_1,
621     PD_CC,
622     PD_GTTP,
623     PD_MM,
624     PD_RR,
625     PD_UNK_1,
626     PD_GMM,
627     PD_SMS,
628     PD_SM,
629     PD_SS,
630     PD_LCS,
631     PD_UNK_2,
632     PD_RSVD_EXT,
633     PD_TP
634 }
635 gsm_a_pd_str_e;
636
637 typedef struct _gsm_a_tap_rec_t {
638     /*
639      * value from packet-bssap.h
640      */
641     guint8      pdu_type;
642     guint8      message_type;
643     gsm_a_pd_str_e  protocol_disc;
644 } gsm_a_tap_rec_t;
645
646 void dissect_bssmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
647
648 void dissect_bssmap_le(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
649
650 void bssmap_old_bss_to_new_bss_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo);
651 void bssmap_new_bss_to_old_bss_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo);
652
653 void dtap_mm_mm_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len);
654
655 guint16 be_cell_id_aux(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len, guint8 disc);
656 guint16 be_cell_id_list(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
657 guint16 be_chan_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
658 guint16 be_prio(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
659
660 WS_DLL_PUBLIC
661 guint16 de_lai(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
662 WS_DLL_PUBLIC
663 guint16 de_mid(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
664 WS_DLL_PUBLIC
665 guint16 de_cell_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
666 guint16 de_bearer_cap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
667 guint16 de_bearer_cap_uplink(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
668 guint16 be_emlpp_prio(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
669 guint16 be_ganss_loc_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
670 guint16 be_ganss_pos_dta(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
671 guint16 be_ganss_ass_dta(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
672 guint16 de_cn_common_gsm_map_nas_sys_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
673 guint16 de_cs_domain_spec_sys_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
674 guint16 de_ps_domain_spec_sys_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
675 guint16 de_plmn_list(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
676 WS_DLL_PUBLIC
677 guint16 de_ms_cm_1(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
678 WS_DLL_PUBLIC
679 guint16 de_ms_cm_2(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
680 WS_DLL_PUBLIC
681 guint16 de_ms_cm_3(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
682 guint16 de_serv_cat(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
683 WS_DLL_PUBLIC
684 guint16 de_sm_apn(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
685 guint16 de_sm_pco(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
686 WS_DLL_PUBLIC
687 guint16 de_sm_qos(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
688 WS_DLL_PUBLIC
689 guint16 de_sm_pflow_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
690 guint16 de_sm_tflow_temp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
691 guint16 de_time_zone(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
692 WS_DLL_PUBLIC
693 guint16 de_gmm_drx_param(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
694 WS_DLL_PUBLIC
695 guint16 de_gmm_ms_net_cap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
696 WS_DLL_PUBLIC
697 guint16 de_gmm_rai(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
698 WS_DLL_PUBLIC
699 guint16 de_gmm_ms_radio_acc_cap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
700 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);
701
702 guint16 de_sup_codec_list(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
703  
704
705 WS_DLL_PUBLIC
706 guint16 de_rr_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
707 WS_DLL_PUBLIC
708 guint16 de_rr_cell_dsc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
709 WS_DLL_PUBLIC
710 guint16 de_rr_ch_dsc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
711 WS_DLL_PUBLIC
712 guint16 de_rr_ch_mode(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
713 WS_DLL_PUBLIC
714 guint16 de_rr_chnl_needed(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
715 WS_DLL_PUBLIC
716 guint16 de_rr_cip_mode_set(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
717 WS_DLL_PUBLIC
718 guint16 de_rr_cm_enq_mask(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
719 guint16 de_rr_meas_res(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
720 WS_DLL_PUBLIC
721 guint16 de_rr_multirate_conf(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
722 WS_DLL_PUBLIC
723 guint16 de_rr_sus_cau(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
724 WS_DLL_PUBLIC
725 guint16 de_rr_tlli(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
726
727 WS_DLL_PUBLIC
728 guint16 de_rej_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
729 WS_DLL_PUBLIC
730 guint16 de_d_gb_call_ref(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
731 guint16 de_spare_nibble(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_);
732
733 guint16 de_emm_ue_net_cap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
734 guint16 de_emm_trac_area_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
735 guint16 de_emm_sec_par_from_eutra(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_);
736 guint16 de_emm_sec_par_to_eutra(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_);
737 guint16 de_esm_qos(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_);
738 void nas_esm_pdn_con_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len);
739
740 void dtap_rr_ho_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len);
741 void dtap_rr_cip_mode_cpte(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len);
742
743 void bssmap_perf_loc_abort(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len);
744 void bssmap_reset(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len);
745 void bssmap_conn_oriented(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len);
746
747 void rp_data_n_ms(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len);
748
749 /*
750  * the following allows TAP code access to the messages
751  * without having to duplicate it. With MSVC and a
752  * libwireshark.dll, we need a special declaration.
753  */
754 WS_DLL_PUBLIC const value_string gsm_a_bssmap_msg_strings[];
755 WS_DLL_PUBLIC const value_string gsm_a_dtap_msg_mm_strings[];
756 WS_DLL_PUBLIC const value_string gsm_a_dtap_msg_rr_strings[];
757 WS_DLL_PUBLIC const value_string gsm_a_dtap_msg_cc_strings[];
758 WS_DLL_PUBLIC const value_string gsm_a_dtap_msg_gmm_strings[];
759 WS_DLL_PUBLIC const value_string gsm_a_dtap_msg_sms_strings[];
760 WS_DLL_PUBLIC const value_string gsm_a_dtap_msg_sm_strings[];
761 WS_DLL_PUBLIC const value_string gsm_a_dtap_msg_ss_strings[];
762 WS_DLL_PUBLIC const value_string gsm_a_dtap_msg_tp_strings[];
763 WS_DLL_PUBLIC const value_string gsm_a_rr_short_pd_msg_strings[];
764 WS_DLL_PUBLIC const gchar *gsm_a_pd_str[];
765
766 extern const value_string gsm_a_sm_qos_del_of_err_sdu_vals[];
767 extern const value_string gsm_a_sm_qos_traffic_cls_vals[];
768 extern const value_string gsm_a_sm_qos_ber_vals[];
769 extern const value_string gsm_a_sm_qos_sdu_err_rat_vals[];
770 extern const value_string gsm_a_sm_qos_traff_hdl_pri_vals[];
771
772 extern const value_string gsm_a_dtap_type_of_number_values[];
773 extern const value_string gsm_a_dtap_numbering_plan_id_values[];
774 extern const value_string gsm_a_sms_vals[];
775 extern const value_string tighter_cap_level_vals[];
776 extern value_string_ext gsm_a_rr_rxlev_vals_ext;
777 extern const value_string gsm_a_gm_type_of_ciph_alg_vals[];
778
779 typedef enum
780 {
781     /* Common Information Elements [3] 10.5.1 */
782     DE_CELL_ID,                        /* Cell Identity */
783     DE_CIPH_KEY_SEQ_NUM,               /* Ciphering Key Sequence Number */
784     DE_LAI,                            /* Location Area Identification */
785     DE_MID,                            /* Mobile Identity */
786     DE_MS_CM_1,                        /* Mobile Station Classmark 1 */
787     DE_MS_CM_2,                        /* Mobile Station Classmark 2 */
788     DE_MS_CM_3,                        /* Mobile Station Classmark 3 */
789     DE_SPARE_NIBBLE,                   /* Spare Half Octet */
790     DE_D_GB_CALL_REF,                  /* Descriptive group or broadcast call reference */
791     DE_G_CIPH_KEY_NUM,                 /* Group Cipher Key Number */
792     DE_PD_SAPI,                        /* PD and SAPI $(CCBS)$ */
793     DE_PRIO,                           /* Priority Level */
794     DE_CN_COMMON_GSM_MAP_NAS_SYS_INFO, /* CN Common GSM-MAP NAS system information */
795     DE_CS_DOMAIN_SPEC_SYS_INFO,        /* CS domain specific system information */
796     DE_PS_DOMAIN_SPEC_SYS_INFO,        /* PS domain specific system information */
797     DE_PLMN_LIST,                      /* PLMN List */
798     DE_NAS_CONT_FOR_PS_HO,             /* 10.5.1.14 NAS container for PS HO */
799     DE_MS_NET_FEAT_SUP,                /* 10.5.1.15 MS network feature support */
800
801     DE_COMMON_NONE          /* NONE */
802 }
803 common_elem_idx_t;
804
805 typedef enum
806 {
807     BE_UDEF_0,                          /* Undefined */
808     BE_CIC,                             /* Circuit Identity Code */
809     BE_RSVD_1,                          /* Reserved */
810     BE_RES_AVAIL,                       /* Resource Available */
811     BE_CAUSE,                           /* Cause */
812     BE_CELL_ID,                         /* Cell Identifier */
813     BE_PRIO,                            /* Priority */
814     BE_L3_HEADER_INFO,                  /* Layer 3 Header Information */
815     BE_IMSI,                            /* IMSI */
816     BE_TMSI,                            /* TMSI */
817     BE_ENC_INFO,                        /* Encryption Information */
818     BE_CHAN_TYPE,                       /* Channel Type */
819     BE_PERIODICITY,                     /* Periodicity */
820     BE_EXT_RES_IND,                     /* Extended Resource Indicator */
821     BE_NUM_MS,                          /* Number Of MSs */
822     BE_RSVD_2,                          /* Reserved */
823     BE_RSVD_3,                          /* Reserved */
824     BE_RSVD_4,                          /* Reserved */
825     BE_CM_INFO_2,                       /* Classmark Information Type 2 */
826     BE_CM_INFO_3,                       /* Classmark Information Type 3 */
827     BE_INT_BAND,                        /* Interference Band To Be Used */
828     BE_RR_CAUSE,                        /* RR Cause */
829     BE_RSVD_5,                          /* Reserved */
830     BE_L3_INFO,                         /* Layer 3 Information */
831     BE_DLCI,                            /* DLCI */
832     BE_DOWN_DTX_FLAG,                   /* Downlink DTX Flag */
833     BE_CELL_ID_LIST,                    /* Cell Identifier List */
834     BE_RESP_REQ,                        /* Response Request */
835     BE_RES_IND_METHOD,                  /* Resource Indication Method */
836     BE_CM_INFO_1,                       /* Classmark Information Type 1 */
837     BE_CIC_LIST,                        /* Circuit Identity Code List */
838     BE_DIAG,                            /* Diagnostic */
839     BE_L3_MSG,                          /* Layer 3 Message Contents */
840     BE_CHOSEN_CHAN,                     /* Chosen Channel */
841     BE_TOT_RES_ACC,                     /* Total Resource Accessible */
842     BE_CIPH_RESP_MODE,                  /* Cipher Response Mode */
843     BE_CHAN_NEEDED,                     /* Channel Needed */
844     BE_TRACE_TYPE,                      /* Trace Type */
845     BE_TRIGGERID,                       /* TriggerID */
846     BE_TRACE_REF,                       /* Trace Reference */
847     BE_TRANSID,                         /* TransactionID */
848     BE_MID,                             /* Mobile Identity */
849     BE_OMCID,                           /* OMCID */
850     BE_FOR_IND,                         /* Forward Indicator */
851     BE_CHOSEN_ENC_ALG,                  /* Chosen Encryption Algorithm */
852     BE_CCT_POOL,                        /* Circuit Pool */
853     BE_CCT_POOL_LIST,                   /* Circuit Pool List */
854     BE_TIME_IND,                        /* Time Indication */
855     BE_RES_SIT,                         /* Resource Situation */
856     BE_CURR_CHAN_1,                     /* Current Channel Type 1 */
857     BE_QUE_IND,                         /* Queueing Indicator */
858     BE_ASS_REQ,                         /* Assignment Requirement */
859     BE_UDEF_52,                         /* Undefined */
860     BE_TALKER_FLAG,                     /* Talker Flag */
861     BE_CONN_REL_REQ,                    /* Connection Release Requested */
862     BE_GROUP_CALL_REF,                  /* Group Call Reference */
863     BE_EMLPP_PRIO,                      /* eMLPP Priority */
864     BE_CONF_EVO_IND,                    /* Configuration Evolution Indication */
865     BE_OLD2NEW_INFO,                    /* Old BSS to New BSS Information */
866     BE_LSA_ID,                          /* LSA Identifier */
867     BE_LSA_ID_LIST,                     /* LSA Identifier List */
868     BE_LSA_INFO,                        /* LSA Information */
869     BE_LCS_QOS,                         /* LCS QoS */
870     BE_LSA_ACC_CTRL,                    /* LSA access control suppression */
871     BE_SPEECH_VER,                      /* Speech Version */
872     BE_UDEF_65,                         /* Undefined */
873     BE_UDEF_66,                         /* Undefined */
874     BE_LCS_PRIO,                        /* LCS Priority */
875     BE_LOC_TYPE,                        /* Location Type */
876     BE_LOC_EST,                         /* Location Estimate */
877     BE_POS_DATA,                        /* Positioning Data */
878     BE_LCS_CAUSE,                       /* 3.2.2.66 LCS Cause */
879     BE_LCS_CLIENT,                      /* 10.14 LCS Client Type */
880     BE_APDU,                            /* APDU */
881     BE_NE_ID,                           /* Network Element Identity */
882     BE_GPS_ASSIST_DATA,                 /* GPS Assistance Data */
883     BE_DECIPH_KEYS,                     /* Deciphering Keys */
884     BE_RET_ERR_REQ,                     /* Return Error Request */
885     BE_RET_ERR_CAUSE,                   /* Return Error Cause */
886     BE_SEG,                             /* Segmentation */
887     BE_SERV_HO,                         /* Service Handover */
888     BE_SRC_RNC_TO_TAR_RNC_UMTS,         /* Source RNC to target RNC transparent information (UMTS) */
889     BE_SRC_RNC_TO_TAR_RNC_CDMA,         /* Source RNC to target RNC transparent information (cdma2000) */
890     BE_GERAN_CLS_M,                     /* GERAN Classmark */
891     BE_GERAN_BSC_CONT,                  /* GERAN BSC Container */
892     BE_VEL_EST,                         /* Velocity Estimate */
893     BE_UDEF_86,                         /* Undefined */
894     BE_UDEF_87,                         /* Undefined */
895     BE_UDEF_88,                         /* Undefined */
896     BE_UDEF_89,                         /* Undefined */
897     BE_UDEF_90,                         /* Undefined */
898     BE_UDEF_91,                         /* Undefined */
899     BE_UDEF_92,                         /* Undefined */
900     BE_UDEF_93,                         /* Undefined */
901     BE_UDEF_94,                         /* Undefined */
902     BE_UDEF_95,                         /* Undefined */
903     BE_UDEF_96,                         /* Undefined */
904     BE_NEW_BSS_TO_OLD_BSS_INF,          /* New BSS to Old BSS Information */
905     BE_UDEF_98,                         /* Undefined */
906     BE_INTER_SYS_INF,                   /* Inter-System Information */
907     BE_SNA_ACC_INF,                     /* SNA Access Information */
908     BE_VSTK_RAND_INF,                   /* VSTK_RAND Information */
909     BE_VSTK_INF,                        /* VSTK Information */
910     BE_PAGING_INF,                      /* Paging Information */
911     BE_IMEI,                            /* IMEI */
912     BE_VGCS_FEAT_FLG,                   /* VGCS Feature Flags */
913     BE_TALKER_PRI,                      /* Talker Priority */
914     BE_EMRG_SET_IND,                    /* Emergency Set Indication */
915     BE_TALKER_ID,                       /* Talker Identity */
916     BE_CELL_ID_LIST_SEG,                /* Cell Identifier List Segment */
917     BE_SMS_TO_VGCS,                     /* SMS to VGCS */
918     BE_VGCS_TALKER_MOD,                 /* VGCS Talker Mode */
919     BE_VGS_VBS_CELL_STAT,               /* VGCS/VBS Cell Status */
920     BE_CELL_ID_LST_SEG_F_EST_CELLS,     /* Cell Identifier List Segment for established cells */
921     BE_CELL_ID_LST_SEG_F_CELL_TB_EST,   /* Cell Identifier List Segment for cells to be established */
922     BE_CELL_ID_LST_SEG_F_REL_CELL,      /* Cell Identifier List Segment for released cells - no user present */
923     BE_CELL_ID_LST_SEG_F_NOT_EST_CELL,  /* Cell Identifier List Segment for not established cells - no establishment possible */
924     BE_GANSS_ASS_DTA,                   /* GANSS Assistance Data */
925     BE_GANSS_POS_DTA,                   /* GANSS Positioning Data */
926     BE_GANSS_LOC_TYP,                   /* GANSS Location Type */
927     BE_APP_DATA,                        /* Application Data */
928     BE_DATA_ID,                         /* Data Identity */
929     BE_APP_DATA_INF,                    /* Application Data Information */
930     BE_MSISDN,                          /* MSISDN */
931     BE_AOIP_TRANS_LAY_ADD,              /* AoIP Transport Layer Address */
932     BE_SPEECH_CODEC_LST,                /* Speech Codec List */
933     BE_SPEECH_CODEC,                    /* Speech Codec */
934     BE_CALL_ID,                         /* Call Identifier */
935     BE_CALL_ID_LST,                     /* Call Identifier List */
936     BE_A_ITF_SEL_FOR_RESET,             /* A-Interface Selector for RESET */
937     BE_UDEF_130,                        /* Undefined */
938     BE_KC128,                           /* Kc128 */
939     BE_CSG_ID,                          /* CSG Identifier */
940         BE_REDIR_ATT_FLG,                   /* Redirect Attempt Flag               3.2.2.111    */
941         BE_REROUTE_REJ_CAUSE,               /* Reroute Reject Cause                3.2.2.112    */
942         BE_SEND_SEQN,                       /* Send Sequence Number                3.2.2.113    */
943         BE_REROUTE_OUTCOME,                 /* Reroute complete outcome            3.2.2.114    */
944         BE_GLOBAL_CALL_REF,                 /* Global Call Reference               3.2.2.115    */
945         BE_LCLS_CONF,                       /* LCLS-Configuration                  3.2.2.116    */
946         BE_LCLS_CON_STATUS_CONTROL,         /* LCLS-Connection-Status-Control      3.2.2.117    */
947         BE_LCLS_CORR_NOT_NEEDED,            /* LCLS-Correlation-Not-Needed         3.2.2.118    */
948         BE_LCLS_BSS_STATUS,                 /* LCLS-BSS-Status                     3.2.2.119    */
949         BE_LCLS_BREAK_REQ,                  /* LCLS-Break-Request                  3.2.2.120    */
950         BE_CSFB_IND                         /* CSFB Indication                     3.2.2.121    */
951 }
952 bssmap_elem_idx_t;
953
954 typedef enum
955 {
956     /* BSSMAP LE Elements */
957     DE_BMAPLE_LCSQOS,           /* LCS QOS */
958     DE_BMAPLE_LCS_PRIO,         /* LCS Priority */
959     DE_BMAPLE_LOC_TYPE,         /* Location Type */
960     DE_BMAPLE_GANSS_LOC_TYPE,   /* GANSS Location Type */
961     DE_BMAPLE_GEO_LOC,          /* 10.9 Geographic Location */
962     DE_BMAPLE_POS_DATA,         /* Positioning Data */
963     DE_BMAPLE_GANSS_POS_DATA,   /* GANSS Positioning Data */
964     DE_BMAPLE_VELOC_DATA,       /* Velocity Data */
965     DE_BMAPLE_LCS_CAUSE,        /* LCS Cause */
966     DE_BMAPLE_LCS_CLIENT_TYPE,  /* LCS Client Type */
967     DE_BMAPLE_APDU,             /* 10.3 APDU */
968     DE_BMAPLE_NETWORK_ELEM_ID,  /* Network Element Identity */
969     DE_BMAPLE_REQ_GPS_ASSIST_D, /* 10.10 Requested GPS Assistance Data */
970     DE_BMAPLE_REQ_GNSS_ASSIST_D,/* Requested GANSS Assistance Data */
971     DE_BMAPLE_DECIPH_KEYS,      /* 10.8 Deciphering Keys */
972     DE_BMAPLE_RETURN_ERROR_REQ, /* Return Error Request */
973     DE_BMAPLE_RETURN_ERROR_CAUSE,   /* Return Error Cause */
974     DE_BMAPLE_SEGMENTATION,     /* Segmentation */
975     DE_BMAPLE_CLASSMARK_TYPE_3, /* Classmark Information Type 3 */
976     DE_BMAPLE_CAUSE,            /* 10.4 Cause */
977     DE_BMAPLE_CELL_IDENTIFIER,  /* 10.5 Cell Identifier */
978     DE_BMAPLE_CHOSEN_CHANNEL,   /* 10.6 Chosen Channel */
979     DE_BMAPLE_IMSI,             /* 10.11 IMSI */
980     DE_BMAPLE_RES1,             /* Reserved */
981     DE_BMAPLE_RES2,             /* Reserved */
982     DE_BMAPLE_RES3,             /* Reserved */
983     DE_BMAPLE_LCS_CAPABILITY,   /* LCS Capability */
984     DE_BMAPLE_PACKET_MEAS_REP,  /* Packet Measurement Report */
985     DE_BMAPLE_MEAS_CELL_ID,     /* Measured Cell Identity */
986     DE_BMAPLE_IMEI,             /* IMEI */
987     BMAPLE_NONE                 /* NONE */
988 }
989 bssmap_le_elem_idx_t;
990
991 typedef enum
992 {
993     /* BSS LAP Elements 5 */
994     DE_BLAP_RES1,           /* Reserved */
995     DE_BLAP_TA,             /* Timing Advance */
996     DE_BLAP_RES3,           /* Reserved */          /* (note) */
997     DE_BLAP_RES4,           /* Cell Identity */
998     DE_BLAP_RES5,           /* Reserved */          /* (note) */
999     DE_BLAP_RES6,           /* Reserved */          /* (note) */
1000     DE_BLAP_RES7,           /* Reserved */          /* (note) */
1001     DE_BLAP_CH_DESC,        /* Channel Description */
1002     DE_BLAP_RES9,           /* Reserved */          /* (note) */
1003     DE_BLAP_RES10,          /* Reserved */          /* (note) */
1004     DE_BLAP_RES11,          /* Reserved */          /* (note) */
1005     DE_BLAP_MEAS_REP,       /* Measurement Report */
1006     DE_BLAP_RES13,          /* Reserved */          /* (note) */
1007     DE_BLAP_CAUSE,          /* Cause */
1008     DE_BLAP_RRLP_FLG,       /* RRLP Flag */
1009     DE_BLAP_RRLP_IE,        /* RRLP IE */
1010     DE_BLAP_CELL_ID_LIST,   /* Cell Identity List */
1011     DE_BLAP_ENH_MEAS_REP,   /* Enhanced Measurement Report */
1012     DE_BLAP_LAC,            /* Location Area Code */
1013     DE_BLAP_FREQ_LIST,      /* Frequency List */
1014     DE_BLAP_MS_POW,         /* MS Power */
1015     DE_BLAP_DELTA_TIME,     /* Delta Timer */
1016     DE_BLAP_SERV_CELL_ID,   /* Serving Cell Identifier */
1017     DE_BLAP_ENC_KEY,        /* Encryption Key (Kc) */
1018     DE_BLAP_CIP_M_SET,      /* Cipher Mode Setting */
1019     DE_BLAP_CH_MODE,        /* Channel Mode */
1020     DE_BLAP_POLL_REP,       /* Polling Repetition */
1021     DE_BLAP_PKT_CH_DESC,    /* Packet Channel Description */
1022     DE_BLAP_TLLI,           /* TLLI */
1023     DE_BLAP_TFI,            /* TFI */
1024     DE_BLAP_START_TIME,     /* Starting Time */
1025     BSSLAP_NONE             /* NONE */
1026 }
1027 bsslap_elem_idx_t;
1028
1029 typedef enum
1030 {
1031     /* Mobility Management Information Elements [3] 10.5.3 */
1032     DE_AUTH_PARAM_RAND,             /* Authentication Parameter RAND */
1033     DE_AUTH_PARAM_AUTN,             /* Authentication Parameter AUTN (UMTS and EPS authentication challenge) */
1034     DE_AUTH_RESP_PARAM,             /* Authentication Response Parameter */
1035     DE_AUTH_RESP_PARAM_EXT,         /* Authentication Response Parameter (extension) (UMTS authentication challenge only) */
1036     DE_AUTH_FAIL_PARAM,             /* Authentication Failure Parameter (UMTS and EPS authentication challenge) */
1037     DE_CM_SRVC_TYPE,                /* CM Service Type */
1038     DE_ID_TYPE,                     /* Identity Type */
1039     DE_LOC_UPD_TYPE,                /* Location Updating Type */
1040     DE_NETWORK_NAME,                /* Network Name */
1041     DE_REJ_CAUSE,                   /* Reject Cause */
1042     DE_FOP,                         /* Follow-on Proceed */
1043     DE_TIME_ZONE,                   /* Time Zone */
1044     DE_TIME_ZONE_TIME,              /* Time Zone and Time */
1045     DE_CTS_PERM,                    /* CTS Permission */
1046     DE_LSA_ID,                      /* LSA Identifier */
1047     DE_DAY_SAVING_TIME,             /* Daylight Saving Time */
1048     DE_EMERGENCY_NUM_LIST,          /* Emergency Number List */
1049     DE_ADD_UPD_PARAMS,              /* Additional update parameters */
1050     DE_MM_TIMER,                    /* MM Timer */
1051     /* Call Control Information Elements 10.5.4 */
1052     DE_AUX_STATES,                  /* Auxiliary States */
1053     DE_BEARER_CAP,                  /* Bearer Capability */
1054     DE_CC_CAP,                      /* Call Control Capabilities */
1055     DE_CALL_STATE,                  /* Call State */
1056     DE_CLD_PARTY_BCD_NUM,           /* Called Party BCD Number */
1057     DE_CLD_PARTY_SUB_ADDR,          /* Called Party Subaddress */
1058     DE_CLG_PARTY_BCD_NUM,           /* Calling Party BCD Number */
1059     DE_CLG_PARTY_SUB_ADDR,          /* Calling Party Subaddress */
1060     DE_CAUSE,                       /* Cause */
1061     DE_CLIR_SUP,                    /* CLIR Suppression */
1062     DE_CLIR_INV,                    /* CLIR Invocation */
1063     DE_CONGESTION,                  /* Congestion Level */
1064     DE_CONN_NUM,                    /* Connected Number */
1065     DE_CONN_SUB_ADDR,               /* Connected Subaddress */
1066     DE_FACILITY,                    /* Facility */
1067     DE_HLC,                         /* High Layer Compatibility */
1068     DE_KEYPAD_FACILITY,             /* Keypad Facility */
1069     DE_LLC,                         /* Low Layer Compatibility */
1070     DE_MORE_DATA,                   /* More Data */
1071     DE_NOT_IND,                     /* Notification Indicator */
1072     DE_PROG_IND,                    /* Progress Indicator */
1073     DE_RECALL_TYPE,                 /* Recall type $(CCBS)$ */
1074     DE_RED_PARTY_BCD_NUM,           /* Redirecting Party BCD Number */
1075     DE_RED_PARTY_SUB_ADDR,          /* Redirecting Party Subaddress */
1076     DE_REPEAT_IND,                  /* Repeat Indicator */
1077     DE_REV_CALL_SETUP_DIR,          /* Reverse Call Setup Direction */
1078     DE_SETUP_CONTAINER,             /* SETUP Container $(CCBS)$ */
1079     DE_SIGNAL,                      /* Signal */
1080     DE_SS_VER_IND,                  /* SS Version Indicator */
1081     DE_USER_USER,                   /* User-user */
1082     DE_ALERT_PATTERN,               /* Alerting Pattern $(NIA)$ */
1083     DE_ALLOWED_ACTIONS,             /* Allowed Actions $(CCBS)$ */
1084     DE_SI,                          /* Stream Identifier */
1085     DE_NET_CC_CAP,                  /* Network Call Control Capabilities */
1086     DE_CAUSE_NO_CLI,                /* Cause of No CLI */
1087     DE_SUP_CODEC_LIST,              /* Supported Codec List */
1088     DE_SERV_CAT,                    /* Service Category */
1089     DE_REDIAL,                      /* 10.5.4.34 Redial */
1090     DE_NET_INIT_SERV_UPG,           /* 10.5.4.35 Network-initiated Service Upgrade ind */
1091     /* Short Message Service Information Elements [5] 8.1.4 */
1092     DE_CP_USER_DATA,                /* CP-User Data */
1093     DE_CP_CAUSE,                    /* CP-Cause */
1094     /* Tests procedures information elements 3GPP TS 44.014 6.4.0 and 3GPP TS 34.109 6.4.0 */
1095     DE_TP_SUB_CHANNEL,                  /* Close TCH Loop Cmd Sub-channel */
1096     DE_TP_ACK,                          /* Open Loop Cmd Ack */
1097     DE_TP_LOOP_TYPE,                    /* Close Multi-slot Loop Cmd Loop type*/
1098     DE_TP_LOOP_ACK,                     /* Close Multi-slot Loop Ack Result */
1099     DE_TP_TESTED_DEVICE,                /* Test Interface Tested device */
1100     DE_TP_PDU_DESCRIPTION,              /* GPRS Test Mode Cmd PDU description */
1101     DE_TP_MODE_FLAG,                    /* GPRS Test Mode Cmd Mode flag */
1102     DE_TP_EGPRS_MODE_FLAG,              /* EGPRS Start Radio Block Loopback Cmd Mode flag */
1103     DE_TP_MS_POSITIONING_TECHNOLOGY,    /* MS Positioning Technology */
1104     DE_TP_UE_TEST_LOOP_MODE,            /* Close UE Test Loop Mode */
1105     DE_TP_UE_POSITIONING_TECHNOLOGY,    /* UE Positioning Technology */
1106     DE_TP_RLC_SDU_COUNTER_VALUE,        /* RLC SDU Counter Value */
1107     DE_TP_EPC_UE_TEST_LOOP_MODE,        /* UE Test Loop Mode */
1108     DE_TP_EPC_UE_TL_A_LB_SETUP,         /* UE Test Loop Mode A LB Setup */
1109     DE_TP_EPC_UE_TL_B_LB_SETUP,         /* UE Test Loop Mode B LB Setup */
1110     DE_TP_EPC_UE_TL_C_SETUP,            /* UE Test Loop Mode C Setup */
1111     DE_TP_EPC_UE_POSITIONING_TECHNOLOGY,/* UE Positioning Technology */
1112     DE_TP_EPC_MBMS_PACKET_COUNTER_VALUE,/* MBMS Packet Counter Value */
1113     DE_TP_EPC_ELLIPSOID_POINT_WITH_ALT, /* ellipsoidPointWithAltitude */
1114     DE_TP_EPC_HORIZONTAL_VELOCITY,      /* horizontalVelocity */
1115     DE_TP_EPC_GNSS_TOD_MSEC,            /* gnss-TOD-msec */
1116     DE_NONE                             /* NONE */
1117 }
1118 dtap_elem_idx_t;
1119
1120 typedef enum
1121 {
1122     /* GPRS Mobility Management Information Elements [3] 10.5.5 */
1123     DE_ADD_UPD_TYPE,                /* [11] 10.5.5.0 Additional Update Type */
1124     DE_ATTACH_RES,                  /* [7] 10.5.5.1 Attach Result*/
1125     DE_ATTACH_TYPE,                 /* [7] 10.5.5.2 Attach Type */
1126     DE_CIPH_ALG,                    /* [7] 10.5.5.3 Cipher Algorithm */
1127     DE_TMSI_STAT,                   /* [7] 10.5.5.4 TMSI Status */
1128     DE_DETACH_TYPE,                 /* [7] 10.5.5.5 Detach Type */
1129     DE_DRX_PARAM,                   /* [7] 10.5.5.6 DRX Parameter */
1130     DE_FORCE_TO_STAND,              /* [7] 10.5.5.7 Force to Standby */
1131     DE_FORCE_TO_STAND_H,            /* [7] 10.5.5.7 Force to Standby - Info is in the high nibble */
1132     DE_P_TMSI_SIG,                  /* [7] 10.5.5.8 P-TMSI Signature */
1133     DE_P_TMSI_SIG_2,                /* [7] 10.5.5.8a P-TMSI Signature 2 */
1134     DE_ID_TYPE_2,                   /* [7] 10.5.5.9 Identity Type 2 */
1135     DE_IMEISV_REQ,                  /* [7] 10.5.5.10 IMEISV Request */
1136     DE_REC_N_PDU_NUM_LIST,          /* [7] 10.5.5.11 Receive N-PDU Numbers List */
1137     DE_MS_NET_CAP,                  /* [7] 10.5.5.12 MS Network Capability */
1138     DE_MS_RAD_ACC_CAP,              /* [7] 10.5.5.12a MS Radio Access Capability */
1139     DE_GMM_CAUSE,                   /* [7] 10.5.5.14 GMM Cause */
1140     DE_RAI,                         /* [7] 10.5.5.15 Routing Area Identification */
1141     DE_RAI_2,                       /* [7] 10.5.5.15a Routing Area Identification 2 */
1142     DE_UPD_RES,                     /* [7] 10.5.5.17 Update Result */
1143     DE_UPD_TYPE,                    /* [7] 10.5.5.18 Update Type */
1144     DE_AC_REF_NUM,                  /* [7] 10.5.5.19 A&C Reference Number */
1145     DE_AC_REF_NUM_H,                /* A&C Reference Number - Info is in the high nibble */
1146     DE_SRVC_TYPE,                   /* [7] 10.5.5.20 Service Type */
1147     DE_CELL_NOT,                    /* [7] 10.5.5.21 Cell Notification */
1148     DE_PS_LCS_CAP,                  /* [7] 10.5.5.22 PS LCS Capability */
1149     DE_NET_FEAT_SUP,                /* [7] 10.5.5.23 Network Feature Support */
1150     DE_ADD_NET_FEAT_SUP,            /* [11] 10.5.5.23a Additional network feature support */
1151     DE_RAT_INFO_CONTAINER,          /* [7] 10.5.5.24 Inter RAT information container */
1152     DE_REQ_MS_INFO,                 /* [7] 10.5.5.25 Requested MS information */
1153     DE_UE_NETWORK_CAP,              /* [7] 10.5.5.26 UE network capability */
1154     DE_EUTRAN_IRAT_INFO_CONTAINER,  /* [7] 10.5.5.27 E-UTRAN inter RAT information container */
1155     DE_VOICE_DOMAIN_PREF,           /* [7] 10.5.5.28 Voice domain preference and UE's usage setting */
1156     DE_PTMSI_TYPE,                  /* [10] 10.5.5.29 P-TMSI type */
1157     DE_LAI_2,                       /* [10] 10.5.5.30 Location Area Identification 2 */
1158     DE_NET_RES_ID_CONT,             /* [11] 10.5.5.31 Network resource identifier container */
1159     /* Session Management Information Elements [3] 10.5.6 */
1160     DE_ACC_POINT_NAME,              /* Access Point Name */
1161     DE_NET_SAPI,                    /* Network Service Access Point Identifier */
1162     DE_PRO_CONF_OPT,                /* Protocol Configuration Options */
1163     DE_PD_PRO_ADDR,                 /* Packet Data Protocol Address */
1164     DE_QOS,                         /* Quality Of Service */
1165     DE_SM_CAUSE,                    /* SM Cause */
1166     DE_SM_CAUSE_2,                  /* SM Cause 2 */
1167     DE_LINKED_TI,                   /* Linked TI */
1168     DE_LLC_SAPI,                    /* LLC Service Access Point Identifier */
1169     DE_TEAR_DOWN_IND,               /* Tear Down Indicator */
1170     DE_PACKET_FLOW_ID,              /* Packet Flow Identifier */
1171     DE_TRAFFIC_FLOW_TEMPLATE,       /* Traffic Flow Template */
1172     DE_TMGI,                        /* Temporary Mobile Group Identity (TMGI) */
1173     DE_MBMS_BEARER_CAP,             /* MBMS bearer capabilities */
1174     DE_MBMS_PROT_CONF_OPT,          /* MBMS protocol configuration options */
1175     DE_ENH_NSAPI,                   /* Enhanced network service access point identifier */
1176     DE_REQ_TYPE,                    /* Request type */
1177     DE_SM_NOTIF_IND,                /* Notification indicator */
1178     DE_SM_CONNECTIVITY_TYPE,        /* Connectivity type */
1179     /* GPRS Common Information Elements [8] 10.5.7 */
1180     DE_PDP_CONTEXT_STAT,            /* [8] 10.5.7.1     PDP Context Status */
1181     DE_RAD_PRIO,                    /* [8] 10.5.7.2     Radio Priority */
1182     DE_GPRS_TIMER,                  /* [8] 10.5.7.3     GPRS Timer */
1183     DE_GPRS_TIMER_2,                /* [8] 10.5.7.4     GPRS Timer 2 */
1184     DE_GPRS_TIMER_3,                /* [10] 10.5.7.4a   GPRS Timer 3 */
1185     DE_RAD_PRIO_2,                  /* [8] 10.5.7.5     Radio Priority 2 */
1186     DE_MBMS_CTX_STATUS,             /* [8] 10.5.7.6     MBMS context status */
1187     DE_UPLINK_DATA_STATUS,          /* [8] 10.5.7.7     Uplink data status */
1188     DE_DEVICE_PROPERTIES,           /* [10] 10.5.7.8    Device properties */
1189     DE_GM_NONE                          /* NONE */
1190 }
1191 gm_elem_idx_t;
1192
1193 typedef enum
1194 {
1195     /* Radio Resource Management Information Elements 10.5.2, most are from 10.5.1  */
1196     DE_RR_BA_RANGE,                 /* [3]  10.5.2.1a    BA Range */
1197     DE_RR_CELL_CH_DSC,              /* [3]  10.5.2.1b    Cell Channel Description    */
1198     DE_RR_BA_LIST_PREF,             /* [3]  10.5.2.1c    BA List Pref */
1199     DE_RR_UTRAN_FREQ_LIST,          /* [3]  10.5.2.1d    UTRAN Frequency List */
1200     DE_RR_CELL_SELECT_INDIC,        /* [3]  10.5.2.1e    Cell selection indicator after release of all TCH and SDCCH IE */
1201     DE_RR_CELL_DSC,                 /* 10.5.2.2   RR Cell Description              */
1202     DE_RR_CELL_OPT_BCCH,            /* [3]  10.5.2.3    Cell Options (BCCH)        */
1203     DE_RR_CELL_OPT_SACCH,           /* [3]  10.5.2.3a   Cell Options (SACCH)       */
1204     DE_RR_CELL_SEL_PARAM,           /* [3]  10.5.2.4    Cell Selection Parameters  */
1205 /*
1206  * [3]  10.5.2.4a   (void)
1207  */
1208     DE_RR_CH_DSC,                   /* [3]  10.5.2.5    Channel Description         */
1209     DE_RR_CH_DSC2,                  /* [3]  10.5.2.5a   Channel Description 2       */
1210     DE_RR_CH_DSC3,                  /* [3]  10.5.2.5c   Channel Description 3       */
1211     DE_RR_CH_MODE,                  /* [3]  10.5.2.6    Channel Mode                */
1212     DE_RR_CH_MODE2,                 /* [3]  10.5.2.7    Channel Mode 2              */
1213     DE_RR_UTRAN_CM,                 /* [3]  10.5.2.7a   UTRAN Classmark */
1214 /* [3]  10.5.2.7b   (void) */
1215     DE_RR_CM_ENQ_MASK,              /* [3]  10.5.2.7c   Classmark Enquiry Mask      */
1216 /* [3]  10.5.2.7d   GERAN Iu Mode Classmark information element                     */
1217     DE_RR_CHNL_NEEDED,              /* [3]  10.5.2.8    Channel Needed
1218  * [3]  10.5.2.8a   (void) */
1219     DE_RR_CHNL_REQ_DESC2,           /* [3]  10.5.2.8b   Channel Request Description 2 */
1220     DE_RR_CIP_MODE_SET,             /* [3]  10.5.2.9    Cipher Mode Setting         */
1221     DE_RR_CIP_MODE_RESP,            /* [3]  10.5.2.10   Cipher Response             */
1222     DE_RR_CTRL_CH_DESC,             /* [3]  10.5.2.11   Control Channel Description */
1223     DE_RR_DTM_INFO_DETAILS,         /* [3]  10.5.2.11a  DTM Information Details */
1224     DE_RR_DYN_ARFCN_MAP,            /* [3]  10.5.2.11b  Dynamic ARFCN Mapping       */
1225     DE_RR_FREQ_CH_SEQ,              /* [3]  10.5.2.12   Frequency Channel Sequence  */
1226     DE_RR_FREQ_LIST,                /* [3]  10.5.2.13   Frequency List              */
1227     DE_RR_FREQ_SHORT_LIST,          /* [3]  10.5.2.14   Frequency Short List        */
1228     DE_RR_FREQ_SHORT_LIST2,         /* [3]  10.5.2.14a  Frequency Short List 2      */
1229 /* [3]  10.5.2.14b  Group Channel Description */
1230     DE_RR_GPRS_RESUMPTION,          /* [3]  10.5.2.14c  GPRS Resumption */
1231     DE_RR_GPRS_BROADCAST_INFORMATION, /* [3]  10.5.2.14d  GPRS broadcast information */
1232 /* [3]  10.5.2.14e  Enhanced DTM CS Release Indication*/
1233
1234     DE_RR_HO_REF,                   /* 10.5.2.15  Handover Reference                */
1235
1236     DE_RR_IA_REST_OCT,              /* [3] 10.5.2.16 IA Rest Octets             */
1237     DE_RR_IAR_REST_OCT,             /* [3] 10.5.2.17 IAR Rest Octets                */
1238     DE_RR_IAX_REST_OCT,             /* [3] 10.5.2.18 IAX Rest Octets                */
1239     DE_RR_L2_PSEUDO_LEN,            /* [3] 10.5.2.19 L2 Pseudo Length               */
1240     DE_RR_MEAS_RES,                 /* [3] 10.5.2.20 Measurement Results        */
1241  /* [3] 10.5.2.20a GPRS Measurement Results */
1242     DE_RR_MOB_ALL,                  /* [3] 10.5.2.21 Mobile Allocation              */
1243     DE_RR_MOB_TIME_DIFF,            /* [3] 10.5.2.21a Mobile Time Difference        */
1244     DE_RR_MULTIRATE_CONF,           /* [3] 10.5.2.21aa MultiRate configuration      */
1245     DE_RR_MULT_ALL,                 /* [3] 10.5.2.21b Multislot Allocation          */
1246 /*
1247  * [3] 10.5.2.21c NC mode
1248  */
1249     DE_RR_NEIGH_CELL_DESC,          /* [3] 10.5.2.22 Neighbour Cell Description */
1250     DE_RR_NEIGH_CELL_DESC2,         /* [3] 10.5.2.22a Neighbour Cell Description 2  */
1251 /*
1252  * [3] 10.5.2.22b (void)
1253  * [3] 10.5.2.22c NT/N Rest Octets */
1254     DE_RR_P1_REST_OCT,              /* [3] 10.5.2.23 P1 Rest Octets */
1255     DE_RR_P2_REST_OCT,              /* [3] 10.5.2.24 P2 Rest Octets */
1256     DE_RR_P3_REST_OCT,              /* [3] 10.5.2.25 P3 Rest Octets */
1257     DE_RR_PACKET_CH_DESC,           /* [3] 10.5.2.25a Packet Channel Description    */
1258     DE_RR_DED_MOD_OR_TBF,           /* [3] 10.5.2.25b Dedicated mode or TBF         */
1259     DE_RR_PKT_UL_ASS,               /* [3] 10.5.2.25c RR Packet Uplink Assignment */
1260     DE_RR_PKT_DL_ASS,               /* [3] 10.5.2.25d RR Packet Downlink Assignment */
1261     DE_RR_PKT_DL_ASS_TYPE2,         /* [3] 10.5.2.25d RR Packet Downlink Assignment Type 2 */
1262     DE_RR_PAGE_MODE,                /* [3] 10.5.2.26 Page Mode                      */
1263     DE_RR_NCC_PERM,                 /* [3] 10.5.2.27 NCC Permitted */
1264     DE_RR_POW_CMD,                  /* 10.5.2.28  Power Command                     */
1265     DE_RR_POW_CMD_AND_ACC_TYPE,     /* 10.5.2.28a Power Command and access type     */
1266     DE_RR_RACH_CTRL_PARAM,          /* [3] 10.5.2.29 RACH Control Parameters */
1267     DE_RR_REQ_REF,                  /* [3] 10.5.2.30 Request Reference              */
1268     DE_RR_CAUSE,                    /* 10.5.2.31  RR Cause                          */
1269     DE_RR_SYNC_IND,                 /* 10.5.2.39  Synchronization Indication        */
1270     DE_RR_SI1_REST_OCT,             /* [3] 10.5.2.32 SI1 Rest Octets */
1271 /* [3] 10.5.2.33 SI 2bis Rest Octets */
1272     DE_RR_SI2TER_REST_OCT,          /* [3] 10.5.2.33a SI 2ter Rest Octets */
1273     DE_RR_SI2QUATER_REST_OCT,       /* [3] 10.5.2.33b SI 2quater Rest Octets */
1274     DE_RR_SI3_REST_OCT,             /* [3] 10.5.2.34 SI3 Rest Octets */
1275     DE_RR_SI4_REST_OCT,             /* [3] 10.5.2.35 SI4 Rest Octets */
1276     DE_RR_SI6_REST_OCT,             /* [3] 10.5.2.35a SI6 Rest Octets */
1277 /* [3] 10.5.2.36 SI 7 Rest Octets
1278  * [3] 10.5.2.37 SI 8 Rest Octets
1279  * [3] 10.5.2.37a SI 9 Rest Octets
1280  */
1281     DE_RR_SI13_REST_OCT,                /* [3] 10.5.2.37b SI13 Rest Octets */
1282 /* [3] 10.5.2.37c (void)
1283  * [3] 10.5.2.37d (void)
1284  * [3] 10.5.2.37e SI 16 Rest Octets
1285  * [3] 10.5.2.37f SI 17 Rest Octets
1286  * [3] 10.5.2.37g SI 19 Rest Octets
1287  * [3] 10.5.2.37h SI 18 Rest Octets
1288  * [3] 10.5.2.37i SI 20 Rest Octets */
1289     DE_RR_STARTING_TIME,            /* [3] 10.5.2.38 Starting Time                  */
1290     DE_RR_TIMING_ADV,               /* [3] 10.5.2.40 Timing Advance                 */
1291     DE_RR_TIME_DIFF,                /* [3] 10.5.2.41 Time Difference                */
1292     DE_RR_TLLI,                     /* [3] 10.5.2.41a TLLI                          */
1293     DE_RR_TMSI_PTMSI,               /* [3] 10.5.2.42 TMSI/P-TMSI */
1294     DE_RR_VGCS_TAR_MODE_IND,        /* [3] 10.5.2.42a VGCS target mode Indication   */
1295     DE_RR_VGCS_CIP_PAR,             /* [3] 10.5.2.42b   VGCS Ciphering Parameters   */
1296
1297     DE_RR_WAIT_IND,                 /* [3] 10.5.2.43 Wait Indication */
1298 /* [3] 10.5.2.44 SI10 rest octets $(ASCI)$ */
1299     DE_RR_EXT_MEAS_RESULT,      /* [3] 10.5.2.45 Extended Measurement Results */
1300     DE_RR_EXT_MEAS_FREQ_LIST,       /* [3] 10.5.2.46 Extended Measurement Frequency List */
1301     DE_RR_SUS_CAU,                  /* [3] 10.5.2.47 Suspension Cause               */
1302     DE_RR_APDU_ID,                  /* [3] 10.5.2.48 APDU ID */
1303     DE_RR_APDU_FLAGS,               /* [3] 10.5.2.49 APDU Flags */
1304     DE_RR_APDU_DATA,                /* [3] 10.5.2.50 APDU Data */
1305     DE_RR_HO_TO_UTRAN_CMD,          /* [3] 10.5.2.51 Handover To UTRAN Command */
1306 /* [3] 10.5.2.52 Handover To cdma2000 Command
1307  * [3] 10.5.2.53 (void)
1308  * [3] 10.5.2.54 (void)
1309  * [3] 10.5.2.55 (void)
1310  * [3] 10.5.2.56 3G Target Cell */
1311     DE_RR_SERV_SUP,                 /* 10.5.2.57 Service Support                        */
1312 /* 10.5.2.58 MBMS p-t-m Channel Description
1313  */
1314
1315     DE_RR_DED_SERV_INF,             /* [3] 10.5.2.59    Dedicated Service Information */
1316
1317 /*
1318  * 10.5.2.60 MPRACH Description
1319  * 10.5.2.61 Restriction Timer
1320  * 10.5.2.62 MBMS Session Identity
1321  * 10.5.2.63 Reduced group or broadcast call reference
1322  * 10.5.2.64 Talker Priority status
1323  * 10.5.2.65 Talker Identity
1324  * 10.5.2.66 Token
1325  * 10.5.2.67 PS Cause
1326  * 10.5.2.68 VGCS AMR Configuration
1327  */
1328     DE_RR_CARRIER_IND,              /* 10.5.2.69 Carrier Indication */
1329     DE_RR_NONE                          /* NONE */
1330 }
1331 rr_elem_idx_t;
1332
1333 typedef enum
1334 {
1335     /* 9.9.3    EPS Mobility Management (EMM) information elements */
1336     DE_EMM_ADD_UPD_RES,         /* 9.9.3.0A Additional update result */
1337     DE_EMM_ADD_UPD_TYPE,        /* 9.9.3.0B Additional update type */
1338     DE_EMM_AUTH_FAIL_PAR,       /* 9.9.3.1  Authentication failure parameter (dissected in packet-gsm_a_dtap.c)*/
1339     DE_EMM_AUTN,                /* 9.9.3.2  Authentication parameter AUTN */
1340     DE_EMM_AUTH_PAR_RAND,       /* 9.9.3.3  Authentication parameter RAND */
1341     DE_EMM_AUTH_RESP_PAR,       /* 9.9.3.4  Authentication response parameter */
1342     DE_EMM_CSFB_RESP,           /* 9.9.3.5  CSFB response */
1343     DE_EMM_DAYL_SAV_T,          /* 9.9.3.6  Daylight saving time */
1344     DE_EMM_DET_TYPE,            /* 9.9.3.7  Detach type */
1345     DE_EMM_DRX_PAR,             /* 9.9.3.8  DRX parameter (dissected in packet-gsm_a_gm.c)*/
1346     DE_EMM_CAUSE,               /* 9.9.3.9  EMM cause */
1347     DE_EMM_ATT_RES,             /* 9.9.3.10 EPS attach result (Coded inline */
1348     DE_EMM_ATT_TYPE,            /* 9.9.3.11 EPS attach type (Coded Inline)*/
1349     DE_EMM_EPS_MID,             /* 9.9.3.12 EPS mobile identity */
1350     DE_EMM_EPS_NET_FEATURE_SUP, /* 9.9.3.12A EPS network feature support */
1351     DE_EMM_EPS_UPD_RES,         /* 9.9.3.13 EPS update result ( Coded inline)*/
1352     DE_EMM_EPS_UPD_TYPE,        /* 9.9.3.14 EPS update type */
1353     DE_EMM_ESM_MSG_CONT,        /* 9.9.3.15 ESM message conta */
1354     DE_EMM_GPRS_TIMER,          /* 9.9.3.16 GPRS timer ,See subclause 10.5.7.3 in 3GPP TS 24.008 [6]. */
1355     DE_EMM_GPRS_TIMER_2,        /* 9.9.3.16A GPRS timer 2, See subclause 10.5.7.4 in 3GPP TS 24.008. */
1356     DE_EMM_GPRS_TIMER_3,        /* 9.9.3.16B GPRS timer 3, See subclause 10.5.7.4a in 3GPP TS 24.008. */
1357     DE_EMM_ID_TYPE_2,           /* 9.9.3.17 Identity type 2 ,See subclause 10.5.5.9 in 3GPP TS 24.008 [6]. */
1358     DE_EMM_IMEISV_REQ,          /* 9.9.3.18 IMEISV request ,See subclause 10.5.5.10 in 3GPP TS 24.008 [6]. */
1359     DE_EMM_KSI_AND_SEQ_NO,      /* 9.9.3.19 KSI and sequence number */
1360     DE_EMM_MS_NET_CAP,          /* 9.9.3.20 MS network capability ,See subclause 10.5.5.12 in 3GPP TS 24.008 [6]. */
1361     DE_EMM_MS_NET_FEAT_SUP,     /* 9.9.3.20A MS network feature support, See subclause 10.5.1.15 in 3GPP TS 24.008. */
1362     DE_EMM_NAS_KEY_SET_ID,      /* 9.9.3.21 NAS key set identifier (coded inline)*/
1363     DE_EMM_NAS_MSG_CONT,        /* 9.9.3.22 NAS message container */
1364     DE_EMM_NAS_SEC_ALGS,        /* 9.9.3.23 NAS security algorithms */
1365     DE_EMM_NET_NAME,            /* 9.9.3.24 Network name, See subclause 10.5.3.5a in 3GPP TS 24.008 [6]. */
1366     DE_EMM_NONCE,               /* 9.9.3.25 Nonce */
1367     DE_EMM_PAGING_ID,           /* 9.9.3.25A Paging identity */
1368     DE_EMM_P_TMSI_SIGN,         /* 9.9.3.26 P-TMSI signature, See subclause 10.5.5.8 in 3GPP TS 24.008 [6]. */
1369     DE_EMM_SERV_TYPE,           /* 9.9.3.27 Service type */
1370     DE_EMM_SHORT_MAC,           /* 9.9.3.28 Short MAC */
1371     DE_EMM_TZ,                  /* 9.9.3.29 Time zone, See subclause 10.5.3.8 in 3GPP TS 24.008 [6]. */
1372     DE_EMM_TZ_AND_T,            /* 9.9.3.30 Time zone and time, See subclause 10.5.3.9 in 3GPP TS 24.008 [6]. */
1373     DE_EMM_TMSI_STAT,           /* 9.9.3.31 TMSI status, See subclause 10.5.5.4 in 3GPP TS 24.008 [6]. */
1374     DE_EMM_TRAC_AREA_ID,        /* 9.9.3.32 Tracking area identity */
1375     DE_EMM_TRAC_AREA_ID_LST,    /* 9.9.3.33 Tracking area identity list */
1376     DE_EMM_UE_NET_CAP,          /* 9.9.3.34 UE network capability */
1377     DE_EMM_UE_RA_CAP_INF_UPD_NEED,  /* 9.9.3.35 UE radio capability information update needed */
1378     DE_EMM_UE_SEC_CAP,          /* 9.9.3.36 UE security capability */
1379     DE_EMM_EMERG_NUM_LST,       /* 9.9.3.37 Emergency Number List */
1380     DE_EMM_CLI,                 /* 9.9.3.38 CLI */
1381     DE_EMM_SS_CODE,             /* 9.9.3.39 SS Code */
1382     DE_EMM_LCS_IND,             /* 9.9.3.40 LCS indicator */
1383     DE_EMM_LCS_CLIENT_ID,       /* 9.9.3.41 LCS client identity */
1384     DE_EMM_GEN_MSG_CONT_TYPE,   /* 9.9.3.42 Generic message container type */
1385     DE_EMM_GEN_MSG_CONT,        /* 9.9.3.43 Generic message container */
1386     DE_EMM_VOICE_DMN_PREF,      /* 9.9.3.44 Voice domain preference and UE's usage setting */
1387     DE_EMM_GUTI_TYPE,           /* 9.9.3.45 GUTI type */
1388     DE_EMM_NONE                 /* NONE */
1389
1390 }
1391 nas_emm_elem_idx_t;
1392
1393 typedef enum
1394 {
1395
1396     DE_SGSAP_IMSI,                                  /* 9.4.6 IMSI*/
1397     DE_SGSAP_VLR_NAME,                              /* 9.4.22 VLR name*/
1398     DE_SGSAP_TMSI,                                  /* 9.4.20 TMSI */
1399     DE_SGSAP_LOC_AREA_ID,                           /* 9.4.11 Location area identifier */
1400     DE_SGSAP_CH_NEEDED,                             /* 9.4.23 Channel Needed */
1401     DE_SGSAP_EMLPP_PRIO,                            /* 9.4.24 eMLPP Priority*/
1402     DE_SGSAP_TMSI_STATUS,                           /* 9.4.21 TMSI status */
1403     DE_SGSAP_SGS_CAUSE,                             /* 9.4.18 SGs cause*/
1404     DE_SGSAP_MME_NAME,                              /* 9.4.13 MME name*/
1405     DE_SGSAP_EPS_LOC_UPD_TYPE,                      /* 9.4.2 EPS location update type*/
1406     DE_SGSAP_GLOBAL_CN_ID,                          /* 9.4.4 Global CN-Id*/
1407
1408     DE_SGSAP_UDEF_11,                               /* Undefined */
1409     DE_SGSAP_UDEF_12,                               /* Undefined */
1410
1411     DE_SGSAP_MID,                                   /* 9.4.14 Mobile identity*/
1412     DE_SGSAP_REJ_CAUSE,                             /* 9.4.16 Reject cause */
1413     DE_SGSAP_IMSI_DET_EPS,                          /* 9.4.7 IMSI detach from EPS service type */
1414     DE_SGSAP_IMSI_DET_NON_EPS,                      /* 9.4.8 IMSI detach from non-EPS service type */
1415
1416     DE_SGSAP_IMEISV,                                /* 9.4.5 IMEISV */
1417     DE_SGSAP_NAS_MSG_CONTAINER,                     /* 9.4.15 NAS message container*/
1418     DE_SGSAP_MM_INFO,                               /* 9.4.12 MM information*/
1419
1420     DE_SGSAP_UDEF_20,                               /* Undefined */
1421     DE_SGSAP_UDEF_21,                               /* Undefined */
1422     DE_SGSAP_UDEF_22,                               /* Undefined */
1423
1424     DE_SGSAP_ERR_MSG,                               /* 9.4.3 Erroneous message*/
1425     DE_SGSAP_CLI,                                   /* 9.4.1 CLI */
1426     DE_SGSAP_LCS_CLIENT_ID,                         /* 9.4.9 LCS client identity */
1427     DE_SGSAP_LCS_INDIC,                             /* 9.4.10 LCS indicator */
1428     DE_SGSAP_SS_CODE,                               /* 9.4.19 SS code */
1429     DE_SGSAP_SERV_INDIC,                            /* 9.4.17 Service indicator */
1430     DE_SGSAP_UE_TZ,                                 /* 9.4.21b UE Time Zone */
1431     DE_SGSAP_MSC_2,                                 /* 9.4.14a Mobile Station Classmark 2 */
1432     DE_SGSAP_TAID,                                  /* 9.4.21a Tracking Area Identity */
1433     DE_SGSAP_ECGI,                                  /* 9.4.3a E-UTRAN Cell Global Identity */
1434     DE_SGSAP_UE_EMM_MODE,                           /* 9.4.21c UE EMM mode*/
1435
1436     DE_SGAP_NONE                            /* NONE */
1437 }
1438 sgsap_elem_idx_t;
1439
1440 #endif /* __PACKET_GSM_A_COMMON_H__ */