From Pascal Quantin:
[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, guint32 offset, guint len, gchar *add_string, int string_len);
58 typedef void (*msg_fcn)(tvbuff_t *tvb, proto_tree *tree, 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, 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, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_);
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, 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, 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, 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, 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, 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, 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, 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, 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, gint pdu_type, int idx, guint32 offset);
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, 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, (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, (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, (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, (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, (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, (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, (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, (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, 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, (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, 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, 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) \
580 {\
581         if ((consumed = elem_v(tvb, tree, EMV_pdu_type, EMV_elem_idx, curr_offset)) > 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, 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, guint32 offset, guint len);
649
650 guint16 be_cell_id_aux(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len, guint8 disc);
651 guint16 be_cell_id_list(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
652 guint16 be_chan_type(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
653 guint16 be_prio(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string, int string_len);
654
655 guint16 de_lai(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
656 guint16 de_mid(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
657 guint16 de_cell_id(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
658 guint16 de_bearer_cap(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
659 guint16 de_bearer_cap_uplink(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
660 guint16 be_emlpp_prio(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
661 guint16 be_ganss_loc_type(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
662 guint16 be_ganss_pos_dta(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
663 guint16 be_ganss_ass_dta(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
664 guint16 de_plmn_list(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
665 guint16 de_ms_cm_1(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_);
666 guint16 de_ms_cm_2(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
667 guint16 de_ms_cm_3(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
668 guint16 de_serv_cat(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
669 guint16 de_sm_apn(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
670 guint16 de_sm_pco(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_);
671 guint16 de_sm_qos(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
672 guint16 de_sm_pflow_id(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
673 guint16 de_sm_tflow_temp(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
674 guint16 de_time_zone(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_);
675 guint16 de_gmm_drx_param(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
676 guint16 de_gmm_ms_net_cap(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
677 guint16 de_gmm_rai(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
678 guint16 de_gmm_ms_radio_acc_cap(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
679
680 guint16 de_rr_cause(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
681 guint16 de_rr_cell_dsc(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
682 guint16 de_rr_ch_dsc(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_);
683 guint16 de_rr_ch_mode(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
684 guint16 de_rr_chnl_needed(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_);
685 guint16 de_rr_cip_mode_set(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
686 guint16 de_rr_cm_enq_mask(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
687 guint16 de_rr_meas_res(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_);
688 guint16 de_rr_multirate_conf(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_);
689 guint16 de_rr_sus_cau(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
690 guint16 de_rr_tlli(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len);
691
692 guint16 de_rej_cause(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_);
693 guint16 de_d_gb_call_ref(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_);
694
695 guint16 de_emm_ue_net_cap(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_);
696 guint16 de_emm_trac_area_id(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_);
697
698 void dtap_rr_ho_cmd(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len);
699 void dtap_rr_cip_mode_cpte(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len);
700
701 void bssmap_perf_loc_abort(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len);
702 void bssmap_reset(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len);
703 void bssmap_conn_oriented(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len);
704
705 /*
706  * the following allows TAP code access to the messages
707  * without having to duplicate it. With MSVC and a 
708  * libwireshark.dll, we need a special declaration.
709  */
710 WS_VAR_IMPORT const value_string gsm_a_bssmap_msg_strings[];
711 WS_VAR_IMPORT const value_string gsm_a_dtap_msg_mm_strings[];
712 WS_VAR_IMPORT const value_string gsm_a_dtap_msg_rr_strings[];
713 WS_VAR_IMPORT const value_string gsm_a_dtap_msg_cc_strings[];
714 WS_VAR_IMPORT const value_string gsm_a_dtap_msg_gmm_strings[];
715 WS_VAR_IMPORT const value_string gsm_a_dtap_msg_sms_strings[];
716 WS_VAR_IMPORT const value_string gsm_a_dtap_msg_sm_strings[];
717 WS_VAR_IMPORT const value_string gsm_a_dtap_msg_ss_strings[];
718 WS_VAR_IMPORT const value_string gsm_a_dtap_msg_tp_strings[];
719 WS_VAR_IMPORT const value_string gsm_a_sacch_msg_rr_strings[];
720 WS_VAR_IMPORT const gchar *gsm_a_pd_str[];
721
722 extern const value_string gsm_a_qos_del_of_err_sdu_vals[];
723 extern const value_string gsm_a_qos_del_order_vals[];
724 extern const value_string gsm_a_qos_traffic_cls_vals[];
725 extern const value_string gsm_a_qos_ber_vals[];
726 extern const value_string gsm_a_qos_sdu_err_rat_vals[];
727 extern const value_string gsm_a_qos_traff_hdl_pri_vals[];
728
729 extern const value_string gsm_a_type_of_number_values[];
730 extern const value_string gsm_a_numbering_plan_id_values[]; 
731 extern const value_string gsm_a_sms_vals[];
732 extern value_string_ext gsm_a_rr_rxlev_vals_ext;
733 extern const value_string gsm_a_gm_type_of_ciph_alg_vals[];
734
735 typedef enum
736 {
737         /* Common Information Elements [3] 10.5.1 */
738         DE_CELL_ID,                             /* Cell Identity */
739         DE_CIPH_KEY_SEQ_NUM,    /* Ciphering Key Sequence Number */
740         DE_LAI,                                 /* Location Area Identification */
741         DE_MID,                                 /* Mobile Identity */
742         DE_MS_CM_1,                             /* Mobile Station Classmark 1 */
743         DE_MS_CM_2,                             /* Mobile Station Classmark 2 */
744         DE_MS_CM_3,                             /* Mobile Station Classmark 3 */
745         DE_SPARE_NIBBLE,                /* Spare Half Octet */
746         DE_D_GB_CALL_REF,               /* Descriptive group or broadcast call reference */
747         DE_G_CIPH_KEY_NUM,              /* Group Cipher Key Number */
748         DE_PD_SAPI,                             /* PD and SAPI $(CCBS)$ */
749         DE_PRIO,                                /* Priority Level */
750         DE_PLMN_LIST,                   /* PLMN List */
751         DE_NAS_CONT_FOR_PS_HO,  /* 10.5.1.14 NAS container for PS HO */
752
753         DE_COMMON_NONE                                                  /* NONE */
754 }
755 common_elem_idx_t;
756
757 typedef enum
758 {
759         BE_CIC,  /* Circuit Identity Code */
760         BE_RSVD_1,       /* Reserved */
761         BE_RES_AVAIL,    /* Resource Available */
762         BE_CAUSE,        /* Cause */
763         BE_CELL_ID,      /* Cell Identifier */
764         BE_PRIO,         /* Priority */
765         BE_L3_HEADER_INFO,       /* Layer 3 Header Information */
766         BE_IMSI,         /* IMSI */
767         BE_TMSI,         /* TMSI */
768         BE_ENC_INFO,     /* Encryption Information */
769         BE_CHAN_TYPE,    /* Channel Type */
770         BE_PERIODICITY,  /* Periodicity */
771         BE_EXT_RES_IND,  /* Extended Resource Indicator */
772         BE_NUM_MS,       /* Number Of MSs */
773         BE_RSVD_2,       /* Reserved */
774         BE_RSVD_3,       /* Reserved */
775         BE_RSVD_4,       /* Reserved */
776         BE_CM_INFO_2,    /* Classmark Information Type 2 */
777         BE_CM_INFO_3,    /* Classmark Information Type 3 */
778         BE_INT_BAND,     /* Interference Band To Be Used */
779         BE_RR_CAUSE,     /* RR Cause */
780         BE_RSVD_5,       /* Reserved */
781         BE_L3_INFO,      /* Layer 3 Information */
782         BE_DLCI,         /* DLCI */
783         BE_DOWN_DTX_FLAG,        /* Downlink DTX Flag */
784         BE_CELL_ID_LIST,         /* Cell Identifier List */
785         BE_RESP_REQ,     /* Response Request */
786         BE_RES_IND_METHOD,       /* Resource Indication Method */
787         BE_CM_INFO_1,    /* Classmark Information Type 1 */
788         BE_CIC_LIST,     /* Circuit Identity Code List */
789         BE_DIAG,         /* Diagnostic */
790         BE_L3_MSG,       /* Layer 3 Message Contents */
791         BE_CHOSEN_CHAN,  /* Chosen Channel */
792         BE_TOT_RES_ACC,  /* Total Resource Accessible */
793         BE_CIPH_RESP_MODE,       /* Cipher Response Mode */
794         BE_CHAN_NEEDED,  /* Channel Needed */
795         BE_TRACE_TYPE,   /* Trace Type */
796         BE_TRIGGERID,    /* TriggerID */
797         BE_TRACE_REF,    /* Trace Reference */
798         BE_TRANSID,      /* TransactionID */
799         BE_MID,  /* Mobile Identity */
800         BE_OMCID,        /* OMCID */
801         BE_FOR_IND,      /* Forward Indicator */
802         BE_CHOSEN_ENC_ALG,       /* Chosen Encryption Algorithm */
803         BE_CCT_POOL,     /* Circuit Pool */
804         BE_CCT_POOL_LIST,        /* Circuit Pool List */
805         BE_TIME_IND,     /* Time Indication */
806         BE_RES_SIT,      /* Resource Situation */
807         BE_CURR_CHAN_1,  /* Current Channel Type 1 */
808         BE_QUE_IND,      /* Queueing Indicator */
809         BE_SPEECH_VER,   /* Speech Version */
810         BE_ASS_REQ,      /* Assignment Requirement */
811         BE_TALKER_FLAG,  /* Talker Flag */
812         BE_CONN_REL_REQ,         /* Connection Release Requested */
813         BE_GROUP_CALL_REF,       /* Group Call Reference */
814         BE_EMLPP_PRIO,   /* eMLPP Priority */
815         BE_CONF_EVO_IND,         /* Configuration Evolution Indication */
816         BE_OLD2NEW_INFO,         /* Old BSS to New BSS Information */
817         BE_LSA_ID,       /* LSA Identifier */
818         BE_LSA_ID_LIST,  /* LSA Identifier List */
819         BE_LSA_INFO,     /* LSA Information */
820         BE_LCS_QOS,      /* LCS QoS */
821         BE_LSA_ACC_CTRL,         /* LSA access control suppression */
822         BE_LCS_PRIO,     /* LCS Priority */
823         BE_LOC_TYPE,     /* Location Type */
824         BE_LOC_EST,      /* Location Estimate */
825         BE_POS_DATA,     /* Positioning Data */
826         BE_LCS_CAUSE,    /* 3.2.2.66 LCS Cause */
827         BE_LCS_CLIENT,   /* 10.14 LCS Client Type */
828         BE_APDU,         /* APDU */
829         BE_NE_ID,        /* Network Element Identity */
830         BE_GPS_ASSIST_DATA,      /* GPS Assistance Data */
831         BE_DECIPH_KEYS,  /* Deciphering Keys */
832         BE_RET_ERR_REQ,  /* Return Error Request */
833         BE_RET_ERR_CAUSE,        /* Return Error Cause */
834         BE_SEG,  /* Segmentation */
835         BE_SERV_HO,     /* Service Handover */
836         BE_SRC_RNC_TO_TAR_RNC_UMTS,     /* Source RNC to target RNC transparent information (UMTS) */
837         BE_SRC_RNC_TO_TAR_RNC_CDMA,     /* Source RNC to target RNC transparent information (cdma2000) */
838         BE_GERAN_CLS_M, /* GERAN Classmark */
839         BE_GRAN_BSC_CONT,       /* GERAN BSC Container */
840         BE_NEW_BSS_TO_OLD_BSS_INF,      /* New BSS to Old BSS Information */
841         BE_INTER_SYS_INF,       /*      Inter-System Information */
842         BE_SNA_ACC_INF,         /* SNA Access Information */
843         BE_VSTK_RAND_INF,       /* VSTK_RAND Information */
844         BE_VSTK_INF,            /* VSTK Information */
845         BE_PAGING_INF,          /* Paging Information */
846         BE_IMEI,                        /* IMEI */
847         BE_VEL_EST,                     /* Velocity Estimate */
848         BE_VGCS_FEAT_FLG,       /* VGCS Feature Flags */
849         BE_TALKER_PRI,          /* Talker Priority */
850         BE_EMRG_SET_IND,        /* Emergency Set Indication */
851         BE_TALKER_ID,           /* Talker Identity */
852         BE_CELL_ID_LIST_SEG,/* Cell Identifier List Segment */
853         BE_SMS_TO_VGCS,         /* SMS to VGCS */
854         BE_VGCS_TALKER_MOD, /*  VGCS Talker Mode */
855         BE_VGS_VBS_CELL_STAT, /*        VGCS/VBS Cell Status */
856         BE_CELL_ID_LST_SEG_F_EST_CELLS, /*      Cell Identifier List Segment for established cells */
857         BE_CELL_ID_LST_SEG_F_CELL_TB_EST,       /* Cell Identifier List Segment for cells to be established */
858         BE_CELL_ID_LST_SEG_F_REL_CELL,  /* Cell Identifier List Segment for released cells - no user present */
859         BE_CELL_ID_LST_SEG_F_NOT_EST_CELL,      /* Cell Identifier List Segment for not established cells - no establishment possible */
860         BE_GANSS_ASS_DTA,       /*      GANSS Assistance Data */
861         BE_GANSS_POS_DTA,       /*      GANSS Positioning Data */
862         BE_GANSS_LOC_TYP,       /* GANSS Location Type */
863         BE_APP_DATA,            /* Application Data */
864         BE_DATA_ID,                     /* Data Identity */
865         BE_APP_DATA_INF,        /*  Application Data Information */
866         BE_MSISDN,                      /* MSISDN */
867         BE_AOIP_TRANS_LAY_ADD,  /*      AoIP Transport Layer Address */
868         BE_SPEECH_CODEC_LST,    /* Speech Codec List */
869         BE_SPEECH_CODEC,                /* Speech Codec */
870         BE_CALL_ID,                             /* Call Identifier */
871         BE_CALL_ID_LST,                 /* Call Identifier List */
872         BE_NONE /* NONE */
873 }
874 bssmap_elem_idx_t;
875
876 typedef enum
877 {
878         /* BSSMAP LE Elements */
879         DE_BMAPLE_LCSQOS,                       /* LCS QOS */
880         DE_BMAPLE_LCS_PRIO,                     /* LCS Priority */
881         DE_BMAPLE_LOC_TYPE,                     /* Location Type */
882         DE_BMAPLE_GANSS_LOC_TYPE,       /* GANSS Location Type */       
883         DE_BMAPLE_GEO_LOC,                      /* 10.9 Geographic Location */  
884         DE_BMAPLE_POS_DATA,                     /* Positioning Data */                  
885         DE_BMAPLE_GANSS_POS_DATA,       /* GANSS Positioning Data */
886         DE_BMAPLE_VELOC_DATA,           /* Velocity Data */
887         DE_BMAPLE_LCS_CAUSE,            /* LCS Cause */ 
888         DE_BMAPLE_LCS_CLIENT_TYPE,      /* LCS Client Type */
889         DE_BMAPLE_APDU,                         /* 10.3 APDU */         
890         DE_BMAPLE_NETWORK_ELEM_ID,      /* Network Element Identity */
891         DE_BMAPLE_REQ_GPS_ASSIST_D, /* 10.10 Requested GPS Assistance Data */   
892         DE_BMAPLE_REQ_GNSS_ASSIST_D,/* Requested GANSS Assistance Data */
893         DE_BMAPLE_DECIPH_KEYS,          /* 10.8 Deciphering Keys */
894         DE_BMAPLE_RETURN_ERROR_REQ,     /* Return Error Request */
895         DE_BMAPLE_RETURN_ERROR_CAUSE,   /* Return Error Cause */
896         DE_BMAPLE_SEGMENTATION,         /* Segmentation */
897         DE_BMAPLE_CLASSMARK_TYPE_3,     /* Classmark Information Type 3 */
898         DE_BMAPLE_CAUSE,                        /* 10.4 Cause */
899         DE_BMAPLE_CELL_IDENTIFIER,      /* 10.5 Cell Identifier */
900         DE_BMAPLE_CHOSEN_CHANNEL,       /* 10.6 Chosen Channel */
901         DE_BMAPLE_IMSI,                         /* 10.11 IMSI */
902         DE_BMAPLE_RES1,                         /* Reserved */
903         DE_BMAPLE_RES2,                         /* Reserved */
904         DE_BMAPLE_RES3,                         /* Reserved */
905         DE_BMAPLE_LCS_CAPABILITY,       /* LCS Capability */
906         DE_BMAPLE_PACKET_MEAS_REP,      /* Packet Measurement Report */
907         DE_BMAPLE_MEAS_CELL_ID,         /* Measured Cell Identity */
908         DE_BMAPLE_IMEI,                         /* IMEI */
909         BMAPLE_NONE                                     /* NONE */
910 }
911 bssmap_le_elem_idx_t;
912
913 typedef enum
914 {
915         /* BSS LAP Elements 5 */
916         DE_BLAP_RES1,                   /* Reserved */
917         DE_BLAP_TA,                             /* Timing Advance */
918         DE_BLAP_RES3,                   /* Reserved */                  /* (note) */
919         DE_BLAP_RES4,                   /* Cell Identity */     
920         DE_BLAP_RES5,                   /* Reserved */                  /* (note) */
921         DE_BLAP_RES6,                   /* Reserved */                  /* (note) */
922         DE_BLAP_RES7,                   /* Reserved */                  /* (note) */
923         DE_BLAP_CH_DESC,                /* Channel Description */
924         DE_BLAP_RES9,                   /* Reserved */                  /* (note) */
925         DE_BLAP_RES10,                  /* Reserved */                  /* (note) */
926         DE_BLAP_RES11,                  /* Reserved */                  /* (note) */
927         DE_BLAP_MEAS_REP,               /* Measurement Report */
928         DE_BLAP_RES13,                  /* Reserved */                  /* (note) */
929         DE_BLAP_CAUSE,                  /* Cause */
930         DE_BLAP_RRLP_FLG,               /* RRLP Flag */
931         DE_BLAP_RRLP_IE,                /* RRLP IE */
932         DE_BLAP_CELL_ID_LIST,   /* Cell Identity List */
933         DE_BLAP_ENH_MEAS_REP,   /* Enhanced Measurement Report */
934         DE_BLAP_LAC,                    /* Location Area Code */
935         DE_BLAP_FREQ_LIST,              /* Frequency List */
936         DE_BLAP_MS_POW,                 /* MS Power */
937         DE_BLAP_DELTA_TIME,             /* Delta Timer */
938         DE_BLAP_SERV_CELL_ID,   /* Serving Cell Identifier */
939         DE_BLAP_ENC_KEY,                /* Encryption Key (Kc) */
940         DE_BLAP_CIP_M_SET,              /* Cipher Mode Setting */
941         DE_BLAP_CH_MODE,                /* Channel Mode */
942         DE_BLAP_POLL_REP,               /* Polling Repetition */
943         DE_BLAP_PKT_CH_DESC,    /* Packet Channel Description */
944         DE_BLAP_TLLI,                   /* TLLI */
945         DE_BLAP_TFI,                    /* TFI */
946         DE_BLAP_START_TIME,             /* Starting Time */
947         BSSLAP_NONE                             /* NONE */
948 }
949 bsslap_elem_idx_t;
950
951 typedef enum
952 {
953         /* Mobility Management Information Elements [3] 10.5.3 */
954         DE_AUTH_PARAM_RAND,                             /* Authentication Parameter RAND */
955         DE_AUTH_PARAM_AUTN,                             /* Authentication Parameter AUTN (UMTS and EPS authentication challenge) */
956         DE_AUTH_RESP_PARAM,                             /* Authentication Response Parameter */
957         DE_AUTH_RESP_PARAM_EXT,                 /* Authentication Response Parameter (extension) (UMTS authentication challenge only) */
958         DE_AUTH_FAIL_PARAM,                             /* Authentication Failure Parameter (UMTS and EPS authentication challenge) */
959         DE_CM_SRVC_TYPE,                                /* CM Service Type */
960         DE_ID_TYPE,                                             /* Identity Type */
961         DE_LOC_UPD_TYPE,                                /* Location Updating Type */
962         DE_NETWORK_NAME,                                /* Network Name */
963         DE_REJ_CAUSE,                                   /* Reject Cause */
964         DE_FOP,                                                 /* Follow-on Proceed */
965         DE_TIME_ZONE,                                   /* Time Zone */
966         DE_TIME_ZONE_TIME,                              /* Time Zone and Time */
967         DE_CTS_PERM,                                    /* CTS Permission */
968         DE_LSA_ID,                                              /* LSA Identifier */
969         DE_DAY_SAVING_TIME,                             /* Daylight Saving Time */
970         DE_EMERGENCY_NUM_LIST,                  /* Emergency Number List */
971         /* Call Control Information Elements 10.5.4 */
972         DE_AUX_STATES,                                  /* Auxiliary States */
973         DE_BEARER_CAP,                                  /* Bearer Capability */
974         DE_CC_CAP,                                              /* Call Control Capabilities */
975         DE_CALL_STATE,                                  /* Call State */
976         DE_CLD_PARTY_BCD_NUM,                   /* Called Party BCD Number */
977         DE_CLD_PARTY_SUB_ADDR,                  /* Called Party Subaddress */
978         DE_CLG_PARTY_BCD_NUM,                   /* Calling Party BCD Number */
979         DE_CLG_PARTY_SUB_ADDR,                  /* Calling Party Subaddress */
980         DE_CAUSE,                                               /* Cause */
981         DE_CLIR_SUP,                                    /* CLIR Suppression */
982         DE_CLIR_INV,                                    /* CLIR Invocation */
983         DE_CONGESTION,                                  /* Congestion Level */
984         DE_CONN_NUM,                                    /* Connected Number */
985         DE_CONN_SUB_ADDR,                               /* Connected Subaddress */
986         DE_FACILITY,                                    /* Facility */
987         DE_HLC,                                                 /* High Layer Compatibility */
988         DE_KEYPAD_FACILITY,                             /* Keypad Facility */
989         DE_LLC,                                                 /* Low Layer Compatibility */
990         DE_MORE_DATA,                                   /* More Data */
991         DE_NOT_IND,                                             /* Notification Indicator */
992         DE_PROG_IND,                                    /* Progress Indicator */
993         DE_RECALL_TYPE,                                 /* Recall type $(CCBS)$ */
994         DE_RED_PARTY_BCD_NUM,                   /* Redirecting Party BCD Number */
995         DE_RED_PARTY_SUB_ADDR,                  /* Redirecting Party Subaddress */
996         DE_REPEAT_IND,                                  /* Repeat Indicator */
997         DE_REV_CALL_SETUP_DIR,                  /* Reverse Call Setup Direction */
998         DE_SETUP_CONTAINER,                             /* SETUP Container $(CCBS)$ */
999         DE_SIGNAL,                                              /* Signal */
1000         DE_SS_VER_IND,                                  /* SS Version Indicator */
1001         DE_USER_USER,                                   /* User-user */
1002         DE_ALERT_PATTERN,                               /* Alerting Pattern $(NIA)$ */
1003         DE_ALLOWED_ACTIONS,                             /* Allowed Actions $(CCBS)$ */
1004         DE_SI,                                                  /* Stream Identifier */
1005         DE_NET_CC_CAP,                                  /* Network Call Control Capabilities */
1006         DE_CAUSE_NO_CLI,                                /* Cause of No CLI */
1007         DE_SUP_CODEC_LIST,                              /* Supported Codec List */
1008         DE_SERV_CAT,                                    /* Service Category */
1009         DE_REDIAL,                                              /* 10.5.4.34 Redial */
1010         DE_NET_INIT_SERV_UPG,                   /* 10.5.4.35 Network-initiated Service Upgrade ind */
1011         /* Short Message Service Information Elements [5] 8.1.4 */
1012         DE_CP_USER_DATA,                                /* CP-User Data */
1013         DE_CP_CAUSE,                                    /* CP-Cause */
1014         /* Tests procedures information elements 3GPP TS 44.014 6.4.0 and 3GPP TS 34.109 6.4.0 */
1015         DE_TP_SUB_CHANNEL,                      /* Close TCH Loop Cmd Sub-channel */
1016         DE_TP_ACK,                      /* Open Loop Cmd Ack */
1017         DE_TP_LOOP_TYPE,                        /* Close Multi-slot Loop Cmd Loop type*/
1018         DE_TP_LOOP_ACK,                 /* Close Multi-slot Loop Ack Result */
1019         DE_TP_TESTED_DEVICE,                    /* Test Interface Tested device */
1020         DE_TP_PDU_DESCRIPTION,                  /* GPRS Test Mode Cmd PDU description */
1021         DE_TP_MODE_FLAG,                        /* GPRS Test Mode Cmd Mode flag */
1022         DE_TP_EGPRS_MODE_FLAG,                  /* EGPRS Start Radio Block Loopback Cmd Mode flag */
1023         DE_TP_UE_TEST_LOOP_MODE,                        /* Close UE Test Loop Mode */
1024         DE_TP_UE_POSITIONING_TECHNOLOGY,                        /* UE Positioning Technology */
1025         DE_TP_RLC_SDU_COUNTER_VALUE,                    /* RLC SDU Counter Value */
1026         DE_TP_EPC_UE_TEST_LOOP_MODE,    /* UE Test Loop Mode */
1027         DE_TP_EPC_UE_TL_A_LB_SETUP,             /* UE Test Loop Mode A LB Setup */
1028         DE_TP_EPC_UE_TL_B_LB_SETUP,             /* UE Test Loop Mode B LB Setup */
1029         DE_NONE                                                 /* NONE */
1030 }
1031 dtap_elem_idx_t;
1032
1033 typedef enum
1034 {
1035         /* GPRS Mobility Management Information Elements [3] 10.5.5 */
1036         DE_ATTACH_RES,                                  /* [7] 10.5.1 Attach Result*/
1037         DE_ATTACH_TYPE,                                 /* [7] 10.5.2 Attach Type */
1038         DE_CIPH_ALG,                                    /* [7] 10.5.3 Cipher Algorithm */
1039         DE_TMSI_STAT,                                   /* [7] 10.5.4 TMSI Status */
1040         DE_DETACH_TYPE,                                 /* [7] 10.5.5 Detach Type */
1041         DE_DRX_PARAM,                                   /* [7] 10.5.6 DRX Parameter */
1042         DE_FORCE_TO_STAND,                              /* [7] 10.5.7 Force to Standby */
1043         DE_FORCE_TO_STAND_H,                    /* [7] 10.5.8 Force to Standby - Info is in the high nibble */
1044         DE_P_TMSI_SIG,                                  /* [7] 10.5.9 P-TMSI Signature */
1045         DE_P_TMSI_SIG_2,                                /* [7] 10.5.10 P-TMSI Signature 2 */
1046         DE_ID_TYPE_2,                                   /* [7] 10.5.11 Identity Type 2 */
1047         DE_IMEISV_REQ,                                  /* [7] 10.5.12 IMEISV Request */
1048         DE_REC_N_PDU_NUM_LIST,                  /* [7] 10.5.13 Receive N-PDU Numbers List */
1049         DE_MS_NET_CAP,                                  /* [7] 10.5.14 MS Network Capability */
1050         DE_MS_RAD_ACC_CAP,                              /* [7] 10.5.15 MS Radio Access Capability */
1051         DE_GMM_CAUSE,                                   /* [7] 10.5.16 GMM Cause */
1052         DE_RAI,                                                 /* [7] 10.5.17 Routing Area Identification */
1053         DE_UPD_RES,                                             /* [7] 10.5.18 Update Result */
1054         DE_UPD_TYPE,                                    /* [7] 10.5.19 Update Type */
1055         DE_AC_REF_NUM,                                  /* [7] 10.5.20 A&C Reference Number */
1056         DE_AC_REF_NUM_H,                                /* A&C Reference Number - Info is in the high nibble */
1057         DE_SRVC_TYPE,                                   /* [7] 10.5.20 Service Type */
1058         DE_CELL_NOT,                                    /* [7] 10.5.21 Cell Notification */
1059         DE_PS_LCS_CAP,                                  /* [7] 10.5.22 PS LCS Capability */
1060         DE_NET_FEAT_SUP,                                /* [7] 10.5.23 Network Feature Support */
1061         DE_RAT_INFO_CONTAINER,                  /* [7] 10.5.24 Inter RAT information container */
1062         /* [7] 10.5.25 Requested MS information */
1063         /* Session Management Information Elements [3] 10.5.6 */
1064         DE_ACC_POINT_NAME,                              /* Access Point Name */
1065         DE_NET_SAPI,                                    /* Network Service Access Point Identifier */
1066         DE_PRO_CONF_OPT,                                /* Protocol Configuration Options */
1067         DE_PD_PRO_ADDR,                                 /* Packet Data Protocol Address */
1068         DE_QOS,                                                 /* Quality Of Service */
1069         DE_SM_CAUSE,                                    /* SM Cause */
1070         DE_SM_CAUSE_2,                                  /* SM Cause 2 */
1071         DE_LINKED_TI,                                   /* Linked TI */
1072         DE_LLC_SAPI,                                    /* LLC Service Access Point Identifier */
1073         DE_TEAR_DOWN_IND,                               /* Tear Down Indicator */
1074         DE_PACKET_FLOW_ID,                              /* Packet Flow Identifier */
1075         DE_TRAFFIC_FLOW_TEMPLATE,               /* Traffic Flow Template */
1076         DE_TMGI,                                                /* Temporary Mobile Group Identity (TMGI) */
1077         DE_MBMS_BEARER_CAP,                             /* MBMS bearer capabilities */
1078         DE_MBMS_PROT_CONF_OPT,                  /* MBMS protocol configuration options */
1079         DE_ENH_NSAPI,                                   /* Enhanced network service access point identifier */
1080         DE_REQ_TYPE,                                    /* Request type */
1081         /* GPRS Common Information Elements [8] 10.5.7 */
1082         DE_PDP_CONTEXT_STAT,                    /* [8] 10.5.7.1         PDP Context Status */
1083         DE_RAD_PRIO,                                    /* [8] 10.5.7.2         Radio Priority */
1084         DE_GPRS_TIMER,                                  /* [8] 10.5.7.3         GPRS Timer */
1085         DE_GPRS_TIMER_2,                                /* [8] 10.5.7.4         GPRS Timer 2 */
1086         DE_RAD_PRIO_2,                                  /* [8] 10.5.7.5         Radio Priority 2 */
1087         DE_MBMS_CTX_STATUS,                             /* [8] 10.5.7.6         MBMS context status */
1088         DE_GM_NONE                                                      /* NONE */
1089 }
1090 gm_elem_idx_t;
1091
1092 typedef enum
1093 {
1094         /* Radio Resource Management Information Elements 10.5.2, most are from 10.5.1  */
1095         DE_RR_BA_RANGE,                            /* [3]  10.5.2.1a    BA Range */
1096         DE_RR_CELL_CH_DSC,                         /* [3]  10.5.2.1b    Cell Channel Description        */
1097         DE_RR_BA_LIST_PREF,                        /* [3]  10.5.2.1c    BA List Pref */
1098         DE_RR_UTRAN_FREQ_LIST,             /* [3]  10.5.2.1d    UTRAN Frequency List */
1099         DE_RR_CELL_SELECT_INDIC,           /* [3]  10.5.2.1e    Cell selection indicator after release of all TCH and SDCCH IE */
1100         DE_RR_CELL_DSC,                                 /* 10.5.2.2   RR Cell Description                               */
1101         DE_RR_CELL_OPT_BCCH,                            /* [3]  10.5.2.3        Cell Options (BCCH)             */
1102         DE_RR_CELL_OPT_SACCH,                           /* [3]  10.5.2.3a       Cell Options (SACCH)            */
1103         DE_RR_CELL_SEL_PARAM,                           /* [3]  10.5.2.4        Cell Selection Parameters               */
1104 /*
1105  * [3]  10.5.2.4a       (void)
1106  */
1107         DE_RR_CH_DSC,                                   /* [3]  10.5.2.5        Channel Description                     */
1108         DE_RR_CH_DSC2,                                  /* [3]  10.5.2.5a   Channel Description 2               */
1109         DE_RR_CH_DSC3,                                  /* [3]  10.5.2.5c   Channel Description 3               */
1110         DE_RR_CH_MODE,                                  /* [3]  10.5.2.6        Channel Mode                            */
1111         DE_RR_CH_MODE2,                                 /* [3]  10.5.2.7        Channel Mode 2                          */
1112         DE_RR_UTRAN_CM,                                 /* [3]  10.5.2.7a       UTRAN Classmark */
1113 /* [3]  10.5.2.7b       (void) */
1114         DE_RR_CM_ENQ_MASK,                              /* [3]  10.5.2.7c       Classmark Enquiry Mask          */
1115 /* [3]  10.5.2.7d       GERAN Iu Mode Classmark information element                                             */
1116         DE_RR_CHNL_NEEDED,                              /* [3]  10.5.2.8        Channel Needed
1117  * [3]  10.5.2.8a       (void)
1118  * [3]  10.5.2.8b       Channel Request Description 2 */
1119         DE_RR_CIP_MODE_SET,                             /* [3]  10.5.2.9        Cipher Mode Setting                     */
1120         DE_RR_CIP_MODE_RESP,                    /* [3]  10.5.2.10       Cipher Response                  */
1121         DE_RR_CTRL_CH_DESC,                             /* [3]  10.5.2.11       Control Channel Description     */
1122 /* [3]  10.5.2.11a      DTM Information Details */
1123         DE_RR_DYN_ARFCN_MAP,                    /* [3]  10.5.2.11b      Dynamic ARFCN Mapping           */
1124         DE_RR_FREQ_CH_SEQ,                              /* [3]  10.5.2.12       Frequency Channel Sequence      */
1125         DE_RR_FREQ_LIST,                                /* [3]  10.5.2.13       Frequency List                          */
1126         DE_RR_FREQ_SHORT_LIST,                  /* [3]  10.5.2.14       Frequency Short List            */
1127         DE_RR_FREQ_SHORT_LIST2,                 /* [3]  10.5.2.14a      Frequency Short List 2          */
1128 /* [3]  10.5.2.14b      Group Channel Description */
1129         DE_RR_GPRS_RESUMPTION,                  /* [3]  10.5.2.14c      GPRS Resumption */
1130         DE_RR_GPRS_BROADCAST_INFORMATION,                       /* [3]  10.5.2.14d      GPRS broadcast information */
1131 /* [3]  10.5.2.14e      Enhanced DTM CS Release Indication*/
1132
1133         DE_RR_HO_REF,                                   /* 10.5.2.15  Handover Reference                                */
1134
1135         DE_RR_IA_REST_OCT,                              /* [3] 10.5.2.16 IA Rest Octets                         */
1136         DE_RR_IAR_REST_OCT,                             /* [3] 10.5.2.17 IAR Rest Octets                                */
1137         DE_RR_IAX_REST_OCT,                             /* [3] 10.5.2.18 IAX Rest Octets                                */
1138         DE_RR_L2_PSEUDO_LEN,                    /* [3] 10.5.2.19 L2 Pseudo Length                               */
1139         DE_RR_MEAS_RES,                                 /* [3] 10.5.2.20 Measurement Results            */
1140  /* [3] 10.5.2.20a GPRS Measurement Results */
1141         DE_RR_MOB_ALL,                                  /* [3] 10.5.2.21 Mobile Allocation                              */
1142         DE_RR_MOB_TIME_DIFF,                    /* [3] 10.5.2.21a Mobile Time Difference                */
1143         DE_RR_MULTIRATE_CONF,                   /* [3] 10.5.2.21aa MultiRate configuration              */
1144         DE_RR_MULT_ALL,                                 /* [3] 10.5.2.21b Multislot Allocation                  */
1145 /*
1146  * [3] 10.5.2.21c NC mode
1147  */
1148         DE_RR_NEIGH_CELL_DESC,                          /* [3] 10.5.2.22 Neighbour Cell Description     */
1149         DE_RR_NEIGH_CELL_DESC2,                         /* [3] 10.5.2.22a Neighbour Cell Description 2  */
1150 /*
1151  * [3] 10.5.2.22b (void)
1152  * [3] 10.5.2.22c NT/N Rest Octets */
1153         DE_RR_P1_REST_OCT,                                      /* [3] 10.5.2.23 P1 Rest Octets */
1154         DE_RR_P2_REST_OCT,                                      /* [3] 10.5.2.24 P2 Rest Octets */
1155         DE_RR_P3_REST_OCT,                                      /* [3] 10.5.2.25 P3 Rest Octets */
1156         DE_RR_PACKET_CH_DESC,                           /* [3] 10.5.2.25a Packet Channel Description    */
1157         DE_RR_DED_MOD_OR_TBF,                   /* [3] 10.5.2.25b Dedicated mode or TBF                 */
1158 /* [3] 10.5.2.25c RR Packet Uplink Assignment
1159  * [3] 10.5.2.25d RR Packet Downlink Assignment */
1160         DE_RR_PAGE_MODE,                                /* [3] 10.5.2.26 Page Mode                                              */
1161 /* [3] 10.5.2.26a (void)
1162  * [3] 10.5.2.26b (void)
1163  * [3] 10.5.2.26c (void)
1164  * [3] 10.5.2.26d (void)
1165  */
1166         DE_RR_NCC_PERM,                                 /* [3] 10.5.2.27 NCC Permitted */
1167         DE_RR_POW_CMD,                                  /* 10.5.2.28  Power Command                                             */
1168         DE_RR_POW_CMD_AND_ACC_TYPE,             /* 10.5.2.28a Power Command and access type             */
1169         DE_RR_RACH_CTRL_PARAM,                  /* [3] 10.5.2.29 RACH Control Parameters */
1170         DE_RR_REQ_REF,                                  /* [3] 10.5.2.30 Request Reference                              */
1171         DE_RR_CAUSE,                                    /* 10.5.2.31  RR Cause                                                  */
1172         DE_RR_SYNC_IND,                                 /* 10.5.2.39  Synchronization Indication                */
1173         DE_RR_SI1_REST_OCT,                             /* [3] 10.5.2.32 SI1 Rest Octets */
1174 /* [3] 10.5.2.33 SI 2bis Rest Octets */
1175         DE_RR_SI2TER_REST_OCT,                  /* [3] 10.5.2.33a SI 2ter Rest Octets */
1176         DE_RR_SI2QUATER_REST_OCT,               /* [3] 10.5.2.33b SI 2quater Rest Octets */
1177         DE_RR_SI3_REST_OCT,                             /* [3] 10.5.2.34 SI3 Rest Octets */
1178         DE_RR_SI4_REST_OCT,                             /* [3] 10.5.2.35 SI4 Rest Octets */
1179         DE_RR_SI6_REST_OCT,                             /* [3] 10.5.2.35a SI6 Rest Octets */
1180 /* [3] 10.5.2.36 SI 7 Rest Octets
1181  * [3] 10.5.2.37 SI 8 Rest Octets
1182  * [3] 10.5.2.37a SI 9 Rest Octets
1183  */
1184         DE_RR_SI13_REST_OCT,                            /* [3] 10.5.2.37b SI13 Rest Octets */
1185 /* [3] 10.5.2.37c (void)
1186  * [3] 10.5.2.37d (void)
1187  * [3] 10.5.2.37e SI 16 Rest Octets
1188  * [3] 10.5.2.37f SI 17 Rest Octets
1189  * [3] 10.5.2.37g SI 19 Rest Octets
1190  * [3] 10.5.2.37h SI 18 Rest Octets
1191  * [3] 10.5.2.37i SI 20 Rest Octets */
1192         DE_RR_STARTING_TIME,                    /* [3] 10.5.2.38 Starting Time                                  */
1193         DE_RR_TIMING_ADV,                               /* [3] 10.5.2.40 Timing Advance                                 */
1194         DE_RR_TIME_DIFF,                                /* [3] 10.5.2.41 Time Difference                                */
1195         DE_RR_TLLI,                                             /* [3] 10.5.2.41a TLLI                                                  */
1196         DE_RR_TMSI_PTMSI,                               /* [3] 10.5.2.42 TMSI/P-TMSI */
1197         DE_RR_VGCS_TAR_MODE_IND,                /* [3] 10.5.2.42a VGCS target mode Indication   */
1198         DE_RR_VGCS_CIP_PAR,                             /* [3] 10.5.2.42b       VGCS Ciphering Parameters       */
1199
1200         DE_RR_WAIT_IND,                                 /* [3] 10.5.2.43 Wait Indication */
1201 /* [3] 10.5.2.44 SI10 rest octets $(ASCI)$ */
1202         DE_RR_EXT_MEAS_RESULT,          /* [3] 10.5.2.45 Extended Measurement Results */
1203         DE_RR_EXT_MEAS_FREQ_LIST,               /* [3] 10.5.2.46 Extended Measurement Frequency List */
1204         DE_RR_SUS_CAU,                                  /* [3] 10.5.2.47 Suspension Cause                               */
1205         DE_RR_APDU_ID,                                  /* [3] 10.5.2.48 APDU ID */
1206         DE_RR_APDU_FLAGS,                               /* [3] 10.5.2.49 APDU Flags */
1207         DE_RR_APDU_DATA,                                /* [3] 10.5.2.50 APDU Data */
1208         DE_RR_HO_TO_UTRAN_CMD,                  /* [3] 10.5.2.51 Handover To UTRAN Command */
1209 /* [3] 10.5.2.52 Handover To cdma2000 Command
1210  * [3] 10.5.2.53 (void)
1211  * [3] 10.5.2.54 (void)
1212  * [3] 10.5.2.55 (void)
1213  * [3] 10.5.2.56 3G Target Cell */
1214         DE_RR_SERV_SUP,                                 /* 10.5.2.57 Service Support                                            */
1215 /* 10.5.2.58 MBMS p-t-m Channel Description
1216  */
1217
1218         DE_RR_DED_SERV_INF,                             /* [3] 10.5.2.59        Dedicated Service Information */
1219
1220 /*
1221  * 10.5.2.60 MPRACH Description
1222  * 10.5.2.61 Restriction Timer
1223  * 10.5.2.62 MBMS Session Identity
1224  * 10.5.2.63 Reduced group or broadcast call reference
1225  * 10.5.2.64 Talker Priority status
1226  * 10.5.2.65 Talker Identity
1227  * 10.5.2.66 Token
1228  * 10.5.2.67 PS Cause
1229  * 10.5.2.68 VGCS AMR Configuration
1230  */
1231         DE_RR_CARRIER_IND,                              /* 10.5.2.69 Carrier Indication */
1232         DE_RR_NONE                                                      /* NONE */
1233 }
1234 rr_elem_idx_t;
1235
1236 typedef enum
1237 {
1238     /* 9.9.3    EPS Mobility Management (EMM) information elements */
1239     DE_EMM_ADD_UPD_RES,         /* 9.9.3.0A Additional update result */
1240     DE_EMM_ADD_UPD_TYPE,        /* 9.9.3.0B Additional update type */
1241     DE_EMM_AUTH_FAIL_PAR,       /* 9.9.3.1  Authentication failure parameter (dissected in packet-gsm_a_dtap.c)*/
1242     DE_EMM_AUTN,                /* 9.9.3.2  Authentication parameter AUTN */
1243     DE_EMM_AUTH_PAR_RAND,       /* 9.9.3.3  Authentication parameter RAND */
1244     DE_EMM_AUTH_RESP_PAR,       /* 9.9.3.4  Authentication response parameter */
1245     DE_EMM_CSFB_RESP,           /* 9.9.3.5  CSFB response */
1246     DE_EMM_DAYL_SAV_T,          /* 9.9.3.6  Daylight saving time */
1247     DE_EMM_DET_TYPE,            /* 9.9.3.7  Detach type */
1248     DE_EMM_DRX_PAR,             /* 9.9.3.8  DRX parameter (dissected in packet-gsm_a_gm.c)*/
1249     DE_EMM_CAUSE,               /* 9.9.3.9  EMM cause */
1250     DE_EMM_ATT_RES,             /* 9.9.3.10 EPS attach result (Coded inline */
1251     DE_EMM_ATT_TYPE,            /* 9.9.3.11 EPS attach type (Coded Inline)*/
1252     DE_EMM_EPS_MID,             /* 9.9.3.12 EPS mobile identity */
1253     DE_EMM_EPS_NET_FEATURE_SUP, /* 9.9.3.12A EPS network feature support */
1254     DE_EMM_EPS_UPD_RES,         /* 9.9.3.13 EPS update result ( Coded inline)*/
1255     DE_EMM_EPS_UPD_TYPE,        /* 9.9.3.14 EPS update type */
1256     DE_EMM_ESM_MSG_CONT,        /* 9.9.3.15 ESM message conta */
1257     DE_EMM_GPRS_TIMER,          /* 9.9.3.16 GPRS timer ,See subclause 10.5.7.3 in 3GPP TS 24.008 [6]. */
1258     DE_EMM_ID_TYPE_2,           /* 9.9.3.17 Identity type 2 ,See subclause 10.5.5.9 in 3GPP TS 24.008 [6]. */
1259     DE_EMM_IMEISV_REQ,          /* 9.9.3.18 IMEISV request ,See subclause 10.5.5.10 in 3GPP TS 24.008 [6]. */
1260     DE_EMM_KSI_AND_SEQ_NO,      /* 9.9.3.19 KSI and sequence number */
1261     DE_EMM_MS_NET_CAP,          /* 9.9.3.20 MS network capability ,See subclause 10.5.5.12 in 3GPP TS 24.008 [6]. */
1262     DE_EMM_NAS_KEY_SET_ID,      /* 9.9.3.21 NAS key set identifier (coded inline)*/
1263     DE_EMM_NAS_MSG_CONT,        /* 9.9.3.22 NAS message container */
1264     DE_EMM_NAS_SEC_ALGS,        /* 9.9.3.23 NAS security algorithms */
1265     DE_EMM_NET_NAME,            /* 9.9.3.24 Network name, See subclause 10.5.3.5a in 3GPP TS 24.008 [6]. */
1266     DE_EMM_NONCE,               /* 9.9.3.25 Nonce */
1267     DE_EMM_PAGING_ID,           /* 9.9.3.25A Paging identity */
1268     DE_EMM_P_TMSI_SIGN,         /* 9.9.3.26 P-TMSI signature, See subclause 10.5.5.8 in 3GPP TS 24.008 [6]. */
1269     DE_EMM_SERV_TYPE,           /* 9.9.3.27 Service type */
1270     DE_EMM_SHORT_MAC,           /* 9.9.3.28 Short MAC */
1271     DE_EMM_TZ,                  /* 9.9.3.29 Time zone, See subclause 10.5.3.8 in 3GPP TS 24.008 [6]. */
1272     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]. */
1273     DE_EMM_TMSI_STAT,           /* 9.9.3.31 TMSI status, See subclause 10.5.5.4 in 3GPP TS 24.008 [6]. */
1274     DE_EMM_TRAC_AREA_ID,        /* 9.9.3.32 Tracking area identity */
1275     DE_EMM_TRAC_AREA_ID_LST,    /* 9.9.3.33 Tracking area identity list */
1276     DE_EMM_UE_NET_CAP,          /* 9.9.3.34 UE network capability */
1277     DE_EMM_UE_RA_CAP_INF_UPD_NEED,  /* 9.9.3.35 UE radio capability information update needed */
1278     DE_EMM_UE_SEC_CAP,          /* 9.9.3.36 UE security capability */
1279     DE_EMM_EMERG_NUM_LST,       /* 9.9.3.37 Emergency Number List */
1280     DE_EMM_CLI,                 /* 9.9.3.38 CLI */
1281     DE_EMM_SS_CODE,             /* 9.9.3.39 SS Code */
1282     DE_EMM_LCS_IND,             /* 9.9.3.40 LCS indicator */
1283     DE_EMM_LCS_CLIENT_ID,       /* 9.9.3.41 LCS client identity */
1284     DE_EMM_GEN_MSG_CONT_TYPE,   /* 9.9.3.42 Generic message container type */
1285     DE_EMM_GEN_MSG_CONT,        /* 9.9.3.43 Generic message container */
1286     DE_EMM_VOICE_DMN_PREF,      /* 9.9.3.44 Voice domain preference and UE's usage setting */
1287     DE_EMM_NONE                 /* NONE */
1288
1289 }
1290 nas_emm_elem_idx_t;
1291
1292 typedef enum
1293 {
1294
1295         DE_SGSAP_IMSI,                                                                  /* 9.4.6 IMSI*/
1296         DE_SGSAP_VLR_NAME,                                                              /* 9.4.22 VLR name*/
1297         DE_SGSAP_TMSI,                                                                  /* 9.4.20 TMSI */
1298         DE_SGSAP_LOC_AREA_ID,                                                   /* 9.4.11 Location area identifier */
1299         DE_SGSAP_CH_NEEDED,                                                             /* 9.4.23 Channel Needed */
1300         DE_SGSAP_EMLPP_PRIO,                                                    /* 9.4.24 eMLPP Priority*/
1301         DE_SGSAP_TMSI_STATUS,                                                   /* 9.4.21 TMSI status */
1302         DE_SGSAP_SGS_CAUSE,                                                             /* 9.4.18 SGs cause*/
1303         DE_SGSAP_MME_NAME,                                                              /* 9.4.13 MME name*/
1304         DE_SGSAP_EPS_LOC_UPD_TYPE,                                              /* 9.4.2 EPS location update type*/
1305         DE_SGSAP_GLOBAL_CN_ID,                                                  /* 9.4.4 Global CN-Id*/
1306
1307         DE_SGSAP_UDEF_12,                                                               /* Undefined */
1308         DE_SGSAP_UDEF_13,                                                               /* Undefined */
1309
1310         DE_SGSAP_MID,                                                                   /* 9.4.14 Mobile identity*/
1311         DE_SGSAP_REJ_CAUSE,                                                             /* 9.4.16 Reject cause */
1312         DE_SGSAP_IMSI_DET_EPS,                                                  /* 9.4.7 IMSI detach from EPS service type */
1313         DE_SGSAP_IMSI_DET_NON_EPS,                                              /* 9.4.8 IMSI detach from non-EPS service type */
1314
1315         DE_SGSAP_IMEISV,                                                                /* 9.4.5 IMEISV */
1316         DE_SGSAP_NAS_MSG_CONTAINER,                                             /* 9.4.15 NAS message container*/
1317         DE_SGSAP_MM_INFO,                                                               /* 9.4.12 MM information*/
1318
1319         DE_SGSAP_UDEF_24,                                                               /* Undefined */
1320         DE_SGSAP_UDEF_25,                                                               /* Undefined */
1321         DE_SGSAP_UDEF_26,                                                               /* Undefined */
1322
1323         DE_SGSAP_ERR_MSG,                                                               /* 9.4.3 Erroneous message*/
1324         DE_SGSAP_CLI,                                                                   /* 9.4.1 CLI */
1325         DE_SGSAP_LCS_CLIENT_ID,                                                 /* 9.4.9 LCS client identity */
1326         DE_SGSAP_LCS_INDIC,                                                             /* 9.4.10 LCS indicator */
1327         DE_SGSAP_SS_CODE,                                                               /* 9.4.19 SS code */
1328         DE_SGSAP_SERV_INDIC,                                                    /* 9.4.17 Service indicator */
1329         DE_SGSAP_UE_TZ,                                                                 /* 9.4.21b UE Time Zone */
1330         DE_SGSAP_MSC_2,                                                                 /* 9.4.14a Mobile Station Classmark 2 */
1331         DE_SGSAP_TAID,                                                                  /* 9.4.21a Tracking Area Identity */
1332         DE_SGSAP_ECGI,                                                                  /* 9.4.3a E-UTRAN Cell Global Identity */
1333         DE_SGSAP_UE_EMM_MODE,                                                   /* 9.4.21c UE EMM mode*/
1334
1335         DE_SGAP_NONE                                                    /* NONE */
1336 }
1337 sgsap_elem_idx_t;
1338
1339 #endif /* __PACKET_GSM_A_COMMON_H__ */