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