From Didier Gautheron:
[obnox/wireshark/wip.git] / epan / dissectors / packet-gsm_a_rr.c
1 /* packet-gsm_a_rr.c
2  * Routines for GSM A Interface (actually A-bis really) RR dissection - A.K.A. GSM layer 3 Radio Resource Protocol
3  *
4  * Copyright 2003, Michael Lum <mlum [AT] telostech.com>
5  * In association with Telos Technology Inc.
6  *
7  * Added Dissection of Radio Resource Management Information Elements
8  * and othere enhancements and fixes.
9  * Copyright 2005 - 2006, Anders Broman [AT] ericsson.com
10  *
11  * Title                3GPP                    Other
12  *
13  *   Reference [3]
14  *   Mobile radio interface Layer 3 specification;
15  *   Core network protocols;
16  *   Stage 3
17  *   (3GPP TS 24.008 version 4.7.0 Release 4)
18  *   (ETSI TS 124 008 V6.8.0 (2005-03))
19  *
20  *   Reference [4]
21  *   Mobile radio interface layer 3 specification;
22  *   Radio Resource Control Protocol
23  *   (GSM 04.18 version 8.4.1 Release 1999)
24  *   (3GPP TS 04.18 version 8.26.0 Release 1999)
25  *
26  * $Id$
27  *
28  * Wireshark - Network traffic analyzer
29  * By Gerald Combs <gerald@wireshark.org>
30  * Copyright 1998 Gerald Combs
31  *
32  * This program is free software; you can redistribute it and/or
33  * modify it under the terms of the GNU General Public License
34  * as published by the Free Software Foundation; either version 2
35  * of the License, or (at your option) any later version.
36  *
37  * This program is distributed in the hope that it will be useful,
38  * but WITHOUT ANY WARRANTY; without even the implied warranty of
39  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
40  * GNU General Public License for more details.
41  *
42  * You should have received a copy of the GNU General Public License
43  * along with this program; if not, write to the Free Software
44  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
45  */
46
47 #ifdef HAVE_CONFIG_H
48 # include "config.h"
49 #endif
50
51 #include <stdio.h>
52 #include <stdlib.h>
53
54 #include <string.h>
55
56 #include <epan/packet.h>
57 #include <epan/prefs.h>
58 #include <epan/tap.h>
59 #include <epan/asn1.h>
60
61 #include "packet-bssap.h"
62 #include "packet-sccp.h"
63 #include "packet-ber.h"
64 #include "packet-q931.h"
65 #include "packet-gsm_a_common.h"
66 #include "packet-ipv6.h"
67 #include "packet-e212.h"
68 #include "packet-ppp.h"
69
70 static dissector_handle_t rrc_irat_ho_info_handle;
71 static dissector_handle_t rrc_irat_ho_to_utran_cmd_handle;
72
73 #define PADDING_BYTE 0x2B
74
75 gboolean gsm_a_rr_is_bit_high(tvbuff_t *tvb, gint bit_offset)
76 {
77     guint8 bit_mask = 0x80 >> (bit_offset & 0x07);
78     if ((tvb_get_guint8(tvb,bit_offset >> 3) & bit_mask) != (PADDING_BYTE & bit_mask))
79         return TRUE;
80     return FALSE;
81 }
82
83 /* PROTOTYPES/FORWARDS */
84
85 const value_string gsm_a_dtap_msg_rr_strings[] = {
86     { 0x3c, "Reserved" },
87     { 0x3b, "Additional Assignment" },
88     { 0x3f, "Immediate Assignment" },
89     { 0x39, "Immediate Assignment Extended" },
90     { 0x3a, "Immediate Assignment Reject" },
91
92     { 0x48, "DTM Assignment Failure" },
93     { 0x49, "DTM Reject" },
94     { 0x4a, "DTM Request" },
95     { 0x4b, "Main DCCH Assignment Command" },
96     { 0x4c, "Packet Assignment Command" },
97
98     { 0x35, "Ciphering Mode Command" },
99     { 0x32, "Ciphering Mode Complete" },
100
101     { 0x30, "Configuration Change Command" },
102     { 0x31, "Configuration Change Ack." },
103     { 0x33, "Configuration Change Reject" },
104
105     { 0x2e, "Assignment Command" },
106     { 0x29, "Assignment Complete" },
107     { 0x2f, "Assignment Failure" },
108     { 0x2b, "Handover Command" },
109     { 0x2c, "Handover Complete" },
110     { 0x28, "Handover Failure" },
111     { 0x2d, "Physical Information" },
112     { 0x4d, "DTM Assignment Command" },
113
114     { 0x08, "RR-cell Change Order" },
115     { 0x23, "PDCH Assignment Command" },
116
117     { 0x0d, "Channel Release" },
118     { 0x0a, "Partial Release" },
119     { 0x0f, "Partial Release Complete" },
120
121     { 0x21, "Paging Request Type 1" },
122     { 0x22, "Paging Request Type 2" },
123     { 0x24, "Paging Request Type 3" },
124     { 0x27, "Paging Response" },
125     { 0x20, "Notification/NCH" },
126     { 0x25, "Reserved" },
127     { 0x26, "Notification/Response" },
128
129     { 0x0b, "Reserved" },
130
131 #if 0
132 /* ETSI TS 101 503 V8.5.0 Seems to give Other def for this Messages??? */
133     { 0xc0, "Utran Classmark Change" }, CONFLICTS WITH Handover To UTRAN Command
134     { 0xc1, "UE RAB Preconfiguration" },
135     { 0xc2, "cdma2000 Classmark Change" },
136 #endif
137
138     /* ETSI TS 101 503 V8.5.0 */
139     { 0x60, "Utran Classmark Change" },
140     { 0x62, "cdma2000 Classmark Change" },
141     { 0x63, "Inter System to UTRAN Handover Command" },
142     { 0x64, "Inter System to cdma2000 Handover Command" },
143     { 0x18, "System Information Type 8" },
144     { 0x19, "System Information Type 1" },
145     { 0x1a, "System Information Type 2" },
146     { 0x1b, "System Information Type 3" },
147     { 0x1c, "System Information Type 4" },
148     { 0x1d, "System Information Type 5" },
149     { 0x1e, "System Information Type 6" },
150     { 0x1f, "System Information Type 7" },
151
152     { 0x02, "System Information Type 2bis" },
153     { 0x03, "System Information Type 2ter" },
154     { 0x07, "System Information Type 2quater" },
155     { 0x05, "System Information Type 5bis" },
156     { 0x06, "System Information Type 5ter" },
157     { 0x04, "System Information Type 9" },
158     { 0x00, "System Information Type 13" },
159
160     { 0x3d, "System Information Type 16" },
161     { 0x3e, "System Information Type 17" },
162
163     { 0x40, "System Information Type 18" },
164     { 0x41, "System Information Type 19" },
165     { 0x42, "System Information Type 20" },
166
167     { 0x10, "Channel Mode Modify" },
168     { 0x12, "RR Status" },
169     { 0x17, "Channel Mode Modify Acknowledge" },
170     { 0x14, "Frequency Redefinition" },
171     { 0x15, "Measurement Report" },
172     { 0x16, "Classmark Change" },
173     { 0x13, "Classmark Enquiry" },
174     { 0x36, "Extended Measurement Report" },
175     { 0x37, "Extended Measurement Order" },
176     { 0x34, "GPRS Suspension Request" },
177
178     { 0x09, "VGCS Uplink Grant" },
179     { 0x0e, "Uplink Release" },
180     { 0x0c, "Reserved" },
181     { 0x2a, "Uplink Busy" },
182     { 0x11, "Talker Indication" },
183
184     { 0xc0, "UTRAN Classmark Change/Handover To UTRAN Command" }, /* spec conflict */
185
186     { 0x38, "Application Information" },
187
188     {    0, NULL }
189 };
190
191 const value_string gsm_rr_elem_strings[] = {
192     /* Radio Resource Management Information Elements 10.5.2, most are from 10.5.1 */
193     { 0x00, "BA Range" },                                                       /* [3]  10.5.2.1a BA Range */
194     { 0x00, "Cell Channel Description" },                                       /* [3]  10.5.2.1b */
195     { 0x00, "BA List Pref" },                                                   /* [3]  10.5.2.1c BA List Pref */
196     { 0x00, "UTRAN Frequency List" },                                           /* [3]  10.5.2.1d UTRAN Frequency List */
197     { 0x00, "Cell Selection Indicator after Release of all TCH and SDCCH" },    /* [3]  10.5.2.1e       Cell selection indicator after release of all TCH and SDCCH IE */
198     { 0x00, "Cell Description" },                                               /* 10.5.2.2  */
199     { 0x00, "Cell Options (BCCH)" },                                            /* [3]  10.5.2.3        Cell Options (BCCH) */
200     { 0x00, "Cell Options (SACCH)" },                                           /* [3]  10.5.2.3a       Cell Options (SACCH) */
201     { 0x00, "Cell Selection Parameters" },                                      /* [3]  10.5.2.4        Cell Selection Parameters */
202 /* [3]  10.5.2.4a       (void) */
203     { 0x00, "Channel Description" },                                            /* 10.5.2.5      */
204     { 0x00, "Channel Description 2" },                                          /* 10.5.2.5a */
205     { 0x00, "Channel Description 3" },                                          /* 10.5.2.5c */
206     { 0x00, "Channel Mode" },                                                   /* [3]  10.5.2.6 */
207     { 0x00, "Channel Mode 2" },                                                 /* [3]  10.5.2.7 */
208     { 0x00, "UTRAN Classmark" },                                                /* [3]  10.5.2.7a       */
209 /* [3]  10.5.2.7b       (void) */
210     { 0x00, "Classmark Enquiry Mask" },                                         /* [3]  10.5.2.7c */
211 /* [3]  10.5.2.7d       GERAN Iu Mode Classmark information element */
212     { 0x00, "Channel Needed"},                                                  /* [3]  10.5.2.8        */
213     /* [3]  10.5.2.8a   (void) */
214     /* [3]  10.5.2.8b   Channel Request Description 2 */
215     /* Pos 20 */
216     { 0x00, "Cipher Mode Setting" },                                            /* [3]  10.5.2.9        */
217     { 0x00, "Cipher Mode Response" },                                           /* [3]  10.5.2.10       */
218     { 0x00, "Control Channel Description" },                                    /* [3]  10.5.2.11       Control Channel Description */
219 /* [3]  10.5.2.11a      DTM Information Details */
220     { 0x00, "Dynamic ARFCN Mapping" },                                          /* [3]  10.5.2.11b      */
221     { 0x00, "Frequency Channel Sequence" },                                     /* [3]  10.5.2.12       */
222     { 0x00, "Frequency List" },                                                 /* 10.5.2.13            */
223     { 0x00, "Frequency Short List" },                                           /* 10.5.2.14            */
224     { 0x00, "Frequency Short List2" },                                          /* 10.5.2.14a           */
225 /* [3]  10.5.2.14b      Group Channel Description */
226     { 0x00, "GPRS Resumption" },                                                /* [3]  10.5.2.14c      GPRS Resumption */
227     { 0x00, "GPRS Broadcast Information" },                                     /* [3]  10.5.2.14d      GPRS broadcast information */
228 /* [3]  10.5.2.14e      Enhanced DTM CS Release Indication */
229     { 0x00, "Handover Reference" },                                             /* 10.5.2.15            */
230     { 0x00, "IA Rest Octets" },                                                 /* [3] 10.5.2.16        */
231     { 0x00, "IAR Rest Octets" },                                                /* [3] 10.5.2.17 IAR Rest Octets */
232     { 0x00, "IAX Rest Octets" },                                                /* [3] 10.5.2.18 IAX Rest Octets */
233     { 0x00, "L2 Pseudo Length" },                                               /* [3] 10.5.2.19        */
234     { 0x00, "Measurement Results" },                                            /* [3] 10.5.2.20 Measurement Results */
235 /*
236  * [3] 10.5.2.20a GPRS Measurement Results
237  */
238     { 0x00, "Mobile Allocation" },                                              /* [3] 10.5.2.21        */
239     { 0x00, "Mobile Time Difference" },                                         /* [3] 10.5.2.21a       */
240     { 0x00, "MultiRate configuration" },                                        /* [3] 10.5.2.21aa      */
241     /* Pos 30 */
242     { 0x00, "Multislot Allocation" },                                           /* [3] 10.5.2.21b       */
243     /*
244      * [3] 10.5.2.21c NC mode
245      */
246     { 0x00, "Neighbour Cell Description" },                                     /* [3] 10.5.2.22 Neighbour Cell Description */
247     { 0x00, "Neighbour Cell Description 2" },                                   /* [3] 10.5.2.22a Neighbour Cell Description 2 */
248 /*
249  * [3] 10.5.2.22b (void)
250  * [3] 10.5.2.22c NT/N Rest Octets */
251     { 0x00, "P1 Rest Octets" },                                                 /* [3] 10.5.2.23 P1 Rest Octets */
252     { 0x00, "P2 Rest Octets" },                                                 /* [3] 10.5.2.24 P2 Rest Octets */
253     { 0x00, "P3 Rest Octets" },                                                 /* [3] 10.5.2.25 P3 Rest Octets */
254     { 0x00, "Packet Channel Description" },                                     /* [3] 10.5.2.25a       */
255     { 0x00, "Dedicated mode or TBF" },                                          /* [3] 10.5.2.25b */
256     /* [3] 10.5.2.25c RR Packet Uplink Assignment
257      * [3] 10.5.2.25d RR Packet Downlink Assignment */
258     { 0x00, "Page Mode" },                                                      /* [3] 10.5.2.26  */
259 /*
260  * [3] 10.5.2.26a (void)
261  * [3] 10.5.2.26b (void)
262  * [3] 10.5.2.26c (void)
263  * [3] 10.5.2.26d (void)
264  */
265     { 0x00, "NCC Permitted" },                                                  /* [3] 10.5.2.27 NCC Permitted */
266     { 0x00, "Power Command" },                                                  /* 10.5.2.28 */
267     { 0x00, "Power Command and access type" },                                  /* 10.5.2.28a */
268     { 0x00, "RACH Control Parameters" },                                        /* [3] 10.5.2.29 RACH Control Parameters */
269     { 0x00, "Request Reference" },                                              /* [3] 10.5.2.30 Request Reference */
270     { 0x00, "RR Cause" },                                                       /* 10.5.2.31 */
271     { 0x00, "Synchronization Indication" },                                     /* 10.5.2.39 */
272     { 0x00, "SI 1 Rest Octets" },                                               /* [3] 10.5.2.32 */
273 /* [3] 10.5.2.33 SI 2bis Rest Octets */
274     { 0x00, "SI 2ter Rest Octets" },                                            /* [3] 10.5.2.33a */
275     { 0x00, "SI 2quater Rest Octets" },                                         /* [3] 10.5.2.33b */
276     { 0x00, "SI 3 Rest Octets" },                                               /* [3] 10.5.2.34 */
277     { 0x00, "SI 4 Rest Octets" },                                               /* [3] 10.5.2.35 */
278     { 0x00, "SI 6 Rest Octets" },                                               /* [3] 10.5.2.35a */
279 /* [3] 10.5.2.36 SI 7 Rest Octets
280  * [3] 10.5.2.37 SI 8 Rest Octets
281  * [3] 10.5.2.37a SI 9 Rest Octets
282  */
283     { 0x00, "SI 13 Rest Octets" },                                              /* [3] 10.5.2.37b */
284 /* [3] 10.5.2.37c (void)
285  * [3] 10.5.2.37d (void)
286  * [3] 10.5.2.37e SI 16 Rest Octets
287  * [3] 10.5.2.37f SI 17 Rest Octets
288  * [3] 10.5.2.37g SI 19 Rest Octets
289  * [3] 10.5.2.37h SI 18 Rest Octets
290  * [3] 10.5.2.37i SI 20 Rest Octets */
291     { 0x00, "Starting Time" },                                                  /* [3] 10.5.2.38 Starting Time  */
292     { 0x00, "Timing Advance" },                                                 /* [3] 10.5.2.40 Timing Advance */
293     { 0x00, "Time Difference" },                                                /* [3] 10.5.2.41 Time Difference */
294     { 0x00, "TLLI" },                                                           /* [3] 10.5.2.41a TLLI  */
295     { 0x00, "TMSI/P-TMSI" },                                                    /* [3] 10.5.2.42 TMSI/P-TMSI */
296     { 0x00, "VGCS target mode Indication" },                                    /* [3] 10.5.2.42a */
297     /* Pos 40 */
298     { 0x00, "VGCS Ciphering Parameters" },                                      /* [3] 10.5.2.42b */
299     { 0x00, "Wait Indication" },                                                /* [3] 10.5.2.43 Wait Indication */
300 /* [3] 10.5.2.44 SI10 rest octets $(ASCI)$ */
301     { 0x00, "Extended Measurement Results" },                                   /* [3] 10.5.2.45 Extended Measurement Results */
302     { 0x00, "Extended Measurement Frequency List" },                            /* [3] 10.5.2.46 Extended Measurement Frequency List */
303     { 0x00, "Suspension Cause" },                                               /* [3] 10.5.2.47                                                                */
304     { 0x00, "APDU ID" },                                                        /* [3] 10.5.2.48 APDU ID */
305     { 0x00, "APDU Flags" },                                                     /* [3] 10.5.2.49 APDU Flags */
306     { 0x00, "APDU Data" },                                                      /* [3] 10.5.2.50 APDU Data */
307     { 0x00, "Handover to UTRAN Command" },                                      /* [3] 10.5.2.51 Handover To UTRAN Command */
308 /* [3] 10.5.2.52 Handover To cdma2000 Command
309  * [3] 10.5.2.53 (void)
310  * [3] 10.5.2.54 (void)
311  * [3] 10.5.2.55 (void)
312  * [3] 10.5.2.56 3G Target Cell */
313     { 0x00, "Service Support" },                                                /* [3] 10.5.2.57        */
314     /* 10.5.2.58 MBMS p-t-m Channel Description */
315     { 0x00, "Dedicated Service Information" },                                  /* [3] 10.5.2.59        */
316 /*
317  * 10.5.2.60 MPRACH Description
318  * 10.5.2.61 Restriction Timer
319  * 10.5.2.62 MBMS Session Identity
320  * 10.5.2.63 Reduced group or broadcast call reference
321  * 10.5.2.64 Talker Priority status
322  * 10.5.2.65 Talker Identity
323  * 10.5.2.66 Token
324  * 10.5.2.67 PS Cause
325  * 10.5.2.68 VGCS AMR Configuration
326  */
327     { 0x00, "Carrier Indication" },                                             /* 10.5.2.69 Carrier Indication */
328     {    0, NULL }
329 };
330
331 const value_string gsm_rr_rest_octets_elem_strings[] = {
332     /* RR Rest Octets information elements */
333     { 0, "UTRAN FDD Description" },
334     { 0, "UTRAN TDD Description" }, 
335     { 0, "3G Measurement Parameters Description" },
336     { 0, "3G Additional Measurement Parameters Description" },
337     { 0, "Measurement Parameters Description" },
338     { 0, "GPRS Real Time Difference Description" },
339     { 0, "GPRS BSIC Description" },
340     { 0, "GPRS Report Priority Description" },
341     { 0, "GPRS Measurement Parameters Description" },
342     { 0, "NC Measurement Parameters" },
343     { 0, "SI2q Extension Information" },
344     { 0, "CCN Support Description" },
345     { 0, "3G Neighbour Cell Description" },
346     { 0, "FDD Cell Information Field" },
347     { 0, "TDD Cell Information Field" },
348     { 0, "GPRS 3G Measurement Parameters Description" },
349     { 0, "3G Additional Measurement Parameters Description 2" },
350     { 0, "Optional Selection Parameters" },
351     { 0, "GPRS Indicator" },
352     { 0, "SI4 Rest Octets_O" },
353     { 0, "SI4 Rest Octets_S" },
354     { 0, "LSA Parameters" },
355     { 0, "LSA ID Information" },
356     { 0, "PCH and NCH Info" },
357     { 0, "VBS/VGCS Options" },
358     { 0, "GPRS Mobile Allocation" },
359     { 0, "GPRS Cell Options" },
360     { 0, "GPRS Cell Options Extension Information" },
361     { 0, "GPRS Power Control Parameters" },
362     { 0, "PBCCH Description" },
363     { 0, "GSM Description" },
364     { 0, "Real Time Difference Description" },
365     { 0, "BSIC Description" },
366     { 0, "Report Priority Description" },
367     { 0, "CDMA2000 Description" },
368     { 0, "Serving cell data" },
369     { 0, "Repeated Invalid BSIC Information" },
370     { 0, "Bitmap Type Reporting" },
371     { 0, NULL }
372 };
373
374
375 /* RR cause value (octet 2) TS 44.018 6.11.0*/
376 static const value_string gsm_a_rr_RR_cause_vals[] = {
377     {    0, "Normal event"},
378     {    1, "Abnormal release, unspecified"},
379     {    2, "Abnormal release, channel unacceptable"},
380     {    3, "Abnormal release, timer expired"},
381     {    4, "Abnormal release, no activity on the radio path"},
382     {    5, "Preemptive release"},
383     {    6, "UTRAN configuration unknown"},
384     {    8, "Handover impossible, timing advance out of range"},
385     {    9, "Channel mode unacceptable"},
386     {   10, "Frequency not implemented"},
387     {   13, "Originator or talker leaving group call area"},
388     {   12, "Lower layer failure"},
389     { 0x41, "Call already cleared"},
390     { 0x5f, "Semantically incorrect message"},
391     { 0x60, "Invalid mandatory information"},
392     { 0x61, "Message type non-existent or not implemented"},
393     { 0x62, "Message type not compatible with protocol state"},
394     { 0x64, "Conditional IE error"},
395     { 0x65, "No cell allocation available"},
396     { 0x6f, "Protocol error unspecified"},
397     { 0,        NULL }
398 };
399
400 static const value_string gsm_a_algorithm_identifier_vals[] = {
401     { 0, "Cipher with algorithm A5/1"},
402     { 1, "Cipher with algorithm A5/2"},
403     { 2, "Cipher with algorithm A5/3"},
404     { 3, "Cipher with algorithm A5/4"},
405     { 4, "Cipher with algorithm A5/5"},
406     { 5, "Cipher with algorithm A5/6"},
407     { 6, "Cipher with algorithm A5/7"},
408     { 7, "Reserved"},
409     { 0, NULL }
410 };
411
412
413 #define DTAP_PD_MASK            0x0f
414 #define DTAP_SKIP_MASK          0xf0
415 #define DTAP_TI_MASK            DTAP_SKIP_MASK
416 #define DTAP_TIE_PRES_MASK      0x07                    /* after TI shifted to right */
417 #define DTAP_TIE_MASK           0x7f
418
419 #define DTAP_RR_IEI_MASK        0xff
420
421 /* Initialize the protocol and registered fields */
422 static int proto_a_ccch = -1;
423 static int proto_a_sacch = -1;
424
425 static int hf_gsm_a_dtap_msg_rr_type = -1;
426 int hf_gsm_a_rr_elem_id = -1;
427
428 static int hf_gsm_a_sacch_msg_rr_type = -1;
429
430 static int hf_gsm_a_bcc = -1;
431 static int hf_gsm_a_ncc = -1;
432 static int hf_gsm_a_bcch_arfcn = -1;
433 static int hf_gsm_a_rr_range_nb = -1;
434 static int hf_gsm_a_rr_range_lower = -1;
435 static int hf_gsm_a_rr_range_higher = -1;
436 static int hf_gsm_a_rr_ba_list_pref_length = -1;
437 static int hf_gsm_a_rr_ba_freq = -1;
438 static int hf_gsm_a_rr_utran_freq_list_length = -1;
439 static int hf_gsm_a_rr_ho_ref_val       = -1;
440 static int hf_gsm_a_rr_L2_pseudo_len = -1;
441 static int hf_gsm_a_rr_ba_used = -1;
442 static int hf_gsm_a_rr_dtx_used = -1;
443 static int hf_gsm_a_rr_3g_ba_used = -1;
444 static int hf_gsm_a_rr_meas_valid = -1;
445 static int hf_gsm_a_rr_rxlev_full_serv_cell = -1;
446 static int hf_gsm_a_rr_rxlev_sub_serv_cell = -1;
447 static int hf_gsm_a_rr_rxqual_full_serv_cell = -1;
448 static int hf_gsm_a_rr_rxqual_sub_serv_cell = -1;
449 static int hf_gsm_a_rr_no_ncell_m = -1;
450 static int hf_gsm_a_rr_rxlev_ncell = -1;
451 static int hf_gsm_a_rr_bcch_freq_ncell = -1;
452 static int hf_gsm_a_rr_bsic_ncell = -1;
453 static int hf_gsm_a_rr_mobile_time_difference = -1;
454 static int hf_gsm_a_rr_pow_cmd_atc = -1;
455 static int hf_gsm_a_rr_pow_cmd_epc = -1;
456 static int hf_gsm_a_rr_page_mode = -1;
457 static int hf_gsm_a_rr_dedicated_mode_or_tbf = -1;
458 static int hf_gsm_a_rr_pow_cmd_fpcepc = -1;
459 static int hf_gsm_a_rr_pow_cmd_powlev = -1;
460 static int hf_gsm_a_rr_sync_ind_nci = -1;
461 static int hf_gsm_a_rr_sync_ind_rot = -1;
462 static int hf_gsm_a_rr_sync_ind_si = -1;
463 static int hf_gsm_a_rr_format_id = -1;
464 static int hf_gsm_a_rr_channel_mode = -1;
465 static int hf_gsm_a_rr_channel_mode2 = -1;
466 static int hf_gsm_a_rr_sc = -1;
467 static int hf_gsm_a_algorithm_id = -1;
468 static int hf_gsm_a_rr_cr = -1;
469 static int hf_gsm_a_rr_multirate_speech_ver = -1;
470 static int hf_gsm_a_rr_NCSB = -1;
471 static int hf_gsm_a_rr_ICMI = -1;
472 static int hf_gsm_a_rr_start_mode = -1;
473 static int hf_gsm_a_rr_timing_adv = -1;
474 static int hf_gsm_a_rr_time_diff = -1;
475 static int hf_gsm_a_rr_tlli = -1;
476 static int hf_gsm_a_rr_tmsi_ptmsi = -1;
477 static int hf_gsm_a_rr_target_mode = -1;
478 static int hf_gsm_a_rr_wait_indication = -1;
479 static int hf_gsm_a_rr_seq_code = -1;
480 static int hf_gsm_a_rr_group_cipher_key_number = -1;
481 static int hf_gsm_a_rr_MBMS_multicast = -1;
482 static int hf_gsm_a_rr_MBMS_broadcast = -1;
483 static int hf_gsm_a_rr_last_segment = -1;
484 static int hf_gsm_a_rr_carrier_ind = -1;
485 static int hf_gsm_a_rr_ra = -1;
486 static int hf_gsm_a_rr_T1prim = -1;
487 static int hf_gsm_a_rr_T3 = -1;
488 static int hf_gsm_a_rr_T2 = -1;
489 static int hf_gsm_a_rr_rfn = -1;
490 static int hf_gsm_a_rr_RR_cause = -1;
491 static int hf_gsm_a_rr_cm_cng_msg_req = -1;
492 static int hf_gsm_a_rr_utran_cm_cng_msg_req = -1;
493 static int hf_gsm_a_rr_cdma200_cm_cng_msg_req = -1;
494 static int hf_gsm_a_rr_geran_iu_cm_cng_msg_req = -1;
495 int hf_gsm_a_rr_chnl_needed_ch1 = -1;
496 static int hf_gsm_a_rr_chnl_needed_ch2 = -1;
497 static int hf_gsm_a_rr_chnl_needed_ch3 = -1;
498 static int hf_gsm_a_rr_chnl_needed_ch4 = -1;
499 static int hf_gsm_a_rr_suspension_cause = -1;
500 static int hf_gsm_a_rr_apdu_id = -1;
501 static int hf_gsm_a_rr_apdu_flags = -1;
502 static int hf_gsm_a_rr_apdu_data = -1;
503 static int hf_gsm_a_rr_set_of_amr_codec_modes_v1_b8 = -1;
504 static int hf_gsm_a_rr_set_of_amr_codec_modes_v1_b7 = -1;
505 static int hf_gsm_a_rr_set_of_amr_codec_modes_v1_b6 = -1;
506 static int hf_gsm_a_rr_set_of_amr_codec_modes_v1_b5 = -1;
507 static int hf_gsm_a_rr_set_of_amr_codec_modes_v1_b4 = -1;
508 static int hf_gsm_a_rr_set_of_amr_codec_modes_v1_b3 = -1;
509 static int hf_gsm_a_rr_set_of_amr_codec_modes_v1_b2 = -1;
510 static int hf_gsm_a_rr_set_of_amr_codec_modes_v1_b1 = -1;
511 static int hf_gsm_a_rr_set_of_amr_codec_modes_v2_b5 = -1;
512 static int hf_gsm_a_rr_set_of_amr_codec_modes_v2_b4 = -1;
513 static int hf_gsm_a_rr_set_of_amr_codec_modes_v2_b3 = -1;
514 static int hf_gsm_a_rr_set_of_amr_codec_modes_v2_b2 = -1;
515 static int hf_gsm_a_rr_set_of_amr_codec_modes_v2_b1 = -1;
516 static int hf_gsm_a_rr_amr_threshold = -1;
517 static int hf_gsm_a_rr_amr_hysteresis = -1;
518 static int hf_gsm_a_rr_pwrc = -1;
519 static int hf_gsm_a_rr_dtx_bcch = -1;
520 static int hf_gsm_a_rr_dtx_sacch = -1;
521 static int hf_gsm_a_rr_radio_link_timeout = -1;
522 static int hf_gsm_a_rr_cell_reselect_hyst = -1;
523 static int hf_gsm_a_rr_ms_txpwr_max_cch = -1;
524 static int hf_gsm_a_rr_acs = -1;
525 static int hf_gsm_a_rr_neci = -1;
526 static int hf_gsm_a_rr_rxlev_access_min = -1;
527 static int hf_gsm_a_rr_mscr = -1;
528 static int hf_gsm_a_rr_att = -1;
529 static int hf_gsm_a_rr_ccch_conf = -1;
530 static int hf_gsm_a_rr_cbq3 = -1;
531 static int hf_gsm_a_rr_bs_pa_mfrms = -1;
532 static int hf_gsm_a_rr_bs_ag_blks_res = -1;
533 static int hf_gsm_a_rr_t3212 = -1;
534 static int hf_gsm_a_rr_dyn_arfcn_length = -1;
535 static int hf_gsm_a_rr_gsm_band = -1;
536 static int hf_gsm_a_rr_arfcn_first = -1;
537 static int hf_gsm_a_rr_band_offset = -1;
538 static int hf_gsm_a_rr_arfcn_range = -1;
539 static int hf_gsm_a_rr_lowest_arfcn = -1;
540 static int hf_gsm_a_rr_inc_skip_arfcn = -1;
541 static int hf_gsm_a_rr_gprs_resumption_ack = -1;
542 static int hf_gsm_a_rr_ext_ind = -1;
543 static int hf_gsm_a_rr_ba_ind = -1;
544 static int hf_gsm_a_rr_multiband_reporting = -1;
545 static int hf_gsm_a_rr_ncc_permitted = -1;
546 static int hf_gsm_a_rr_max_retrans = -1;
547 static int hf_gsm_a_rr_tx_integer = -1;
548 static int hf_gsm_a_rr_cell_barr_access = -1;
549 static int hf_gsm_a_rr_re = -1;
550 static int hf_gsm_a_rr_acc = -1;
551 static int hf_gsm_a_rr_nch_position = -1;
552 static int hf_gsm_a_rr_si2ter_mp_change_mark = -1;
553 static int hf_gsm_a_rr_si2ter_3g_change_mark = -1;
554 static int hf_gsm_a_rr_si2ter_index = -1;
555 static int hf_gsm_a_rr_si2ter_count = -1;
556 static int hf_gsm_a_rr_fdd_uarfcn = -1;
557 static int hf_gsm_a_rr_bandwidth_fdd = -1;
558 static int hf_gsm_a_rr_tdd_uarfcn = -1;
559 static int hf_gsm_a_rr_bandwidth_tdd = -1;
560 static int hf_gsm_a_rr_arfcn = -1;
561 static int hf_gsm_a_rr_bsic = -1;
562 static int hf_gsm_a_rr_qsearch_i = -1;
563 static int hf_gsm_a_rr_fdd_qoffset = -1;
564 static int hf_gsm_a_rr_fdd_qmin = -1;
565 static int hf_gsm_a_rr_tdd_qoffset = -1;
566 static int hf_gsm_a_rr_fdd_qmin_offset = -1;
567 static int hf_gsm_a_rr_fdd_rscpmin = -1;
568 static int hf_gsm_a_rr_3g_ba_ind = -1;
569 static int hf_gsm_a_rr_mp_change_mark = -1;
570 static int hf_gsm_a_rr_si2quater_index = -1;
571 static int hf_gsm_a_rr_si2quater_count = -1;
572 static int hf_gsm_a_rr_gsm_report_type = -1;
573 static int hf_gsm_a_rr_serving_band_reporting = -1;
574 static int hf_gsm_a_rr_frequency_scrolling = -1;
575 static int hf_gsm_a_rr_rep_priority = -1;
576 static int hf_gsm_a_rr_report_type = -1;
577 static int hf_gsm_a_rr_reporting_rate = -1;
578 static int hf_gsm_a_rr_invalid_bsic_reporting = -1;
579 static int hf_gsm_a_rr_scale_ord = -1;
580 static int hf_gsm_a_rr_900_reporting_offset = -1;
581 static int hf_gsm_a_rr_900_reporting_threshold = -1;
582 static int hf_gsm_a_rr_1800_reporting_offset = -1;
583 static int hf_gsm_a_rr_1800_reporting_threshold = -1;
584 static int hf_gsm_a_rr_400_reporting_offset = -1;
585 static int hf_gsm_a_rr_400_reporting_threshold = -1;
586 static int hf_gsm_a_rr_1900_reporting_offset = -1;
587 static int hf_gsm_a_rr_1900_reporting_threshold = -1;
588 static int hf_gsm_a_rr_850_reporting_offset = -1;
589 static int hf_gsm_a_rr_850_reporting_threshold = -1;
590 static int hf_gsm_a_rr_network_control_order = -1;
591 static int hf_gsm_a_rr_nc_non_drx_period = -1;
592 static int hf_gsm_a_rr_nc_reporting_period_i = -1;
593 static int hf_gsm_a_rr_nc_reporting_period_t = -1;
594 static int hf_gsm_a_rr_index_start_3g = -1;
595 static int hf_gsm_a_rr_absolute_index_start_emr = -1;
596 static int hf_gsm_a_rr_qsearch_c_initial = -1;
597 static int hf_gsm_a_rr_fdd_rep_quant = -1;
598 static int hf_gsm_a_rr_fdd_multirat_reporting = -1;
599 static int hf_gsm_a_rr_tdd_multirat_reporting = -1;
600 static int hf_gsm_a_rr_qsearch_p = -1;
601 static int hf_gsm_a_rr_3g_search_prio = -1;
602 static int hf_gsm_a_rr_fdd_reporting_offset = -1;
603 static int hf_gsm_a_rr_fdd_reporting_threshold = -1;
604 static int hf_gsm_a_rr_tdd_reporting_offset = -1;
605 static int hf_gsm_a_rr_tdd_reporting_threshold = -1;
606 static int hf_gsm_a_rr_fdd_reporting_threshold_2 = -1;
607 static int hf_gsm_a_rr_3g_ccn_active = -1;
608 static int hf_gsm_a_rr_700_reporting_offset = -1;
609 static int hf_gsm_a_rr_700_reporting_threshold = -1;
610 static int hf_gsm_a_rr_810_reporting_offset = -1;
611 static int hf_gsm_a_rr_810_reporting_threshold = -1;
612 static int hf_gsm_a_rr_cbq = -1;
613 static int hf_gsm_a_rr_cell_reselect_offset = -1;
614 static int hf_gsm_a_rr_temporary_offset = -1;
615 static int hf_gsm_a_rr_penalty_time = -1;
616 static int hf_gsm_a_rr_si13_position = -1;
617 static int hf_gsm_a_rr_power_offset = -1;
618 static int hf_gsm_a_rr_si2quater_position = -1;
619 static int hf_gsm_a_rr_si13alt_position = -1;
620 static int hf_gsm_a_rr_prio_thr = -1;
621 static int hf_gsm_a_rr_lsa_offset = -1;
622 static int hf_gsm_a_rr_paging_channel_restructuring = -1;
623 static int hf_gsm_a_rr_nln_sacch = -1;
624 static int hf_gsm_a_rr_nln_status_sacch = -1;
625 static int hf_gsm_a_rr_nln_pch = -1;
626 static int hf_gsm_a_rr_nln_status_pch = -1;
627 static int hf_gsm_a_rr_vbs_vgcs_inband_notifications = -1;
628 static int hf_gsm_a_rr_vbs_vgcs_inband_pagings = -1;
629 static int hf_gsm_a_rr_rac = -1;
630 static int hf_gsm_a_rr_max_lapdm = -1;
631 static int hf_gsm_a_rr_gprs_ms_txpwr_max_ccch = -1;
632 static int hf_gsm_a_rr_dedicated_mode_mbms_notification_support = -1;
633 static int hf_gsm_a_rr_mnci_support = -1;
634 static int hf_gsm_a_rr_amr_config = -1;
635 static int hf_gsm_a_rr_bcch_change_mark = -1;
636 static int hf_gsm_a_rr_si_change_field = -1;
637 static int hf_gsm_a_rr_si13_change_mark = -1;
638 static int hf_gsm_a_rr_hsn = -1;
639 static int hf_gsm_a_rr_rfl_number = -1;
640 static int hf_gsm_a_rr_arfcn_index = -1;
641 static int hf_gsm_a_rr_ma_length = -1;
642 static int hf_gsm_a_rr_psi1_repeat_period = -1;
643 static int hf_gsm_a_rr_pbcch_pb = -1;
644 static int hf_gsm_a_rr_pbcch_tsc = -1;
645 static int hf_gsm_a_rr_pbcch_tn = -1;
646 static int hf_gsm_a_rr_spgc_ccch_sup = -1;
647 static int hf_gsm_a_rr_priority_access_thr = -1;
648 static int hf_gsm_a_rr_nmo = -1;
649 static int hf_gsm_a_rr_t3168 = -1;
650 static int hf_gsm_a_rr_t3192 = -1;
651 static int hf_gsm_a_rr_drx_timer_max = -1;
652 static int hf_gsm_a_rr_access_burst_type = -1;
653 static int hf_gsm_a_rr_control_ack_type = -1;
654 static int hf_gsm_a_rr_bs_cv_max = -1;
655 static int hf_gsm_a_rr_pan_dec = -1;
656 static int hf_gsm_a_rr_pan_inc = -1;
657 static int hf_gsm_a_rr_pan_max = -1;
658 static int hf_gsm_a_rr_egprs_packet_channel_request = -1;
659 static int hf_gsm_a_rr_bep_period = -1;
660 static int hf_gsm_a_rr_pfc_feature_mode = -1;
661 static int hf_gsm_a_rr_dtm_support = -1;
662 static int hf_gsm_a_rr_bss_paging_coordination = -1;
663 static int hf_gsm_a_rr_ccn_active = -1;
664 static int hf_gsm_a_rr_nw_ext_utbf = -1;
665 static int hf_gsm_a_rr_multiple_tbf_capability = -1;
666 static int hf_gsm_a_rr_ext_utbf_no_data = -1;
667 static int hf_gsm_a_rr_dtm_enhancements_capability = -1;
668 static int hf_gsm_a_rr_reduced_latency_access = -1;
669 static int hf_gsm_a_rr_alpha = -1;
670 static int hf_gsm_a_rr_t_avg_w = -1;
671 static int hf_gsm_a_rr_t_avg_t = -1;
672 static int hf_gsm_a_rr_pc_meas_chan = -1;
673 static int hf_gsm_a_rr_n_avg_i = -1;
674 static int hf_gsm_a_rr_sgsnr = -1;
675 static int hf_gsm_a_rr_si_status_ind = -1;
676 static int hf_gsm_a_rr_lb_ms_txpwr_max_cch = -1;
677 static int hf_gsm_a_rr_si2n_support = -1;
678 static int hf_gsm_a_rr_mi_index = -1;
679 static int hf_gsm_a_rr_mi_count = -1;
680 static int hf_gsm_a_rr_3g_wait = -1;
681 static int hf_gsm_a_rr_qsearch_c = -1;
682 static int hf_gsm_a_rr_bsic_seen = -1;
683 static int hf_gsm_a_rr_scale = -1;
684 static int hf_gsm_a_rr_mean_bep_gmsk = -1;
685 static int hf_gsm_a_rr_mean_cv_bep = -1;
686 static int hf_gsm_a_rr_nbr_rcvd_blocks = -1;
687 static int hf_gsm_a_rr_reporting_quantity = -1;
688
689 /* Initialize the subtree pointers */
690 static gint ett_ccch_msg = -1;
691 static gint ett_ccch_oct_1 = -1;
692 static gint ett_sacch_msg = -1;
693
694 static char a_bigbuf[1024];
695
696 static dissector_handle_t data_handle;
697 static dissector_handle_t rrlp_dissector;
698
699
700 #define NUM_GSM_RR_ELEM (sizeof(gsm_rr_elem_strings)/sizeof(value_string))
701 gint ett_gsm_rr_elem[NUM_GSM_RR_ELEM];
702
703 typedef enum
704 {
705     /* RR Rest Octets information elements */
706     DE_RR_REST_OCTETS_UTRAN_FDD_DESC,
707     DE_RR_REST_OCTETS_UTRAN_TDD_DESC,
708     DE_RR_REST_OCTETS_3G_MEAS_PARAM_DESC,
709     DE_RR_REST_OCTETS_3G_ADD_MEAS_PARAM_DESC,
710     DE_RR_REST_OCTETS_MEAS_PARAM_DESC,
711     DE_RR_REST_OCTETS_GPRS_RTD_DESC,
712     DE_RR_REST_OCTETS_GPRS_BSIC_DESC,
713     DE_RR_REST_OCTETS_GPRS_REPORT_PRIO_DESC,
714     DE_RR_REST_OCTETS_GPRS_MEAS_PARAM_DESC,
715     DE_RR_REST_OCTETS_NC_MEAS_PARAM,
716     DE_RR_REST_OCTETS_SI2Q_EXT_INFO,
717     DE_RR_REST_OCTETS_CCN_SUPPORT_DESC,
718     DE_RR_REST_OCTETS_3G_NEIGH_CELL_DESC,
719     DE_RR_REST_OCTETS_FDD_CELL_INFORMATION_FIELD,
720     DE_RR_REST_OCTETS_TDD_CELL_INFORMATION_FIELD,
721     DE_RR_REST_OCTETS_GPRS_3G_MEAS_PARAM_DESC,
722     DE_RR_REST_OCTETS_3G_ADD_MEAS_PARAM_DESC2,
723     DE_RR_REST_OCTETS_OPTIONAL_SEL_PARAM,
724     DE_RR_REST_OCTETS_GPRS_INDICATOR,
725     DE_RR_REST_OCTETS_SI4_REST_OCTETS_O,
726     DE_RR_REST_OCTETS_SI4_REST_OCTETS_S,
727     DE_RR_REST_OCTETS_LSA_PARAMETERS,
728     DE_RR_REST_OCTETS_LSA_ID_INFO,
729     DE_RR_REST_OCTETS_PCH_AND_NCH_INFO,
730     DE_RR_REST_OCTETS_VBS_VGCS_OPTIONS,
731     DE_RR_REST_OCTETS_GPRS_MOBILE_ALLOC,
732     DE_RR_REST_OCTETS_GPRS_CELL_OPTIONS,
733     DE_RR_REST_OCTETS_GPRS_CELL_OPTIONS_EXT_INFO,
734     DE_RR_REST_OCTETS_GPRS_POWER_CONTROL_PARAMS,
735     DE_RR_REST_OCTETS_PBCCH_DESC,
736     DE_RR_REST_OCTETS_GSM_DESC,
737     DE_RR_REST_OCTETS_RTD_DESC,
738     DE_RR_REST_OCTETS_BSIC_DESC,
739     DE_RR_REST_OCTETS_REPORT_PRIO_DESC,
740     DE_RR_REST_OCTETS_CDMA2000_DESC,
741     DE_RR_REST_OCTETS_SERVING_CELL_DATA,
742     DE_RR_REST_OCTETS_REPEAT_INV_BSIC_INFO,
743     DE_RR_REST_OCTETS_BITMAP_TYPE_REPORTING,
744     DE_RR_REST_OCTETS_NONE
745 }
746 rr_rest_octets_elem_idx_t;
747
748 #define NUM_GSM_RR_REST_OCTETS_ELEM (sizeof(gsm_rr_rest_octets_elem_strings)/sizeof(value_string))
749 gint ett_gsm_rr_rest_octets_elem[NUM_GSM_RR_REST_OCTETS_ELEM];
750
751 /*
752 10.5.2 Radio Resource management information elements
753  * [3] 10.5.2.1a BA Range
754  */
755 guint16
756 de_rr_ba_range(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
757 {
758     guint32 curr_offset;
759     gint bit_offset;
760     guint8 value;
761
762     curr_offset = offset;
763     proto_tree_add_item(tree, hf_gsm_a_rr_range_nb, tvb, curr_offset, 1, FALSE);
764     value = tvb_get_guint8(tvb, curr_offset);
765     curr_offset += 1;
766     bit_offset = curr_offset << 3;
767     while (value)
768     {
769         proto_tree_add_bits_item(tree, hf_gsm_a_rr_range_lower, tvb, bit_offset, 10, FALSE);
770         bit_offset += 10;
771         proto_tree_add_bits_item(tree, hf_gsm_a_rr_range_higher, tvb, bit_offset, 10, FALSE);
772         bit_offset += 10;
773         value -= 1;
774     }
775
776     curr_offset += len - 1;
777     return (curr_offset - offset);
778 }
779
780 /*
781  * [3] 10.5.2.1b Cell Channel Description
782  */
783
784 #define ARFCN_MAX 1024 /* total number of ARFCNs defined */
785
786 static void display_channel_list(guint8 *list, tvbuff_t *tvb, proto_tree *tree, guint32 offset)
787 {
788     int arfcn;
789     proto_item *ti=NULL;
790
791     ti = proto_tree_add_text(tree, tvb, 0, offset, "List of ARFCNs =");
792     for (arfcn=0; arfcn<ARFCN_MAX; arfcn++) {
793         if (list[arfcn])
794             proto_item_append_text(ti, " %d", arfcn);
795     }
796
797     return;
798 }
799
800 static gint greatest_power_of_2_lesser_or_equal_to(gint index)
801 {
802     gint j = 1;
803     do {
804         j<<=1;
805     } while (j<=index);
806     j >>= 1;
807     return j;
808 }
809
810 static gint f_k(gint k, gint *w, gint range)
811 {
812     gint index, n, j;
813
814     index = k;
815     range -= 1;
816     range = range/greatest_power_of_2_lesser_or_equal_to(index);
817     n = w[index]-1;
818
819     while (index>1) {
820         j = greatest_power_of_2_lesser_or_equal_to(index);
821         range = 2*range+1;
822         if ((2*index) < 3*j){ /* left child */
823             index -= j/2;
824             n = (n+w[index]-1+((range-1)/2)+1)%range;
825         }
826         else { /* right child */
827             index -= j;
828             n = (n+w[index]-1+1)%range;
829         }
830     }
831
832     return (n+1)%1024;
833 }
834
835 static void dissect_channel_list_n_range(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gint range)
836 {
837     gint curr_offset=offset, f0, arfcn_orig, bits, w[64], wsize, i, wi;
838     gint octet, nwi=1, jwi=0, wbits, imax, iused, arfcn;
839     guint8 list[1024];
840
841     memset((void*)list,0,sizeof(list));
842
843     octet = tvb_get_guint8(tvb, curr_offset++);
844     if (range==1024) {
845         f0 = (octet>>2)&1;
846         if (f0)
847             list[0] = 1;
848         bits = 2;
849         arfcn_orig = 0;
850         wsize = 10;
851         imax = 16;
852     }
853     else {
854         arfcn_orig = (octet&1);
855         arfcn_orig = (arfcn_orig << 8) + tvb_get_guint8(tvb, curr_offset++);
856         octet = tvb_get_guint8(tvb, curr_offset++);
857         arfcn_orig = (arfcn_orig << 1) + (octet>>7);
858         list[arfcn_orig] = 1;
859         bits = 7;
860         switch (range) {
861         case 512:
862             wsize=9;
863             imax = 17;
864             break;
865         case 256:
866             wsize=8;
867             imax = 21;
868             break;
869         case 128:
870             wsize=7;
871             imax = 28;
872             break;
873         default:
874             wsize=0;
875             imax = 0;
876             DISSECTOR_ASSERT_NOT_REACHED();
877         }
878     }
879     iused = imax;   /* in case the list is actually full */
880
881     /* extract the variable size w[] elements */
882     for (i=1; i<=imax; i++) {
883         wi = octet & ~(0xff<<bits);      /* mask "bits" low bits to start wi from existing octet */
884         wbits = bits;
885         if (wsize>wbits) {               /* need to extract more bits from the next octet */
886             octet = tvb_get_guint8(tvb, curr_offset++);
887             wi = (wi << 8) + octet;
888             bits = 8;
889             wbits += 8;
890         }
891
892         if (wbits>wsize) {      /* now we have too many bits - save some */
893             bits = wbits - wsize;
894             wi >>= bits;
895         }
896         else                    /* just right number of bits */
897             bits = 0;
898
899         w[i] = wi;
900         if ((w[i]==0) || ((curr_offset-offset)>len)) {
901             iused = i - 1;
902             break;        /* all remaining elements must also be zero */
903         }
904
905         if (++jwi==nwi) {       /* check if the number of wi at this wsize has been extracted */
906             jwi = 0;            /* reset the count of wi at this size */
907             nwi <<= 1;          /* get twice as many of the next size */
908             wsize--;            /* make the next size 1 bit smaller */
909         }
910     }
911
912     for (i=1; i<=iused; i++) {
913         arfcn = (f_k(i, w, range) + arfcn_orig)%1024;
914         list[arfcn] = 1;
915     }
916
917     display_channel_list(list, tvb, tree, offset);
918
919     return;
920 }
921
922 static guint16
923 dissect_arfcn_list(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
924 {
925     guint32     curr_offset;
926     guint8  oct,bit,byte;
927     guint16 arfcn;
928     proto_item  *item;
929
930     curr_offset = offset;
931
932     oct = tvb_get_guint8(tvb, curr_offset);
933
934     /* FORMAT-ID, Format Identifier (part of octet 3)*/
935     proto_tree_add_item(tree, hf_gsm_a_rr_format_id, tvb, curr_offset, 1, FALSE);
936
937     if ((oct & 0xc0) == 0x00)
938     {
939         /* bit map 0 */
940         item = proto_tree_add_text(tree,tvb, curr_offset, len, "List of ARFCNs =");
941         bit = 4;
942         arfcn = 125;
943         for (byte = 0;byte <= len-1;byte++)
944         {
945             oct = tvb_get_guint8(tvb, curr_offset);
946             while (bit-- != 0)
947             {
948                 arfcn--;
949                 if (((oct >> bit) & 1) == 1)
950                 {
951                     proto_item_append_text(item," %d",arfcn);
952                 }
953             }
954             bit = 8;
955             curr_offset++;
956         }
957     }
958     else if ((oct & 0xc8) == 0x80)
959     {
960         /* 1024 range */
961         dissect_channel_list_n_range(tvb, tree, curr_offset, len, 1024);
962         curr_offset = curr_offset + len;
963     }
964     else if ((oct & 0xce) == 0x88)
965     {
966         /* 512 range */
967         dissect_channel_list_n_range(tvb, tree, curr_offset, len, 512);
968         curr_offset = curr_offset + len;
969     }
970     else if ((oct & 0xce) == 0x8a)
971     {
972         /* 256 range */
973         dissect_channel_list_n_range(tvb, tree, curr_offset, len, 256);
974         curr_offset = curr_offset + len;
975     }
976     else if ((oct & 0xce) == 0x8c)
977     {
978         /* 128 range */
979         dissect_channel_list_n_range(tvb, tree, curr_offset, len, 128);
980         curr_offset = curr_offset + len;
981     }
982     else if ((oct & 0xce) == 0x8e)
983     {
984         /* variable bit map */
985         arfcn = ((oct & 0x01) << 9) | (tvb_get_guint8(tvb, curr_offset+1) << 1) | ((tvb_get_guint8(tvb, curr_offset + 2) & 0x80) >> 7);
986         item = proto_tree_add_text(tree,tvb,curr_offset,len,"List of ARFCNs = %d",arfcn);
987         curr_offset = curr_offset + 2;
988         bit = 7;
989         for (byte = 0;byte <= len-3;byte++)
990         {
991             oct = tvb_get_guint8(tvb, curr_offset);
992             while (bit-- != 0)
993             {
994                 arfcn++;
995                 if (((oct >> bit) & 1) == 1)
996                 {
997                     proto_item_append_text(item," %d",arfcn);
998                 }
999             }
1000             bit = 8;
1001             curr_offset++;
1002         }
1003     }
1004
1005     return(curr_offset - offset);
1006 }
1007
1008 guint16
1009 de_rr_cell_ch_dsc(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1010 {
1011     return dissect_arfcn_list(tvb, tree, offset, 16, add_string, string_len);
1012 }
1013 /*
1014  * [3] 10.5.2.1c BA List Pref
1015  */
1016 guint16
1017 de_rr_ba_list_pref(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
1018 {
1019     guint32 curr_offset;
1020     gint bit_offset;
1021     guint8 value;
1022
1023     curr_offset = offset;
1024         proto_tree_add_item(tree, hf_gsm_a_rr_ba_list_pref_length, tvb, curr_offset, 1, FALSE);
1025     bit_offset = curr_offset << 3;
1026     value = tvb_get_bits8(tvb,bit_offset,1);
1027     bit_offset += 1;
1028     while (value)
1029     {
1030         proto_tree_add_bits_item(tree, hf_gsm_a_rr_range_lower, tvb, bit_offset, 10, FALSE);
1031         bit_offset += 10;
1032         proto_tree_add_bits_item(tree, hf_gsm_a_rr_range_higher, tvb, bit_offset, 10, FALSE);
1033         bit_offset += 10;
1034         value = tvb_get_bits8(tvb,bit_offset,1);
1035         bit_offset += 1;
1036     }
1037     value = tvb_get_bits8(tvb,bit_offset,1);
1038     bit_offset += 1;
1039     while (value)
1040     {
1041         proto_tree_add_bits_item(tree, hf_gsm_a_rr_ba_freq, tvb, bit_offset, 10, FALSE);
1042         bit_offset += 10;
1043         value = tvb_get_bits8(tvb,bit_offset,1);
1044         bit_offset += 1;
1045     }
1046
1047     curr_offset += len;
1048     return (curr_offset - offset);
1049 }
1050
1051 /*
1052  * [3] 10.5.2.1d UTRAN Frequency List
1053  */
1054 guint16
1055 de_rr_utran_freq_list(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
1056 {
1057     guint32 curr_offset;
1058     gint bit_offset;
1059     guint8 value;
1060
1061     curr_offset = offset;
1062         proto_tree_add_item(tree, hf_gsm_a_rr_utran_freq_list_length, tvb, curr_offset, 1, FALSE);
1063     bit_offset = curr_offset << 3;
1064     value = tvb_get_bits8(tvb,bit_offset,1);
1065     bit_offset += 1;
1066     while (value)
1067     {
1068         proto_tree_add_bits_item(tree, hf_gsm_a_rr_fdd_uarfcn, tvb, bit_offset, 14, FALSE);
1069         bit_offset += 14;
1070         value = tvb_get_bits8(tvb,bit_offset,1);
1071         bit_offset += 1;
1072     }
1073     value = tvb_get_bits8(tvb,bit_offset,1);
1074     bit_offset += 1;
1075     while (value)
1076     {
1077         proto_tree_add_bits_item(tree, hf_gsm_a_rr_tdd_uarfcn, tvb, bit_offset, 14, FALSE);
1078         bit_offset += 14;
1079         value = tvb_get_bits8(tvb,bit_offset,1);
1080         bit_offset += 1;
1081     }
1082
1083     curr_offset += len;
1084     return (curr_offset - offset);
1085 }
1086
1087 /*
1088  * [3] 10.5.2.1e Cell selection indicator after release of all TCH and SDCCH
1089  */
1090 static const guint8
1091 convert_n_to_p[32] = {   0, 10, 19, 28, 26, 44, 52, 60, 67, 74, 81, 88, 95, 102, 109, 116,
1092                        122,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,   0,   0,   0};
1093
1094 static const guint8
1095 convert_n_to_q[32] = {   0,   9,  17,  25,  32, 39, 46, 53, 59, 65, 71, 77, 83, 89, 95, 101,
1096                        106, 111, 116, 121, 126,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,   0};
1097
1098 guint16
1099 de_rr_cell_select_indic(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1100 {
1101     proto_tree *subtree, *subtree2;
1102     proto_item *item, *item2;
1103     guint32 curr_offset;
1104     gint bit_offset, bit_offset_sav, idx, xdd_cell_info, wsize, nwi, jwi, w[64], i, iused, xdd_indic0;
1105     guint8 value, length;
1106
1107     curr_offset = offset;
1108     length = tvb_get_guint8(tvb, curr_offset);
1109     curr_offset += 1;
1110     bit_offset = curr_offset << 3;
1111     value = tvb_get_bits8(tvb,bit_offset,3);
1112     bit_offset += 3;
1113     switch (value)
1114     {
1115     case 0: /* GSM Description */
1116         bit_offset_sav = bit_offset;
1117         item = proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "%s",
1118                                    gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_GSM_DESC].strptr);
1119         subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_GSM_DESC]);
1120         value = tvb_get_bits8(tvb,bit_offset,1);
1121         bit_offset += 1;
1122         while (value)
1123         {
1124             proto_tree_add_text(subtree,tvb, bit_offset>>3, 1, "Band Indicator: %s",tvb_get_bits8(tvb,bit_offset,1) ? "1900" : "1800");
1125             bit_offset += 1;
1126             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_arfcn, tvb, bit_offset, 10, FALSE);
1127             bit_offset += 10;
1128             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_bsic, tvb, bit_offset, 6, FALSE);
1129             bit_offset += 6;
1130             value = tvb_get_bits8(tvb,bit_offset,1);
1131             bit_offset += 1;
1132         }
1133         proto_item_set_len(item,((bit_offset-bit_offset_sav)>>3)+1);
1134         break;
1135     case 1: /* UTRAN FDD Description */
1136         bit_offset_sav = bit_offset;
1137         item = proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "%s", 
1138                                    gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_UTRAN_FDD_DESC].strptr);
1139         subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_UTRAN_FDD_DESC]);
1140         value = tvb_get_bits8(tvb,bit_offset,1);
1141         bit_offset += 1;
1142         while (value)
1143         {
1144             if (tvb_get_bits8(tvb,bit_offset,1))
1145             {
1146                 bit_offset += 1;
1147                 proto_tree_add_bits_item(subtree, hf_gsm_a_rr_bandwidth_fdd, tvb, bit_offset, 3, FALSE);
1148                 bit_offset += 3;
1149             }
1150             else
1151                 bit_offset += 1;
1152             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_fdd_uarfcn, tvb, bit_offset, 14, FALSE);
1153             bit_offset += 14;
1154             if (tvb_get_bits8(tvb,bit_offset,1))
1155             {
1156                 bit_offset += 1;
1157                 xdd_indic0 = tvb_get_bits8(tvb,bit_offset,1);
1158                 proto_tree_add_text(subtree,tvb, bit_offset>>3, 1, "FDD Indic0: %d", xdd_indic0);
1159                 bit_offset += 1;
1160                 idx = tvb_get_bits8(tvb,bit_offset,5);
1161                 proto_tree_add_text(subtree,tvb, bit_offset>>3, 1, "Nr of FDD Cells : %d", idx);
1162                 bit_offset += 5;
1163                 idx = convert_n_to_p[idx];
1164                 item2 = proto_tree_add_text(subtree,tvb, bit_offset>>3, (idx>>3)+1, "%s",
1165                                             gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_UTRAN_FDD_DESC].strptr);
1166                 subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_FDD_CELL_INFORMATION_FIELD]);
1167                 proto_tree_add_text(subtree2,tvb, bit_offset>>3, (idx>>3)+1, "Field is %d bits long", idx);
1168                 if (xdd_indic0)
1169                 {
1170                     proto_tree_add_text(subtree2,tvb, bit_offset>>3, 0, "Scrambling Code: %d", 0);
1171                     proto_tree_add_text(subtree2,tvb, bit_offset>>3, 0, "Diversity: %d", 0);
1172                 }
1173                 if (idx)
1174                 {
1175                     wsize = 10;
1176                     nwi = 1;
1177                     jwi = 0;
1178                     i = 1;
1179    
1180                     while (idx > 0)
1181                     {
1182                         w[i] = tvb_get_bits16(tvb, bit_offset, wsize, FALSE);
1183                         bit_offset += wsize;
1184                         idx -= wsize;
1185                         if (w[i] == 0)
1186                         {
1187                             idx = 0;
1188                             break;
1189                         }
1190                         if (++jwi==nwi)
1191                         {
1192                             jwi = 0;
1193                             nwi <<= 1;
1194                             wsize--;
1195                         }
1196                         i++;
1197                     }
1198                     if (idx < 0)
1199                     {
1200                         bit_offset += idx;
1201                     }
1202                     iused = i-1;
1203    
1204                     for (i=1; i <= iused; i++)
1205                     {
1206                         xdd_cell_info = f_k(i, w, 1024);
1207                         proto_tree_add_text(subtree2,tvb, bit_offset>>3, 0, 
1208                                             "Scrambling Code: %d", xdd_cell_info & 0x01FF);
1209                         proto_tree_add_text(subtree2,tvb, bit_offset>>3, 0, 
1210                                             "Diversity: %d", (xdd_cell_info >> 9) & 0x01);
1211                     }
1212                 }
1213             }
1214             else
1215                 bit_offset += 1;
1216             value = tvb_get_bits8(tvb,bit_offset,1);
1217             bit_offset += 1;
1218         }
1219         proto_item_set_len(item,((bit_offset-bit_offset_sav)>>3)+1);
1220         break;
1221     case 2: /* UTRAN TDD Description */
1222         bit_offset_sav = bit_offset;
1223         item = proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_UTRAN_TDD_DESC].strptr);
1224         subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_UTRAN_TDD_DESC]);
1225         value = tvb_get_bits8(tvb,bit_offset,1);
1226         bit_offset += 1;
1227         while (value)
1228         {
1229             if (tvb_get_bits8(tvb,bit_offset,1))
1230             {
1231                 bit_offset += 1;
1232                 proto_tree_add_bits_item(subtree, hf_gsm_a_rr_bandwidth_tdd, tvb, bit_offset, 3, FALSE);
1233                 bit_offset += 3;
1234             }
1235             else
1236                 bit_offset += 1;
1237             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_tdd_uarfcn, tvb, bit_offset, 14, FALSE);
1238             bit_offset += 14;
1239             if (tvb_get_bits8(tvb,bit_offset,1))
1240             {
1241                 bit_offset += 1;
1242                 xdd_indic0 = tvb_get_bits8(tvb,bit_offset,1);
1243                 proto_tree_add_text(subtree,tvb, bit_offset>>3, 1, "TDD Indic0: %d", xdd_indic0);
1244                 bit_offset += 1;
1245                 idx = tvb_get_bits8(tvb,bit_offset,5);
1246                 proto_tree_add_text(subtree,tvb, bit_offset>>3, 1, "Nr of TDD Cells : %d", idx);
1247                 bit_offset += 5;
1248                 idx = convert_n_to_q[idx];
1249                 item2 = proto_tree_add_text(subtree,tvb, bit_offset>>3, (idx>>3)+1, "%s", 
1250                                             gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_UTRAN_TDD_DESC].strptr);
1251                 subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_TDD_CELL_INFORMATION_FIELD]);
1252                 proto_tree_add_text(subtree2,tvb, bit_offset>>3, (idx>>3)+1, "Field is %d bits long", idx);
1253                 if (xdd_indic0)
1254                 {
1255                     proto_tree_add_text(subtree2,tvb, bit_offset>>3, 0, "Cell Parameter: %d", 0);
1256                     proto_tree_add_text(subtree2,tvb, bit_offset>>3, 0, "Sync Case TSTD: %d", 0);
1257                     proto_tree_add_text(subtree2,tvb, bit_offset>>3, 0, "Diversity TDD: %d", 0);
1258                 }
1259                 if (idx)
1260                 {
1261                     wsize = 9;
1262                     nwi = 1;
1263                     jwi = 0;
1264                     i = 1;
1265    
1266                     while (idx > 0)
1267                     {
1268                         w[i] = tvb_get_bits16(tvb, bit_offset, wsize, FALSE);
1269                         bit_offset += wsize;
1270                         idx -= wsize;
1271                         if (w[i] == 0)
1272                         {
1273                             idx = 0;
1274                             break;
1275                         }
1276                         if (++jwi==nwi)
1277                         {
1278                             jwi = 0;
1279                             nwi <<= 1;
1280                             wsize--;
1281                         }
1282                         i++;
1283                     }
1284                     if (idx < 0)
1285                     {
1286                         bit_offset += idx;
1287                     }
1288                     iused = i-1;
1289                                                 
1290                     for (i=1; i <= iused; i++)
1291                     {
1292                         xdd_cell_info = f_k(i, w, 512);
1293                         proto_tree_add_text(subtree2,tvb, bit_offset>>3, 0,
1294                                             "Cell Parameter: %d", xdd_cell_info & 0x07F);
1295                         proto_tree_add_text(subtree2,tvb, bit_offset>>3, 0,
1296                                             "Sync Case TSTD: %d", (xdd_cell_info >> 7) & 0x01);
1297                         proto_tree_add_text(subtree2,tvb, bit_offset>>3, 0,
1298                                             "Diversity TDD: %d", (xdd_cell_info >> 8) & 0x01);
1299                     }
1300                 }
1301             }
1302             else
1303                 bit_offset += 1;
1304             value = tvb_get_bits8(tvb,bit_offset,1);
1305             bit_offset += 1;
1306         }
1307         proto_item_set_len(item,((bit_offset-bit_offset_sav)>>3)+1);
1308         break;
1309     default:
1310         break;
1311     }
1312
1313     curr_offset += length;
1314     return (curr_offset - offset);
1315 }
1316
1317 /*
1318  * [3] 10.5.2.2 Cell Description
1319  */
1320 guint16
1321 de_rr_cell_dsc(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1322 {
1323     proto_tree  *subtree;
1324     proto_item  *item;
1325     guint8      oct;
1326     guint32     curr_offset;
1327     guint16 bcch_arfcn;
1328
1329     curr_offset = offset;
1330
1331     oct = tvb_get_guint8(tvb, curr_offset);
1332     item =
1333         proto_tree_add_text(tree,
1334                             tvb, curr_offset, 2, "%s",
1335                             gsm_rr_elem_strings[DE_RR_CELL_DSC].strptr);
1336
1337     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_CELL_DSC]);
1338
1339     proto_tree_add_item(subtree, hf_gsm_a_ncc, tvb, curr_offset, 1, FALSE);
1340     proto_tree_add_item(subtree, hf_gsm_a_bcc, tvb, curr_offset, 1, FALSE);
1341     bcch_arfcn = (tvb_get_guint8(tvb,curr_offset) & 0xc0) << 2;
1342     bcch_arfcn = bcch_arfcn | tvb_get_guint8(tvb,curr_offset+1);
1343     proto_tree_add_uint(subtree, hf_gsm_a_bcch_arfcn , tvb, curr_offset, 2, bcch_arfcn );
1344
1345     curr_offset = curr_offset + 2;
1346
1347     return(curr_offset - offset);
1348 }
1349
1350 /*
1351  * [3] 10.5.2.3 Cell Options (BCCH)
1352  */
1353 static const value_string gsm_a_rr_dtx_bcch_vals[] = {
1354     { 0x00, "The MSs may use uplink discontinuous transmission" },
1355     { 0x01, "The MSs shall use uplink discontinuous transmission" },
1356     { 0x02, "The MSs shall not use uplink discontinuous transmission" },
1357     { 0x03, "Reserved" },
1358     {    0, NULL } };
1359
1360 static const value_string gsm_a_rr_radio_link_timeout_vals[] = {
1361     { 0x00, "4" },
1362     { 0x01, "8" },
1363     { 0x02, "12" },
1364     { 0x03, "16" },
1365     { 0x04, "20" },
1366     { 0x05, "24" },
1367     { 0x06, "28" },
1368     { 0x07, "32" },
1369     { 0x08, "36" },
1370     { 0x09, "40" },
1371     { 0x0A, "44" },
1372     { 0x0B, "48" },
1373     { 0x0C, "52" },
1374     { 0x0D, "56" },
1375     { 0x0E, "60" },
1376     { 0x0F, "64" },
1377     {    0, NULL } };
1378
1379 static guint16
1380 de_rr_cell_opt_bcch(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1381 {
1382     proto_tree  *subtree;
1383     proto_item  *item;
1384     guint32     curr_offset;
1385
1386     curr_offset = offset;
1387
1388     item = proto_tree_add_text(tree, tvb, curr_offset, 1, "%s",
1389                                gsm_rr_elem_strings[DE_RR_CELL_OPT_BCCH].strptr);
1390
1391     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_CELL_OPT_BCCH]);
1392
1393     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_pwrc, tvb, (curr_offset<<3)+1, 1, FALSE);
1394     proto_tree_add_item(subtree, hf_gsm_a_rr_dtx_bcch, tvb, curr_offset, 1, FALSE);
1395     proto_tree_add_item(subtree, hf_gsm_a_rr_radio_link_timeout, tvb, curr_offset, 1, FALSE);
1396
1397     curr_offset = curr_offset + 1;
1398
1399     return(curr_offset - offset);
1400 }
1401
1402 /*
1403  * [3] 10.5.2.3a Cell Options (SACCH)
1404  */
1405 static const value_string gsm_a_rr_dtx_sacch_vals[] = {
1406     { 0x00, "The MS may use uplink discontinuous transmission on a TCH-F. The MS shall not use uplink discontinuous transmission on TCH-H" },
1407     { 0x01, "The MS shall use uplink discontinuous transmission on a TCH-F. The MS shall not use uplink discontinuous transmission on TCH-H" },
1408     { 0x02, "The MS shall not use uplink discontinuous transmission on a TCH-F. The MS shall not use uplink discontinuous transmission on TCH-H" },
1409     { 0x03, "The MS shall use uplink discontinuous transmission on a TCH-F. The MS may use uplink discontinuous transmission on TCH-H" },
1410     { 0x04, "The MS may use uplink discontinuous transmission on a TCH-F. The MS may use uplink discontinuous transmission on TCH-H" },
1411     { 0x05, "The MS shall use uplink discontinuous transmission on a TCH-F. The MS shall use uplink discontinuous transmission on TCH-H" },
1412     { 0x06, "The MS shall not use uplink discontinuous transmission on a TCH-F. The MS shall use uplink discontinuous transmission on TCH-H" },
1413     { 0x07, "The MS may use uplink discontinuous transmission on a TCH-F. The MS shall use uplink discontinuous transmission on TCH-H" },
1414     {    0, NULL } };
1415
1416 static guint16
1417 de_rr_cell_opt_sacch(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1418 {
1419     proto_tree  *subtree;
1420     proto_item  *item;
1421     guint8      oct;
1422     guint8      dtx;
1423     guint32     curr_offset;
1424
1425     curr_offset = offset;
1426
1427     oct = tvb_get_guint8(tvb, curr_offset);
1428     dtx = ((oct&0x80)>>5)|((oct&0x30)>>4); /* DTX is a split filed in bits 8, 6 and 5 */
1429     item = proto_tree_add_text(tree, tvb, curr_offset, 1, "%s",
1430                                gsm_rr_elem_strings[DE_RR_CELL_OPT_SACCH].strptr);
1431
1432     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_CELL_OPT_SACCH]);
1433
1434     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_pwrc, tvb, (curr_offset<<3)+1, 1, FALSE);
1435     proto_tree_add_uint(subtree, hf_gsm_a_rr_dtx_sacch, tvb, curr_offset, 1, dtx);
1436     proto_tree_add_item(subtree, hf_gsm_a_rr_radio_link_timeout, tvb, curr_offset, 1, FALSE);
1437
1438     curr_offset = curr_offset + 1;
1439
1440     return(curr_offset - offset);
1441 }
1442
1443 /*
1444  * [3] 10.5.2.4 Cell Selection Parameters
1445  */
1446 static guint16
1447 de_rr_cell_sel_param(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1448 {
1449     proto_tree  *subtree;
1450     proto_item  *item;
1451     guint8      oct;
1452     guint32     curr_offset;
1453
1454     curr_offset = offset;
1455
1456     oct = tvb_get_guint8(tvb, curr_offset);
1457     item = proto_tree_add_text(tree, tvb, curr_offset, 2, "%s",
1458                                gsm_rr_elem_strings[DE_RR_CELL_SEL_PARAM].strptr);
1459
1460     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_CELL_SEL_PARAM]);
1461
1462     proto_tree_add_item(subtree, hf_gsm_a_rr_cell_reselect_hyst, tvb, curr_offset, 1, FALSE);
1463     proto_tree_add_item(subtree, hf_gsm_a_rr_ms_txpwr_max_cch, tvb, curr_offset, 1, FALSE);
1464
1465     curr_offset = curr_offset + 1;
1466
1467     proto_tree_add_item(subtree, hf_gsm_a_rr_acs, tvb, curr_offset, 1, FALSE);
1468     proto_tree_add_item(subtree, hf_gsm_a_rr_neci, tvb, curr_offset, 1, FALSE);
1469     proto_tree_add_item(subtree, hf_gsm_a_rr_rxlev_access_min, tvb, curr_offset, 1, FALSE);
1470
1471     curr_offset = curr_offset + 1;
1472
1473     return(curr_offset - offset);
1474 }
1475
1476 /*
1477  * [3] 10.5.2.4a MAC Mode and Channel Coding Requested
1478  * [3] 10.5.2.5 Channel Description
1479  */
1480 guint16
1481 de_rr_ch_dsc(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1482 {
1483     guint32     curr_offset;
1484     guint8      oct8,subchannel;
1485     guint16 arfcn, hsn, maio;
1486     proto_tree  *subtree;
1487     proto_item  *item;
1488     const gchar *str;
1489
1490     curr_offset = offset;
1491
1492     item = proto_tree_add_text(tree,tvb, curr_offset, 3, "%s", gsm_rr_elem_strings[DE_RR_CH_DSC].strptr);
1493
1494     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_CH_DSC]);
1495
1496     /* Octet 2 */
1497     oct8 = tvb_get_guint8(tvb, curr_offset);
1498
1499     if ((oct8 & 0xf8) == 0x08)
1500     {
1501         str = "TCH/F + ACCHs";
1502         other_decode_bitfield_value(a_bigbuf, oct8, 0xf8, 8);
1503         proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = %s",a_bigbuf,str);
1504     }
1505     else
1506     {
1507         if ((oct8 & 0xf0) == 0x10)
1508         {
1509             str = "TCH/H + ACCHs, Subchannel";
1510             subchannel = ((oct8 & 0x08)>>3);
1511         }
1512         else if ((oct8 & 0xe0) == 0x20)
1513         {
1514             str = "SDCCH/4 + SACCH/C4 or CBCH (SDCCH/4), Subchannel";
1515             subchannel = ((oct8 & 0x18)>>3);
1516         }
1517         else if ((oct8 & 0xc0) == 0x40)
1518         {
1519             str = "SDCCH/8 + SACCH/C8 or CBCH (SDCCH/8), Subchannel";
1520             subchannel = ((oct8 % 0x38)>>3);
1521         } else {
1522             str = "Unknown channel information";
1523             subchannel = oct8;
1524         }
1525         
1526         other_decode_bitfield_value(a_bigbuf, oct8, 0xf8, 8);
1527         proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = %s %d",a_bigbuf,str,subchannel);
1528     }
1529
1530     other_decode_bitfield_value(a_bigbuf, oct8, 0x07, 8);
1531     proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = Timeslot: %d",a_bigbuf,(oct8 & 0x07));
1532
1533     curr_offset +=1;
1534         
1535     /* Octet 3 */
1536     oct8 = tvb_get_guint8(tvb, curr_offset);
1537     other_decode_bitfield_value(a_bigbuf, oct8, 0xe0, 8);
1538     proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = Training Sequence: %d",a_bigbuf,((oct8 & 0xe0)>>5));
1539         
1540
1541     if ((oct8 & 0x10) == 0x10)
1542     {
1543         /* Hopping sequence */
1544         maio = ((oct8 & 0x0f)<<2) | ((tvb_get_guint8(tvb,curr_offset+1) & 0xc0) >> 6);
1545         hsn = (tvb_get_guint8(tvb,curr_offset+1) & 0x3f);
1546         str = "Yes";
1547
1548         other_decode_bitfield_value(a_bigbuf, oct8, 0x10, 8);
1549         proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = Hopping channel: %s",a_bigbuf,str);
1550         proto_tree_add_text(subtree,tvb, curr_offset, 2,"Hopping channel: MAIO %d",maio);
1551         proto_tree_add_text(subtree,tvb, curr_offset, 2,"Hopping channel: HSN %d",hsn);
1552     }
1553     else
1554     {
1555         /* single ARFCN */
1556         arfcn = ((oct8 & 0x03) << 8) | tvb_get_guint8(tvb,curr_offset+1);
1557         str = "No";
1558
1559         other_decode_bitfield_value(a_bigbuf, oct8, 0x10, 8);
1560         proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = Hopping channel: %s",a_bigbuf,str);
1561         other_decode_bitfield_value(a_bigbuf, oct8, 0x0c, 8);
1562         proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = Spare",a_bigbuf);
1563         proto_tree_add_text(subtree,tvb, curr_offset, 2,"Single channel : ARFCN %d",arfcn);
1564     }
1565         
1566     curr_offset = curr_offset + 2;
1567
1568     return(curr_offset - offset);
1569 }
1570 /*
1571  * [3] 10.5.2.5a Channel Description 2
1572  */
1573 static guint16
1574 de_rr_ch_dsc2(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1575 {
1576     guint32     curr_offset;
1577     guint8      oct8,subchannel;
1578     guint16 arfcn, hsn, maio;
1579     proto_tree  *subtree;
1580     proto_item  *item;
1581     const gchar *str;
1582
1583     curr_offset = offset;
1584
1585     item = proto_tree_add_text(tree,tvb, curr_offset, 3, "%s", gsm_rr_elem_strings[DE_RR_CH_DSC2].strptr);
1586
1587     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_CH_DSC2]);
1588
1589     /* Octet 2 */
1590     oct8 = tvb_get_guint8(tvb, curr_offset);
1591
1592     if ((oct8 & 0xf8) == 0x0)
1593     {
1594         str = "TCH/F + FACCH/F and SACCH/M";
1595         other_decode_bitfield_value(a_bigbuf, oct8, 0xf8, 8);
1596         proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = %s",a_bigbuf,str);
1597     }
1598     else if ((oct8 & 0xf8) == 0x08)
1599     {
1600         str = "TCH/F + FACCH/F and SACCH/F";
1601         other_decode_bitfield_value(a_bigbuf, oct8, 0xf8, 8);
1602         proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = %s",a_bigbuf,str);
1603     }
1604     else if ((oct8 & 0xf8) == 0xf0)
1605     {
1606         str = "TCH/F + FACCH/F and SACCH/M + bi- and unidirectional channels";
1607         other_decode_bitfield_value(a_bigbuf, oct8, 0xf8, 8);
1608         proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = %s",a_bigbuf,str);
1609     }
1610     else
1611     {
1612         if ((oct8 & 0xf0) == 0x10)
1613         {
1614             str = "TCH/H + ACCHs, Subchannel";
1615             subchannel = ((oct8 & 0x08)>>3);
1616         }
1617         else if ((oct8 & 0xe0) == 0x20)
1618         {
1619             str = "SDCCH/4 + SACCH/C4 or CBCH (SDCCH/4), Subchannel";
1620             subchannel = ((oct8 & 0x18)>>3);
1621         }
1622         else if ((oct8 & 0xc0) == 0x40)
1623         {
1624             str = "SDCCH/8 + SACCH/C8 or CBCH (SDCCH/8), Subchannel";
1625             subchannel = ((oct8 % 0x38)>>3);
1626         }
1627         else if ((oct8 & 0xc0) == 0x80)
1628         {
1629             str = "TCH/F + FACCH/F and SACCH/M + bidirectional channels at timeslot";
1630             subchannel = ((oct8 % 0x38)>>3);
1631         }
1632         else if ((oct8 & 0xe0) == 0xc0)
1633         {
1634             str = "TCH/F + FACCH/F and SACCH/M + unidirectional channels at timeslot";
1635             subchannel = ((oct8 % 0x38)>>3);
1636         } else {
1637             str = "Unknown channel information";
1638             subchannel = oct8;
1639         }
1640         other_decode_bitfield_value(a_bigbuf, oct8, 0xf8, 8);
1641         proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = %s %d",a_bigbuf,str,subchannel);
1642     }
1643
1644     other_decode_bitfield_value(a_bigbuf, oct8, 0x07, 8);
1645     proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = Timeslot: %d",a_bigbuf,(oct8 & 0x07));
1646
1647     curr_offset +=1;
1648         
1649     /* Octet 3 */
1650     oct8 = tvb_get_guint8(tvb, curr_offset);
1651     other_decode_bitfield_value(a_bigbuf, oct8, 0xe0, 8);
1652     proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = Training Sequence: %d",a_bigbuf,((oct8 & 0xe0)>>5));
1653
1654     if ((oct8 & 0x10) == 0x10)
1655     {
1656         /* Hopping sequence */
1657         maio = ((oct8 & 0x0f)<<2) | ((tvb_get_guint8(tvb,curr_offset+1) & 0xc0) >> 6);
1658         hsn = (tvb_get_guint8(tvb,curr_offset+1) & 0x3f);
1659         str = "Yes";
1660
1661         other_decode_bitfield_value(a_bigbuf, oct8, 0x10, 8);
1662         proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = Hopping channel: %s",a_bigbuf,str);
1663         proto_tree_add_text(subtree,tvb, curr_offset, 2,"Hopping channel: MAIO %d",maio);
1664         proto_tree_add_text(subtree,tvb, curr_offset, 2,"Hopping channel: HSN %d",hsn);
1665     }
1666     else
1667     {
1668         /* single ARFCN */
1669         arfcn = ((oct8 & 0x03) << 8) | tvb_get_guint8(tvb,curr_offset+1);
1670         str = "No";
1671
1672         other_decode_bitfield_value(a_bigbuf, oct8, 0x10, 8);
1673         proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = Hopping channel: %s",a_bigbuf,str);
1674         other_decode_bitfield_value(a_bigbuf, oct8, 0x0c, 8);
1675         proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = Spare",a_bigbuf);
1676         proto_tree_add_text(subtree,tvb, curr_offset, 2,"Single channel : ARFCN %d",arfcn);
1677     }
1678         
1679     curr_offset = curr_offset + 2;
1680
1681     return(curr_offset - offset);
1682 }
1683
1684 /*
1685  * [3] 10.5.2.5c Channel Description 3
1686  */
1687 static guint16
1688 de_rr_ch_dsc3(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1689 {
1690     guint32     curr_offset;
1691     guint8      oct8;
1692     guint16 arfcn, hsn, maio;
1693     proto_tree  *subtree;
1694     proto_item  *item;
1695     const gchar *str;
1696
1697     curr_offset = offset;
1698
1699     item = proto_tree_add_text(tree,tvb, curr_offset, 3, "%s", gsm_rr_elem_strings[DE_RR_CH_DSC3].strptr);
1700
1701     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_CH_DSC3]);
1702
1703     /* Octet 2 */
1704     oct8 = tvb_get_guint8(tvb, curr_offset);
1705     other_decode_bitfield_value(a_bigbuf, oct8, 0xe0, 8);
1706     proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = Training Sequence: %d",a_bigbuf,((oct8 & 0xe0)>>5));
1707
1708     if ((oct8 & 0x10) == 0x10)
1709     {
1710         /* Hopping sequence */
1711         maio = ((oct8 & 0x0f)<<2) | ((tvb_get_guint8(tvb,curr_offset+1) & 0xc0) >> 6);
1712         hsn = (tvb_get_guint8(tvb,curr_offset+1) & 0x3f);
1713         str = "Yes";
1714
1715         other_decode_bitfield_value(a_bigbuf, oct8, 0x10, 8);
1716         proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = Hopping channel: %s",a_bigbuf,str);
1717         proto_tree_add_text(subtree,tvb, curr_offset, 2,"Hopping channel: MAIO %d",maio);
1718         proto_tree_add_text(subtree,tvb, curr_offset, 2,"Hopping channel: HSN %d",hsn);
1719     }
1720     else
1721     {
1722         /* single ARFCN */
1723         arfcn = ((oct8 & 0x03) << 8) | tvb_get_guint8(tvb,curr_offset+1);
1724         str = "No";
1725
1726         other_decode_bitfield_value(a_bigbuf, oct8, 0x10, 8);
1727         proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = Hopping channel: %s",a_bigbuf,str);
1728         other_decode_bitfield_value(a_bigbuf, oct8, 0x0c, 8);
1729         proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = Spare",a_bigbuf);
1730         proto_tree_add_text(subtree,tvb, curr_offset, 2,"Single channel : ARFCN %d",arfcn);
1731     }
1732         
1733     curr_offset = curr_offset + 2;
1734
1735     return(curr_offset - offset);
1736 }
1737
1738 /*
1739  * [3] 10.5.2.6 Channel Mode
1740  */
1741 /* Channel Mode  */
1742 static const value_string gsm_a_rr_channel_mode_vals[] = {
1743     { 0x00, "signalling only"},
1744     { 0x01, "speech full rate or half rate version 1(GSM FR or GSM HR)"},
1745     { 0x21, "speech full rate or half rate version 2(GSM EFR)"},
1746     { 0x41, "speech full rate or half rate version 3(FR AMR or HR AMR)"},
1747     { 0x81, "speech full rate or half rate version 4(OFR AMR-WB or OHR AMR-WB)"},
1748     { 0x82, "speech full rate or half rate version 5(FR AMR-WB )"},
1749     { 0x83, "speech full rate or half rate version 6(OHR AMR )"},
1750     { 0x61, "data, 43.5 kbit/s (downlink)+14.5 kbps (uplink)"},
1751     { 0x62, "data, 29.0 kbit/s (downlink)+14.5 kbps (uplink)"},
1752     { 0x64, "data, 43.5 kbit/s (downlink)+29.0 kbps (uplink)"},
1753     { 0x67, "data, 14.5 kbit/s (downlink)+43.5 kbps (uplink)"},
1754     { 0x65, "data, 14.5 kbit/s (downlink)+29.0 kbps (uplink)"},
1755     { 0x66, "data, 29.0 kbit/s (downlink)+43.5 kbps (uplink)"},
1756     { 0x27, "data, 43.5 kbit/s radio interface rate"},
1757     { 0x63, "data, 32.0 kbit/s radio interface rate"},
1758     { 0x43, "data, 29.0 kbit/s radio interface rate"},
1759     { 0x0f, "data, 14.5 kbit/s radio interface rate"},
1760     { 0x03, "data, 12.0 kbit/s radio interface rate"},
1761     { 0x0b, "data, 6.0 kbit/s radio interface rate"},
1762     { 0x13, "data, 3.6 kbit/s radio interface rate"},
1763     {    0, NULL }
1764 };
1765
1766 guint16
1767 de_rr_ch_mode(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1768 {
1769     guint32     curr_offset;
1770
1771     curr_offset = offset;
1772
1773     proto_tree_add_item(tree, hf_gsm_a_rr_channel_mode, tvb, curr_offset, 1, FALSE);
1774
1775     curr_offset = curr_offset + 1;
1776
1777     return(curr_offset - offset);
1778 }
1779 /*
1780  * [3] 10.5.2.7 Channel Mode 2
1781  */
1782
1783 static const value_string gsm_a_rr_channel_mode2_vals[] = {
1784     { 0x00, "signalling only"},
1785     { 0x05, "speech half rate version 1(GSM HR)"},
1786     { 0x25, "speech half rate version 2(GSM EFR)"},
1787     { 0x45, "speech half rate version 3(HR AMR)"},
1788     { 0x85, "speech half rate version 4(OHR AMR-WB)"},
1789     { 0x06, "speech half rate version 6(OHR AMR )"},
1790     { 0x0f, "data, 6.0 kbit/s radio interface rate"},
1791     { 0x17, "data, 3.6 kbit/s radio interface rate"},
1792     {    0, NULL }
1793 };
1794
1795 static guint16
1796 de_rr_ch_mode2(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1797 {
1798     guint32     curr_offset;
1799
1800     curr_offset = offset;
1801
1802     proto_tree_add_item(tree, hf_gsm_a_rr_channel_mode2, tvb, curr_offset, 1, FALSE);
1803
1804     curr_offset = curr_offset + 1;
1805
1806     return(curr_offset - offset);
1807 }
1808 /*
1809  * [3] 10.5.2.7a UTRAN Classmark information element
1810  */
1811 static guint16
1812 de_rr_utran_cm(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
1813 {
1814     guint32 curr_offset;
1815     tvbuff_t *rrc_irat_ho_info_tvb;
1816
1817     curr_offset = offset;
1818     if (len)
1819     {
1820         rrc_irat_ho_info_tvb = tvb_new_subset(tvb, curr_offset, len, len);
1821         if (rrc_irat_ho_info_handle)
1822                         /* gsm_a_dtap_pinfo MUST be set by any dissector calling de_rr_utran_cm */
1823             call_dissector(rrc_irat_ho_info_handle, rrc_irat_ho_info_tvb, gsm_a_dtap_pinfo, tree);
1824     }
1825
1826     curr_offset += len;
1827     return(curr_offset - offset);
1828 }
1829
1830 /*
1831  * [3] 10.5.2.7b (void)
1832  */
1833
1834 /*
1835  * [3] 10.5.2.7c Classmark Enquiry Mask
1836  * Bit 8:
1837  * 0    CLASSMARK CHANGE message is requested
1838  * 1    CLASSMARK CHANGE message is not requested
1839  * Bits 7-5 . 5
1840  * 000  UTRAN CLASSMARK CHANGE message including status on predefined configurations (i.e. Sequence Description) is requested
1841  * 111  UTRAN CLASSMARK CHANGE message including status on predefined configurations (i.e. Sequence Description) is not requested.
1842  * All other values shall not be sent. If received, they shall be interpreted as '000'.
1843  * Bit 4:
1844  * 0    CDMA2000 CLASSMARK CHANGE message requested
1845  * 1    CDMA2000 CLASSMARK CHANGE message not requested.
1846  * Bit 3:
1847  * 0    GERAN IU MODE CLASSMARK CHANGE message requested
1848  * 1    GERAN IU MODE CLASSMARK CHANGE message not requested.
1849  * Bits 2 - 1: spare(0).
1850  */
1851 static const true_false_string gsm_a_msg_req_value  = {
1852     "message is not requested",
1853     "message is requested"
1854 };
1855
1856 static const value_string gsm_a_rr_utran_cm_cng_msg_req_vals[] = {
1857     { 0x0, "message including status on predefined configurations (i.e. Sequence Description) is requested"},
1858     { 0x1, "message including status on predefined configurations (i.e. Sequence Description) is requested"},
1859     { 0x2, "message including status on predefined configurations (i.e. Sequence Description) is requested"},
1860     { 0x3, "message including status on predefined configurations (i.e. Sequence Description) is requested"},
1861     { 0x4, "message including status on predefined configurations (i.e. Sequence Description) is requested"},
1862     { 0x5, "message including status on predefined configurations (i.e. Sequence Description) is requested"},
1863     { 0x6, "message including status on predefined configurations (i.e. Sequence Description) is requested"},
1864     { 0x7, "message including status on predefined configurations (i.e. Sequence Description) is not requested."},
1865     {   0, NULL }
1866 };
1867 guint16
1868 de_rr_cm_enq_mask(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1869 {
1870     guint32     curr_offset;
1871
1872     curr_offset = offset;
1873
1874     proto_tree_add_item(tree, hf_gsm_a_rr_cm_cng_msg_req, tvb, curr_offset, 1, FALSE);
1875     proto_tree_add_item(tree, hf_gsm_a_rr_utran_cm_cng_msg_req, tvb, curr_offset, 1, FALSE);
1876     proto_tree_add_item(tree, hf_gsm_a_rr_cdma200_cm_cng_msg_req, tvb, curr_offset, 1, FALSE);
1877     proto_tree_add_item(tree, hf_gsm_a_rr_geran_iu_cm_cng_msg_req, tvb, curr_offset, 1, FALSE);
1878
1879     curr_offset = curr_offset + 1;
1880
1881     return(curr_offset - offset);
1882 }
1883 /*
1884  * [3] 10.5.2.8 Channel Needed
1885  */
1886 static const value_string gsm_a_rr_channel_needed_vals[] = {
1887     { 0x00, "Any channel"},
1888     { 0x01, "SDCCH"},
1889     { 0x02, "TCH/F (Full rate)"},
1890     { 0x03, "TCH/H or TCH/F (Dual rate)"},
1891     {    0, NULL }
1892 };
1893 guint16
1894 de_rr_chnl_needed(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1895 {
1896     proto_tree  *subtree;
1897     proto_item  *item;
1898     guint32     curr_offset;
1899     gint bit_offset;
1900
1901     curr_offset = offset;
1902     if (UPPER_NIBBLE==len)
1903         bit_offset = 4;
1904     else
1905         bit_offset = 0;
1906
1907     item = proto_tree_add_text(tree, tvb, curr_offset, 3, "%s",
1908                                gsm_rr_elem_strings[DE_RR_CHNL_NEEDED].strptr);
1909
1910     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_CHNL_NEEDED]);
1911
1912     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_chnl_needed_ch1, tvb, (curr_offset<<3)+bit_offset+2, 2, FALSE);
1913     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_chnl_needed_ch2, tvb, (curr_offset<<3)+bit_offset, 2, FALSE);
1914
1915     curr_offset = curr_offset + 1;
1916
1917     return(curr_offset - offset);
1918 }
1919 /*
1920  * [3] 10.5.2.8a Channel Request Description
1921  * [3] 10.5.2.8b Channel Request Description 2
1922  */
1923 /*
1924  * [3] 10.5.2.9 Cipher Mode Setting
1925  */
1926 /* SC (octet 1) */
1927 static const value_string gsm_a_rr_sc_vals[] = {
1928     { 0, "No ciphering"},
1929     { 1, "Start ciphering"},
1930     { 0, NULL }
1931 };
1932 /* algorithm identifier
1933  * If SC=1 then:
1934  * bits
1935  * 4 3 2
1936  */
1937 guint16
1938 de_rr_cip_mode_set(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
1939 {
1940     guint32     curr_offset;
1941     gint bit_offset;
1942     guint64 value;
1943
1944     curr_offset = offset;
1945
1946     /* Cipher Mode Setting
1947      * Note: The coding of fields SC and algorithm identifier is defined in [44.018]
1948      * as part of the Cipher Mode Setting IE.
1949      */
1950     if (UPPER_NIBBLE==len)
1951         bit_offset = 4;
1952     else
1953         bit_offset = 0;
1954
1955     proto_tree_add_bits_ret_val(tree, hf_gsm_a_rr_sc, tvb, (curr_offset<<3)+bit_offset+3, 1, &value, FALSE);
1956     if (value == 1){ /* Start ciphering */
1957         /* algorithm identifier */
1958         proto_tree_add_bits_item(tree, hf_gsm_a_algorithm_id, tvb, (curr_offset<<3)+bit_offset, 3, FALSE);
1959     }
1960     curr_offset = curr_offset + 1;
1961
1962     return(curr_offset - offset);
1963 }
1964 /*
1965  * [3] 10.5.2.10 Cipher Response
1966  */
1967 /* CR (octet 1) */
1968 static const value_string gsm_a_rr_cr_vals[] = {
1969     { 0, "IMEISV shall not be included"},
1970     { 1, "IMEISV shall be included"},
1971     { 0, NULL }
1972 };
1973
1974 static guint16
1975 de_rr_cip_mode_resp(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
1976 {
1977     guint32     curr_offset;
1978     gint bit_offset;
1979
1980     curr_offset = offset;
1981     if (UPPER_NIBBLE==len)
1982         bit_offset = 4;
1983     else
1984         bit_offset = 0;
1985
1986     /* Cipher Mode Response
1987      * Note: The coding of field CR is defined in [44.018]
1988      * as part of the Cipher Mode Response IE.
1989      */
1990     proto_tree_add_bits_item(tree, hf_gsm_a_rr_cr, tvb, (curr_offset<<3)+bit_offset+3, 1, FALSE);
1991     curr_offset = curr_offset + 1;
1992
1993     return(curr_offset - offset);
1994 }
1995 /* [3] 10.5.2.11 Control Channel Description */
1996
1997 static const value_string gsm_a_rr_mscr_vals[] = {
1998     { 0, "MSC is Release '98 or older"},
1999     { 1, "MSC is Release '99 onwards"},
2000     { 0, NULL }
2001 };
2002
2003 static const value_string gsm_a_rr_att_vals[] = {
2004     { 0, "MSs in the cell are not allowed to apply IMSI attach and detach procedure"},
2005     { 1, "MSs in the cell shall apply IMSI attach and detach procedure"},
2006     { 0, NULL }
2007 };
2008
2009 static const value_string gsm_a_rr_ccch_conf_vals[] = {
2010     { 0, "1 basic physical channel used for CCCH, not combined with SDCCHs"},
2011     { 1, "1 basic physical channel used for CCCH, combined with SDCCHs"},
2012     { 2, "2 basic physical channels used for CCCH, not combined with SDCCHs"},
2013     { 3, "Reserved"},
2014     { 4, "3 basic physical channels used for CCCH, not combined with SDCCHs"},
2015     { 5, "Reserved"},
2016     { 6, "4 basic physical channels used for CCCH, not combined with SDCCHs"},
2017     { 7, "Reserved"},
2018     { 0, NULL }
2019 };
2020
2021 static const value_string gsm_a_rr_cbq3_vals[] = {
2022     { 0, "Iu mode not supported"},
2023     { 1, "Iu mode capable MSs barred"},
2024     { 2, "Iu mode supported, cell not barred"},
2025     { 3, "Iu mode supported, cell not barred"},
2026     { 0, NULL }
2027 };
2028
2029 static guint16
2030 de_rr_ctrl_ch_desc(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2031 {
2032     proto_tree  *subtree;
2033     proto_item  *item;
2034     guint8      oct;
2035     guint32     curr_offset;
2036
2037     curr_offset = offset;
2038
2039     item = proto_tree_add_text(tree, tvb, curr_offset, 3, "%s",
2040                                gsm_rr_elem_strings[DE_RR_CTRL_CH_DESC].strptr);
2041
2042     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_CTRL_CH_DESC]);
2043
2044     proto_tree_add_item(subtree, hf_gsm_a_rr_mscr, tvb, curr_offset, 1, FALSE);
2045     proto_tree_add_item(subtree, hf_gsm_a_rr_att, tvb, curr_offset, 1, FALSE);
2046     proto_tree_add_item(subtree, hf_gsm_a_rr_bs_ag_blks_res, tvb, curr_offset, 1, FALSE);
2047     proto_tree_add_item(subtree, hf_gsm_a_rr_ccch_conf, tvb, curr_offset, 1, FALSE);
2048
2049     curr_offset = curr_offset + 1;
2050     oct = tvb_get_guint8(tvb, curr_offset);
2051
2052     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_cbq3, tvb, (curr_offset<<3)+1, 2, FALSE);
2053     proto_tree_add_uint(subtree, hf_gsm_a_rr_bs_pa_mfrms, tvb, curr_offset, 1, (oct&0x07)+2);
2054
2055     curr_offset = curr_offset + 1;
2056
2057     proto_tree_add_item(subtree, hf_gsm_a_rr_t3212, tvb, curr_offset, 1, FALSE);
2058
2059     curr_offset = curr_offset + 1;
2060
2061     return(curr_offset - offset);
2062 }
2063
2064 /* [3] 10.5.2.11a DTM Information Details
2065  */
2066 /*
2067  * [3]  10.5.2.11b      Dynamic ARFCN Mapping   
2068  */
2069 static const value_string gsm_a_rr_gsm_band_vals[] = {
2070     {  0, "GSM 750"},
2071     {  1, "DCS 1800"},
2072     {  2, "PCS 1900"},
2073     {  3, "GSM T 380"},
2074     {  4, "GSM T 410"},
2075     {  5, "GSM T 900"},
2076     {  6, "GSM 710"},
2077     {  7, "GSM T 810"},
2078     {  8, "Reserved"},
2079     {  9, "Reserved"},
2080     { 10, "Reserved"},
2081     { 11, "Reserved"},
2082     { 12, "Reserved"},
2083     { 13, "Reserved"},
2084     { 14, "Reserved"},
2085     { 15, "Reserved"},
2086     {  0, NULL }
2087 };
2088
2089
2090 static guint16
2091 de_rr_dyn_arfcn_map(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2092 {
2093     guint32     curr_offset;
2094     gint bit_offset;
2095     guint64 length;
2096     guint value;
2097
2098     curr_offset = offset;
2099     bit_offset = curr_offset << 3;
2100
2101     proto_tree_add_bits_ret_val(tree, hf_gsm_a_rr_dyn_arfcn_length, tvb, bit_offset, 8, &length, FALSE);
2102     value = tvb_get_bits8(tvb,bit_offset,1);
2103     bit_offset += 1;
2104     while (value && length)
2105     {
2106         proto_tree_add_bits_item(tree, hf_gsm_a_rr_gsm_band, tvb, bit_offset, 4, FALSE);
2107         bit_offset += 4;
2108         proto_tree_add_bits_item(tree, hf_gsm_a_rr_arfcn_first, tvb, bit_offset, 10, FALSE);
2109         bit_offset += 10;
2110         proto_tree_add_bits_item(tree, hf_gsm_a_rr_band_offset, tvb, bit_offset, 10, FALSE);
2111         bit_offset += 10;
2112         proto_tree_add_bits_item(tree, hf_gsm_a_rr_arfcn_range, tvb, bit_offset, 7, FALSE);
2113         bit_offset += 7;
2114         value = tvb_get_bits8(tvb,bit_offset,1);
2115         bit_offset += 1;
2116         length -= 4;
2117     }
2118
2119     curr_offset = curr_offset + len;
2120
2121     return(curr_offset - offset);
2122 }
2123 /*
2124  * [3] 10.5.2.12 Frequency Channel Sequence
2125  */
2126 static guint16
2127 de_rr_freq_ch_seq(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2128 {
2129     guint32     curr_offset;
2130     gint bit_offset, i;
2131
2132     curr_offset = offset;
2133
2134     proto_tree_add_item(tree, hf_gsm_a_rr_lowest_arfcn, tvb, curr_offset, 1, FALSE);
2135     curr_offset += 1;
2136     bit_offset = curr_offset << 3;
2137     for (i=0; i<16; i++)
2138     {
2139         proto_tree_add_bits_item(tree, hf_gsm_a_rr_inc_skip_arfcn, tvb, bit_offset, 4, FALSE);
2140         bit_offset += 4;
2141     }
2142
2143     curr_offset = curr_offset + 8;
2144
2145     return(curr_offset - offset);
2146 }
2147
2148 /*
2149  * [3] 10.5.2.13 Frequency List
2150  */
2151 /*
2152  * [3] 10.5.2.13 Frequency List
2153  * 
2154  * Bit Bit Bit Bit Bit format notation
2155  * 8 7  4 3 2
2156  * 0 0  X X X bit map 0
2157  * 1 0  0 X X 1024 range
2158  * 1 0  1 0 0 512 range
2159  * 1 0  1 0 1 256 range
2160  * 1 0  1 1 0 128 range
2161  * 1 0  1 1 1 variable bit map
2162  */
2163 /* The mask 0xce (1100 1110) will produce the result 0110 0111*/ 
2164 static const value_string gsm_a_rr_freq_list_format_id_vals[] = {
2165     { 0x00, "bit map 0"},
2166     { 0x02, "bit map 0"},
2167     { 0x04, "bit map 0"},
2168     { 0x06, "bit map 0"},
2169     { 0x08, "bit map 0"},
2170     { 0x0a, "bit map 0"},
2171     { 0x0c, "bit map 0"},
2172     { 0x0e, "bit map 0"},
2173     { 0x40, "1024 range"},
2174     { 0x41, "1024 range"},
2175     { 0x42, "1024 range"},
2176     { 0x43, "1024 range"},
2177     { 0x44, "512 range"},
2178     { 0x45, "256 range"},
2179     { 0x46, "128 range"},
2180     { 0x47, "variable bit map"},
2181     { 0x00, NULL }
2182 };
2183 static guint16
2184 de_rr_freq_list(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
2185 {
2186     return dissect_arfcn_list(tvb, tree, offset, len, add_string, string_len);
2187 }
2188 /*
2189  * [3] 10.5.2.14 Frequency Short List
2190  *
2191  *The Frequency Short List information element is a type 3 information element of 10 octet length.
2192  *
2193  * This element is encoded exactly as the Frequency List information element,
2194  * except that it has a fixed length instead of a variable length and does
2195  * not contain a length indicator and that it shall not be encoded in bitmap 0 format.
2196  */
2197
2198  static guint16
2199 de_rr_freq_short_list(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2200  {
2201      return dissect_arfcn_list(tvb, tree, offset, 9, add_string, string_len);
2202  }
2203
2204 /*
2205  * [3] 10.5.2.14a Frequency Short List 2
2206  *
2207  * The Frequency Short List information element is a type 3 information element of 8 octet length.
2208  *
2209  * This element is encoded exactly as the Frequency List information element,
2210  * except that it has a fixed length instead of a variable length and does
2211  * not contain a length indicator and that it shall not be encoded in bitmap 0 format.
2212  */
2213 static guint16
2214 de_rr_freq_short_list2(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2215 {
2216     return dissect_arfcn_list(tvb, tree, offset, 8, add_string, string_len);
2217 }
2218 /*
2219  * [3] 10.5.2.14b Group Channel Description
2220  */
2221
2222 /*
2223  * [3] 10.5.2.14c GPRS Resumption
2224  */
2225 static const true_false_string gsm_a_rr_gprs_resumption_ack_value  = {
2226     "Resumption of GPRS services successfully acknowledged",
2227     "Resumption of GPRS services not successfully acknowledged"
2228 };
2229
2230 static guint16
2231 de_rr_gprs_resumption(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2232 {
2233     guint32 curr_offset;
2234
2235     curr_offset = offset;
2236
2237     proto_tree_add_item(tree, hf_gsm_a_rr_gprs_resumption_ack, tvb, curr_offset, 1, FALSE);
2238     curr_offset += 1;
2239
2240     return (curr_offset - offset);
2241 }
2242
2243 /*
2244  * [3] 10.5.2.14d GPRS broadcast information
2245  */
2246
2247 static gint
2248 de_rr_rest_oct_gprs_cell_options(tvbuff_t *tvb, proto_tree *tree, gint bit_offset)
2249 {
2250     proto_tree *subtree, *subtree2;
2251     proto_item *item, *item2;
2252     gint curr_bit_offset, curr_bit_offset_sav;
2253     guint8 value;
2254
2255     curr_bit_offset = bit_offset;
2256
2257     item = proto_tree_add_text(tree, tvb, curr_bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_GPRS_CELL_OPTIONS].strptr);
2258     subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_GPRS_CELL_OPTIONS]);
2259     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_nmo, tvb, curr_bit_offset, 2, FALSE);
2260     curr_bit_offset += 2;
2261     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_t3168, tvb, curr_bit_offset, 3, FALSE);
2262     curr_bit_offset += 3;
2263     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_t3192, tvb, curr_bit_offset, 3, FALSE);
2264     curr_bit_offset += 3;
2265     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_drx_timer_max, tvb, curr_bit_offset, 3, FALSE);
2266     curr_bit_offset += 3;
2267     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_access_burst_type, tvb, curr_bit_offset, 1, FALSE);
2268     curr_bit_offset += 1;
2269     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_control_ack_type, tvb, curr_bit_offset, 1, FALSE);
2270     curr_bit_offset += 1;
2271     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_bs_cv_max, tvb, curr_bit_offset, 4, FALSE);
2272     curr_bit_offset += 4;
2273     if (tvb_get_bits8(tvb,curr_bit_offset,1))
2274     {
2275         curr_bit_offset += 1;
2276         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_pan_dec, tvb, curr_bit_offset, 3, FALSE);
2277         curr_bit_offset += 3;
2278         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_pan_inc, tvb, curr_bit_offset, 3, FALSE);
2279         curr_bit_offset += 3;
2280         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_pan_max, tvb, curr_bit_offset, 3, FALSE);
2281         curr_bit_offset += 3;
2282     }
2283     else
2284         curr_bit_offset += 1;
2285     if (tvb_get_bits8(tvb,curr_bit_offset,1))
2286     { /* Optional extension information */
2287         curr_bit_offset += 1;
2288         curr_bit_offset_sav = curr_bit_offset;
2289         item2 = proto_tree_add_text(subtree, tvb, curr_bit_offset>>3, -1, "%s",
2290                                     gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_GPRS_CELL_OPTIONS_EXT_INFO].strptr);
2291         subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_GPRS_CELL_OPTIONS_EXT_INFO]);
2292         value = tvb_get_bits8(tvb,curr_bit_offset,6);
2293         proto_tree_add_text(subtree2,tvb, curr_bit_offset>>3, 1, "Extension Length: %d", value);
2294         curr_bit_offset += 6;
2295         value += 1;
2296         proto_item_set_len(item2,((curr_bit_offset+value-curr_bit_offset_sav)>>3)+1);
2297         if (tvb_get_bits8(tvb,curr_bit_offset,1))
2298         {
2299             curr_bit_offset += 1;
2300             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_egprs_packet_channel_request, tvb, curr_bit_offset, 1, FALSE);
2301             curr_bit_offset += 1;
2302             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_bep_period, tvb, curr_bit_offset, 4, FALSE);
2303             curr_bit_offset += 4;
2304             value -= 5;
2305         }
2306         else
2307             curr_bit_offset += 1;
2308         value -= 1;
2309         proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_pfc_feature_mode, tvb, curr_bit_offset, 1, FALSE);
2310         curr_bit_offset += 1;
2311         proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_dtm_support, tvb, curr_bit_offset, 1, FALSE);
2312         curr_bit_offset += 1;
2313         proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_bss_paging_coordination, tvb, curr_bit_offset, 1, FALSE);
2314         curr_bit_offset += 1;
2315         value -= 3;
2316         if (value > 0)
2317         { /* Rel 4 extension */
2318             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_ccn_active, tvb, curr_bit_offset, 1, FALSE);
2319             curr_bit_offset += 1;
2320             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_nw_ext_utbf, tvb, curr_bit_offset, 1, FALSE);
2321             curr_bit_offset += 1;
2322             value -= 2;
2323             if (value > 0)
2324             { /* Rel 6 extension */
2325                 proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_multiple_tbf_capability, tvb, curr_bit_offset, 1, FALSE);
2326                 curr_bit_offset += 1;
2327                 proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_ext_utbf_no_data, tvb, curr_bit_offset, 1, FALSE);
2328                 curr_bit_offset += 1;
2329                 proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_dtm_enhancements_capability, tvb, curr_bit_offset, 1, FALSE);
2330                 curr_bit_offset += 1;
2331                 value -= 3;
2332                 if (tvb_get_bits8(tvb,curr_bit_offset,1))
2333                 {
2334                     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_dedicated_mode_mbms_notification_support, tvb, bit_offset, 1, FALSE);
2335                     bit_offset += 1;
2336                     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_mnci_support, tvb, bit_offset, 1, FALSE);
2337                     bit_offset += 1;
2338                     value -= 2;
2339                 }
2340                 else
2341                     bit_offset += 1;
2342                 value -= 1;
2343                 if (value > 0)
2344                 { /* Rel 7 extension */
2345                     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_reduced_latency_access, tvb, bit_offset, 1, FALSE);
2346                     bit_offset += 1;
2347                     value -= 1;
2348                 }
2349             }
2350         }
2351         curr_bit_offset += value;
2352     }
2353     else
2354         curr_bit_offset += 1;
2355     proto_item_set_len(item,((curr_bit_offset-bit_offset)>>3)+1);
2356
2357     return (curr_bit_offset - bit_offset);
2358 }
2359
2360 static gint
2361 de_rr_rest_oct_gprs_power_control_parameters(tvbuff_t *tvb, proto_tree *tree, gint bit_offset)
2362 {
2363     proto_tree *subtree;
2364     proto_item *item;
2365     gint curr_bit_offset;
2366         
2367     curr_bit_offset = bit_offset;
2368
2369     item = proto_tree_add_text(tree, tvb, curr_bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_GPRS_POWER_CONTROL_PARAMS].strptr);
2370     subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_GPRS_POWER_CONTROL_PARAMS]);
2371     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_alpha, tvb, curr_bit_offset, 4, FALSE);
2372     curr_bit_offset += 4;
2373     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_t_avg_w, tvb, curr_bit_offset, 5, FALSE);
2374     curr_bit_offset += 5;
2375     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_t_avg_t, tvb, curr_bit_offset, 5, FALSE);
2376     curr_bit_offset += 5;
2377     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_pc_meas_chan, tvb, curr_bit_offset, 1, FALSE);
2378     curr_bit_offset += 1;
2379     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_n_avg_i, tvb, curr_bit_offset, 4, FALSE);
2380     curr_bit_offset += 4;
2381     proto_item_set_len(item,((curr_bit_offset-bit_offset)>>3)+1);
2382
2383     return (curr_bit_offset - bit_offset);
2384 }
2385
2386 static guint16
2387 de_rr_gprs_broadcast_info(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len , gchar *add_string _U_, int string_len _U_)
2388 {
2389     guint32 curr_offset;
2390     gint bit_offset;
2391
2392     curr_offset = offset;
2393     bit_offset = curr_offset << 3;
2394
2395     bit_offset += de_rr_rest_oct_gprs_cell_options(tvb, tree, bit_offset);
2396     bit_offset += de_rr_rest_oct_gprs_power_control_parameters(tvb, tree, bit_offset);  
2397     curr_offset += len;
2398
2399     return (curr_offset - offset);
2400 }
2401
2402 /*
2403  * [3] 10.5.2.15 Handover Reference
2404  */
2405 static guint16
2406 de_rr_ho_ref(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2407 {
2408     proto_tree  *subtree;
2409     proto_item  *item;
2410     guint32     curr_offset;
2411
2412     curr_offset = offset;
2413
2414     item =
2415         proto_tree_add_text(tree,
2416                             tvb, curr_offset, 1, "%s",
2417                             gsm_rr_elem_strings[DE_RR_HO_REF].strptr);
2418
2419     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_HO_REF]);
2420
2421     /* Handover reference value */
2422     proto_tree_add_item(subtree, hf_gsm_a_rr_ho_ref_val, tvb, curr_offset, 1, FALSE);
2423
2424     curr_offset = curr_offset + 1;
2425
2426     return(curr_offset - offset);
2427 }
2428 /*
2429  * [3] 10.5.2.16 IA Rest Octets
2430  */
2431
2432 static guint16
2433 de_rr_ia_rest_oct(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
2434 {
2435     proto_tree  *subtree;
2436     proto_item  *item;
2437     guint32     curr_offset;
2438
2439     len = tvb_length_remaining(tvb,offset);
2440     if (len==0)
2441         return 0;
2442
2443     curr_offset = offset;
2444
2445     item =
2446         proto_tree_add_text(tree,
2447                             tvb, curr_offset, len, "%s",
2448                             gsm_rr_elem_strings[DE_RR_IA_REST_OCT].strptr);
2449
2450     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_IA_REST_OCT]);
2451
2452     proto_tree_add_text(subtree,tvb, curr_offset, len ,"Data(Not decoded)");
2453
2454     curr_offset = curr_offset + len;
2455
2456     return curr_offset-offset;
2457 }
2458
2459 /*
2460  * [3] 10.5.2.17 IAR Rest Octets
2461  */
2462
2463 static guint16
2464 de_rr_iar_rest_oct(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
2465 {
2466     proto_tree  *subtree;
2467     proto_item  *item;
2468     guint32     curr_offset;
2469
2470     len = 3;
2471     curr_offset = offset;
2472
2473     item =
2474         proto_tree_add_text(tree,
2475                             tvb, curr_offset, 3, "%s",
2476                             gsm_rr_elem_strings[DE_RR_IAR_REST_OCT].strptr);
2477
2478     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_IAR_REST_OCT]);
2479
2480     proto_tree_add_text(subtree,tvb, curr_offset, len ,"Data(Not decoded)");
2481
2482     curr_offset = curr_offset + len;
2483
2484     return curr_offset-offset;
2485 }
2486
2487 /*
2488  * [3] 10.5.2.18 IAX Rest Octets
2489  */
2490 static guint16
2491 de_rr_iax_rest_oct(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
2492 {
2493     proto_tree  *subtree;
2494     proto_item  *item;
2495     guint32     curr_offset;
2496
2497     len = tvb_length_remaining(tvb,offset);
2498     if (len==0)
2499         return 0;
2500
2501     curr_offset = offset;
2502
2503     item =
2504         proto_tree_add_text(tree,
2505                             tvb, curr_offset, len, "%s",
2506                             gsm_rr_elem_strings[DE_RR_IAX_REST_OCT].strptr);
2507
2508     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_IAX_REST_OCT]);
2509
2510     proto_tree_add_text(subtree,tvb, curr_offset, len ,"Data(Not decoded)");
2511
2512     curr_offset = curr_offset + len;
2513
2514     return curr_offset-offset;
2515 }
2516
2517 /*
2518  * [3] 10.5.2.19 L2 Pseudo Length
2519  */
2520 static guint16
2521 de_rr_l2_pseudo_len(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2522 {
2523     proto_tree  *subtree;
2524     proto_item  *item;
2525     guint32     curr_offset;
2526
2527     curr_offset = offset;
2528
2529     item = proto_tree_add_text(tree,tvb, curr_offset, 1, "%s", gsm_rr_elem_strings[DE_RR_L2_PSEUDO_LEN].strptr);
2530
2531     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_L2_PSEUDO_LEN]);
2532
2533     /* L2 Pseudo Length value */
2534     proto_tree_add_item(subtree, hf_gsm_a_rr_L2_pseudo_len, tvb, curr_offset, 1, FALSE);
2535
2536     curr_offset = curr_offset + 1;
2537
2538     return(curr_offset - offset);
2539 }
2540
2541 /*
2542  * [3] 10.5.2.20 Measurement Results
2543  */
2544 static const true_false_string gsm_a_rr_dtx_vals  = {
2545     "DTX was used",
2546     "DTX was not used"
2547 };
2548
2549 static const value_string gsm_a_rr_rxlev_vals [] = {
2550     { 0, "< -110 dBm"},
2551     { 1, "-110 <= x < -109 dBm"},
2552     { 2, "-109 <= x < -108 dBm"},
2553     { 3, "-108 <= x < -107 dBm"},
2554     { 4, "-107 <= x < -106 dBm"},
2555     { 5, "-106 <= x < -105 dBm"},
2556     { 6, "-105 <= x < -104 dBm"},
2557     { 7, "-104 <= x < -103 dBm"},
2558     { 8, "-103 <= x < -102 dBm"},
2559     { 9, "-102 <= x < -101 dBm"},
2560     {10, "-101 <= x < -100 dBm"},
2561     {11, "-100 <= x < -99 dBm"},
2562     {12, "-99 <= x < -98 dBm"},
2563     {13, "-98 <= x < -97 dBm"},
2564     {14, "-97 <= x < -96 dBm"},
2565     {15, "-96 <= x < -95 dBm"},
2566     {16, "-95 <= x < -94 dBm"},
2567     {17, "-94 <= x < -93 dBm"},
2568     {18, "-93 <= x < -92 dBm"},
2569     {19, "-92 <= x < -91 dBm"},
2570     {20, "-91 <= x < -90 dBm"},
2571     {21, "-90 <= x < -89 dBm"},
2572     {22, "-89 <= x < -88 dBm"},
2573     {23, "-88 <= x < -87 dBm"},
2574     {24, "-87 <= x < -86 dBm"},
2575     {25, "-86 <= x < -85 dBm"},
2576     {26, "-85 <= x < -84 dBm"},
2577     {27, "-84 <= x < -83 dBm"},
2578     {28, "-83 <= x < -82 dBm"},
2579     {29, "-82 <= x < -81 dBm"},
2580     {30, "-81 <= x < -80 dBm"},
2581     {31, "-80 <= x < -79 dBm"},
2582     {32, "-79 <= x < -78 dBm"},
2583     {33, "-78 <= x < -77 dBm"},
2584     {34, "-77 <= x < -76 dBm"},
2585     {35, "-76 <= x < -75 dBm"},
2586     {36, "-75 <= x < -74 dBm"},
2587     {37, "-74 <= x < -73 dBm"},
2588     {38, "-73 <= x < -72 dBm"},
2589     {39, "-72 <= x < -71 dBm"},
2590     {40, "-71 <= x < -70 dBm"},
2591     {41, "-70 <= x < -69 dBm"},
2592     {42, "-69 <= x < -68 dBm"},
2593     {43, "-68 <= x < -67 dBm"},
2594     {44, "-67 <= x < -66 dBm"},
2595     {45, "-66 <= x < -65 dBm"},
2596     {46, "-65 <= x < -64 dBm"},
2597     {47, "-64 <= x < -63 dBm"},
2598     {48, "-63 <= x < -62 dBm"},
2599     {49, "-62 <= x < -61 dBm"},
2600     {50, "-61 <= x < -60 dBm"},
2601     {51, "-60 <= x < -59 dBm"},
2602     {52, "-59 <= x < -58 dBm"},
2603     {53, "-58 <= x < -57 dBm"},
2604     {54, "-57 <= x < -56 dBm"},
2605     {55, "-56 <= x < -55 dBm"},
2606     {56, "-55 <= x < -54 dBm"},
2607     {57, "-54 <= x < -53 dBm"},
2608     {58, "-53 <= x < -52 dBm"},
2609     {59, "-52 <= x < -51 dBm"},
2610     {60, "-51 <= x < -50 dBm"},
2611     {61, "-50 <= x < -49 dBm"},
2612     {62, "-49 <= x < -48 dBm"},
2613     {63, ">= -48 dBm"},
2614     { 0, NULL}
2615 };
2616
2617 static const true_false_string gsm_a_rr_mv_vals  = {
2618     "The measurement results are not valid",
2619     "The measurement results are valid"
2620 };
2621
2622 static const value_string gsm_a_rr_rxqual_vals [] = {
2623     {0, "BER < 0.2%, Mean value 0.14%"},
2624     {1, "0.2% <= BER < 0.4%, Mean value 0.28%"},
2625     {2, "0.4% <= BER < 0.8%, Mean value 0.57%"},
2626     {3, "0.8% <= BER < 1.6%, Mean value 1.13%"},
2627     {4, "1.6% <= BER < 3.2%, Mean value 2.26%"},
2628     {5, "3.2% <= BER < 6.4%, Mean value 4.53%"},
2629     {6, "6.4% <= BER < 12.8%, Mean value 9.05%"},
2630     {7, "BER > 12.8%, Mean value 18.10%"},
2631     {0, NULL}
2632 };
2633
2634 static const value_string gsm_a_rr_ncell_vals [] = {
2635     {0, "No neighbour cell measurement result"},
2636     {1, "1 neighbour cell measurement result"},
2637     {2, "2 neighbour cell measurement result"},
2638     {3, "3 neighbour cell measurement result"},
2639     {4, "4 neighbour cell measurement result"},
2640     {5, "5 neighbour cell measurement result"},
2641     {6, "6 neighbour cell measurement result"},
2642     {7, "Neighbour cell information not available for serving cell"},
2643     {0, NULL}
2644 };
2645
2646 guint16
2647 de_rr_meas_res(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2648 {
2649     proto_tree  *subtree;
2650     proto_item  *item;
2651     guint32     curr_offset;
2652     gint bit_offset;
2653     guint64 no_ncell_m;
2654
2655     curr_offset = offset;
2656
2657     item =
2658         proto_tree_add_text(tree,
2659                             tvb, curr_offset, 16, "%s",
2660                             gsm_rr_elem_strings[DE_RR_MEAS_RES].strptr);
2661     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_MEAS_RES]);
2662
2663     /* 2nd octet */
2664     /* BA-USED */
2665     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_ba_used, tvb, curr_offset<<3, 1, FALSE);
2666     /* DTX USED */
2667     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_dtx_used, tvb, (curr_offset<<3)+1, 1, FALSE);
2668     /* RXLEV-FULL-SERVING-CELL */
2669     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_rxlev_full_serv_cell, tvb, (curr_offset<<3)+2, 6, FALSE);
2670     curr_offset++;
2671
2672     /* 3rd octet */
2673     /* 3G-BA-USED */ 
2674     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_3g_ba_used, tvb, curr_offset<<3, 1, FALSE);
2675     /* MEAS-VALID */
2676     proto_tree_add_item(subtree, hf_gsm_a_rr_meas_valid, tvb, curr_offset, 1, FALSE);   
2677     /* RXLEV-SUB-SERVING-CELL */
2678     proto_tree_add_item(subtree, hf_gsm_a_rr_rxlev_sub_serv_cell, tvb, curr_offset, 1, FALSE);
2679
2680     curr_offset++;
2681
2682     /* 4th octet */
2683     /* RXQUAL-FULL-SERVING-CELL */
2684     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_rxqual_full_serv_cell, tvb, (curr_offset<<3)+1, 3, FALSE);
2685
2686     /* RXQUAL-SUB-SERVING-CELL */
2687     proto_tree_add_item(subtree, hf_gsm_a_rr_rxqual_sub_serv_cell, tvb, curr_offset, 1, FALSE);
2688     /* NO-NCELL-M */
2689     bit_offset = (curr_offset << 3) + 7;
2690     proto_tree_add_bits_ret_val(subtree, hf_gsm_a_rr_no_ncell_m, tvb, bit_offset, 3, &no_ncell_m, FALSE);
2691     bit_offset += 3;
2692     if (no_ncell_m == 7) /* No neighbour cell information available) */
2693         no_ncell_m = 0;
2694     while (no_ncell_m)
2695     {
2696         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_rxlev_ncell, tvb, bit_offset, 6, FALSE);
2697         bit_offset += 6;
2698         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_bcch_freq_ncell, tvb, bit_offset, 5, FALSE);
2699         bit_offset += 5;
2700         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_bsic_ncell, tvb, bit_offset, 6, FALSE);
2701         bit_offset += 6;
2702         no_ncell_m -= 1;
2703     }
2704
2705     return(len);
2706 }
2707
2708 /*
2709  * [3] 10.5.2.20a GPRS Measurement Results
2710  */
2711 /*
2712  * [3] 10.5.2.21 Mobile Allocation
2713  */
2714 static guint16
2715 de_rr_mob_all(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
2716 {
2717     guint32     curr_offset;
2718     proto_item *item;
2719     gint i, j;
2720     guint8 value;
2721
2722     curr_offset = offset;
2723
2724     item = proto_tree_add_text(tree, tvb, curr_offset, len, "Bitmap of increasing ARFCNs included in the Mobile Allocation: ");
2725     for(i=len; i>0; i--)
2726     {
2727         value = tvb_get_guint8(tvb,curr_offset+i-1);
2728         for (j=0; j<8; j++)
2729         {
2730             proto_item_append_text(item,"%d",(value>>j)&0x01);
2731         }
2732     }
2733
2734     curr_offset = curr_offset + len;
2735     return(curr_offset - offset);
2736 }
2737
2738 /*
2739  * [3] 10.5.2.21a Mobile Time Difference
2740  */
2741 static guint16
2742 de_rr_mob_time_diff(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
2743 {
2744     guint32     curr_offset;
2745
2746     curr_offset = offset;
2747
2748     proto_tree_add_item(tree, hf_gsm_a_rr_mobile_time_difference, tvb, curr_offset, len, FALSE);
2749
2750     curr_offset = curr_offset + len;
2751     return(curr_offset - offset);
2752
2753 }
2754 /*
2755  * [3] 10.5.2.21aa MultiRate configuration
2756  */
2757 /*      Multirate speech version Octet 3 Bits 8 7 6 */
2758 static const value_string multirate_speech_ver_vals[] = {
2759     { 1, "Adaptive Multirate speech version 1"},
2760     { 2, "Adaptive Multirate speech version 2"},
2761     { 0, NULL }
2762 };
2763 /* Bit 5  NSCB: Noise Suppression Control Bit */
2764 static const value_string NSCB_vals[] = {
2765     { 0, "Noise Suppression can be used (default)"},
2766     { 1, "Noise Suppression shall be turned off"},
2767     { 0, NULL }
2768 };
2769 /* Bit 4 ICMI: Initial Codec Mode Indicator */
2770 static const value_string ICMI_vals[] = {
2771     { 0, "The initial codec mode is defined by the implicit rule provided in 3GPP TS 05.09"},
2772     { 1, "The initial codec mode is defined by the Start Mode field"},
2773     { 0, NULL }
2774 };
2775 /*
2776 Table 10.5.2.21aa.2: Set of adaptive multirate codec modes field (octet 4)
2777 for the Multirate speech version 1
2778 */
2779 static const true_false_string gsm_a_rr_set_of_amr_codec_modes  = {
2780     "is part of the subset",
2781     "is not part of the subset"
2782 };
2783
2784 static const value_string gsm_a_rr_amr_threshold_vals[] = {
2785     {  0, "0.0 dB"},
2786     {  1, "0.5 dB"},
2787     {  2, "1.0 dB"},
2788     {  3, "1.5 dB"},
2789     {  4, "2.0 dB"},
2790     {  5, "2.5 dB"},
2791     {  6, "3.0 dB"},
2792     {  7, "3.5 dB"},
2793     {  8, "4.0 dB"},
2794     {  9, "4.5 dB"},
2795     { 10, "5.0 dB"},
2796     { 11, "5.5 dB"},
2797     { 12, "6.0 dB"},
2798     { 13, "6.5 dB"},
2799     { 14, "7.0 dB"},
2800     { 15, "7.5 dB"},
2801     { 16, "8.0 dB"},
2802     { 17, "8.5 dB"},
2803     { 18, "9.0 dB"},
2804     { 19, "9.5 dB"},
2805     { 20, "10.0 dB"},
2806     { 21, "10.5 dB"},
2807     { 22, "11.0 dB"},
2808     { 23, "11.5 dB"},
2809     { 24, "12.0 dB"},
2810     { 25, "12.5 dB"},
2811     { 26, "13.0 dB"},
2812     { 27, "13.5 dB"},
2813     { 28, "14.0 dB"},
2814     { 29, "14.5 dB"},
2815     { 30, "15.0 dB"},
2816     { 31, "15.5 dB"},
2817     { 32, "16.0 dB"},
2818     { 33, "16.5 dB"},
2819     { 34, "17.0 dB"},
2820     { 35, "17.5 dB"},
2821     { 36, "18.0 dB"},
2822     { 37, "18.5 dB"},
2823     { 38, "19.0 dB"},
2824     { 39, "19.5 dB"},
2825     { 40, "20.0 dB"},
2826     { 41, "20.5 dB"},
2827     { 42, "21.0 dB"},
2828     { 43, "21.5 dB"},
2829     { 44, "22.0 dB"},
2830     { 45, "22.5 dB"},
2831     { 46, "23.0 dB"},
2832     { 47, "23.5 dB"},
2833     { 48, "24.0 dB"},
2834     { 49, "24.5 dB"},
2835     { 50, "25.0 dB"},
2836     { 51, "25.5 dB"},
2837     { 52, "26.0 dB"},
2838     { 53, "26.5 dB"},
2839     { 54, "27.0 dB"},
2840     { 55, "27.5 dB"},
2841     { 56, "28.0 dB"},
2842     { 57, "28.5 dB"},
2843     { 58, "29.0 dB"},
2844     { 59, "29.5 dB"},
2845     { 60, "30.0 dB"},
2846     { 61, "30.5 dB"},
2847     { 62, "31.0 dB"},
2848     { 63, "31.5 dB"},
2849     { 0, NULL }
2850 };
2851
2852 static const value_string gsm_a_rr_amr_hysteresis_vals[] = {
2853     {  0, "0.0 dB"},
2854     {  1, "0.5 dB"},
2855     {  2, "1.0 dB"},
2856     {  3, "1.5 dB"},
2857     {  4, "2.0 dB"},
2858     {  5, "2.5 dB"},
2859     {  6, "3.0 dB"},
2860     {  7, "3.5 dB"},
2861     {  8, "4.0 dB"},
2862     {  9, "4.5 dB"},
2863     { 10, "5.0 dB"},
2864     { 11, "5.5 dB"},
2865     { 12, "6.0 dB"},
2866     { 13, "6.5 dB"},
2867     { 14, "7.0 dB"},
2868     { 15, "7.5 dB"},
2869     { 0, NULL }
2870 };
2871
2872 guint16
2873 de_rr_multirate_conf(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2874 {
2875     guint32     curr_offset;
2876     guint8 oct;
2877     gint bit_offset, remaining_length, nb_of_params;
2878
2879     curr_offset = offset;
2880
2881     proto_tree_add_item(tree, hf_gsm_a_rr_multirate_speech_ver, tvb, curr_offset, 1, FALSE);
2882     proto_tree_add_item(tree, hf_gsm_a_rr_NCSB, tvb, curr_offset, 1, FALSE);
2883     proto_tree_add_item(tree, hf_gsm_a_rr_ICMI, tvb, curr_offset, 1, FALSE);
2884     /* The initial codec mode is coded as in 3GPP TS 45.009 */
2885     proto_tree_add_item(tree, hf_gsm_a_rr_start_mode, tvb, curr_offset, 1, FALSE);
2886     oct = ( tvb_get_guint8(tvb,curr_offset) &0xe0 ) >> 5;
2887     curr_offset++;
2888     switch ( oct){
2889     case 1:
2890         /* Adaptive Multirate speech version 1 */
2891         /* Set of AMR codec modes */
2892         proto_tree_add_item(tree, hf_gsm_a_rr_set_of_amr_codec_modes_v1_b8, tvb, curr_offset, 1, FALSE);
2893         proto_tree_add_item(tree, hf_gsm_a_rr_set_of_amr_codec_modes_v1_b7, tvb, curr_offset, 1, FALSE);
2894         proto_tree_add_item(tree, hf_gsm_a_rr_set_of_amr_codec_modes_v1_b6, tvb, curr_offset, 1, FALSE);
2895         proto_tree_add_item(tree, hf_gsm_a_rr_set_of_amr_codec_modes_v1_b5, tvb, curr_offset, 1, FALSE);
2896         proto_tree_add_item(tree, hf_gsm_a_rr_set_of_amr_codec_modes_v1_b4, tvb, curr_offset, 1, FALSE);
2897         proto_tree_add_item(tree, hf_gsm_a_rr_set_of_amr_codec_modes_v1_b3, tvb, curr_offset, 1, FALSE);
2898         proto_tree_add_item(tree, hf_gsm_a_rr_set_of_amr_codec_modes_v1_b2, tvb, curr_offset, 1, FALSE);
2899         proto_tree_add_item(tree, hf_gsm_a_rr_set_of_amr_codec_modes_v1_b1, tvb, curr_offset, 1, FALSE);
2900         curr_offset++;
2901
2902         remaining_length = len-2;
2903         break;
2904     case 2:
2905         /* Adaptive Multirate speech version 2 */
2906         proto_tree_add_item(tree, hf_gsm_a_rr_set_of_amr_codec_modes_v2_b5, tvb, curr_offset, 1, FALSE);
2907         proto_tree_add_item(tree, hf_gsm_a_rr_set_of_amr_codec_modes_v2_b4, tvb, curr_offset, 1, FALSE);
2908         proto_tree_add_item(tree, hf_gsm_a_rr_set_of_amr_codec_modes_v2_b3, tvb, curr_offset, 1, FALSE);
2909         proto_tree_add_item(tree, hf_gsm_a_rr_set_of_amr_codec_modes_v2_b2, tvb, curr_offset, 1, FALSE);
2910         proto_tree_add_item(tree, hf_gsm_a_rr_set_of_amr_codec_modes_v2_b1, tvb, curr_offset, 1, FALSE);
2911         curr_offset++;
2912
2913         remaining_length = len-2;
2914         break;
2915     default:
2916         proto_tree_add_text(tree,tvb,offset,1,"Unknown version");
2917         proto_tree_add_text(tree,tvb, curr_offset, len-1 ,"Data(Not decoded)");
2918         remaining_length = 0;
2919         break;
2920     }
2921
2922     if (remaining_length)
2923     {
2924         bit_offset = (curr_offset<<3) + 2;
2925         nb_of_params = remaining_length - 1;
2926         while (nb_of_params)
2927         {
2928             proto_tree_add_bits_item(tree, hf_gsm_a_rr_amr_threshold, tvb, bit_offset, 6, FALSE);
2929             bit_offset += 6;
2930             proto_tree_add_bits_item(tree, hf_gsm_a_rr_amr_hysteresis, tvb, bit_offset, 4, FALSE);
2931             bit_offset += 4;
2932             nb_of_params -= 1;
2933         }
2934     }
2935
2936     curr_offset = offset + len;
2937     return(curr_offset - offset);
2938
2939 }
2940 /*
2941  * [3] 10.5.2.21b Multislot Allocation
2942  */
2943 static guint16
2944 de_rr_mult_all(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
2945 {
2946     guint32     curr_offset;
2947
2948     curr_offset = offset;
2949
2950     proto_tree_add_text(tree,tvb, curr_offset, len ,"Data(Not decoded)");
2951
2952     curr_offset = curr_offset + len;
2953     return(curr_offset - offset);
2954
2955 }
2956 /*
2957  * [3] 10.5.2.21c NC mode
2958  */
2959
2960  /*
2961  * [3] 10.5.2.22 Neighbour Cell Description
2962  */
2963 static const value_string gsm_a_rr_ext_ind_vals[] = {
2964     { 0, "The information element carries the complete BA"},
2965     { 1, "The information element carries only a part of the BA"},
2966     { 0, NULL }
2967 };
2968 static guint16
2969 de_rr_neigh_cell_desc(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2970 {
2971     guint32     curr_offset;
2972
2973     curr_offset = offset;
2974
2975     proto_tree_add_item(tree, hf_gsm_a_rr_ext_ind, tvb, curr_offset, 1, FALSE);
2976     proto_tree_add_bits_item(tree, hf_gsm_a_rr_ba_ind, tvb, (curr_offset<<3)+3, 1, FALSE);
2977
2978     return dissect_arfcn_list(tvb, tree, offset, 16, add_string, string_len);
2979 }
2980
2981  /*
2982  * [3] 10.5.2.22a Neighbour Cell Description 2
2983  */
2984 static guint16
2985 de_rr_neigh_cell_desc2(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2986 {
2987     guint32     curr_offset;
2988
2989     curr_offset = offset;
2990
2991     proto_tree_add_bits_item(tree, hf_gsm_a_rr_multiband_reporting, tvb, (curr_offset<<3)+1, 2, FALSE);
2992     proto_tree_add_bits_item(tree, hf_gsm_a_rr_ba_ind, tvb, (curr_offset<<3)+3, 1, FALSE);
2993
2994     return dissect_arfcn_list(tvb, tree, offset, 16, add_string, string_len);
2995 }
2996
2997 /*
2998  * [3] 10.5.2.22b (void)
2999  * [3] 10.5.2.22c NT/N Rest Octets
3000  */
3001
3002 /*
3003  * [3] 10.5.2.23 P1 Rest Octets
3004  */
3005 static guint16
3006 de_rr_p1_rest_oct(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
3007 {
3008     proto_tree *subtree;
3009     proto_item *item, *item2;
3010     guint32 curr_offset, value;
3011     gint bit_offset, bit_offset_sav, i;
3012
3013     curr_offset = offset;
3014     bit_offset = curr_offset << 3;
3015     len = tvb_length_remaining(tvb,offset);
3016
3017     item = proto_tree_add_text(tree, tvb, curr_offset, len, "%s",
3018                                gsm_rr_elem_strings[DE_RR_P1_REST_OCT].strptr);
3019
3020     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_P1_REST_OCT]);
3021
3022     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
3023     {
3024         bit_offset += 1;
3025         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_nln_pch, tvb, bit_offset, 2, FALSE);
3026         bit_offset += 2;
3027         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_nln_status_pch, tvb, bit_offset, 1, FALSE);
3028         bit_offset += 1;
3029     }
3030     else
3031         bit_offset += 1;
3032     for (i=1; i<=2; i++)
3033     {
3034         if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
3035         {
3036             bit_offset += 1;
3037             item2 = proto_tree_add_bits_item(subtree, hf_gsm_a_call_prio, tvb, bit_offset, 3, FALSE);
3038             bit_offset += 3;
3039             proto_item_append_text(item2, " for Mobile Identity %d", i);
3040         }
3041         else
3042             bit_offset += 1;
3043     }
3044     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
3045     { /* Group Call Information */
3046         bit_offset += 1;
3047         bit_offset_sav = bit_offset;
3048         bit_offset += 36;
3049         if (tvb_get_bits8(tvb,bit_offset,1))
3050         { /* Group Channel Description */
3051             bit_offset += 24+1;
3052             if (tvb_get_bits8(tvb,bit_offset,1))
3053             { /* Hopping case */
3054                 bit_offset += 1;
3055                 if (tvb_get_bits8(tvb,bit_offset,1))
3056                 {
3057                     bit_offset += 64+1;
3058                 }
3059                 else
3060                 {
3061                     bit_offset += 1;
3062                     value = tvb_get_bits8(tvb,bit_offset,8);
3063                     bit_offset += 8 + (value<<3);
3064                 }
3065             }
3066             else
3067                 bit_offset += 1;
3068         }
3069         else
3070             bit_offset += 1;
3071         proto_tree_add_text(subtree,tvb, bit_offset_sav>>3, (bit_offset-bit_offset_sav)>>3,"Group Call Information: Data(Not decoded)");
3072     }
3073     else
3074         bit_offset += 1;
3075     for (i=1; i<=2; i++)
3076     {
3077         item2 = proto_tree_add_text(subtree,tvb, bit_offset>>3, 1, "Packet Page Indication %d: ", i);
3078         if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
3079             proto_item_append_text(item2, "Packet paging procedure");
3080         else
3081             proto_item_append_text(item2, "Paging procedure for RR connection establishment");
3082         bit_offset += 1;
3083     }
3084     if (((curr_offset + len)<<3) - bit_offset > 0)
3085     {
3086         /* There is still room left in the Rest Octets IE */
3087         if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
3088         { /* Additions in release 6 */
3089             bit_offset += 1;
3090             proto_tree_add_text(subtree, tvb, bit_offset>>3, -1,"Additions in Release 6: Data(Not decoded)");
3091         }
3092         else
3093             bit_offset += 1;
3094     }
3095
3096     curr_offset = curr_offset + len;
3097
3098     return (curr_offset - offset);
3099 }
3100
3101 /*
3102  * [3] 10.5.2.24 P2 Rest Octets
3103  */
3104 static guint16
3105 de_rr_p2_rest_oct(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3106
3107 {
3108     proto_tree *subtree;
3109     proto_item *item, *item2;
3110     guint32 curr_offset;
3111     gint bit_offset, i;
3112
3113     curr_offset = offset;
3114     bit_offset = curr_offset << 3;
3115     len = tvb_length_remaining(tvb,offset);
3116
3117     item = proto_tree_add_text(tree, tvb, curr_offset, len, "%s",
3118                                gsm_rr_elem_strings[DE_RR_P2_REST_OCT].strptr);
3119
3120     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_P2_REST_OCT]);
3121
3122     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
3123     {
3124         bit_offset += 1;
3125         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_chnl_needed_ch3, tvb, bit_offset, 2, FALSE);
3126         bit_offset += 2;
3127     }
3128     else
3129         bit_offset += 1;
3130     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
3131     {
3132         bit_offset += 1;
3133         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_nln_pch, tvb, bit_offset, 2, FALSE);
3134         bit_offset += 2;
3135         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_nln_status_pch, tvb, bit_offset, 1, FALSE);
3136         bit_offset += 1;
3137     }
3138     else
3139         bit_offset += 1;
3140     for (i=1; i<=3; i++)
3141     {
3142         if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
3143         {
3144             bit_offset += 1;
3145             item2 = proto_tree_add_bits_item(subtree, hf_gsm_a_call_prio, tvb, bit_offset, 3, FALSE);
3146             bit_offset += 3;
3147             proto_item_append_text(item2, " for Mobile Identity %d", i);
3148         }
3149         else
3150             bit_offset += 1;
3151     }
3152     item2 = proto_tree_add_text(subtree,tvb, bit_offset>>3, 1, "Packet Page Indication 3: ");
3153     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
3154         proto_item_append_text(item2, "Packet paging procedure");
3155     else
3156         proto_item_append_text(item2, "Paging procedure for RR connection establishment");
3157     bit_offset += 1;
3158     if (((curr_offset + len)<<3) - bit_offset > 0)
3159     {
3160         /* There is still room left in the Rest Octets IE */
3161         if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
3162         { /* Additions in release 6 */
3163             bit_offset += 1;
3164             proto_tree_add_text(subtree, tvb, bit_offset>>3, -1,"Additions in Release 6: Data(Not decoded)");
3165         }
3166         else
3167             bit_offset += 1;
3168     }
3169
3170     curr_offset = curr_offset + len;
3171
3172     return (curr_offset - offset);
3173 }
3174
3175 /*
3176  * [3] 10.5.2.25 P3 Rest Octets
3177  */
3178 static guint16
3179 de_rr_p3_rest_oct(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3180 {
3181     proto_tree *subtree;
3182     proto_item *item, *item2;
3183     guint32 curr_offset;
3184     gint bit_offset, i;
3185
3186     curr_offset = offset;
3187     bit_offset = curr_offset << 3;
3188     len = 3;
3189
3190     item = proto_tree_add_text(tree, tvb, curr_offset, len, "%s",
3191                                gsm_rr_elem_strings[DE_RR_P3_REST_OCT].strptr);
3192
3193     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_P3_REST_OCT]);
3194
3195     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
3196     {
3197         bit_offset += 1;
3198         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_chnl_needed_ch3, tvb, bit_offset, 2, FALSE);
3199         bit_offset += 2;
3200         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_chnl_needed_ch4, tvb, bit_offset, 2, FALSE);
3201         bit_offset += 2;
3202     }
3203     else
3204         bit_offset += 1;
3205     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
3206     {
3207         bit_offset += 1;
3208         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_nln_pch, tvb, bit_offset, 2, FALSE);
3209         bit_offset += 2;
3210         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_nln_status_pch, tvb, bit_offset, 1, FALSE);
3211         bit_offset += 1;
3212     }
3213     else
3214         bit_offset += 1;
3215     for (i=1; i<=4; i++)
3216     {
3217         if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
3218         {
3219             bit_offset += 1;
3220             item2 = proto_tree_add_bits_item(subtree, hf_gsm_a_call_prio, tvb, bit_offset, 3, FALSE);
3221             bit_offset += 3;
3222             proto_item_append_text(item2, " for Mobile Identity %d", i);
3223         }
3224         else
3225             bit_offset += 1;
3226     }
3227
3228     curr_offset = curr_offset + len;
3229
3230     return (curr_offset - offset);
3231 }
3232
3233 /*
3234  * [3] 10.5.2.25a Packet Channel Description C V 3
3235  */
3236 static guint16
3237 de_rr_packet_ch_desc(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3238 {
3239     guint32     curr_offset;
3240     guint8      oct8;
3241     guint16     arfcn, hsn, maio;
3242     proto_tree  *subtree;
3243     proto_item  *item;
3244     const gchar *str;
3245
3246     curr_offset = offset;
3247
3248     item = proto_tree_add_text(tree,tvb,curr_offset,3, "%s", gsm_rr_elem_strings[DE_RR_PACKET_CH_DESC].strptr);
3249     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_PACKET_CH_DESC]);
3250
3251     /* Octet 2 */
3252     oct8 = tvb_get_guint8(tvb, curr_offset);
3253     /* Channel Type */
3254     str = "Spare bits (ignored by receiver)";
3255     other_decode_bitfield_value(a_bigbuf, oct8, 0xf8, 8);
3256     proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = %s",a_bigbuf,str);
3257     /* TN */
3258     other_decode_bitfield_value(a_bigbuf, oct8, 0x07, 8);
3259     proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = Timeslot: %d",a_bigbuf,(oct8 & 0x07));
3260
3261     curr_offset +=1;
3262         
3263     /* Octet 3 */
3264     oct8 = tvb_get_guint8(tvb, curr_offset);
3265     other_decode_bitfield_value(a_bigbuf, oct8, 0xe0, 8);
3266     proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = Training Sequence: %d",a_bigbuf,((oct8 & 0xe0)>>5));
3267         
3268     if ((oct8 & 0x10) == 0x10)
3269     {
3270         /* Hopping sequence */
3271         maio = ((oct8 & 0x0f)<<2) | ((tvb_get_guint8(tvb,curr_offset+1) & 0xc0) >> 6);
3272         hsn = (tvb_get_guint8(tvb,curr_offset+1) & 0x3f);
3273         str = "Yes";
3274
3275         other_decode_bitfield_value(a_bigbuf, oct8, 0x10, 8);
3276         proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = Hopping channel: %s",a_bigbuf,str);
3277         proto_tree_add_text(subtree,tvb, curr_offset, 2,"Hopping channel: MAIO %d",maio);
3278         proto_tree_add_text(subtree,tvb, curr_offset, 2,"Hopping channel: HSN %d",hsn);
3279     }
3280     else
3281     {
3282         /* single ARFCN */
3283         arfcn = ((oct8 & 0x03) << 8) | tvb_get_guint8(tvb,curr_offset+1);
3284         str = "No";
3285         other_decode_bitfield_value(a_bigbuf, oct8, 0x10, 8);
3286         proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = Hopping channel: %s",a_bigbuf,str);
3287         other_decode_bitfield_value(a_bigbuf, oct8, 0x0c, 8);
3288         proto_tree_add_text(subtree,tvb, curr_offset, 1,"%s = Spare",a_bigbuf);
3289         proto_tree_add_text(subtree,tvb, curr_offset, 2,"Single channel : ARFCN %d",arfcn);
3290     }
3291
3292     curr_offset = curr_offset + 2;
3293     return(curr_offset - offset);
3294
3295 }
3296 /*
3297  * [3] 10.5.2.25b Dedicated mode or TBF
3298  */
3299
3300 static const value_string gsm_a_rr_dedicated_mode_or_tbf_vals[] = {
3301     { 0, "This message assigns a dedicated mode resource"},
3302     { 1, "This message assigns an uplink TBF or is the second message of two in a two-message assignment of an uplink or downlink TBF"},
3303     { 2, "Not used"},
3304     { 3, "This message assigns a downlink TBF to the mobile station identified in the IA Rest Octets IE"},
3305     { 4, "Not used"},
3306     { 5, "This message is the first message of two in a two-message assignment of an uplink TBF"},
3307     { 6, "Not used"},
3308     { 7, "This message is the first message of two in a two-message assignment of a downlink TBF to the mobile station identified in the IA Rest Octets IE"},
3309     { 0, NULL }
3310 };
3311 static guint16
3312 de_rr_ded_mod_or_tbf(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3313 {
3314     proto_tree  *subtree;
3315     proto_item  *item;
3316     guint32     curr_offset;
3317
3318     curr_offset = offset;
3319
3320     item =
3321         proto_tree_add_text(tree,
3322                             tvb, curr_offset, 1, "%s",
3323                             gsm_rr_elem_strings[DE_RR_DED_MOD_OR_TBF].strptr);
3324
3325     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_DED_MOD_OR_TBF]);
3326
3327     proto_tree_add_item(subtree, hf_gsm_a_rr_dedicated_mode_or_tbf, tvb, curr_offset, 1, FALSE);
3328
3329     curr_offset += 1;
3330
3331     return(curr_offset - offset);
3332 }
3333 /*
3334  * [3] 10.5.2.25c RR Packet Uplink Assignment
3335  * [3] 10.5.2.25d RR Packet Downlink Assignment
3336  */
3337 /*
3338  * [3] 10.5.2.26 Page Mode
3339  */
3340
3341 static const value_string gsm_a_rr_page_mode_vals[] = {
3342     { 0, "Normal paging"},
3343     { 1, "Extended paging"},
3344     { 2, "Paging reorganization"},
3345     { 3, "Same as before"},
3346     { 0, NULL }
3347 };
3348 static guint16
3349 de_rr_page_mode(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3350 {
3351     proto_tree  *subtree;
3352     proto_item  *item;
3353     guint32     curr_offset;
3354
3355     curr_offset = offset;
3356
3357     item =
3358         proto_tree_add_text(tree,
3359                             tvb, curr_offset, 1, "%s",
3360                             gsm_rr_elem_strings[DE_RR_PAGE_MODE].strptr);
3361
3362     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_PAGE_MODE]);
3363
3364     proto_tree_add_item(subtree, hf_gsm_a_rr_page_mode, tvb, curr_offset, 1, FALSE);
3365
3366     curr_offset += 1;
3367
3368     return(curr_offset - offset);
3369 }
3370 /*
3371  * [3] 10.5.2.26a (void)
3372  * [3] 10.5.2.26b (void)
3373  * [3] 10.5.2.26c (void)
3374  * [3] 10.5.2.26d (void)
3375  */
3376 /*
3377  * [3] 10.5.2.27 NCC Permitted
3378  */
3379 static guint16
3380 de_rr_ncc_perm(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3381 {
3382     proto_tree  *subtree;
3383     proto_item  *item;
3384     guint32     curr_offset;
3385
3386     curr_offset = offset;
3387
3388     item = proto_tree_add_text(tree, tvb, curr_offset, 1, "%s",
3389                                gsm_rr_elem_strings[DE_RR_NCC_PERM].strptr);
3390
3391     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_NCC_PERM]);
3392
3393     proto_tree_add_item(subtree, hf_gsm_a_rr_ncc_permitted, tvb, curr_offset, 1, FALSE);
3394
3395     curr_offset = curr_offset + 1;
3396
3397     return(curr_offset - offset);
3398 }
3399 /*
3400  * [3] 10.5.2.28 Power Command
3401  *
3402  *
3403  * ATC (Access Type Control) (octet 2)Bit 8
3404  * 0    Sending of Handover access is mandatory
3405  * 1    Sending of Handover access is optional
3406  */
3407 static const true_false_string gsm_a_rr_pow_cmd_atc_value  = {
3408     "Sending of Handover access is optional",
3409     "Sending of Handover access is mandatory"
3410 };
3411 /*
3412  *  The EPC mode field (octet 2) indicates whether the assigned channel(s)
3413  *  shall be in enhanced power control (EPC) mode. It is only valid for channels
3414  *  on which EPC may be used. It is coded as follows:
3415 */
3416 static const true_false_string gsm_a_rr_pow_cmd_epc_value  = {
3417     "Channel(s) in EPC mode",
3418     "Channel(s) not in EPC mode"
3419 };
3420 /*
3421  * FPC_EPC (octet 2)
3422  * The FPC_EPC field (octet 2) has different interpretation depending
3423  *              on the channel mode     of the assigned channel (s) and the value
3424  *              of the EPC mode field.
3425  * If the channel mode is such that fast power control (FPC) may be
3426  *              used, the FPC_EPC field indicates whether Fast Measurement
3427  *              Reporting and Power Control mechanism is used.
3428  *              It is coded as follows:
3429  * Value 0      FPC not in use
3430  *         1    FPC in use
3431  * If the channel mode is such that EPC may be used and the EPC mode
3432  *              field indicates that the channel is in EPC mode, the FPC_EPC
3433  *              field indicates whether EPC shall be used for uplink power control.
3434  * It is coded as follows:
3435  * Value 0      EPC not in use for uplink power control
3436  *               1      EPC in use for uplink power control
3437  *
3438  */
3439 static const true_false_string gsm_a_rr_pow_cmd_fpcepc_value  = {
3440     "FPC in use/EPC in use for uplink power control",
3441     "FPC not in use/C not in use for uplink power control"
3442 };
3443
3444 /*
3445  * Power level (octet 2)The power level field is coded as the binaryRepresentation
3446  * of the "power control level", see 3GPP TS 3GPP TS 45.005. This value shall be used
3447  * by the mobile station According to 3GPP TS 45.008.Range: 0 to 31.
3448  */
3449
3450 static guint16
3451 de_rr_pow_cmd(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3452 {
3453     proto_tree  *subtree;
3454     proto_item  *item;
3455     guint32     curr_offset;
3456
3457     curr_offset = offset;
3458
3459     item =
3460         proto_tree_add_text(tree,
3461                             tvb, curr_offset, 1, "%s",
3462                             gsm_rr_elem_strings[DE_RR_POW_CMD].strptr);
3463
3464     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_POW_CMD]);
3465
3466     proto_tree_add_item(subtree, hf_gsm_a_b8spare, tvb, curr_offset, 1, FALSE);
3467     /*EPC mode */
3468     proto_tree_add_item(subtree, hf_gsm_a_rr_pow_cmd_epc, tvb, curr_offset, 1, FALSE);
3469     /*FPC_EPC*/
3470     proto_tree_add_item(subtree, hf_gsm_a_rr_pow_cmd_fpcepc, tvb, curr_offset, 1, FALSE);
3471     /*POWER LEVEL*/
3472     proto_tree_add_item(subtree, hf_gsm_a_rr_pow_cmd_powlev, tvb, curr_offset, 1, FALSE);
3473
3474     curr_offset = curr_offset + 1;
3475
3476     return(curr_offset - offset);
3477 }
3478
3479 /*
3480  * [3] 10.5.2.28a Power Command and access type
3481  */
3482 static guint16
3483 de_rr_pow_cmd_and_acc_type(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3484 {
3485     proto_tree  *subtree;
3486     proto_item  *item;
3487     guint32     curr_offset;
3488
3489     curr_offset = offset;
3490
3491     item =
3492         proto_tree_add_text(tree,
3493                             tvb, curr_offset, 1, "%s",
3494                             gsm_rr_elem_strings[DE_RR_POW_CMD_AND_ACC_TYPE].strptr);
3495
3496     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_POW_CMD_AND_ACC_TYPE]);
3497
3498     /*ATC */
3499     proto_tree_add_item(subtree, hf_gsm_a_rr_pow_cmd_atc, tvb, curr_offset, 1, FALSE);
3500     /*EPC mode */
3501     proto_tree_add_item(subtree, hf_gsm_a_rr_pow_cmd_epc, tvb, curr_offset, 1, FALSE);
3502     /*FPC_EPC*/
3503     proto_tree_add_item(subtree, hf_gsm_a_rr_pow_cmd_fpcepc, tvb, curr_offset, 1, FALSE);
3504     /*POWER LEVEL*/
3505     proto_tree_add_item(subtree, hf_gsm_a_rr_pow_cmd_powlev, tvb, curr_offset, 1, FALSE);
3506
3507     curr_offset = curr_offset + 1;
3508
3509     return(curr_offset - offset);
3510 }
3511 /*
3512  * [3] 10.5.2.29 RACH Control Parameters
3513  */
3514
3515 static const value_string gsm_a_rr_max_retrans_vals[] = {
3516     {  0, "Maximum 1 retransmission"},
3517     {  1, "Maximum 2 retransmissions"},
3518     {  2, "Maximum 4 retransmissions"},
3519     {  3, "Maximum 7 retransmissions"},
3520     {  0, NULL }
3521 };
3522
3523 static const value_string gsm_a_rr_tx_integer_vals[] = {
3524     {  0, "3 slots used to spread transmission"},
3525     {  1, "4 slots used to spread transmission"},
3526     {  2, "5 slots used to spread transmission"},
3527     {  3, "6 slots used to spread transmission"},
3528     {  4, "7 slots used to spread transmission"},
3529     {  5, "8 slots used to spread transmission"},
3530     {  6, "9 slots used to spread transmission"},
3531     {  7, "10 slots used to spread transmission"},
3532     {  8, "11 slots used to spread transmission"},
3533     {  9, "12 slots used to spread transmission"},
3534     { 10, "14 slots used to spread transmission"},
3535     { 11, "16 slots used to spread transmission"},
3536     { 12, "20 slots used to spread transmission"},
3537     { 13, "25 slots used to spread transmission"},
3538     { 14, "32 slots used to spread transmission"},
3539     { 15, "50 slots used to spread transmission"},
3540     {  0, NULL }
3541 };
3542 static const value_string gsm_a_rr_cell_barr_access_vals[] = {
3543     {  0, "The cell is not barred"},
3544     {  1, "The cell is barred"},
3545     {  0, NULL }
3546 };
3547 static const value_string gsm_a_rr_re_vals[] = {
3548     {  0, "Call Reestablishment allowed in the cell"},
3549     {  1, "Call Reestablishment not allowed in the cell"},
3550     {  0, NULL }
3551 };
3552
3553 static guint16
3554 de_rr_rach_ctrl_param(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3555 {
3556     proto_tree  *subtree;
3557     proto_item  *item;
3558     guint32     curr_offset;
3559
3560     curr_offset = offset;
3561
3562     item = proto_tree_add_text(tree, tvb, curr_offset, 3, "%s",
3563                                gsm_rr_elem_strings[DE_RR_RACH_CTRL_PARAM].strptr);
3564
3565     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_RACH_CTRL_PARAM]);
3566
3567     proto_tree_add_item(subtree, hf_gsm_a_rr_max_retrans, tvb, curr_offset, 1, FALSE);
3568     proto_tree_add_item(subtree, hf_gsm_a_rr_tx_integer, tvb, curr_offset, 1, FALSE);
3569     proto_tree_add_item(subtree, hf_gsm_a_rr_cell_barr_access, tvb, curr_offset, 1, FALSE);
3570     proto_tree_add_item(subtree, hf_gsm_a_rr_re, tvb, curr_offset, 1, FALSE);
3571     curr_offset = curr_offset + 1;
3572
3573     proto_tree_add_item(subtree, hf_gsm_a_rr_acc, tvb, curr_offset, 2, FALSE);
3574
3575     curr_offset = curr_offset + 2;
3576
3577     return(curr_offset - offset);
3578 }
3579 /*
3580  * [3] 10.5.2.30 Request Reference M V 3
3581  */
3582 static guint16 reduced_frame_number(guint16 fn)
3583 {
3584     /* great care needed with signed/unsigned - -1 in unsigned is 0xffff, which mod(26) is not what you think !!! */
3585     gint16      t2, t3, t;
3586     guint16     frame, t1;
3587
3588     t1 = (fn >> 11) & 0x1f;
3589     t2 = (fn >> 0) & 0x1f;
3590     t3 = (fn >> 5) & 0x3f;
3591
3592     t = (t3-t2)%26;
3593     if (t<0)
3594         t += 26;
3595
3596     frame = 51*(unsigned)t+(unsigned)t3+51*26*t1;
3597
3598     return frame;
3599 }
3600
3601 static guint16
3602 de_rr_req_ref(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3603 {
3604     proto_tree  *subtree;
3605     proto_item  *item;
3606     guint32     curr_offset;
3607     guint16     rfn;
3608     guint16     fn;
3609
3610     curr_offset = offset;
3611
3612     item =
3613         proto_tree_add_text(tree,
3614                             tvb, curr_offset, 3, "%s",
3615                             gsm_rr_elem_strings[DE_RR_REQ_REF].strptr);
3616
3617     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_REQ_REF]);
3618
3619     proto_tree_add_item(subtree, hf_gsm_a_rr_ra, tvb, curr_offset, 1, FALSE);
3620     curr_offset++;
3621     fn = tvb_get_ntohs(tvb,curr_offset);
3622     rfn = reduced_frame_number(fn);
3623     proto_tree_add_item(subtree, hf_gsm_a_rr_T1prim, tvb, curr_offset, 1, FALSE);
3624     proto_tree_add_item(subtree, hf_gsm_a_rr_T3, tvb, curr_offset, 2, FALSE);
3625     curr_offset++;
3626     proto_tree_add_item(subtree, hf_gsm_a_rr_T2, tvb, curr_offset, 1, FALSE);
3627     curr_offset++;
3628     item = proto_tree_add_uint(subtree, hf_gsm_a_rr_rfn, tvb, curr_offset-2, 2, rfn);
3629     PROTO_ITEM_SET_GENERATED(item);
3630
3631     return(curr_offset - offset);
3632 }
3633 /*
3634  * [3] 10.5.2.31
3635  */
3636 guint16
3637 de_rr_cause(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3638 {
3639     guint32     curr_offset;
3640
3641     curr_offset = offset;
3642
3643     proto_tree_add_item(tree, hf_gsm_a_rr_RR_cause, tvb, curr_offset, 1, FALSE);
3644
3645     curr_offset++;
3646
3647     return(curr_offset - offset);
3648 }
3649
3650 /*
3651  * [3] 10.5.2.32 SI 1 Rest Octets
3652  */
3653 static const value_string gsm_a_rr_nch_position_vals[] = {
3654     { 0, "No of blocks = 1 and Number of first block = 0"},
3655     { 1, "No of blocks = 1 and Number of first block = 1"},
3656     { 2, "No of blocks = 1 and Number of first block = 2"},
3657     { 3, "No of blocks = 1 and Number of first block = 3"},
3658     { 4, "No of blocks = 1 and Number of first block = 4"},
3659     { 5, "No of blocks = 1 and Number of first block = 5"},
3660     { 6, "No of blocks = 1 and Number of first block = 6"},
3661     { 7, "No of blocks = 1 and Number of first block = 0"},
3662     { 8, "No of blocks = 2 and Number of first block = 1"},
3663     { 9, "No of blocks = 2 and Number of first block = 2"},
3664     {10, "No of blocks = 2 and Number of first block = 3"},
3665     {11, "No of blocks = 2 and Number of first block = 4"},
3666     {12, "No of blocks = 2 and Number of first block = 5"},
3667     {13, "No of blocks = 3 and Number of first block = 0"},
3668     {14, "No of blocks = 3 and Number of first block = 1"},
3669     {15, "No of blocks = 3 and Number of first block = 2"},
3670     {16, "No of blocks = 3 and Number of first block = 3"},
3671     {17, "No of blocks = 3 and Number of first block = 4"},
3672     {18, "No of blocks = 4 and Number of first block = 0"},
3673     {19, "No of blocks = 4 and Number of first block = 1"},
3674     {20, "No of blocks = 4 and Number of first block = 2"},
3675     {21, "No of blocks = 4 and Number of first block = 3"},
3676     {22, "No of blocks = 5 and Number of first block = 0"},
3677     {23, "No of blocks = 5 and Number of first block = 1"},
3678     {24, "No of blocks = 5 and Number of first block = 2"},
3679     {25, "No of blocks = 6 and Number of first block = 0"},
3680     {26, "No of blocks = 6 and Number of first block = 1"},
3681     {27, "No of blocks = 7 and Number of first block = 0"},
3682     {28, "Reserved"},
3683     {29, "Reserved"},
3684     {30, "Reserved"},
3685     {31, "Reserved"},
3686     { 0, NULL }
3687 };
3688
3689 static guint16
3690 de_rr_si1_rest_oct(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
3691 {
3692     proto_tree  *subtree;
3693     proto_item  *item;
3694     guint32     curr_offset;
3695     gint bit_offset;
3696
3697     len = 1;
3698     curr_offset = offset;
3699     bit_offset = curr_offset << 3;
3700
3701     item = proto_tree_add_text(tree, tvb, curr_offset, len, "%s",
3702                                gsm_rr_elem_strings[DE_RR_SI1_REST_OCT].strptr);
3703
3704     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_SI1_REST_OCT]);
3705
3706     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
3707     {
3708         bit_offset += 1;
3709         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_nch_position, tvb, bit_offset, 5, FALSE);
3710         bit_offset += 5;
3711     }
3712     else
3713     {
3714         proto_tree_add_text(subtree,tvb, bit_offset>>3, 1, "NCH position: not present");
3715         bit_offset += 1;
3716     }
3717     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
3718         proto_tree_add_text(subtree,tvb, bit_offset>>3, 1, "Band Indicator: 1900");
3719     else
3720         proto_tree_add_text(subtree,tvb, bit_offset>>3, 1, "Band Indicator: 1800");
3721     bit_offset += 1;
3722
3723     curr_offset = curr_offset + len;
3724
3725     return curr_offset-offset;
3726 }
3727
3728 /*
3729  * [3] 10.5.2.33 SI 2bis Rest Octets
3730  */
3731
3732 /*
3733  * [3] 10.5.2.33a SI 2ter Rest Octets
3734  */
3735 static const value_string gsm_a_rr_qsearch_x_vals[] = {
3736     { 0, "-98 dBm"},
3737     { 1, "-94 dBm"},
3738     { 2, "-90 dBm"},
3739     { 3, "-86 dBm"},
3740     { 4, "-82 dBm"},
3741     { 5, "-78 dBm"},
3742     { 6, "-74 dBm"},
3743     { 7, "Always"},
3744     { 8, "-78 dBm"},
3745     { 9, "-74 dBm"},
3746     {10, "-70 dBm"},
3747     {11, "-66 dBm"},
3748     {12, "-62 dBm"},
3749     {13, "-58 dBm"},
3750     {14, "-54 dBm"},
3751     {15, "Never"},
3752     { 0, NULL }
3753 };
3754
3755 static const value_string gsm_a_rr_xdd_qoffset_vals[] = {
3756     { 0, "always select a cell if acceptable"},
3757     { 1, "-28 dB"},
3758     { 2, "-24 dB"},
3759     { 3, "-20 dB"},
3760     { 4, "-16 dB"},
3761     { 5, "-12 dB"},
3762     { 6, "-8 dB"},
3763     { 7, "-4 dB"},
3764     { 8, "0 dB"},
3765     { 9, "4 dB"},
3766     {10, "8 dB"},
3767     {11, "12 dB"},
3768     {12, "16 dB"},
3769     {13, "20 dB"},
3770     {14, "24 dB"},
3771     {15, "28 dB"},
3772     { 0, NULL }
3773 };
3774
3775 static const value_string gsm_a_rr_fdd_qmin_vals[] = {
3776     { 0, "-20 dB"},
3777     { 1, "-6 dB"},
3778     { 2, "-18 dB"},
3779     { 3, "-8 dB"},
3780     { 4, "-16 dB"},
3781     { 5, "-10 dB"},
3782     { 6, "-14 dB"},
3783     { 7, "-12 dB"},
3784     { 0, NULL }
3785 };
3786
3787 static const value_string gsm_a_rr_fdd_qmin_offset_vals[] = {
3788     { 0, "0 dB"},
3789     { 1, "2 dB"},
3790     { 2, "4 dB"},
3791     { 3, "6 dB"},
3792     { 4, "8 dB"},
3793     { 5, "10 dB"},
3794     { 6, "12 dB"},
3795     { 7, "14 dB"},
3796     { 0, NULL }
3797 };
3798
3799 static const value_string gsm_a_rr_fdd_rscpmin_vals[] = {
3800     { 0, "-114 dBm"},
3801     { 1, "-112 dBm"},
3802     { 2, "-110 dBm"},
3803     { 3, "-108 dBm"},
3804     { 4, "-106 dBm"},
3805     { 5, "-104 dBm"},
3806     { 6, "-102 dBm"},
3807     { 7, "-100 dBm"},
3808     { 8, "-98 dBm"},
3809     { 9, "-96 dBm"},
3810     {10, "-94 dBm"},
3811     {11, "-92 dBm"},
3812     {12, "-90 dBm"},
3813     {13, "-88 dBm"},
3814     {14, "-86 dBm"},
3815     {15, "-84 dBm"},
3816     { 0, NULL }
3817 };
3818
3819 static guint16
3820 de_rr_si2ter_rest_oct(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
3821 {
3822     proto_tree  *subtree, *subtree2;
3823     proto_item  *item, *item2;
3824     guint32     curr_offset;
3825     gint bit_offset, bit_offset_sav;
3826     guint8 value;
3827
3828     len = 4;
3829     curr_offset = offset;
3830     bit_offset = curr_offset<<3;
3831
3832     item = proto_tree_add_text(tree, tvb, curr_offset, len, "%s",
3833                                gsm_rr_elem_strings[DE_RR_SI2TER_REST_OCT].strptr);
3834
3835     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_SI2TER_REST_OCT]);
3836
3837     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
3838     {
3839         bit_offset += 1;
3840         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_si2ter_mp_change_mark, tvb, bit_offset, 1, FALSE);
3841         bit_offset += 1;
3842         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_si2ter_3g_change_mark, tvb, bit_offset, 1, FALSE);
3843         bit_offset += 1;
3844         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_si2ter_index, tvb, bit_offset, 3, FALSE);
3845         bit_offset += 3;
3846         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_si2ter_count, tvb, bit_offset, 3, FALSE);
3847         bit_offset += 3;
3848         value = tvb_get_bits8(tvb,bit_offset,1);
3849         bit_offset += 1;
3850         if (value)
3851         { /* UTRAN FDD Description */
3852             bit_offset_sav = bit_offset;
3853             item2 = proto_tree_add_text(subtree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_UTRAN_FDD_DESC].strptr);
3854             subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_UTRAN_FDD_DESC]);
3855             bit_offset += 2; /* skip '01' bits */
3856             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_fdd_uarfcn, tvb, bit_offset, 14, FALSE);
3857             bit_offset += 14;
3858             value = tvb_get_bits8(tvb,bit_offset,1);
3859             bit_offset += 1;
3860             if (value)
3861             {
3862                 proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_bandwidth_fdd, tvb, bit_offset, 3, FALSE);
3863                 bit_offset += 3;
3864             }
3865             proto_item_set_len(item2,((bit_offset-bit_offset_sav)>>3)+1);
3866         }
3867         value = tvb_get_bits8(tvb,bit_offset,1);
3868         bit_offset += 1;
3869         if (value)
3870         { /* UTRAN TDD Description */
3871             bit_offset_sav = bit_offset;
3872             item2 = proto_tree_add_text(subtree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_UTRAN_TDD_DESC].strptr);
3873             subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_UTRAN_TDD_DESC]);
3874             bit_offset += 2; /* skip '01' bits */
3875             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_tdd_uarfcn, tvb, bit_offset, 14, FALSE);
3876             bit_offset += 14;
3877             value = tvb_get_bits8(tvb,bit_offset,1);
3878             bit_offset += 1;
3879             if (value)
3880             {
3881                 proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_bandwidth_tdd, tvb, bit_offset, 3, FALSE);
3882                 bit_offset += 3;
3883             }
3884             proto_item_set_len(item2,((bit_offset-bit_offset_sav)>>3)+1);
3885         }
3886         value = tvb_get_bits8(tvb,bit_offset,1);
3887         bit_offset += 1;
3888         if (value)
3889         { /* 3G Measurement Parameters Description */
3890             bit_offset_sav = bit_offset;
3891             item2 = proto_tree_add_text(subtree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_3G_MEAS_PARAM_DESC].strptr);
3892             subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_3G_MEAS_PARAM_DESC]);
3893             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_qsearch_i, tvb, bit_offset, 4, FALSE);
3894             bit_offset += 4;
3895             value = tvb_get_bits8(tvb,bit_offset,1);
3896             bit_offset += 1;
3897             if (value)
3898             {
3899                 proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_fdd_qoffset, tvb, bit_offset, 4, FALSE);
3900                 bit_offset += 4;
3901                 proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_fdd_qmin, tvb, bit_offset, 3, FALSE);
3902                 bit_offset += 3;
3903             }
3904             value = tvb_get_bits8(tvb,bit_offset,1);
3905             bit_offset += 1;
3906             if (value)
3907             {
3908                 proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_tdd_qoffset, tvb, bit_offset, 4, FALSE);
3909                 bit_offset += 4;
3910             }
3911             proto_item_set_len(item2,((bit_offset-bit_offset_sav)>>3)+1);
3912         }
3913         if (((curr_offset + len)<<3) - bit_offset > 0)
3914         {
3915             /* There is still room left in the Rest Octets IE */
3916             if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
3917             { /* Additions in release R5 */
3918                 bit_offset += 1;
3919                 value = tvb_get_bits8(tvb,bit_offset,1);
3920                 bit_offset += 1;
3921                 if (value)
3922                 { /* 3G Additional Measurement Parameters Description */
3923                     bit_offset_sav = bit_offset;
3924                     item2 = proto_tree_add_text(subtree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_3G_ADD_MEAS_PARAM_DESC].strptr);
3925                     subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_3G_ADD_MEAS_PARAM_DESC]);
3926                     proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_fdd_qmin_offset, tvb, bit_offset, 3, FALSE);
3927                     bit_offset += 3;
3928                     proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_fdd_rscpmin, tvb, bit_offset, 4, FALSE);
3929                     bit_offset += 4;
3930                     proto_item_set_len(item2,((bit_offset-bit_offset_sav)>>3)+1);
3931                 }
3932             }
3933             else
3934                 bit_offset += 1;
3935         }
3936     }
3937     else
3938     {
3939         bit_offset += 1;
3940         proto_tree_add_text(subtree,tvb, curr_offset, len ,"Empty");
3941     }
3942
3943     curr_offset = curr_offset + len;
3944
3945     return curr_offset-offset;
3946 }
3947
3948 /*
3949  * [3] 10.5.2.33b SI 2quater Rest Octets
3950  */
3951 static const true_false_string gsm_a_rr_gsm_report_type_value = {
3952     "The MS shall use the Measurement Report message for reporting",
3953     "The MS shall use the Enhanced Measurement Report message for reporting if at least one BSIC is allocated to each BA (list) frequency. Otherwise, the Measurement Report message shall be used"
3954 };
3955
3956 static const true_false_string gsm_a_rr_frequency_scrolling_value = {
3957     "Next BSIC in the structure relates to the subsequent frequency in the BA(list)",
3958     "Next BSIC in the structure relates to the same frequency in the BA(list)"
3959 };
3960
3961 static const true_false_string gsm_a_rr_rep_priority_value = {
3962     "High reporting priority",
3963     "Normal reporting priority"
3964 };
3965
3966 static const true_false_string gsm_a_rr_report_type_value = {
3967     "The MS shall use the PACKET MEASUREMENT REPORT message for reporting",
3968     "The MS shall use the PACKET ENHANCED MEASUREMENT REPORT message for reporting"
3969 };
3970
3971 static const true_false_string gsm_a_rr_reporting_rate_value = {
3972     "Reduced reporting rate allowed",
3973     "Normal reporting rate"
3974 };
3975
3976 static const true_false_string gsm_a_rr_invalid_bsic_reporting_value = {
3977     "Report on cells with invalid BSIC and allowed NCC part of BSIC is allowed",
3978     "Report on cells with invalid BSIC and allowed NCC part of BSIC is not allowed"
3979 };
3980
3981 static const value_string gsm_a_rr_scale_ord_vals[] = {
3982     { 0, "An offset of 0 dB shall be used for the reported RXLEV values"},
3983     { 1, "An offset of 10 dB shall be used for the reported RXLEV values"},
3984     { 2, "An automatic offset shall be used for the reported RXLEV values"},
3985     { 0, NULL }
3986 };
3987
3988 static const value_string gsm_a_rr_xxx_reporting_offset_vals[] = {
3989     { 0, "Apply an offset of 0 dB to the reported value when prioritising the cells for reporting"},
3990     { 1, "Apply an offset of 6 dB to the reported value when prioritising the cells for reporting"},
3991     { 2, "Apply an offset of 12 dB to the reported value when prioritising the cells for reporting"},
3992     { 3, "Apply an offset of 18 dB to the reported value when prioritising the cells for reporting"},
3993     { 4, "Apply an offset of 24 dB to the reported value when prioritising the cells for reporting"},
3994     { 5, "Apply an offset of 30 dB to the reported value when prioritising the cells for reporting"},
3995     { 6, "Apply an offset of 36 dB to the reported value when prioritising the cells for reporting"},
3996     { 7, "Apply an offset of 42 dB to the reported value when prioritising the cells for reporting"},
3997     { 0, NULL }
3998 };
3999
4000 static const value_string gsm_a_rr_xxx_reporting_threshold_vals[] = {
4001     { 0, "Apply priority reporting if the reported value is above 0 dB"},
4002     { 1, "Apply priority reporting if the reported value is above 6 dB"},
4003     { 2, "Apply priority reporting if the reported value is above 12 dB"},
4004     { 3, "Apply priority reporting if the reported value is above 18 dB"},
4005     { 4, "Apply priority reporting if the reported value is above 24 dB"},
4006     { 5, "Apply priority reporting if the reported value is above 30 dB"},
4007     { 6, "Apply priority reporting if the reported value is above 36 dB"},
4008     { 7, "Never apply priority reporting"},
4009     { 0, NULL }
4010 };
4011
4012 static const value_string gsm_a_rr_network_control_order_vals[] = {
4013     { 0, "NC0"},
4014     { 1, "NC1"},
4015     { 2, "NC2"},
4016     { 3, "NC0"},
4017     { 0, NULL }
4018 };
4019
4020 static const value_string gsm_a_rr_nc_non_drx_period_vals[] = {
4021     { 0, "No non-DRX mode after a measurement report has been sent"},
4022     { 1, "0,24 s"},
4023     { 2, "0,48 s"},
4024     { 3, "0.72 s"},
4025     { 4, "0.96 s"},
4026     { 5, "1.20 s"},
4027     { 6, "1.44 s"},
4028     { 7, "1.92 s"},
4029     { 0, NULL }
4030 };
4031
4032 static const value_string gsm_a_rr_nc_reporting_period_x_vals[] = {
4033     { 0, "0.48 s"},
4034     { 1, "0.96 s"},
4035     { 2, "1.92 s"},
4036     { 3, "3.84 s"},
4037     { 4, "7.68 s"},
4038     { 5, "15.36 s"},
4039     { 6, "30.72 s"},
4040     { 7, "61.44 s"},
4041     { 0, NULL }
4042 };
4043
4044 static const true_false_string gsm_a_rr_qsearch_c_initial_value = {
4045     "Always",
4046     "use Qsearch I"
4047 };
4048
4049 static const true_false_string gsm_a_rr_fdd_rep_quant_value = {
4050     "Ec/No",
4051     "RSCP"
4052 };
4053
4054 static const true_false_string gsm_a_rr_3g_search_prio_value = {
4055     "3G cells may be searched when BSIC decoding is required",
4056     "3G cells may not be searched when BSIC decoding is required"
4057 };
4058
4059 static const true_false_string gsm_a_rr_3g_ccn_active_value = {
4060     "CCN towards 3G cells is enabled in the cell",
4061     "CCN towards 3G cells is disabled in the cell"
4062 };
4063
4064 static gint
4065 de_rr_si2quater_meas_info_utran_fdd_desc(tvbuff_t *tvb, proto_tree *tree, gint bit_offset)
4066 {
4067     proto_tree *subtree, *subtree2;
4068     proto_item *item, *item2;
4069     gint curr_bit_offset, idx;
4070     gint xdd_cell_info, wsize, nwi, jwi, w[64], i, iused, xdd_indic0;
4071     guint8 value;
4072
4073     curr_bit_offset = bit_offset; 
4074
4075     item = proto_tree_add_text(tree, tvb, curr_bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_UTRAN_FDD_DESC].strptr);
4076     subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_UTRAN_FDD_DESC]);
4077     value = tvb_get_bits8(tvb,curr_bit_offset,1);
4078     curr_bit_offset += 1;
4079     if (value)
4080     {
4081         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_bandwidth_fdd, tvb, curr_bit_offset, 3, FALSE);
4082         curr_bit_offset += 3;
4083     }
4084     value = tvb_get_bits8(tvb,curr_bit_offset,1);
4085     curr_bit_offset += 1;
4086     while (value)
4087     {
4088         curr_bit_offset += 1; /* skip a 0 bit */
4089         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_fdd_uarfcn, tvb, curr_bit_offset, 14, FALSE);
4090         curr_bit_offset += 14;
4091         xdd_indic0 = tvb_get_bits8(tvb,curr_bit_offset,1);
4092         proto_tree_add_text(subtree,tvb, curr_bit_offset>>3, 1, "FDD Indic0: %d", xdd_indic0);
4093         curr_bit_offset += 1;
4094         idx = tvb_get_bits8(tvb,curr_bit_offset,5);
4095         proto_tree_add_text(subtree,tvb, curr_bit_offset>>3, 1, "Nr of FDD Cells : %d", idx);
4096         curr_bit_offset += 5;
4097         idx = convert_n_to_p[idx];
4098         item2 = proto_tree_add_text(subtree,tvb, curr_bit_offset>>3, (idx>>3)+1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_UTRAN_FDD_DESC].strptr);
4099         subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_FDD_CELL_INFORMATION_FIELD]);
4100         proto_tree_add_text(subtree2,tvb, curr_bit_offset>>3, (idx>>3)+1, "Field is %d bits long", idx);
4101         if (xdd_indic0)
4102         {
4103             proto_tree_add_text(subtree2,tvb, curr_bit_offset>>3, 0, "Scrambling Code: %d", 0);
4104             proto_tree_add_text(subtree2,tvb, curr_bit_offset>>3, 0, "Diversity: %d", 0);
4105         }
4106         if (idx)
4107         {
4108             wsize = 10;
4109             nwi = 1;
4110             jwi = 0;
4111             i = 1;
4112
4113             while (idx > 0)
4114             {
4115                 w[i] = tvb_get_bits16(tvb, curr_bit_offset, wsize, FALSE);
4116                 curr_bit_offset += wsize;
4117                 idx -= wsize;
4118                 if (w[i] == 0)
4119                 {
4120                     idx = 0;
4121                     break;
4122                 }
4123                 if (++jwi==nwi)
4124                 {
4125                     jwi = 0;
4126                     nwi <<= 1;
4127                     wsize--;
4128                 }
4129                 i++;
4130             }
4131             if (idx < 0)
4132             {
4133                 curr_bit_offset += idx;
4134             }
4135             iused = i-1;
4136
4137             for (i=1; i <= iused; i++)
4138             {
4139                 xdd_cell_info = f_k(i, w, 1024);
4140                 proto_tree_add_text(subtree2,tvb, curr_bit_offset>>3, 0, "Scrambling Code: %d", xdd_cell_info & 0x01FF);
4141                 proto_tree_add_text(subtree2,tvb, curr_bit_offset>>3, 0, "Diversity: %d", (xdd_cell_info >> 9) & 0x01);
4142             }
4143         }
4144         value = tvb_get_bits8(tvb,curr_bit_offset,1);
4145         curr_bit_offset += 1;
4146     }
4147     proto_item_set_len(item,((curr_bit_offset-bit_offset)>>3)+1);
4148
4149     return (curr_bit_offset - bit_offset);
4150 }
4151
4152 static gint
4153 de_rr_si2quater_meas_info_utran_tdd_desc(tvbuff_t *tvb, proto_tree *tree, gint bit_offset)
4154 {
4155     proto_tree *subtree, *subtree2;
4156     proto_item *item, *item2;
4157     gint curr_bit_offset, idx;
4158     gint xdd_cell_info, wsize, nwi, jwi, w[64], i, iused, xdd_indic0;
4159     guint8 value;
4160
4161     curr_bit_offset = bit_offset; 
4162
4163     item = proto_tree_add_text(tree, tvb, curr_bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_UTRAN_TDD_DESC].strptr);
4164     subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_UTRAN_TDD_DESC]);
4165     value = tvb_get_bits8(tvb,curr_bit_offset,1);
4166     curr_bit_offset += 1;
4167     if (value)
4168     {
4169         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_bandwidth_tdd, tvb, curr_bit_offset, 3, FALSE);
4170         curr_bit_offset += 3;
4171     }
4172     value = tvb_get_bits8(tvb,curr_bit_offset,1);
4173     curr_bit_offset += 1;
4174     while (value)
4175     {
4176         curr_bit_offset += 1; /* skip a 0 bit */
4177         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_tdd_uarfcn, tvb, curr_bit_offset, 14, FALSE);
4178         curr_bit_offset += 14;
4179         xdd_indic0 = tvb_get_bits8(tvb,curr_bit_offset,1);
4180         proto_tree_add_text(subtree,tvb, curr_bit_offset>>3, 1, "TDD Indic0: %d", xdd_indic0);
4181         curr_bit_offset += 1;
4182         idx = tvb_get_bits8(tvb,curr_bit_offset,5);
4183         proto_tree_add_text(subtree,tvb, curr_bit_offset>>3, 1, "Nr of TDD Cells : %d", idx);
4184         curr_bit_offset += 5;
4185         idx = convert_n_to_q[idx];
4186         item2 = proto_tree_add_text(subtree,tvb, curr_bit_offset>>3, (idx>>3)+1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_UTRAN_TDD_DESC].strptr);
4187         subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_TDD_CELL_INFORMATION_FIELD]);
4188         proto_tree_add_text(subtree2,tvb, curr_bit_offset>>3, (idx>>3)+1, "Field is %d bits long", idx);
4189         if (xdd_indic0)
4190         {
4191             proto_tree_add_text(subtree2,tvb, curr_bit_offset>>3, 0, "Cell Parameter: %d", 0);
4192             proto_tree_add_text(subtree2,tvb, curr_bit_offset>>3, 0, "Sync Case TSTD: %d", 0);
4193             proto_tree_add_text(subtree2,tvb, curr_bit_offset>>3, 0, "Diversity TDD: %d", 0);
4194         }
4195         if (idx)
4196         {
4197             wsize = 9;
4198             nwi = 1;
4199             jwi = 0;
4200             i = 1;
4201
4202             while (idx > 0)
4203             {
4204                 w[i] = tvb_get_bits16(tvb, curr_bit_offset, wsize, FALSE);
4205                 curr_bit_offset += wsize;
4206                 idx -= wsize;
4207                 if (w[i] == 0)
4208                 {
4209                     idx = 0;
4210                     break;
4211                 }
4212                 if (++jwi==nwi)
4213                 {
4214                     jwi = 0;
4215                     nwi <<= 1;
4216                     wsize--;
4217                 }
4218                 i++;
4219             }
4220             if (idx < 0)
4221             {
4222                 curr_bit_offset += idx;
4223             }
4224             iused = i-1;
4225
4226             for (i=1; i <= iused; i++)
4227             {
4228                 xdd_cell_info = f_k(i, w, 512);
4229                 proto_tree_add_text(subtree2,tvb, curr_bit_offset>>3, 0, "Cell Parameter: %d", xdd_cell_info & 0x07F);
4230                 proto_tree_add_text(subtree2,tvb, curr_bit_offset>>3, 0, "Sync Case TSTD: %d", (xdd_cell_info >> 7) & 0x01);
4231                 proto_tree_add_text(subtree2,tvb, curr_bit_offset>>3, 0, "Diversity TDD: %d", (xdd_cell_info >> 8) & 0x01);
4232             }
4233         }
4234         value = tvb_get_bits8(tvb,curr_bit_offset,1);
4235         curr_bit_offset += 1;
4236     }
4237     proto_item_set_len(item,((curr_bit_offset-bit_offset)>>3)+1);
4238
4239     return (curr_bit_offset - bit_offset);
4240 }
4241
4242 static gint
4243 de_rr_rtd_desc(tvbuff_t *tvb, proto_tree *tree, gint bit_offset, rr_rest_octets_elem_idx_t id)
4244 {
4245     proto_tree *subtree;
4246     proto_item *item;
4247     gint curr_bit_offset, idx;
4248     guint8 value;
4249
4250     curr_bit_offset = bit_offset;
4251
4252     item = proto_tree_add_text(tree, tvb, curr_bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[id].strptr);
4253     subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[id]);
4254     value = tvb_get_bits8(tvb,curr_bit_offset,1);
4255     curr_bit_offset += 1;
4256     if (value)
4257     {
4258         value = tvb_get_bits8(tvb,curr_bit_offset,1);
4259         curr_bit_offset += 1;
4260         if (value)
4261         {
4262             idx = tvb_get_bits8(tvb,curr_bit_offset,5);
4263             proto_tree_add_text(subtree,tvb, curr_bit_offset>>3, 1, "BA Index Start RTD: %d", idx);
4264             curr_bit_offset += 5;
4265         }
4266         else
4267             idx = 0;
4268         value = tvb_get_bits8(tvb,curr_bit_offset,1);
4269         curr_bit_offset += 1;
4270         while (value == 0)
4271         {
4272             proto_tree_add_text(subtree,tvb, curr_bit_offset>>3, 1, "RTD index %d: %d TDMA frame(s) modulo 51 TDMA frames", idx, tvb_get_bits8(tvb,curr_bit_offset,6));
4273             curr_bit_offset += 6;
4274             value = tvb_get_bits8(tvb,curr_bit_offset,1);
4275             curr_bit_offset += 1;
4276         }
4277         value = tvb_get_bits8(tvb,curr_bit_offset,1);
4278         curr_bit_offset += 1;
4279         while (value == 0)
4280         {
4281             idx += 1;
4282             value = tvb_get_bits8(tvb,curr_bit_offset,1);
4283             curr_bit_offset += 1;
4284             while (value == 0)
4285             {
4286                 proto_tree_add_text(subtree,tvb, curr_bit_offset>>3, 1, "RTD index %d: %d TDMA frame(s) modulo 51 TDMA frames", idx, tvb_get_bits8(tvb,curr_bit_offset,6));
4287                 curr_bit_offset += 6;
4288                 value = tvb_get_bits8(tvb,curr_bit_offset,1);
4289                 curr_bit_offset += 1;
4290             }
4291         }
4292     }
4293     value = tvb_get_bits8(tvb,curr_bit_offset,1);
4294     curr_bit_offset += 1;
4295     if (value)
4296     {
4297         value = tvb_get_bits8(tvb,curr_bit_offset,1);
4298         curr_bit_offset += 1;
4299         if (value)
4300         {
4301             idx = tvb_get_bits8(tvb,curr_bit_offset,5);
4302             proto_tree_add_text(subtree,tvb, curr_bit_offset>>3, 1, "BA Index Start RTD: %d", idx);
4303             curr_bit_offset += 5;
4304         }
4305         else
4306             idx = 0;
4307         value = tvb_get_bits8(tvb,curr_bit_offset,1);
4308         curr_bit_offset += 1;
4309         while (value == 0)
4310         {
4311             proto_tree_add_text(subtree,tvb, curr_bit_offset>>3, 2, "RTD index %d: %d/64 TDMA frame(s) modulo 51 TDMA frames", idx, tvb_get_bits16(tvb,curr_bit_offset,12,FALSE));
4312             curr_bit_offset += 12;
4313             value = tvb_get_bits8(tvb,curr_bit_offset,1);
4314             curr_bit_offset += 1;
4315         }
4316         value = tvb_get_bits8(tvb,curr_bit_offset,1);
4317         curr_bit_offset += 1;
4318         while (value == 0)
4319         {
4320             idx += 1;
4321             value = tvb_get_bits8(tvb,curr_bit_offset,1);
4322             curr_bit_offset += 1;
4323             while (value == 0)
4324             {
4325                 proto_tree_add_text(subtree,tvb, curr_bit_offset>>3, 2, "RTD index %d: %d/64 TDMA frame(s) modulo 51 TDMA frames", idx, tvb_get_bits16(tvb,curr_bit_offset,12,FALSE));
4326                 curr_bit_offset += 12;
4327                 value = tvb_get_bits8(tvb,curr_bit_offset,1);
4328                 curr_bit_offset += 1;
4329             }
4330         }
4331     }
4332     proto_item_set_len(item,((curr_bit_offset-bit_offset)>>3)+1);
4333
4334     return (curr_bit_offset - bit_offset);
4335 }
4336
4337 static gint
4338 de_rr_bsic_desc(tvbuff_t *tvb, proto_tree *tree, gint bit_offset, rr_rest_octets_elem_idx_t id)
4339 {
4340     proto_tree *subtree;
4341     proto_item *item;
4342     gint curr_bit_offset, idx;
4343     guint8 value;
4344
4345     curr_bit_offset = bit_offset;
4346     item = proto_tree_add_text(tree, tvb, curr_bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[id].strptr);
4347     subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[id]);
4348     value = tvb_get_bits8(tvb,curr_bit_offset,1);
4349     curr_bit_offset += 1;
4350     if (value)
4351     {
4352         proto_tree_add_text(subtree,tvb, curr_bit_offset>>3, 1, "BA Index Start BSIC: %d", tvb_get_bits8(tvb,curr_bit_offset,5));
4353         curr_bit_offset += 5;
4354     }
4355     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_bsic, tvb, bit_offset, 6, FALSE);
4356     curr_bit_offset += 6;
4357     idx = tvb_get_bits8(tvb,curr_bit_offset,7);
4358     proto_tree_add_text(subtree,tvb, curr_bit_offset>>3, 1, "Number Remaining BSIC: %d", idx);
4359     curr_bit_offset += 7;
4360     while (idx)
4361     {
4362         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_frequency_scrolling, tvb, curr_bit_offset, 1, FALSE);
4363         curr_bit_offset += 1;
4364         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_bsic, tvb, bit_offset, 6, FALSE);
4365         curr_bit_offset += 6;
4366         idx -= 1;
4367     }
4368     proto_item_set_len(item,((curr_bit_offset-bit_offset)>>3)+1);
4369
4370     return(curr_bit_offset - bit_offset);
4371 }
4372
4373 static gint
4374 de_rr_report_priority_desc(tvbuff_t *tvb, proto_tree *tree, gint bit_offset, rr_rest_octets_elem_idx_t id)
4375 {
4376     proto_tree *subtree;
4377     proto_item *item;
4378     gint curr_bit_offset, idx;
4379
4380     curr_bit_offset = bit_offset;
4381
4382     item = proto_tree_add_text(tree, tvb, curr_bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[id].strptr);
4383     subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[id]);
4384     idx = tvb_get_bits8(tvb,curr_bit_offset,7);
4385     proto_tree_add_text(subtree,tvb, curr_bit_offset>>3, 1, "Number Cells: %d", idx);
4386     curr_bit_offset += 7;
4387     while (idx)
4388     {
4389         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_rep_priority, tvb, curr_bit_offset, 1, FALSE);
4390         curr_bit_offset += 1;
4391         idx -= 1;
4392     }
4393     proto_item_set_len(item,((curr_bit_offset-bit_offset)>>3)+1);
4394
4395     return(curr_bit_offset - bit_offset);
4396 }
4397
4398 static gint
4399 de_rr_meas_param_desc(tvbuff_t *tvb, proto_tree *tree, gint bit_offset, rr_rest_octets_elem_idx_t id)
4400 {
4401     proto_tree *subtree;
4402     proto_item *item;
4403     gint curr_bit_offset;
4404     guint8 value;
4405
4406     curr_bit_offset = bit_offset;
4407     item = proto_tree_add_text(tree, tvb, curr_bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[id].strptr);
4408     subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[id]);
4409     if (id == DE_RR_REST_OCTETS_GPRS_MEAS_PARAM_DESC)
4410     {
4411         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_report_type, tvb, curr_bit_offset, 1, FALSE);
4412         curr_bit_offset += 1;
4413         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_reporting_rate, tvb, curr_bit_offset, 1, FALSE);
4414         curr_bit_offset +=1;
4415         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_invalid_bsic_reporting, tvb, curr_bit_offset, 1, FALSE);
4416         curr_bit_offset +=1;
4417     }
4418     value = tvb_get_bits8(tvb,curr_bit_offset,1);
4419     curr_bit_offset += 1;
4420     if (value)
4421     {
4422         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_multiband_reporting, tvb, curr_bit_offset, 2, FALSE);
4423         curr_bit_offset += 2;
4424     }
4425     value = tvb_get_bits8(tvb,curr_bit_offset,1);
4426     curr_bit_offset += 1;
4427     if (value)
4428     {
4429         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_serving_band_reporting, tvb, curr_bit_offset, 2, FALSE);
4430         curr_bit_offset += 2;
4431     }
4432     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_scale_ord, tvb, curr_bit_offset, 2, FALSE);
4433     curr_bit_offset += 2;
4434     value = tvb_get_bits8(tvb,curr_bit_offset,1);
4435     curr_bit_offset += 1;
4436     if (value)
4437     {
4438         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_900_reporting_offset, tvb, curr_bit_offset, 3, FALSE);
4439         curr_bit_offset += 3;
4440         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_900_reporting_threshold, tvb, curr_bit_offset, 3, FALSE);
4441         curr_bit_offset += 3;
4442     }
4443     value = tvb_get_bits8(tvb,curr_bit_offset,1);
4444     curr_bit_offset += 1;
4445     if (value)
4446     {
4447         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_1800_reporting_offset, tvb, curr_bit_offset, 3, FALSE);
4448         curr_bit_offset += 3;
4449         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_1800_reporting_threshold, tvb, curr_bit_offset, 3, FALSE);
4450         curr_bit_offset += 3;
4451     }
4452     value = tvb_get_bits8(tvb,curr_bit_offset,1);
4453     curr_bit_offset += 1;
4454     if (value)
4455     {
4456         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_400_reporting_offset, tvb, curr_bit_offset, 3, FALSE);
4457         curr_bit_offset += 3;
4458         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_400_reporting_threshold, tvb, curr_bit_offset, 3, FALSE);
4459         curr_bit_offset += 3;
4460     }
4461     value = tvb_get_bits8(tvb,curr_bit_offset,1);
4462     curr_bit_offset += 1;
4463     if (value)
4464     {
4465         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_1900_reporting_offset, tvb, curr_bit_offset, 3, FALSE);
4466         curr_bit_offset += 3;
4467         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_1900_reporting_threshold, tvb, curr_bit_offset, 3, FALSE);
4468         curr_bit_offset += 3;
4469     }
4470     value = tvb_get_bits8(tvb,curr_bit_offset,1);
4471     curr_bit_offset += 1;
4472     if (value)
4473     {
4474         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_850_reporting_offset, tvb, curr_bit_offset, 3, FALSE);
4475         curr_bit_offset += 3;
4476         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_850_reporting_threshold, tvb, curr_bit_offset, 3, FALSE);
4477         curr_bit_offset += 3;
4478     }
4479     proto_item_set_len(item,((curr_bit_offset-bit_offset)>>3)+1);
4480
4481     return(curr_bit_offset - bit_offset);
4482 }
4483
4484 static gint
4485 de_rr_3g_add_meas_param_desc2(tvbuff_t *tvb, proto_tree *tree, gint bit_offset)
4486 {
4487     proto_tree *subtree;
4488     proto_item *item;
4489     gint curr_bit_offset;
4490     guint8 value;
4491
4492     curr_bit_offset = bit_offset;
4493     item = proto_tree_add_text(tree, tvb, curr_bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_3G_ADD_MEAS_PARAM_DESC2].strptr);
4494     subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_3G_ADD_MEAS_PARAM_DESC2]);
4495     value = tvb_get_bits8(tvb,curr_bit_offset,1);
4496     curr_bit_offset += 1;
4497     if (value)
4498     {
4499         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_fdd_reporting_threshold_2, tvb, curr_bit_offset, 6, FALSE);
4500         curr_bit_offset += 6;
4501     }
4502     proto_item_set_len(item,((curr_bit_offset-bit_offset)>>3)+1);
4503
4504     return(curr_bit_offset - bit_offset);
4505 }
4506
4507 static guint16
4508 de_rr_si2quater_rest_oct(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
4509 {
4510     proto_tree  *subtree, *subtree2, *subtree3;
4511     proto_item  *item, *item2, *item3;
4512     guint32     curr_offset;
4513     gint bit_offset, bit_offset_sav, idx;
4514     guint8 value;
4515
4516     len = 20;
4517     curr_offset = offset;
4518     bit_offset = curr_offset<<3;
4519
4520     item = proto_tree_add_text(tree, tvb, curr_offset, len, "%s",
4521                                gsm_rr_elem_strings[DE_RR_SI2QUATER_REST_OCT].strptr);
4522
4523     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_SI2QUATER_REST_OCT]);
4524
4525     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_ba_ind, tvb, bit_offset, 1, FALSE);
4526     bit_offset += 1;
4527     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_3g_ba_ind, tvb, bit_offset, 1, FALSE);
4528     bit_offset += 1;
4529     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_mp_change_mark, tvb, bit_offset, 1, FALSE);
4530     bit_offset += 1;
4531     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_si2quater_index, tvb, bit_offset, 4, FALSE);
4532     bit_offset += 4;
4533     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_si2quater_count, tvb, bit_offset, 4, FALSE);
4534     bit_offset += 4;
4535     value = tvb_get_bits8(tvb,bit_offset,1);
4536     bit_offset += 1;
4537     if (value)
4538     { /* Measurement Parameters Description */
4539         bit_offset_sav = bit_offset;
4540         item2 = proto_tree_add_text(subtree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_MEAS_PARAM_DESC].strptr);
4541         subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_MEAS_PARAM_DESC]);
4542         proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_gsm_report_type, tvb, bit_offset, 1, FALSE);
4543         bit_offset += 1;
4544         proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_serving_band_reporting, tvb, bit_offset, 2, FALSE);
4545         bit_offset += 2;
4546         proto_item_set_len(item2,((bit_offset-bit_offset_sav)>>3)+1);
4547     }
4548     value  = tvb_get_bits8(tvb,bit_offset,1);
4549     bit_offset += 1;
4550     if (value)
4551     { /* GPRS Real Time Difference Description */
4552         bit_offset += de_rr_rtd_desc(tvb, subtree, bit_offset, DE_RR_REST_OCTETS_GPRS_RTD_DESC);
4553
4554     }
4555     value  = tvb_get_bits8(tvb,bit_offset,1);
4556     bit_offset += 1;
4557     if (value)
4558     { /* GPRS BSIC Description */
4559         bit_offset += de_rr_bsic_desc(tvb, subtree, bit_offset, DE_RR_REST_OCTETS_GPRS_BSIC_DESC);
4560     }
4561     value  = tvb_get_bits8(tvb,bit_offset,1);
4562     bit_offset += 1;
4563     if (value)
4564     { /* GPRS Report Priority Description */
4565         bit_offset += de_rr_report_priority_desc(tvb, subtree, bit_offset, DE_RR_REST_OCTETS_GPRS_REPORT_PRIO_DESC);
4566     }
4567     value  = tvb_get_bits8(tvb,bit_offset,1);
4568     bit_offset += 1;
4569     if (value)
4570     { /* GPRS Measurement Parameters Description */
4571         bit_offset += de_rr_meas_param_desc(tvb, subtree, bit_offset, DE_RR_REST_OCTETS_GPRS_MEAS_PARAM_DESC);
4572     }
4573     value = tvb_get_bits8(tvb,bit_offset,1);
4574     bit_offset += 1;
4575     if (value)
4576     { /* NC Measurement Parameters */
4577         bit_offset_sav = bit_offset;
4578         item2 = proto_tree_add_text(subtree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_NC_MEAS_PARAM].strptr);
4579         subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_NC_MEAS_PARAM]);
4580         proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_network_control_order, tvb, bit_offset, 2, FALSE);
4581         bit_offset += 2;
4582         value = tvb_get_bits8(tvb,bit_offset,1);
4583         bit_offset += 1;
4584         if (value)
4585         {
4586             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_nc_non_drx_period, tvb, bit_offset, 3, FALSE);
4587             bit_offset += 3;
4588             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_nc_reporting_period_i, tvb, bit_offset, 3, FALSE);
4589             bit_offset += 3;
4590             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_nc_reporting_period_t, tvb, bit_offset, 3, FALSE);
4591             bit_offset += 3;
4592         }
4593         proto_item_set_len(item2,((bit_offset-bit_offset_sav)>>3)+1);
4594     }
4595     value = tvb_get_bits8(tvb,bit_offset,1);
4596     bit_offset += 1;
4597     if (value)
4598     { /* SI 2quater Extension Information */
4599         bit_offset_sav = bit_offset;
4600         item2 = proto_tree_add_text(subtree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_SI2Q_EXT_INFO].strptr);
4601         subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_SI2Q_EXT_INFO]);
4602         idx = tvb_get_bits8(tvb,bit_offset,8);
4603         proto_tree_add_text(subtree2,tvb, bit_offset>>3, 1, "Extension Length: %d", idx);
4604         bit_offset += 8;
4605         proto_item_set_len(item2,((bit_offset+idx+1-bit_offset_sav)>>3)+1);
4606         value = tvb_get_bits8(tvb,bit_offset,1);
4607         bit_offset += 1;
4608         if (value)
4609         { /* CCN Support Description */
4610             bit_offset_sav = bit_offset;
4611             item3 = proto_tree_add_text(subtree2, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_CCN_SUPPORT_DESC].strptr);
4612             subtree3 = proto_item_add_subtree(item3, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_CCN_SUPPORT_DESC]);
4613             value = tvb_get_bits8(tvb,bit_offset,7);
4614             proto_tree_add_text(subtree3,tvb, bit_offset>>3, 1, "Number Cells: %d", value);
4615             bit_offset += 7;
4616             idx -= 7;
4617             item2 = proto_tree_add_text(subtree3,tvb, bit_offset>>3, (value>>3)+1, "CCN Supported: ");
4618             while (value)
4619             {
4620                 proto_item_append_text(item2,"%d",tvb_get_bits8(tvb,bit_offset,1));
4621                 bit_offset += 1;
4622                 value -= 1;
4623                 idx -= 1;
4624             }
4625             proto_item_set_len(item3,((bit_offset+-bit_offset_sav)>>3)+1);
4626         }
4627         bit_offset += idx;
4628     }
4629     value = tvb_get_bits8(tvb,bit_offset,1);
4630     bit_offset += 1;
4631     if (value)
4632     { /* 3G Neighbour Cell Description */
4633         bit_offset_sav = bit_offset;
4634         item2 = proto_tree_add_text(subtree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_3G_NEIGH_CELL_DESC].strptr);
4635         subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_3G_NEIGH_CELL_DESC]);
4636         value = tvb_get_bits8(tvb,bit_offset,1);
4637         bit_offset += 1;
4638         if (value)
4639         {
4640             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_index_start_3g, tvb, bit_offset, 7, FALSE);
4641             bit_offset += 7;
4642         }
4643         value = tvb_get_bits8(tvb,bit_offset,1);
4644         bit_offset += 1;
4645         if (value)
4646         {
4647             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_absolute_index_start_emr, tvb, bit_offset, 7, FALSE);
4648             bit_offset += 7;
4649         }
4650         value = tvb_get_bits8(tvb,bit_offset,1);
4651         bit_offset += 1;
4652         if (value)
4653         { /* UTRAN FDD Description */
4654             bit_offset += de_rr_si2quater_meas_info_utran_fdd_desc(tvb, subtree2, bit_offset);
4655         }
4656         value = tvb_get_bits8(tvb,bit_offset,1);
4657         bit_offset += 1;
4658         if (value)
4659         { /* UTRAN TDD Description */
4660             bit_offset += de_rr_si2quater_meas_info_utran_tdd_desc(tvb, subtree2, bit_offset);
4661         }
4662         proto_item_set_len(item2,((bit_offset-bit_offset_sav)>>3)+1);
4663     }
4664     value = tvb_get_bits8(tvb,bit_offset,1);
4665     bit_offset += 1;
4666     if (value)
4667     { /* 3G Measurement Parameters Description */
4668         bit_offset_sav = bit_offset;
4669         item2 = proto_tree_add_text(subtree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_3G_MEAS_PARAM_DESC].strptr);
4670         subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_3G_MEAS_PARAM_DESC]);
4671         proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_qsearch_i, tvb, bit_offset, 4, FALSE);
4672         bit_offset += 4;
4673         proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_qsearch_c_initial, tvb, bit_offset, 1, FALSE);
4674         bit_offset += 1;
4675         value = tvb_get_bits8(tvb,bit_offset,1);
4676         bit_offset += 1;
4677         if (value)
4678         {
4679             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_fdd_qoffset, tvb, bit_offset, 4, FALSE);
4680             bit_offset += 4;
4681             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_fdd_rep_quant, tvb, bit_offset, 1, FALSE);
4682             bit_offset += 1;
4683             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_fdd_multirat_reporting, tvb, bit_offset, 2, FALSE);
4684             bit_offset += 2;
4685             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_fdd_qmin, tvb, bit_offset, 3, FALSE);
4686             bit_offset += 3;
4687         }
4688         value = tvb_get_bits8(tvb,bit_offset,1);
4689         bit_offset += 1;
4690         if (value)
4691         {
4692             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_tdd_qoffset, tvb, bit_offset, 4, FALSE);
4693             bit_offset += 4;
4694             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_tdd_multirat_reporting, tvb, bit_offset, 2, FALSE);
4695             bit_offset += 2;
4696         }
4697         proto_item_set_len(item2,((bit_offset-bit_offset_sav)>>3)+1);
4698     }
4699     value = tvb_get_bits8(tvb,bit_offset,1);
4700     bit_offset += 1;
4701     if (value)
4702     { /* GPRS 3G Measurement Parameters Description */
4703         bit_offset_sav = bit_offset;
4704         item2 = proto_tree_add_text(subtree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_GPRS_3G_MEAS_PARAM_DESC].strptr);
4705         subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_GPRS_3G_MEAS_PARAM_DESC]);
4706         proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_qsearch_p, tvb, bit_offset, 4, FALSE);
4707         bit_offset += 4;
4708         proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_3g_search_prio, tvb, bit_offset, 1, FALSE);
4709         bit_offset += 1;
4710         value = tvb_get_bits8(tvb,bit_offset,1);
4711         bit_offset += 1;
4712         if (value)
4713         {
4714             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_fdd_rep_quant, tvb, bit_offset, 1, FALSE);
4715             bit_offset += 1;
4716             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_fdd_multirat_reporting, tvb, bit_offset, 2, FALSE);
4717             bit_offset += 2;
4718         }
4719         value = tvb_get_bits8(tvb,bit_offset,1);
4720         bit_offset += 1;
4721         if (value)
4722         {
4723             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_fdd_reporting_offset, tvb, bit_offset, 3, FALSE);
4724             bit_offset += 3;
4725             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_fdd_reporting_threshold, tvb, bit_offset, 3, FALSE);
4726             bit_offset += 3;
4727         }
4728         value = tvb_get_bits8(tvb,bit_offset,1);
4729         bit_offset += 1;
4730         if (value)
4731         {
4732             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_tdd_multirat_reporting, tvb, bit_offset, 2, FALSE);
4733             bit_offset += 2;
4734         }
4735         value = tvb_get_bits8(tvb,bit_offset,1);
4736         bit_offset += 1;
4737         if (value)
4738         {
4739             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_tdd_reporting_offset, tvb, bit_offset, 3, FALSE);
4740             bit_offset += 3;
4741             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_tdd_reporting_threshold, tvb, bit_offset, 3, FALSE);
4742             bit_offset += 3;
4743         }
4744         proto_item_set_len(item2,((bit_offset-bit_offset_sav)>>3)+1);
4745     }
4746     if (((curr_offset + len)<<3) - bit_offset > 0)
4747     {
4748         /* There is still room left in the Rest Octets IE */
4749         if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
4750         { /* Additions in Rel-5 */
4751             bit_offset += 1;
4752             value = tvb_get_bits8(tvb,bit_offset,1);
4753             bit_offset += 1;
4754             if (value)
4755             { /* 3G Additional Measurement Parameters Description */
4756                 bit_offset_sav = bit_offset;
4757                 item2 = proto_tree_add_text(subtree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_3G_ADD_MEAS_PARAM_DESC].strptr);
4758                 subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_3G_ADD_MEAS_PARAM_DESC]);
4759                 proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_fdd_qmin_offset, tvb, bit_offset, 3, FALSE);
4760                 bit_offset += 3;
4761                 proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_fdd_rscpmin, tvb, bit_offset, 4, FALSE);
4762                 bit_offset += 4;
4763                 proto_item_set_len(item2,((bit_offset-bit_offset_sav)>>3)+1);
4764             }
4765             value = tvb_get_bits8(tvb,bit_offset,1);
4766             bit_offset += 1;
4767             if (value)
4768             { /* 3G Additional Measurement Parameters Description 2 */
4769                 bit_offset += de_rr_3g_add_meas_param_desc2(tvb, subtree, bit_offset);
4770             }
4771             if (((curr_offset + len)<<3) - bit_offset > 0)
4772             {
4773                 /* There is still room left in the Rest Octets IE */
4774                 if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
4775                 { /* Additions in Rel-6 */
4776                     bit_offset += 1;
4777                     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_3g_ccn_active, tvb, bit_offset, 1, FALSE);
4778                     bit_offset += 1;
4779                     if (((curr_offset + len)<<3) - bit_offset > 0)
4780                     {
4781                         /* There is still room left in the Rest Octets IE */
4782                         if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
4783                         { /* Additions in Rel-7 */
4784                             bit_offset += 1;
4785                             value = tvb_get_bits8(tvb,bit_offset,1);
4786                             bit_offset += 1;
4787                             if (value)
4788                             {
4789                                 proto_tree_add_bits_item(subtree, hf_gsm_a_rr_700_reporting_offset, tvb, bit_offset, 3, FALSE);
4790                                 bit_offset += 3;
4791                                 proto_tree_add_bits_item(subtree, hf_gsm_a_rr_700_reporting_threshold, tvb, bit_offset, 3, FALSE);
4792                                 bit_offset += 3;
4793                             }
4794                             value = tvb_get_bits8(tvb,bit_offset,1);
4795                             bit_offset += 1;
4796                             if (value)
4797                             {
4798                                 proto_tree_add_bits_item(subtree, hf_gsm_a_rr_810_reporting_offset, tvb, bit_offset, 3, FALSE);
4799                                 bit_offset += 3;
4800                                 proto_tree_add_bits_item(subtree, hf_gsm_a_rr_810_reporting_threshold, tvb, bit_offset, 3, FALSE);
4801                                 bit_offset += 3;
4802                             }
4803                         }
4804                         else
4805                             bit_offset += 1;
4806                     }
4807                 }
4808                 else
4809                     bit_offset += 1;
4810             }
4811         }
4812         else bit_offset += 1;
4813     }
4814
4815     curr_offset = curr_offset + len;
4816
4817     return curr_offset-offset;
4818 }
4819
4820 /*
4821  * [3] 10.5.2.34 SI 3 Rest Octets
4822  */
4823 static const value_string gsm_a_rr_temporary_offset_vals[] = {
4824     { 0, "0 dB"},
4825     { 1, "10 dB"},
4826     { 2, "20 dB"},
4827     { 3, "30 dB"},
4828     { 4, "40 dB"},
4829     { 5, "50 dB"},
4830     { 6, "60 dB"},
4831     { 7, "infinity"},
4832     { 0, NULL }
4833 };
4834
4835 static const value_string gsm_a_rr_cell_reselect_offset_vals[] = {
4836     { 0, "0 dB"},
4837     { 1, "2 dB"},
4838     { 2, "4 dB"},
4839     { 3, "6 dB"},
4840     { 4, "8 dB"},
4841     { 5, "10 dB"},
4842     { 6, "12 dB"},
4843     { 7, "14 dB"},
4844     { 8, "16 dB"},
4845     { 9, "18 dB"},
4846     {10, "20 dB"},
4847     {11, "22 dB"},
4848     {12, "24 dB"},
4849     {13, "26 dB"},
4850     {14, "28 dB"},
4851     {15, "30 dB"},
4852     {16, "32 dB"},
4853     {17, "34 dB"},
4854     {18, "36 dB"},
4855     {19, "38 dB"},
4856     {20, "40 dB"},
4857     {21, "42 dB"},
4858     {22, "44 dB"},
4859     {23, "46 dB"},
4860     {24, "48 dB"},
4861     {25, "50 dB"},
4862     {26, "52 dB"},
4863     {27, "54 dB"},
4864     {28, "56 dB"},
4865     {29, "58 dB"},
4866     {30, "60 dB"},
4867     {31, "62 dB"},
4868     {32, "64 dB"},
4869     {33, "66 dB"},
4870     {34, "68 dB"},
4871     {35, "70 dB"},
4872     {36, "72 dB"},
4873     {37, "74 dB"},
4874     {38, "76 dB"},
4875     {39, "78 dB"},
4876     {40, "80 dB"},
4877     {41, "82 dB"},
4878     {42, "84 dB"},
4879     {43, "86 dB"},
4880     {44, "88 dB"},
4881     {45, "90 dB"},
4882     {46, "92 dB"},
4883     {47, "94 dB"},
4884     {48, "96 dB"},
4885     {49, "98 dB"},
4886     {50, "100 dB"},
4887     {51, "102 dB"},
4888     {52, "104 dB"},
4889     {53, "106 dB"},
4890     {54, "108 dB"},
4891     {55, "110 dB"},
4892     {56, "112 dB"},
4893     {57, "114 dB"},
4894     {58, "116 dB"},
4895     {59, "118 dB"},
4896     {60, "120 dB"},
4897     {61, "122 dB"},
4898     {62, "124 dB"},
4899     {63, "126 dB"},
4900     { 0, NULL }
4901 };
4902
4903 static const value_string gsm_a_rr_penalty_time_vals[] = {
4904     { 0, "20 s"},
4905     { 1, "40 s"},
4906     { 2, "60 s"},
4907     { 3, "80 s"},
4908     { 4, "100 s"},
4909     { 5, "120 s"},
4910     { 6, "140 s"},
4911     { 7, "160 s"},
4912     { 8, "180 s"},
4913     { 9, "200 s"},
4914     {10, "220 s"},
4915     {11, "240 s"},
4916     {12, "260 s"},
4917     {13, "280 s"},
4918     {14, "300 s"},
4919     {15, "320 s"},
4920     {16, "340 s"},
4921     {17, "360 s"},
4922     {18, "380 s"},
4923     {19, "400 s"},
4924     {20, "420 s"},
4925     {21, "440 s"},
4926     {22, "460 s"},
4927     {23, "480 s"},
4928     {24, "500 s"},
4929     {25, "520 s"},
4930     {26, "540 s"},
4931     {27, "560 s"},
4932     {28, "580 s"},
4933     {29, "600 s"},
4934     {30, "620 s"},
4935     {31, "Cell Reselect Offset is subtracted from C2 and Temporary Offset is ignored"},
4936     { 0, NULL }
4937 };
4938
4939 static gint
4940 de_rr_rest_oct_opt_sel_param(tvbuff_t *tvb, proto_tree *tree, gint bit_offset)
4941 {
4942     proto_tree *subtree;
4943     proto_item *item;
4944     gint curr_bit_offset;
4945
4946     curr_bit_offset = bit_offset;
4947
4948     if (gsm_a_rr_is_bit_high(tvb,curr_bit_offset) == TRUE)
4949     { /* Selection Parameters */
4950         curr_bit_offset += 1;
4951         item = proto_tree_add_text(tree, tvb, curr_bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_OPTIONAL_SEL_PARAM].strptr);
4952         subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_OPTIONAL_SEL_PARAM]);
4953         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_cbq, tvb, curr_bit_offset, 1, FALSE);
4954         curr_bit_offset += 1;
4955         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_cell_reselect_offset, tvb, curr_bit_offset, 6, FALSE);
4956         curr_bit_offset += 6;
4957         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_temporary_offset, tvb, curr_bit_offset, 3, FALSE);
4958         curr_bit_offset += 3;
4959         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_penalty_time, tvb, curr_bit_offset, 5, FALSE);
4960         curr_bit_offset += 5;
4961         proto_item_set_len(item,((curr_bit_offset-bit_offset)>>3)+1);
4962     }
4963     else
4964         curr_bit_offset += 1;
4965
4966     return (curr_bit_offset - bit_offset);
4967 }
4968
4969 static const value_string gsm_a_rr_si13_position_vals[] = {
4970     { 0, "SYSTEM INFORMATION TYPE 13 message is sent on BCCH Norm"},
4971     { 1, "SYSTEM INFORMATION TYPE 13 message is sent on BCCH Ext"},
4972     { 0, NULL }
4973 };
4974
4975 static gint
4976 de_rr_rest_oct_gprs_indicator(tvbuff_t *tvb, proto_tree *tree, gint bit_offset)
4977 {
4978     proto_tree *subtree;
4979     proto_item *item;
4980     gint curr_bit_offset;
4981
4982     curr_bit_offset = bit_offset;
4983
4984     item = proto_tree_add_text(tree, tvb, curr_bit_offset>>3, 1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_GPRS_INDICATOR].strptr);
4985     subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_GPRS_INDICATOR]);
4986     proto_tree_add_text(subtree, tvb, curr_bit_offset>>3, 1, "RA Colour: %d",tvb_get_bits8(tvb,curr_bit_offset,3));
4987     curr_bit_offset += 3;
4988     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_si13_position, tvb, curr_bit_offset, 1, FALSE);
4989     curr_bit_offset += 1;
4990
4991     return (curr_bit_offset - bit_offset);
4992 }
4993
4994 static const value_string gsm_a_rr_power_offset_vals[] = {
4995     { 0, "0 dB"},
4996     { 1, "2 dB"},
4997     { 2, "4 dB"},
4998     { 3, "8 dB"},
4999     { 0, NULL }
5000 };
5001
5002 static const true_false_string gsm_a_rr_si2quater_position_value = {
5003     "SYSTEM INFORMATION TYPE 2 quater message is sent on BCCH Ext",
5004     "SYSTEM INFORMATION TYPE 2 quater message is sent on BCCH Norm"
5005 };
5006
5007 static const true_false_string gsm_a_rr_si13alt_position_value = {
5008     "If Iu mode is supported in the cell, SYSTEM INFORMATION TYPE 13alt message is sent on BCCH Ext",
5009     "If Iu mode is supported in the cell, SYSTEM INFORMATION TYPE 13alt message is sent on BCCH Norm"
5010 };
5011
5012 static guint16
5013 de_rr_si3_rest_oct(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
5014 {
5015     proto_tree  *subtree;
5016     proto_item  *item;
5017     guint32     curr_offset;
5018     gint bit_offset;
5019     gboolean gprs_indicator;
5020
5021     len = 4;
5022     curr_offset = offset;
5023     bit_offset = curr_offset << 3;
5024
5025     item = proto_tree_add_text(tree, tvb, curr_offset, len, "%s",
5026                                gsm_rr_elem_strings[DE_RR_SI3_REST_OCT].strptr);
5027
5028     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_SI3_REST_OCT]);
5029
5030     bit_offset += de_rr_rest_oct_opt_sel_param(tvb, subtree, bit_offset);
5031
5032     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5033     { /* Optional Power Offset */
5034         bit_offset += 1;
5035         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_power_offset, tvb, bit_offset, 2, FALSE);
5036         bit_offset += 2;
5037     }
5038     else
5039         bit_offset += 1;
5040     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5041         proto_tree_add_text(subtree, tvb, bit_offset>>3, 1, "SYSTEM INFORMATION TYPE 2ter message is available");
5042     else
5043         proto_tree_add_text(subtree, tvb, bit_offset>>3, 1, "SYSTEM INFORMATION TYPE 2ter message is not available");
5044     bit_offset += 1;
5045     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5046         proto_tree_add_text(subtree, tvb, bit_offset>>3, 1, "Early Classmark Sending is allowed");
5047     else
5048         proto_tree_add_text(subtree, tvb, bit_offset>>3, 1, "Early Classmark Sending is forbidden");
5049     bit_offset += 1;
5050     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5051     { /* Scheduling if and where */
5052         bit_offset += 1;
5053         proto_tree_add_text(subtree, tvb, bit_offset>>3, 1, "Where: %d",tvb_get_bits8(tvb,bit_offset,3));
5054         bit_offset += 3;
5055     }
5056     else
5057         bit_offset += 1;
5058     gprs_indicator = gsm_a_rr_is_bit_high(tvb,bit_offset);
5059     if (gprs_indicator == TRUE)
5060     { /* GPRS indicator */
5061         bit_offset += 1;
5062         bit_offset += de_rr_rest_oct_gprs_indicator(tvb, subtree, bit_offset);
5063     }
5064     else
5065         bit_offset += 1;
5066     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5067         proto_tree_add_text(subtree, tvb, bit_offset>>3, 1, "3G Early Classmark Sending Restriction: The sending of UTRAN,CDMA2000 and GERAN IU MODE CLASSMARK CHANGE messages are controlled by the Early Classmark Sending Control parameter");
5068     else
5069         proto_tree_add_text(subtree, tvb, bit_offset>>3, 1, "3G Early Classmark Sending Restriction: Neither UTRAN, CDMA2000 nor GERAN IU MODE CLASSMARK CHANGE message shall be sent with the Early classmark sending");
5070     bit_offset += 1;
5071     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5072     { /* SI2quater Indicator */
5073         bit_offset += 1;
5074         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_si2quater_position, tvb, bit_offset, 1, FALSE);
5075         bit_offset += 1;
5076     }
5077     else
5078         bit_offset += 1;
5079     if (gprs_indicator == FALSE)
5080     {
5081         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_si13alt_position, tvb, bit_offset, 1, FALSE);
5082         bit_offset += 1;
5083     }
5084    
5085     curr_offset = curr_offset + len;
5086
5087     return curr_offset-offset;
5088 }
5089
5090 /*
5091  * [3] 10.5.2.32 SI 4 Rest Octets
5092  */
5093 static const value_string gsm_a_rr_prio_thr_vals[] = {
5094     { 0, "0 dB"},
5095     { 1, "6 dB"},
5096     { 2, "12 dB"},
5097     { 3, "18 dB"},
5098     { 4, "24 dB"},
5099     { 5, "30 dB"},
5100     { 6, "36 dB"},
5101     { 7, "Infinite"},
5102     { 0, NULL }
5103 };
5104
5105 static const value_string gsm_a_rr_lsa_offset_vals[] = {
5106     { 0, "0 dB"},
5107     { 1, "4 dB"},
5108     { 2, "8 dB"},
5109     { 3, "16 dB"},
5110     { 4, "24 dB"},
5111     { 5, "32 dB"},
5112     { 6, "48 dB"},
5113     { 7, "64 dB"},
5114     { 0, NULL }
5115 };
5116
5117 static guint16
5118 de_rr_si4_rest_oct(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
5119 {
5120     proto_tree  *subtree, *subtree2, *subtree3;
5121     proto_item  *item, *item2, *item3;
5122     guint32     curr_offset;
5123     gint bit_offset, bit_offset_sav, bit_offset_sav2;
5124     guint value;
5125
5126     len = tvb_length_remaining(tvb,offset);
5127     if (len==0)
5128         return 0;
5129
5130     curr_offset = offset;
5131     bit_offset = curr_offset << 3;
5132
5133     item = proto_tree_add_text(tree, tvb, curr_offset, len, "%s",
5134                                gsm_rr_elem_strings[DE_RR_SI4_REST_OCT].strptr);
5135
5136     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_SI4_REST_OCT]);
5137
5138     item2 = proto_tree_add_text(subtree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_SI4_REST_OCTETS_O].strptr);
5139
5140     subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_SI4_REST_OCTETS_O]);
5141
5142     bit_offset += de_rr_rest_oct_opt_sel_param(tvb, subtree2, bit_offset);
5143
5144     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5145     { /* Optional Power Offset */
5146         bit_offset += 1;
5147         proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_power_offset, tvb, bit_offset, 2, FALSE);
5148         bit_offset += 2;
5149     }
5150     else
5151         bit_offset += 1;
5152     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5153     {
5154         bit_offset += 1;
5155         bit_offset += de_rr_rest_oct_gprs_indicator(tvb, subtree2, bit_offset);
5156     }
5157     else
5158         bit_offset += 1;
5159     proto_item_set_len(item2,(bit_offset>>3)+1-curr_offset);
5160     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5161     { /* SI4 Rest Octets_S */
5162         bit_offset += 1;
5163         bit_offset_sav = bit_offset;
5164         item2 = proto_tree_add_text(subtree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_SI4_REST_OCTETS_S].strptr);
5165         subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_SI4_REST_OCTETS_S]);
5166         if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5167         { /* LSA Parameters */
5168             bit_offset += 1;
5169             bit_offset_sav2 = bit_offset;
5170             item3 = proto_tree_add_text(subtree2, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_LSA_PARAMETERS].strptr);
5171             subtree3 = proto_item_add_subtree(item3, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_LSA_PARAMETERS]);
5172             proto_tree_add_bits_item(subtree3, hf_gsm_a_rr_prio_thr, tvb, bit_offset, 3, FALSE);
5173             bit_offset += 3;
5174             proto_tree_add_bits_item(subtree3, hf_gsm_a_rr_lsa_offset, tvb, bit_offset, 3, FALSE);
5175             bit_offset += 3;
5176             value = tvb_get_bits8(tvb,bit_offset,1);
5177             bit_offset += 1;
5178             if (value)
5179             {
5180                 proto_tree_add_text(subtree3, tvb, bit_offset>>3, 2, "MCC: %d", tvb_get_bits16(tvb,bit_offset,12,FALSE));
5181                 bit_offset += 12;
5182                 proto_tree_add_text(subtree3, tvb, bit_offset>>3, 2, "MNC: %d", tvb_get_bits16(tvb,bit_offset,12,FALSE));
5183                 bit_offset += 12;
5184             }
5185             proto_item_set_len(item2,((bit_offset-bit_offset_sav2)>>3)+1);
5186         }
5187         else
5188             bit_offset += 1;
5189         if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5190         { /* Cell Identity */
5191             bit_offset += 1;
5192             value = tvb_get_bits16(tvb, bit_offset, 16, FALSE);
5193             proto_tree_add_uint(subtree2, hf_gsm_a_bssmap_cell_ci, tvb, bit_offset>>3, 2, value);
5194             bit_offset += 16;
5195         }
5196         else
5197             bit_offset += 1;
5198         if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5199         { /* LSA ID information */
5200             bit_offset += 1;
5201             bit_offset_sav2 = bit_offset;
5202             item3 = proto_tree_add_text(subtree2, tvb, bit_offset>>3, len, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_LSA_ID_INFO].strptr);
5203             subtree3 = proto_item_add_subtree(item3, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_LSA_ID_INFO]);
5204             do
5205             {
5206                 value = tvb_get_bits8(tvb,bit_offset,1);
5207                 bit_offset += 1;
5208                 if (value)
5209                 {
5210                     proto_tree_add_text(subtree3, tvb, bit_offset>>3, 3, "Short LSA ID: %d",tvb_get_bits16(tvb,bit_offset,10,FALSE));
5211                     bit_offset += 10;
5212                 }
5213                 else
5214                 {
5215                     proto_tree_add_text(subtree3, tvb, bit_offset>>3, 3, "LSA ID: %d",tvb_get_bits32(tvb,bit_offset,24,FALSE));
5216                     bit_offset += 24;
5217                 }
5218                 value = tvb_get_bits8(tvb,bit_offset,1);
5219                 bit_offset += 1;
5220             } while (value);
5221         }
5222         else
5223             bit_offset += 1;
5224         if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5225         {
5226             bit_offset += 1;
5227             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_cbq3, tvb, (curr_offset<<3)+1, 2, FALSE);
5228             bit_offset += 3;
5229         }
5230         else
5231             bit_offset += 1;
5232         value = tvb_get_bits8(tvb,bit_offset,1);
5233         bit_offset += 1;
5234         if (value)
5235         {
5236             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_si13alt_position, tvb, bit_offset, 1, FALSE);
5237             bit_offset += 1;
5238         }
5239         proto_item_set_len(item2,((bit_offset-bit_offset_sav)>>3)+1);
5240     }
5241     else
5242     { /* Break indicator */
5243         bit_offset += 1;
5244         if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5245             proto_tree_add_text(subtree, tvb, bit_offset>>3, 1, "Break Indicator: Additional parameters \"SI4 Rest Octets_S\" are sent in SYSTEM INFORMATION TYPE 7 and 8");
5246         else
5247             proto_tree_add_text(subtree, tvb, bit_offset>>3, 1, "Break Indicator: Additional parameters \"SI4 Rest Octets_S\" are not sent in SYSTEM INFORMATION TYPE 7 and 8");
5248         bit_offset += 1;
5249     }
5250
5251     curr_offset = curr_offset + len;
5252
5253     return curr_offset-offset;
5254 }
5255
5256 /*
5257  * [3] 10.5.2.35a SI 6 Rest Octets
5258  */
5259 static const true_false_string gsm_a_rr_paging_channel_restructuring_value = {
5260     "Paging channel is restructured",
5261     "Paging channel is not restructured"
5262 };
5263
5264 static const true_false_string gsm_a_rr_vbs_vgcs_inband_notifications_value = {
5265     "The mobile shall be notified on incoming high priority VBS/VGCS calls through NOTIFICATION/FACCH, the mobile need not to inspect the NCH",
5266     "The network does not provide notification on FACCH so that the mobile should inspect the NCH for notifications"
5267 };
5268
5269 static const true_false_string gsm_a_rr_vbs_vgcs_inband_pagings_value = {
5270     "The mobile shall be notified on incoming high priority point-to-point calls through NOTIFICATION/FACCH, the mobile need not to inspect the PCH",
5271     "The network does not provide paging information on FACCH so that the mobile should inspect the PCH for pagings"
5272 };
5273
5274 static const value_string gsm_a_rr_max_lapdm_vals[] = {
5275     { 0, "Any message segmented in up to 5 LAPDm frames"},
5276     { 1, "Any message segmented in up to 6 LAPDm frames"},
5277     { 2, "Any message segmented in up to 7 LAPDm frames"},
5278     { 3, "Any message segmented in up to 8 LAPDm frames"},
5279     { 4, "Any message segmented in up to 9 LAPDm frames"},
5280     { 5, "Any message segmented in up to 10 LAPDm frames"},
5281     { 6, "Any message segmented in up to 11 LAPDm frames"},
5282     { 7, "Any message segmented in up to 12 LAPDm frames"},
5283     { 0, NULL }
5284 };
5285
5286 static const true_false_string gsm_a_rr_dedicated_mode_mbms_notification_support_value = {
5287     "The cell supports the Dedicated Mode MBMS Notification procedures",
5288     "The cell does not support the Dedicated Mode MBMS Notification procedures"
5289 };
5290
5291 static const true_false_string gsm_a_rr_mnci_support_value = {
5292     "The cell supports the distribution of MBMS NEIGHBOURING CELL INFORMATION messages",
5293     "The cell does not support the distribution of MBMS NEIGHBOURING CELL INFORMATION messages"
5294 };
5295
5296 static guint16
5297 de_rr_si6_rest_oct(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
5298 {
5299     proto_tree  *subtree, *subtree2;
5300     proto_item  *item, *item2;
5301     guint32     curr_offset;
5302     gint bit_offset, bit_offset_sav;
5303     guint8 value;
5304
5305     len = 7;
5306     curr_offset = offset;
5307     bit_offset = curr_offset << 3;
5308
5309     item = proto_tree_add_text(tree, tvb, curr_offset, len, "%s",
5310                                gsm_rr_elem_strings[DE_RR_SI6_REST_OCT].strptr);
5311
5312     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_SI6_REST_OCT]);
5313
5314     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5315     { /* PCH and NCH Info */
5316         bit_offset += 1;
5317         bit_offset_sav = bit_offset;
5318         item2 = proto_tree_add_text(subtree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_PCH_AND_NCH_INFO].strptr);
5319         subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_PCH_AND_NCH_INFO]);
5320         proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_paging_channel_restructuring, tvb, bit_offset, 1, FALSE);
5321         bit_offset += 1;
5322         proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_nln_sacch, tvb, bit_offset, 2, FALSE);
5323         bit_offset += 2;
5324         value = tvb_get_bits8(tvb,bit_offset,1);
5325         bit_offset += 1;
5326         if (value)
5327         {
5328             proto_tree_add_bits_item(subtree2, hf_gsm_a_call_prio, tvb, bit_offset, 3, FALSE);
5329             bit_offset += 3;
5330         }
5331         proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_nln_status_sacch, tvb, bit_offset, 1, FALSE);
5332         bit_offset += 1;
5333         proto_item_set_len(item2,((bit_offset-bit_offset_sav)>>3)+1);
5334     }
5335     else
5336         bit_offset += 1;
5337     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5338     { /* VBS/VGCS options */
5339         bit_offset += 1;
5340         bit_offset_sav = bit_offset;
5341         item2 = proto_tree_add_text(subtree, tvb,bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_VBS_VGCS_OPTIONS].strptr);
5342         subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_VBS_VGCS_OPTIONS]);
5343         proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_vbs_vgcs_inband_notifications, tvb, bit_offset, 1, FALSE);
5344         bit_offset += 1;
5345         proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_vbs_vgcs_inband_pagings, tvb, bit_offset, 1, FALSE);
5346         bit_offset += 1;
5347         proto_item_set_len(item2,((bit_offset-bit_offset_sav)>>3)+1);
5348     }
5349     else
5350         bit_offset += 1;
5351     value = gsm_a_rr_is_bit_high(tvb,bit_offset);
5352     if (value == TRUE)
5353     {
5354         proto_tree_add_text(subtree, tvb, bit_offset>>3, 1, "DTM is supported in the serving cell");
5355         bit_offset += 1;
5356         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_rac, tvb, bit_offset, 8, FALSE);
5357         bit_offset += 8;
5358         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_max_lapdm, tvb, bit_offset, 3, FALSE);
5359         bit_offset += 3;
5360     }
5361     else
5362     {
5363         proto_tree_add_text(subtree, tvb, bit_offset>>3, 1, "DTM is not supported in the serving cell");
5364         bit_offset += 1;
5365     }
5366     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5367         proto_tree_add_text(subtree, tvb, bit_offset>>3, 1, "Band Indicator: 1900");
5368     else
5369         proto_tree_add_text(subtree, tvb, bit_offset>>3, 1, "Band Indicator: 1800");
5370     bit_offset += 1;
5371     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5372     {
5373         bit_offset += 1;
5374         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_gprs_ms_txpwr_max_ccch, tvb, bit_offset, 5, FALSE);
5375         bit_offset += 5;
5376     }
5377     else
5378         bit_offset += 1;
5379     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5380     { /* MBMS Procedures */
5381         bit_offset += 1;
5382         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_dedicated_mode_mbms_notification_support, tvb, bit_offset, 1, FALSE);
5383         bit_offset += 1;
5384         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_mnci_support, tvb, bit_offset, 1, FALSE);
5385         bit_offset += 1;
5386     }
5387     else
5388         bit_offset += 1;
5389     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5390     { /* Additions in Release 7 */
5391         bit_offset += 1;
5392         value = tvb_get_bits8(tvb,bit_offset,1);
5393         bit_offset += 1;
5394         if (value)
5395         {
5396             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_amr_config, tvb, bit_offset, 4, FALSE);
5397             bit_offset += 4;
5398         }
5399     }
5400     else
5401         bit_offset += 1;
5402
5403     curr_offset = curr_offset + len;
5404
5405     return curr_offset-offset;
5406 }
5407
5408 /* [3] 10.5.2.36 SI 7 Rest Octets
5409  * [3] 10.5.2.37 SI 8 Rest Octets
5410  * [3] 10.5.2.37a SI 9 Rest Octets
5411  */
5412
5413 /*
5414  * [3] 10.5.2.37b SI 13 Rest Octets
5415  */
5416 static const value_string gsm_a_rr_si_change_field_vals[] = {
5417     {  0, "Update of unspecified SI message or SI messages"},
5418     {  1, "Update of SI1 message"},
5419     {  2, "Update of SI2, SI2 bis or SI2 ter message or any instance of SI2quater messages"},
5420     {  3, "Update of SI3, SI4, SI7, SI8, SI16 or SI17 message"},
5421     {  4, "Update of SI9 message"},
5422     {  5, "Update of SI18 or SI20 message"},
5423     {  6, "Update of SI19 message"},
5424     {  7, "Update of SI15 message"},
5425     {  8, "Update of SI2n message"},
5426     {  9, "Update of unknown SI message type"},
5427     { 10, "Update of unknown SI message type"},
5428     { 11, "Update of unknown SI message type"},
5429     { 12, "Update of unknown SI message type"},
5430     { 13, "Update of unknown SI message type"},
5431     { 14, "Update of unknown SI message type"},
5432     { 15, "Update of unknown SI message type"},
5433     {  0, NULL }
5434 };
5435
5436 static const value_string gsm_a_rr_psi1_repeat_period_vals[] = {
5437     {  0, "1 multiframe"},
5438     {  1, "2 multiframes"},
5439     {  2, "3 multiframes"},
5440     {  3, "4 multiframes"},
5441     {  4, "5 multiframes"},
5442     {  5, "6 multiframes"},
5443     {  6, "7 multiframes"},
5444     {  7, "8 multiframes"},
5445     {  8, "9 multiframes"},
5446     {  9, "10 multiframes"},
5447     { 10, "11 multiframes"},
5448     { 11, "12 multiframes"},
5449     { 12, "13 multiframes"},
5450     { 13, "14 multiframes"},
5451     { 14, "15 multiframes"},
5452     { 15, "16 multiframes"},
5453     {  0, NULL }
5454 };
5455
5456 static const value_string gsm_a_rr_pbcch_pb_vals[] = {
5457     {  0, "0 dB"},
5458     {  1, "-2 dB"},
5459     {  2, "-4 dB"},
5460     {  3, "-6 dB"},
5461     {  4, "-8 dB"},
5462     {  5, "-10 dB"},
5463     {  6, "-12 dB"},
5464     {  7, "-14 dB"},
5465     {  8, "-16 dB"},
5466     {  9, "-18 dB"},
5467     { 10, "-20 dB"},
5468     { 11, "-22 dB"},
5469     { 12, "-24 dB"},
5470     { 13, "-26 dB"},
5471     { 14, "-28 dB"},
5472     { 15, "-30 dB"},
5473     {  0, NULL }
5474 };
5475
5476 static const true_false_string gsm_a_rr_spgc_ccch_sup_value = {
5477     "SPLIT_PG_CYCLE is supported on CCCH in this cell",
5478     "SPLIT_PG_CYCLE is not supported on CCCH in this cell"
5479 };
5480
5481 static const value_string gsm_a_rr_priority_access_thr_vals[] = {
5482     {  0, "Packet access is not allowed in the cell"},
5483     {  1, "Packet access is not allowed in the cell"},
5484     {  2, "Packet access is not allowed in the cell"},
5485     {  3, "Packet access is allowed for priority level 1"},
5486     {  4, "Packet access is allowed for priority level 1 to 2"},
5487     {  5, "Packet access is allowed for priority level 1 to 3"},
5488     {  6, "Packet access is allowed for priority level 1 to 4"},
5489     {  7, "Packet access is allowed for priority level 1 to 4"},
5490     {  0, NULL }
5491 };
5492
5493 static gint
5494 de_rr_rest_oct_gprs_mobile_allocation(tvbuff_t *tvb, proto_tree *tree, gint bit_offset)
5495 {
5496     proto_tree *subtree;
5497     proto_item *item;
5498     gint curr_bit_offset;
5499     guint8 value;
5500     guint64 ma_length;
5501
5502     curr_bit_offset = bit_offset;
5503
5504     item = proto_tree_add_text(tree, tvb, curr_bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_GPRS_MOBILE_ALLOC].strptr);
5505     subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_GPRS_MOBILE_ALLOC]);
5506     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_hsn, tvb, curr_bit_offset, 6, FALSE);
5507     curr_bit_offset += 6;
5508     while (tvb_get_bits8(tvb,curr_bit_offset,1))
5509     {
5510         curr_bit_offset += 1;
5511         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_rfl_number, tvb, curr_bit_offset, 4, FALSE);
5512         curr_bit_offset += 4;
5513     }
5514     curr_bit_offset += 1;
5515     if (tvb_get_bits8(tvb,curr_bit_offset,1))
5516     {
5517         curr_bit_offset += 1;
5518         while (tvb_get_bits8(tvb,curr_bit_offset,1))
5519         {
5520             curr_bit_offset += 1;
5521             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_arfcn_index, tvb, curr_bit_offset, 6, FALSE);
5522             curr_bit_offset += 6;
5523         }
5524         curr_bit_offset += 1;
5525     }
5526     else
5527     {
5528         curr_bit_offset += 1;
5529         proto_tree_add_bits_ret_val(subtree, hf_gsm_a_rr_ma_length, tvb, curr_bit_offset, 6, &ma_length, FALSE);
5530         curr_bit_offset += 6;
5531         value = (gint)ma_length + 1;
5532         item = proto_tree_add_text(subtree,tvb, curr_bit_offset>>3, (value>>3)+1, "MA Bitmap: ");
5533         while (value)
5534         {
5535             proto_item_append_text(item,"%d",tvb_get_bits8(tvb,curr_bit_offset,1));
5536             curr_bit_offset += 1;
5537             value -= 1;
5538         }
5539     }
5540     proto_item_set_len(item,((curr_bit_offset-bit_offset)>>3)+1);
5541
5542     return (curr_bit_offset - bit_offset);
5543 }
5544
5545 static const value_string gsm_a_rr_nmo_vals[] = {
5546     { 0, "Network Mode of Operation I"},
5547     { 1, "Network Mode of Operation II"},
5548     { 2, "Network Mode of Operation III"},
5549     { 3, "Reserved"},
5550     { 0, NULL }
5551 };
5552
5553 static const value_string gsm_a_rr_t3168_vals[] = {
5554     { 0, "500 ms"},
5555     { 1, "1000 ms"},
5556     { 2, "1500 ms"},
5557     { 3, "2000 ms"},
5558     { 4, "2500 ms"},
5559     { 5, "3000 ms"},
5560     { 6, "3500 ms"},
5561     { 7, "4000 ms"},
5562     { 0, NULL }
5563 };
5564
5565 static const value_string gsm_a_rr_t3192_vals[] = {
5566     { 0, "500 ms"},
5567     { 1, "1000 ms"},
5568     { 2, "1500 ms"},
5569     { 3, "0 ms"},
5570     { 4, "80 ms"},
5571     { 5, "120 ms"},
5572     { 6, "160 ms"},
5573     { 7, "200 ms"},
5574     { 0, NULL }
5575 };
5576
5577 static const value_string gsm_a_rr_drx_timer_max_vals[] = {
5578     { 0, "0 s"},
5579     { 1, "1 s"},
5580     { 2, "2 s"},
5581     { 3, "4 s"},
5582     { 4, "8 s"},
5583     { 5, "16 s"},
5584     { 6, "32 s"},
5585     { 7, "64 s"},
5586     { 0, NULL }
5587 };
5588
5589 static const true_false_string gsm_a_rr_access_burst_type_value = {
5590     "11-bit format shall be used",
5591     "8-bit format shall be used"
5592 };
5593
5594 static const true_false_string gsm_a_rr_control_ack_type_value = {
5595     "Default format is RLC/MAC control block",
5596     "Default format is four access bursts"
5597 };
5598
5599 static const value_string gsm_a_rr_pan_max_vals[] = {
5600     { 0, "maximum value allowed for counter N3102 is 4"},
5601     { 1, "maximum value allowed for counter N3102 is 8"},
5602     { 2, "maximum value allowed for counter N3102 is 12"},
5603     { 3, "maximum value allowed for counter N3102 is 16"},
5604     { 4, "maximum value allowed for counter N3102 is 20"},
5605     { 5, "maximum value allowed for counter N3102 is 24"},
5606     { 6, "maximum value allowed for counter N3102 is 28"},
5607     { 7, "maximum value allowed for counter N3102 is 32"},
5608     { 0, NULL }
5609 };
5610
5611 static const true_false_string gsm_a_rr_egprs_packet_channel_request_value = {
5612     "Use two phase packet access with PACKET CHANNEL REQUEST message for uplink TBF establishment on the PRACH",
5613     "Use EGPRS PACKET CHANNEL REQUEST message for uplink TBF establishment on the PRACH"
5614 };
5615
5616 static const value_string gsm_a_rr_bep_period_vals[] = {
5617     {  0, "1"},
5618     {  1, "2"},
5619     {  2, "3"},
5620     {  3, "4"},
5621     {  4, "5"},
5622     {  5, "7"},
5623     {  6, "10"},
5624     {  7, "12"},
5625     {  8, "15"},
5626     {  9, "20"},
5627     { 10, "25"},
5628     { 11, "Reserved"},
5629     { 12, "Reserved"},
5630     { 13, "Reserved"},
5631     { 14, "Reserved"},
5632     { 15, "Reserved"},
5633     {  0, NULL }
5634 };
5635
5636 static const true_false_string gsm_a_rr_pfc_feature_mode_value = {
5637     "The network supports packet flow context procedures",
5638     "The network does not support packet flow context procedures"
5639 };
5640
5641 static const true_false_string gsm_a_rr_dtm_support_value = {
5642     "The cell supports DTM procedures",
5643     "The cell does not support DTM procedures"
5644 };
5645
5646 static const true_false_string gsm_a_rr_bss_paging_coordination_value = {
5647     "The cell supports Circuit-Switched paging coordination",
5648     "The cell does not support Circuit-Switched paging coordination"
5649 };
5650
5651 static const true_false_string gsm_a_rr_ccn_active_value = {
5652     "CCN is enabled in the cell",
5653     "CCN is disabled in the cell"
5654 };
5655
5656 static const true_false_string gsm_a_rr_nw_ext_utbf_value = {
5657     "The extended uplink TBF mode is supported by the network",
5658     "The extended uplink TBF mode is not supported by the network"
5659 };
5660
5661 static const true_false_string gsm_a_rr_multiple_tbf_capability_value = {
5662     "The cell supports multiple TBF procedures",
5663     "The cell does not support multiple TBF procedures"
5664 };
5665
5666 static const true_false_string gsm_a_rr_ext_utbf_no_data_value = {
5667     "The mobile station may refrain from sending a PACKET UPLINK DUMMY CONTROL BLOCK message when there is no other RLC/MAC block ready to send in an uplink radio block allocated by the network",
5668     "The mobile station shall send a PACKET UPLINK DUMMY CONTROL BLOCK message when there is no other RLC/MAC block ready to send in an uplink radio block allocated by the network"
5669 };
5670
5671 static const true_false_string gsm_a_rr_dtm_enhancements_capability_value = {
5672     "The cell supports enhanced DTM CS establishment and enhanced DTM CS release procedures",
5673     "The cell does not support enhanced DTM CS establishment and enhanced DTM CS release procedures"
5674 };
5675
5676 static const true_false_string gsm_a_rr_reduced_latency_access_value = {
5677     "The cell supports \"One Phase Access Request by Reduced Latency MS\"",
5678     "The cell does not support \"One Phase Access Request by Reduced Latency MS\""
5679 };
5680
5681 static const value_string gsm_a_rr_alpha_vals[] = {
5682     {  0, "0.0"},
5683     {  1, "0.1"},
5684     {  2, "0.2"},
5685     {  3, "0.3"},
5686     {  4, "0.4"},
5687     {  5, "0.5"},
5688     {  6, "0.6"},
5689     {  7, "0.7"},
5690     {  8, "0.8"},
5691     {  9, "0.9"},
5692     { 10, "1.0"},
5693     { 11, "1.0"},
5694     { 12, "1.0"},
5695     { 13, "1.0"},
5696     { 14, "1.0"},
5697     { 15, "1.0"},
5698     {  0, NULL }
5699 };
5700
5701 static const value_string gsm_a_rr_t_avg_x_vals[] = {
5702     {  0, "2^(0/2) / 6 multiframes"},
5703     {  1, "2^(1/2) / 6 multiframes"},
5704     {  2, "2^(2/2) / 6 multiframes"},
5705     {  3, "2^(3/2) / 6 multiframes"},
5706     {  4, "2^(4/2) / 6 multiframes"},
5707     {  5, "2^(5/2) / 6 multiframes"},
5708     {  6, "2^(6/2) / 6 multiframes"},
5709     {  7, "2^(7/2) / 6 multiframes"},
5710     {  8, "2^(8/2) / 6 multiframes"},
5711     {  9, "2^(9/2) / 6 multiframes"},
5712     { 10, "2^(10/2) / 6 multiframes"},
5713     { 11, "2^(11/2) / 6 multiframes"},
5714     { 12, "2^(12/2) / 6 multiframes"},
5715     { 13, "2^(13/2) / 6 multiframes"},
5716     { 14, "2^(14/2) / 6 multiframes"},
5717     { 15, "2^(15/2) / 6 multiframes"},
5718     { 16, "2^(16/2) / 6 multiframes"},
5719     { 17, "2^(17/2) / 6 multiframes"},
5720     { 18, "2^(18/2) / 6 multiframes"},
5721     { 19, "2^(19/2) / 6 multiframes"},
5722     { 20, "2^(20/2) / 6 multiframes"},
5723     { 21, "2^(21/2) / 6 multiframes"},
5724     { 22, "2^(22/2) / 6 multiframes"},
5725     { 23, "2^(23/2) / 6 multiframes"},
5726     { 24, "2^(24/2) / 6 multiframes"},
5727     { 25, "2^(25/2) / 6 multiframes"},
5728     { 26, "2^(25/2) / 6 multiframes"},
5729     { 27, "2^(25/2) / 6 multiframes"},
5730     { 28, "2^(25/2) / 6 multiframes"},
5731     { 29, "2^(25/2) / 6 multiframes"},
5732     { 30, "2^(25/2) / 6 multiframes"},
5733     { 31, "2^(25/2) / 6 multiframes"},
5734     {  0, NULL }
5735 };
5736
5737 static const true_false_string gsm_a_rr_pc_meas_chan_value = {
5738     "Downlink measurements for power control shall be made on PDCH",
5739     "Downlink measurements for power control shall be made on BCCH"
5740 };
5741
5742 static const value_string gsm_a_rr_n_avg_i_vals[] = {
5743     {  0, "2^(0/2)"},
5744     {  1, "2^(1/2)"},
5745     {  2, "2^(2/2)"},
5746     {  3, "2^(3/2)"},
5747     {  4, "2^(4/2)"},
5748     {  5, "2^(5/2)"},
5749     {  6, "2^(6/2)"},
5750     {  7, "2^(7/2)"},
5751     {  8, "2^(8/2)"},
5752     {  9, "2^(9/2)"},
5753     { 10, "2^(10/2)"},
5754     { 11, "2^(11/2)"},
5755     { 12, "2^(12/2)"},
5756     { 13, "2^(13/2)"},
5757     { 14, "2^(14/2)"},
5758     { 15, "2^(15/2)"},
5759     {  0, NULL }
5760 };
5761
5762 static const true_false_string gsm_a_rr_sgsnr_value = {
5763     "SGSN is Release '99 onwards",
5764     "SGSN is Release '98 or older"
5765 };
5766
5767 static const true_false_string gsm_a_rr_si_status_ind_value = {
5768     "The network supports the PACKET SI STATUS message",
5769     "The network does not support the PACKET SI STATUS message"
5770 };
5771
5772 static const value_string gsm_a_rr_lb_ms_txpwr_max_cch_vals[] = {
5773     {  0, "43 dBm"},
5774     {  1, "41 dBm"},
5775     {  2, "39 dBm"},
5776     {  3, "37 dBm"},
5777     {  4, "35 dBm"},
5778     {  5, "33 dBm"},
5779     {  6, "31 dBm"},
5780     {  7, "29 dBm"},
5781     {  8, "27 dBm"},
5782     {  9, "25 dBm"},
5783     { 10, "23 dBm"},
5784     { 11, "21 dBm"},
5785     { 12, "19 dBm"},
5786     { 13, "17 dBm"},
5787     { 14, "15 dBm"},
5788     { 15, "13 dBm"},
5789     { 16, "11 dBm"},
5790     { 17, "9 dBm"},
5791     { 18, "7 dBm"},
5792     { 19, "5 dBm"},
5793     { 20, "5 dBm"},
5794     { 21, "5 dBm"},
5795     { 22, "5 dBm"},
5796     { 23, "5 dBm"},
5797     { 24, "5 dBm"},
5798     { 25, "5 dBm"},
5799     { 26, "5 dBm"},
5800     { 27, "5 dBm"},
5801     { 28, "5 dBm"},
5802     { 29, "5 dBm"},
5803     { 30, "5 dBm"},
5804     { 31, "5 dBm"},
5805     {  0, NULL }
5806 };
5807
5808 static const value_string gsm_a_rr_si2n_support_vals[] = {
5809     { 0, "SI2n is not supported"},
5810     { 1, "SI2n is supported on PACCH"},
5811     { 2, "SI2n is supported on PACCH and broadcast on BCCH"},
5812     { 3, "SI2n is supported on PACCH and broadcast on BCCH Ext"},
5813     { 0, NULL }
5814 };
5815
5816 static guint16
5817 de_rr_si13_rest_oct(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
5818 {
5819     proto_tree  *subtree, *subtree2;
5820     proto_item  *item, *item2;
5821     guint32     curr_offset;
5822     gint bit_offset, bit_offset_sav;
5823     guint8 value;
5824
5825     len = 20;
5826     curr_offset = offset;
5827     bit_offset = curr_offset << 3;
5828
5829     item = proto_tree_add_text(tree, tvb, curr_offset, len, "%s",
5830                                gsm_rr_elem_strings[DE_RR_SI13_REST_OCT].strptr);
5831
5832     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_SI13_REST_OCT]);
5833
5834     if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5835     {
5836         bit_offset += 1;
5837         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_bcch_change_mark, tvb, bit_offset, 3, FALSE);
5838         bit_offset += 3;
5839         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_si_change_field, tvb, bit_offset, 4, FALSE);
5840         bit_offset += 4;
5841         value = tvb_get_bits8(tvb,bit_offset,1);
5842         bit_offset += 1;
5843         if (value)
5844         {
5845             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_si13_change_mark, tvb, bit_offset, 2, FALSE);
5846             bit_offset += 2;
5847             bit_offset += de_rr_rest_oct_gprs_mobile_allocation(tvb, subtree, bit_offset);
5848         }
5849         value = tvb_get_bits8(tvb,bit_offset,1);
5850         bit_offset += 1;
5851         if (value)
5852         { /* PBCCH present in the cell */
5853             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_psi1_repeat_period, tvb, bit_offset, 4, FALSE);
5854             bit_offset += 4;
5855             bit_offset_sav = bit_offset;
5856             item2 = proto_tree_add_text(subtree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_PBCCH_DESC].strptr);
5857             subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_PBCCH_DESC]);
5858             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_pbcch_pb, tvb, bit_offset, 4, FALSE);
5859             bit_offset += 4;
5860             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_pbcch_tsc, tvb, bit_offset, 3, FALSE);
5861             bit_offset += 3;
5862             proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_pbcch_tn, tvb, bit_offset, 3, FALSE);
5863             bit_offset += 3;
5864             value = tvb_get_bits8(tvb,bit_offset,1);
5865             bit_offset += 1;
5866             if (value)
5867             {
5868                 proto_tree_add_text(subtree2, tvb, bit_offset>>3, 1, "MAIO: %d", tvb_get_bits8(tvb,bit_offset,6));
5869                 bit_offset += 6;
5870             }
5871             else
5872             {
5873                 value = tvb_get_bits8(tvb,bit_offset,1);
5874                 bit_offset += 1;
5875                 if (value)
5876                 {
5877                     proto_tree_add_bits_item(subtree2, hf_gsm_a_rr_arfcn, tvb, bit_offset, 10, FALSE);
5878                     bit_offset += 10;
5879                 }
5880                 else
5881                     proto_tree_add_text(subtree2, tvb, bit_offset>>3, 1, "PBCCH shall use the BCCH carrier");
5882             }
5883             proto_item_set_len(item2,((bit_offset-bit_offset_sav)>>3)+1);
5884         }
5885         else
5886         { /* PBCCH not present in the cell */
5887             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_rac, tvb, bit_offset, 8, FALSE);
5888             bit_offset += 8;
5889             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_spgc_ccch_sup, tvb, bit_offset, 1, FALSE);
5890             bit_offset += 1;
5891             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_priority_access_thr, tvb, bit_offset, 3, FALSE);
5892             bit_offset += 3;
5893             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_network_control_order, tvb, bit_offset, 2, FALSE);
5894             bit_offset += 2;
5895             bit_offset += de_rr_rest_oct_gprs_cell_options(tvb, subtree, bit_offset);
5896             bit_offset += de_rr_rest_oct_gprs_power_control_parameters(tvb, subtree, bit_offset);  
5897         }
5898         if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5899         { /* Additions in release 99 */
5900             bit_offset += 1;
5901             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_sgsnr, tvb, bit_offset, 1, FALSE);
5902             bit_offset += 1;
5903             if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5904             { /* Additions in release Rel-4 */
5905                 bit_offset += 1;
5906                 proto_tree_add_bits_item(subtree, hf_gsm_a_rr_si_status_ind, tvb, bit_offset, 1, FALSE);
5907                 bit_offset += 1;
5908                 if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
5909                 { /* Additions in release Rel-6 */
5910                     bit_offset += 1;
5911                     value = tvb_get_bits8(tvb,bit_offset,1);
5912                     bit_offset += 1;
5913                     if (value)
5914                     {
5915                         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_lb_ms_txpwr_max_cch, tvb, bit_offset, 5, FALSE);
5916                         bit_offset += 5;
5917                     }
5918                     proto_tree_add_bits_item(subtree, hf_gsm_a_rr_si2n_support, tvb, bit_offset, 2, FALSE);
5919                     bit_offset += 2;
5920                 }
5921                 else
5922                     bit_offset += 1;
5923             }
5924             else
5925                 bit_offset += 1;
5926         }
5927         else
5928             bit_offset += 1;
5929     }
5930     else
5931     {
5932         bit_offset += 1;
5933         proto_tree_add_text(subtree,tvb, curr_offset, len ,"Empty");
5934     }
5935
5936     curr_offset = curr_offset + len;
5937
5938     return curr_offset-offset;
5939 }
5940
5941 /* [3] 10.5.2.37c (void)
5942  * [3] 10.5.2.37d (void)
5943  * [3] 10.5.2.37e SI 16 Rest Octets
5944  * [3] 10.5.2.37f SI 17 Rest Octets
5945  * [3] 10.5.2.37g SI 19 Rest Octets
5946  * [3] 10.5.2.37h SI 18 Rest Octets
5947  * [3] 10.5.2.37i SI 20 Rest Octets
5948  */
5949 /*
5950  * [3] 10.5.2.38 Starting Time
5951  */
5952 static guint16
5953 de_rr_starting_time(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
5954 {
5955     proto_item *item;
5956     guint32     curr_offset;
5957     guint16     rfn, fn;
5958
5959     curr_offset = offset;
5960
5961     fn = tvb_get_ntohs(tvb,curr_offset);
5962     rfn = reduced_frame_number(fn);
5963     proto_tree_add_item(tree, hf_gsm_a_rr_T1prim, tvb, curr_offset, 1, FALSE);
5964     proto_tree_add_item(tree, hf_gsm_a_rr_T3, tvb, curr_offset, 2, FALSE);
5965     curr_offset++;
5966     proto_tree_add_item(tree, hf_gsm_a_rr_T2, tvb, curr_offset, 1, FALSE);
5967     curr_offset++;
5968     item = proto_tree_add_uint(tree, hf_gsm_a_rr_rfn, tvb, curr_offset-2, 2, rfn);
5969     PROTO_ITEM_SET_GENERATED(item);
5970     return(curr_offset - offset);
5971 }
5972 /*
5973  * [3] 10.5.2.39 Synchronization Indication
5974  */
5975 /*
5976  * ROT: Report Observed Time Difference (Octet1 bit 3) */
5977
5978 static const true_false_string sm_a_rr_sync_ind_rot_value  = {
5979     "Mobile Time Difference IE shall be included in the HANDOVER COMPLETE message",
5980     "Mobile Time Difference IE shall not be included in the HANDOVER COMPLETE message"
5981 };
5982
5983 /* SI: Synchronization indication (octet 1)Bit2 1 */
5984
5985 static const value_string gsm_a_rr_sync_ind_si_vals[] = {
5986     { 0, "Non-synchronized"},
5987     { 1, "Synchronized"},
5988     { 2, "Pre-synchronised"},
5989     { 3, "Pseudo-synchronised"},
5990     { 0, NULL }
5991 };
5992 /* NCI: Normal cell indication (octet 1, bit 4) */
5993
5994 static const true_false_string gsm_a_rr_sync_ind_nci_value  = {
5995     "Out of range timing advance shall trigger a handover failure procedure",
5996     "Out of range timing advance is ignored"
5997 };
5998 static guint16
5999 de_rr_sync_ind(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
6000 {
6001     guint32     curr_offset;
6002
6003     curr_offset = offset;
6004
6005     /*NCI */
6006     proto_tree_add_item(tree, hf_gsm_a_rr_sync_ind_nci, tvb, curr_offset, 1, FALSE);
6007     /*ROT */
6008     proto_tree_add_item(tree, hf_gsm_a_rr_sync_ind_rot, tvb, curr_offset, 1, FALSE);
6009     /*SI*/
6010     proto_tree_add_item(tree, hf_gsm_a_rr_sync_ind_si, tvb, curr_offset, 1, FALSE);
6011
6012     curr_offset = curr_offset + 1;
6013
6014     return(curr_offset - offset);
6015 }
6016
6017 /*
6018  * [3] 10.5.2.40 Timing Advance
6019  */
6020 static guint16
6021 de_rr_timing_adv(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
6022 {
6023     guint32     curr_offset;
6024
6025     curr_offset = offset;
6026
6027     proto_tree_add_item(tree, hf_gsm_a_rr_timing_adv, tvb, curr_offset, 1, FALSE);
6028     curr_offset = curr_offset + 1;
6029
6030     return(curr_offset - offset);
6031 }
6032
6033 /*
6034  * [3] 10.5.2.41 Time Difference
6035  */
6036 static guint16
6037 de_rr_time_diff(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
6038 {
6039     guint32     curr_offset;
6040
6041     curr_offset = offset;
6042
6043     proto_tree_add_item(tree, hf_gsm_a_rr_time_diff, tvb, curr_offset, 1, FALSE);
6044     curr_offset = curr_offset + 1;
6045
6046     return(curr_offset - offset);
6047 }
6048 /*
6049  * [3] 10.5.2.41a TLLI
6050  * The TLLI is encoded as a binary number with a length of 4 octets. TLLI is defined in 3GPP TS 23.003
6051  */
6052 guint16
6053 de_rr_tlli(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
6054 {
6055     guint32     curr_offset;
6056
6057     curr_offset = offset;
6058
6059     proto_tree_add_item(tree, hf_gsm_a_rr_tlli, tvb, curr_offset, 4, FALSE);
6060     curr_offset = curr_offset + 4;
6061
6062     return(curr_offset - offset);
6063 }
6064
6065 /*
6066  * [3] 10.5.2.42 TMSI/P-TMSI
6067  */
6068 guint16
6069 de_rr_tmsi_ptmsi(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
6070 {
6071     proto_tree  *subtree;
6072     proto_item  *item;
6073     guint32     curr_offset;
6074
6075     curr_offset = offset;
6076
6077     item = proto_tree_add_text(tree, tvb, curr_offset, 3, "%s",
6078                                gsm_rr_elem_strings[DE_RR_TMSI_PTMSI].strptr);
6079
6080     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_TMSI_PTMSI]);
6081
6082     proto_tree_add_item(subtree, hf_gsm_a_rr_tmsi_ptmsi, tvb, curr_offset, 4, FALSE);
6083     curr_offset = curr_offset + 4;
6084
6085     return(curr_offset - offset);
6086 }
6087
6088 /*
6089  * [3] 10.5.2.42a VGCS target mode Indication
6090  */
6091 /*
6092 Target mode (octet 3)
6093 Bit  8 7
6094      0 0    dedicated mode
6095      0 1    group transmit mode
6096      Other values are reserved for future use.
6097 */
6098 static const value_string gsm_a_rr_target_mode_vals[] _U_ = {
6099     { 0,        "Dedicated mode"},
6100     { 1,        "Group transmit mode"},
6101     { 0,        NULL }
6102 };
6103 static guint16
6104 de_rr_vgcs_tar_mode_ind(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
6105 {
6106     guint32     curr_offset;
6107
6108     curr_offset = offset;
6109
6110     proto_tree_add_item(tree, hf_gsm_a_rr_target_mode, tvb, curr_offset, 1, FALSE);
6111     proto_tree_add_item(tree, hf_gsm_a_rr_group_cipher_key_number, tvb, curr_offset, 1, FALSE);
6112     curr_offset = curr_offset + 1;
6113
6114     return(curr_offset - offset);
6115 }
6116
6117 /*
6118  * [3] 10.5.2.42b       VGCS Ciphering Parameters
6119  */
6120 static guint16
6121 de_rr_vgcs_cip_par(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
6122 {
6123     guint32     curr_offset;
6124
6125     curr_offset = offset;
6126
6127     proto_tree_add_text(tree,tvb, curr_offset, len ,"Data(Not decoded)");
6128
6129     curr_offset = curr_offset + 2;
6130
6131     return(curr_offset - offset);
6132 }
6133 /*
6134  * [3] 10.5.2.43 Wait Indication
6135  */
6136 static guint16
6137 de_rr_wait_ind(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
6138 {
6139     guint32     curr_offset;
6140
6141     curr_offset = offset;
6142
6143     proto_tree_add_item(tree, hf_gsm_a_rr_wait_indication, tvb, curr_offset, 1, FALSE);
6144
6145     curr_offset = curr_offset + 1;
6146
6147     return(curr_offset - offset);
6148 }
6149
6150 /*
6151  * [3] 10.5.2.44 SI10 rest octets $(ASCI)$
6152  */
6153
6154 /*
6155  * [3] 10.5.2.45 Extended Measurement Results
6156  */
6157 static guint16
6158 de_rr_ext_meas_result(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
6159 {
6160     guint32 curr_offset;
6161     gint bit_offset, i;
6162     guint8 value;
6163
6164     curr_offset = offset;
6165     len = 16;
6166     bit_offset = curr_offset << 3;
6167
6168     proto_tree_add_bits_item(tree, hf_gsm_a_rr_seq_code, tvb,bit_offset, 1, FALSE);
6169     bit_offset += 1;
6170     proto_tree_add_bits_item(tree, hf_gsm_a_rr_dtx_used, tvb, bit_offset, 1, FALSE);
6171     bit_offset += 1;
6172     for (i=0; i<21; i++)
6173     {
6174         value = tvb_get_bits8(tvb,bit_offset,6);
6175         proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "RXLEV carrier %d: %s (%d)",i,gsm_a_rr_rxlev_vals[value].strptr,value);
6176         bit_offset += 6;
6177     }
6178
6179     curr_offset = offset + len;
6180
6181     return(curr_offset - offset);
6182 }
6183
6184 /*
6185  * [3] 10.5.2.46 Extended Measurement Frequency List
6186  */
6187 static guint16
6188 de_rr_ext_meas_freq_list(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
6189 {
6190    guint32 curr_offset;
6191
6192    curr_offset = offset;
6193
6194    proto_tree_add_bits_item(tree, hf_gsm_a_rr_seq_code, tvb,(curr_offset<<3)+3, 1, FALSE);
6195    
6196    return dissect_arfcn_list(tvb, tree, offset, 16, add_string, string_len);
6197 }
6198
6199 /*
6200  * [3] 10.5.2.47 Suspension Cause
6201  */
6202 /*Suspension cause value (octet 2)*/
6203 static const value_string gsm_a_rr_suspension_cause_vals[] = {
6204     { 0, "Emergency call, mobile originating call or call re-establishment"},
6205     { 1, "Location Area Update"},
6206     { 2, "MO Short message service"},
6207     { 3, "Other procedure which can be completed with an SDCCH"},
6208     { 4, "MO Voice broadcast or group call"},
6209     { 5, "Mobile terminating CS connection"},
6210     { 6, "DTM not supported in the cell"},
6211     { 0, NULL }
6212 };
6213 guint16
6214 de_rr_sus_cau(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
6215 {
6216     guint32     curr_offset;
6217
6218     curr_offset = offset;
6219
6220     proto_tree_add_item(tree, hf_gsm_a_rr_suspension_cause, tvb, curr_offset, 1, FALSE);
6221
6222     curr_offset = curr_offset + 1;
6223
6224     return(curr_offset - offset);
6225 }
6226 /*
6227  * [3] 10.5.2.48 APDU ID
6228  */
6229 static const value_string gsm_a_rr_apdu_id_vals[] = {
6230         { 0, "RRLP (GSM 04.31) LCS" },
6231         { 0, NULL },
6232 };
6233 static guint16
6234 de_rr_apdu_id(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
6235 {
6236     proto_tree_add_item(tree, hf_gsm_a_rr_apdu_id, tvb, offset, 1, FALSE);
6237
6238     return 0;
6239 }
6240
6241 /*
6242  * [3] 10.5.2.49 APDU Flags
6243  */
6244 static const value_string gsm_a_rr_apdu_flags_vals[] = {
6245         { 1, "Last or only segment" },
6246         { 2, "First or only segment" },
6247         { 0, NULL },
6248 };
6249 static guint16
6250 de_rr_apdu_flags(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
6251 {
6252     proto_tree_add_item(tree, hf_gsm_a_rr_apdu_flags, tvb, offset, 1, FALSE);
6253
6254     return 1;
6255 }
6256
6257 /*
6258  * [3] 10.5.2.50 APDU Data
6259  */
6260 static guint16
6261 de_rr_apdu_data(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
6262 {
6263     tvbuff_t *sub_tvb;
6264
6265     sub_tvb = tvb_new_subset(tvb, offset, len, len);
6266
6267     call_dissector(rrlp_dissector, sub_tvb, gsm_a_dtap_pinfo, tree);
6268
6269     return len;
6270 }
6271
6272 /*
6273  * [3] 10.5.2.51 Handover To UTRAN Command
6274  */
6275 static guint16
6276 de_rr_ho_to_utran_cmd(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
6277 {
6278     guint32 curr_offset;
6279     tvbuff_t *rrc_irat_ho_to_utran_cmd_tvb;
6280
6281     curr_offset = offset;
6282     if (len)
6283     {
6284         rrc_irat_ho_to_utran_cmd_tvb = tvb_new_subset(tvb, curr_offset, len, len);
6285         if (rrc_irat_ho_to_utran_cmd_handle)
6286                         /* gsm_a_dtap_pinfo MUST be set by any dissector calling de_rr_ho_to_utran_cmd */
6287             call_dissector(rrc_irat_ho_to_utran_cmd_handle, rrc_irat_ho_to_utran_cmd_tvb, gsm_a_dtap_pinfo, tree);
6288     }
6289
6290     curr_offset += len;
6291     return(curr_offset - offset);
6292 }
6293
6294
6295 /*
6296  * [3] 10.5.2.52 Handover To cdma2000 Command
6297  * [3] 10.5.2.53 (void)
6298  * [3] 10.5.2.54 (void)
6299  * [3] 10.5.2.55 (void)
6300  * [3] 10.5.2.56 3G Target Cell
6301  */
6302 /*
6303  * 10.5.2.57 Service Support
6304  */
6305 static const true_false_string gsm_a_rr_MBMS_multicast_value  = {
6306     "mobile station requires notification of multicast MBMS services",
6307     "mobile station does not require notification of multicast MBMS services"
6308 };
6309 static const true_false_string gsm_a_rr_MBMS_broadcast_value  = {
6310     "mobile station requires notification of broadcast MBMS services",
6311     "mobile station does not require notification of broadcast MBMS services"
6312 };
6313 static guint16
6314 de_rr_serv_sup(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
6315 {
6316     guint32     curr_offset;
6317
6318     curr_offset = offset;
6319     /* bit 1
6320      * 0 mobile station does not require notification of broadcast MBMS services
6321      * 1 mobile station requires notification of broadcast MBMS services
6322      * bit 2
6323      * 0 mobile station does not require notification of multicast MBMS services
6324      * 1 mobile station requires notification of multicast MBMS services
6325      */
6326     /* MBMS Multicast */
6327     proto_tree_add_item(tree, hf_gsm_a_rr_MBMS_multicast, tvb, curr_offset, 1, FALSE);
6328
6329     /* MBMS Broadcast */
6330     proto_tree_add_item(tree, hf_gsm_a_rr_MBMS_broadcast, tvb, curr_offset, 1, FALSE);
6331     curr_offset++;
6332
6333     return(curr_offset - offset);
6334 }
6335
6336 /*
6337  * [3] 10.5.2.59        Dedicated Service Information
6338  */
6339 /*
6340 Last Segment (octet 2)
6341 bit 1
6342   0  mobile station shall not perform Service Information Sending procedure on new cell.
6343   1  mobile station shall perform Service Information Sending procedure on new cell.
6344 */
6345 static const true_false_string gsm_a_rr_last_segment_value  = {
6346     "Mobile station shall perform Service Information Sending procedure on new cell.",
6347     "mobile station shall not perform Service Information Sending procedure on new cell."
6348 };
6349 static guint16
6350 de_rr_ded_serv_inf(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
6351 {
6352     guint32     curr_offset;
6353
6354     curr_offset = offset;
6355
6356     proto_tree_add_item(tree, hf_gsm_a_rr_last_segment, tvb, curr_offset, 1, FALSE);
6357
6358     curr_offset = curr_offset + 3;
6359
6360     return(curr_offset - offset);
6361 }
6362
6363 /*
6364  * [3] 10.5.2.69        Carrier Indication
6365  */
6366 static const true_false_string gsm_a_rr_carrier_ind_value  = {
6367     "Carrier 2",
6368     "Carrier 1"
6369 };
6370
6371 static guint16
6372 de_rr_carrier_ind(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
6373 {
6374     proto_tree *subtree;
6375     proto_item *item;
6376     guint32 curr_offset;
6377
6378     curr_offset = offset;
6379
6380     item = proto_tree_add_text(tree, tvb, curr_offset, 3, "%s",
6381                                gsm_rr_elem_strings[DE_RR_CARRIER_IND].strptr);
6382
6383     subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_CARRIER_IND]);
6384
6385     proto_tree_add_item(tree, hf_gsm_a_rr_carrier_ind, tvb, curr_offset, 1, FALSE);
6386
6387     curr_offset += 1;
6388
6389     return(curr_offset - offset);
6390 }
6391
6392 guint16 (*rr_elem_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len) = {
6393     /* Radio Resource Management  Information Elements 10.5.2, most are from 10.5.1 */
6394
6395     de_rr_ba_range,                             /* [3]  10.5.2.1a       BA Range */
6396     de_rr_cell_ch_dsc,                          /* [3]  10.5.2.1b       Cell Channel Description        */
6397     de_rr_ba_list_pref,                         /* [3]  10.5.2.1c       BA List Pref                    */
6398     de_rr_utran_freq_list,                      /* [3]  10.5.2.1d       UTRAN Frequency List            */
6399     de_rr_cell_select_indic,                    /* [3]  10.5.2.1e       Cell selection indicator after release of all TCH and SDCCH IE */
6400     de_rr_cell_dsc,                             /* 10.5.2.2   RR Cell Description                       */
6401     de_rr_cell_opt_bcch,                        /* [3]  10.5.2.3        Cell Options (BCCH)             */
6402     de_rr_cell_opt_sacch,                       /* [3]  10.5.2.3a       Cell Options (SACCH)            */
6403     de_rr_cell_sel_param,                       /* [3]  10.5.2.4        Cell Selection Parameters       */
6404 /*
6405  * [3]  10.5.2.4a       (void)
6406  */
6407     de_rr_ch_dsc,                               /* [3]  10.5.2.5        Channel Description             */
6408     de_rr_ch_dsc2,                              /* [3]  10.5.2.5a   RR Channel Description 2            */
6409     de_rr_ch_dsc3,                              /* [3]  10.5.2.5c   RR Channel Description 3            */
6410     de_rr_ch_mode,                              /* [3]  10.5.2.6        Channel Mode                    */
6411     de_rr_ch_mode2,                             /* [3]  10.5.2.7        Channel Mode 2                  */
6412     de_rr_utran_cm,                             /* [3]  10.5.2.7a       UTRAN Classmark */
6413 /* [3]  10.5.2.7b       (void) */
6414
6415     de_rr_cm_enq_mask,                          /* [3]  10.5.2.7c       Classmark Enquiry Mask          */
6416 /* [3]  10.5.2.7d       GERAN Iu Mode Classmark information element                                     */
6417     de_rr_chnl_needed,                          /* [3]  10.5.2.8        Channel Needed
6418                                                  * [3]  10.5.2.8a       (void)
6419                                                  * [3]  10.5.2.8b       Channel Request Description 2   */
6420     /* Pos 20 */
6421     de_rr_cip_mode_set,                         /* [3]  10.5.2.9        Cipher Mode Setting             */
6422     de_rr_cip_mode_resp,                        /* [3]  10.5.2.10       Cipher Response */
6423     de_rr_ctrl_ch_desc,                         /* [3]  10.5.2.11       Control Channel Description     */
6424 /* [3]  10.5.2.11a      DTM Information Details */
6425     de_rr_dyn_arfcn_map,                        /* [3]  10.5.2.11b      Dynamic ARFCN Mapping           */
6426     de_rr_freq_ch_seq,                          /* [3]  10.5.2.12       Frequency Channel Sequence      */
6427     de_rr_freq_list,                            /* [3]  10.5.2.13       Frequency List                  */
6428     de_rr_freq_short_list,                      /* [3]  10.5.2.14       Frequency Short List            */
6429     de_rr_freq_short_list2,                     /* [3]  10.5.2.14a      Frequency Short List 2          */
6430 /* [3]  10.5.2.14b      Group Channel Description */
6431     de_rr_gprs_resumption,                      /* [3]  10.5.2.14c      GPRS Resumption                 */
6432     de_rr_gprs_broadcast_info,                  /* [3]  10.5.2.14d      GPRS broadcast information      */
6433 /* [3]  10.5.2.14e      Enhanced DTM CS Release Indication */
6434     de_rr_ho_ref,                               /* 10.5.2.15  Handover Reference                        */
6435     de_rr_ia_rest_oct,                          /* [3] 10.5.2.16 IA Rest Octets                         */
6436     de_rr_iar_rest_oct,                         /* [3] 10.5.2.17 IAR Rest Octets                        */
6437     de_rr_iax_rest_oct,                         /* [3] 10.5.2.18 IAX Rest Octets                        */
6438     de_rr_l2_pseudo_len,                        /*[3] 10.5.2.19 L2 Pseudo Length                        */
6439     de_rr_meas_res,                             /* [3] 10.5.2.20 Measurement Results                    */
6440 /*
6441  * [3] (void)
6442  */
6443     de_rr_mob_all,                              /* [3] 10.5.2.21 Mobile Allocation                      */
6444     de_rr_mob_time_diff,                        /* [3] 10.5.2.21a Mobile Time Difference                */
6445     de_rr_multirate_conf,                       /* [3] 10.5.2.21aa MultiRate configuration              */
6446     /* Pos 30 */
6447     de_rr_mult_all,                             /* [3] 10.5.2.21b Multislot Allocation                  */
6448 /*
6449  * [3] 10.5.2.21c (void)
6450  */
6451     de_rr_neigh_cell_desc,                      /* [3] 10.5.2.22 Neighbour Cell Description             */
6452     de_rr_neigh_cell_desc2,                     /* [3] 10.5.2.22a Neighbour Cell Description 2          */
6453 /*
6454  * [3] 10.5.2.22b (void)
6455  * [3] 10.5.2.22c NT/N Rest Octets */
6456     de_rr_p1_rest_oct,                          /* [3] 10.5.2.23 P1 Rest Octets                         */
6457     de_rr_p2_rest_oct,                          /* [3] 10.5.2.24 P2 Rest Octets                         */
6458     de_rr_p3_rest_oct,                          /* [3] 10.5.2.25 P3 Rest Octets                         */
6459     de_rr_packet_ch_desc,                       /* [3] 10.5.2.25a Packet Channel Description            */
6460     de_rr_ded_mod_or_tbf,                       /* [3] 10.5.2.25b Dedicated mode or TBF                 */
6461 /* [3] 10.5.2.25c RR Packet Uplink Assignment
6462  * [3] 10.5.2.25d RR Packet Downlink Assignment
6463  */
6464     de_rr_page_mode,                            /* [3] 10.5.2.26 Page Mode                              */
6465 /*
6466  * [3] 10.5.2.26a (void)
6467  * [3] 10.5.2.26b (void)
6468  * [3] 10.5.2.26c (void)
6469  * [3] 10.5.2.26d (void)
6470  */
6471     de_rr_ncc_perm,                             /* [3] 10.5.2.27 NCC Permitted                          */
6472     de_rr_pow_cmd,                              /* 10.5.2.28  Power Command                             */
6473     de_rr_pow_cmd_and_acc_type,                 /* 10.5.2.28a Power Command and access type             */
6474     de_rr_rach_ctrl_param,                      /* [3] 10.5.2.29 RACH Control Parameters                */
6475     de_rr_req_ref,                              /* [3] 10.5.2.30 Request Reference                      */
6476     de_rr_cause,                                /* 10.5.2.31  RR Cause                                  */
6477     de_rr_sync_ind,                             /* 10.5.2.39  Synchronization Indication                */
6478     de_rr_si1_rest_oct,                         /* [3] 10.5.2.32 SI1 Rest Octets                        */
6479 /* [3] 10.5.2.33 SI 2bis Rest Octets */
6480     de_rr_si2ter_rest_oct,                      /* [3] 10.5.2.33a SI 2ter Rest Octets                   */
6481     de_rr_si2quater_rest_oct,                   /* [3] 10.5.2.33b SI 2quater Rest Octets                */
6482     de_rr_si3_rest_oct,                         /* [3] 10.5.2.34 SI3 Rest Octets                        */
6483     de_rr_si4_rest_oct,                         /* [3] 10.5.2.35 SI4 Rest Octets                        */
6484     de_rr_si6_rest_oct,                         /* [3] 10.5.2.35b SI6 Rest Octets                       */
6485 /* [3] 10.5.2.36 SI 7 Rest Octets
6486  * [3] 10.5.2.37 SI 8 Rest Octets
6487  * [3] 10.5.2.37a SI 9 Rest Octets
6488  */
6489     de_rr_si13_rest_oct,                        /* [3] 10.5.2.37a SI13 Rest Octets                      */
6490 /* [3] 10.5.2.37c (void)
6491  * [3] 10.5.2.37d (void)
6492  * [3] 10.5.2.37e SI 16 Rest Octets
6493  * [3] 10.5.2.37f SI 17 Rest Octets
6494  * [3] 10.5.2.37g SI 19 Rest Octets
6495  * [3] 10.5.2.37h SI 18 Rest Octets
6496  * [3] 10.5.2.37i SI 20 Rest Octets */
6497     de_rr_starting_time,                        /* [3] 10.5.2.38 Starting Time                          */
6498     de_rr_timing_adv,                           /* [3] 10.5.2.40 Timing Advance                         */
6499     de_rr_time_diff,                            /* [3] 10.5.2.41 Time Difference                        */
6500     de_rr_tlli,                                 /* [3] 10.5.2.41a TLLI                                  */
6501     de_rr_tmsi_ptmsi,                           /* [3] 10.5.2.42 TMSI/P-TMSI                            */
6502     de_rr_vgcs_tar_mode_ind,                    /* [3] 10.5.2.42a VGCS target mode Indication           */
6503     /* Pos 40 */
6504     de_rr_vgcs_cip_par,                         /* [3] 10.5.2.42b       VGCS Ciphering Parameters       */
6505     de_rr_wait_ind,                             /* [3] 10.5.2.43 Wait Indication                        */
6506 /* [3] 10.5.2.44 SI10 rest octets $(ASCI)$ */
6507     de_rr_ext_meas_result,                      /* [3] 10.5.2.45 Extended Measurement Results           */
6508     de_rr_ext_meas_freq_list,                   /* [3] 10.5.2.46 Extended Measurement Frequency List    */
6509     de_rr_sus_cau,                              /* [3] 10.5.2.47 Suspension Cause                       */
6510     de_rr_apdu_id,                              /* [3] 10.5.2.48 APDU ID                                */
6511     de_rr_apdu_flags,                           /* [3] 10.5.2.49 APDU Flags                             */
6512     de_rr_apdu_data,                            /* [3] 10.5.2.50 APDU Data */
6513     de_rr_ho_to_utran_cmd,                      /* [3] 10.5.2.51 Handover To UTRAN Command              */
6514 /* [3] 10.5.2.52 Handover To cdma2000 Command
6515  * [3] 10.5.2.53 (void)
6516  * [3] 10.5.2.54 (void)
6517  * [3] 10.5.2.55 (void)
6518  * [3] 10.5.2.56 3G Target Cell
6519  * 10.5.2.57 Service Support */
6520     de_rr_serv_sup,                             /* 10.5.2.57            Service Support                 */
6521 /*
6522  * 10.5.2.58 MBMS p-t-m Channel Description
6523  */
6524     de_rr_ded_serv_inf,                         /* [3] 10.5.2.59        Dedicated Service Information   */
6525 /*
6526  * 10.5.2.60 MPRACH Description
6527  * 10.5.2.61 Restriction Timer
6528  * 10.5.2.62 MBMS Session Identity
6529  * 10.5.2.63 Reduced group or broadcast call reference
6530  * 10.5.2.64 Talker Priority status
6531  * 10.5.2.65 Talker Identity
6532  * 10.5.2.66 Token
6533  * 10.5.2.67 PS Cause
6534  * 10.5.2.68 VGCS AMR Configuration
6535  */
6536     de_rr_carrier_ind,                          /* 10.5.2.69 Carrier Indication                         */
6537     NULL,       /* NONE */
6538 };
6539
6540 /* MESSAGE FUNCTIONS */
6541
6542 /*
6543  * 9.1.1 Additional Assignment
6544  */
6545 static void
6546 dtap_rr_add_ass(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
6547 {
6548     guint32 curr_offset;
6549     guint32 consumed;
6550     guint curr_len;
6551
6552     curr_offset = offset;
6553     curr_len = len;
6554
6555     /* Channel Description  10.5.2.5  M V 3 */
6556     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC);
6557
6558     /* Mobile Allocation  10.5.2.21  C TLV 3-10 */
6559     ELEM_OPT_TLV(0x72, GSM_A_PDU_TYPE_RR, DE_RR_MOB_ALL, NULL);
6560
6561     /* Starting Time  10.5.2.38  O TV 3 */
6562     ELEM_OPT_TV(0x7c, GSM_A_PDU_TYPE_RR, DE_RR_STARTING_TIME, NULL);
6563
6564     EXTRANEOUS_DATA_CHECK(curr_len, 0);
6565 }
6566
6567 /*
6568  * 9.1.2 Assignment command
6569  */
6570 static void
6571 dtap_rr_ass_cmd(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
6572 {
6573     guint32     curr_offset;
6574     guint32     consumed;
6575     guint       curr_len;
6576
6577     curr_offset = offset;
6578     curr_len = len;
6579
6580     /* Channel Description 2    10.5.2.5a       M V 3 */
6581     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC2);
6582
6583     /* Power Command                    10.5.2.28       M V 1 */
6584     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_POW_CMD);
6585
6586     /* 05 Frequency List                10.5.2.13       C TLV 4-132 */
6587     ELEM_OPT_TLV(0x05, GSM_A_PDU_TYPE_RR, DE_RR_FREQ_LIST, " - Frequency List, after time");
6588
6589     /* 62 Cell Channel Description      10.5.2.1b       O TV 17 */
6590     ELEM_OPT_TV(0x62, GSM_A_PDU_TYPE_RR, DE_RR_CELL_CH_DSC, NULL);
6591
6592     /* 10 Multislot Allocation          10.5.2.21b      C TLV 3-12 */
6593     ELEM_OPT_TLV(0x10,GSM_A_PDU_TYPE_RR, DE_RR_MULT_ALL, " - Description of the multislot configuration");
6594
6595     /* 63 Channel Mode                          10.5.2.6        O TV 2 */
6596     ELEM_OPT_TV(0x63,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of the First Channel(Channel Set 1)");
6597
6598     /* 11 Channel Mode                          10.5.2.6        O TV 2 */
6599     ELEM_OPT_TV(0x11,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 2");
6600
6601     /* 13 Channel Mode                          10.5.2.6        O TV 2 */
6602     ELEM_OPT_TV(0x13,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 3");
6603
6604     /* 14 Channel Mode                          10.5.2.6        O TV 2 */
6605     ELEM_OPT_TV(0x14,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 4");
6606
6607     /* 15 Channel Mode                          10.5.2.6        O TV 2 */
6608     ELEM_OPT_TV(0x15,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 5");
6609
6610     /* 16 Channel Mode                          10.5.2.6        O TV 2 */
6611     ELEM_OPT_TV(0x16,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 6");
6612
6613     /* 17 Channel Mode                          10.5.2.6        O TV 2 */
6614     ELEM_OPT_TV(0x17,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 7");
6615
6616     /* 18 Channel Mode                          10.5.2.6        O TV 2 */
6617     ELEM_OPT_TV(0x18,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 8");
6618
6619     /* 64 Channel Description           10.5.2.5        O TV 4 */
6620     ELEM_OPT_TV(0x64,GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC, "Description of the Second Channel, after time");
6621
6622     /* 66  Channel Mode 2                       10.5.2.7        O TV 2 */
6623     ELEM_OPT_TV(0x66,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE2, " - Mode of the Second Channel");
6624
6625     /* 72 Mobile Allocation                     10.5.2.21       C TLV 3-10 */
6626     ELEM_OPT_TLV(0x72,GSM_A_PDU_TYPE_RR, DE_RR_MOB_ALL, " - Mobile Allocation, after time");
6627
6628     /* 7C Starting Time                         10.5.2.38       O TV 3 */
6629     ELEM_OPT_TV(0x7C,GSM_A_PDU_TYPE_RR, DE_RR_STARTING_TIME, NULL);
6630
6631     /* 19 Frequency List                        10.5.2.13       C TLV 4-132 */
6632     ELEM_OPT_TLV(0x19, GSM_A_PDU_TYPE_RR, DE_RR_FREQ_LIST, " - Frequency List, before time");
6633
6634     /* 1C Channel Description 2         10.5.2.5a       O TV 4 */
6635     ELEM_OPT_TV(0x1c,GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC2, " - Description of the First Channel, before time");
6636
6637     /* 1D Channel Description           10.5.2.5        O TV 4 */
6638     ELEM_OPT_TV(0x1d,GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC, " - Description of the Second Channel, before time");
6639
6640     /* 1E Frequency channel sequence 10.5.2.12  C TV 10 */
6641     ELEM_OPT_TV(0x1e,GSM_A_PDU_TYPE_RR, DE_RR_FREQ_CH_SEQ, " - Frequency channel sequence before time");
6642
6643     /* 21 Mobile Allocation                     10.5.2.21       C TLV 3-10 */
6644     ELEM_OPT_TLV(0x21,GSM_A_PDU_TYPE_RR, DE_RR_MOB_ALL, " - Mobile Allocation, before time");
6645
6646     /* 9- Cipher Mode Setting           10.5.2.9        O TV 1 */
6647     ELEM_OPT_TV_SHORT(0x90,GSM_A_PDU_TYPE_RR, DE_RR_CIP_MODE_SET, NULL);
6648     /* 01 VGCS target mode Indication VGCS target mode Indication 10.5.2.42a O TLV 3 */
6649     ELEM_OPT_TLV(0x01,GSM_A_PDU_TYPE_RR, DE_RR_VGCS_TAR_MODE_IND, NULL);
6650
6651     /* 03 Multi-Rate configuration,     MultiRate configuration 10.5.2.21aa     O TLV 4-8 */
6652     ELEM_OPT_TLV(0x03,GSM_A_PDU_TYPE_RR, DE_RR_MULTIRATE_CONF, NULL);
6653
6654     /* 04 VGCS Ciphering Parameters VGCS Ciphering Parameters 10.5.2.42b O TLV 3-15     */
6655     ELEM_OPT_TLV(0x04,GSM_A_PDU_TYPE_RR, DE_RR_VGCS_CIP_PAR, NULL);
6656
6657     EXTRANEOUS_DATA_CHECK(curr_len, 0);
6658
6659 }
6660
6661 /*
6662  * 9.1.3 Assignment complete
6663  */
6664 static void
6665 dtap_rr_ass_comp(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
6666 {
6667     guint32     curr_offset;
6668     guint32     consumed;
6669     guint       curr_len;
6670
6671     curr_offset = offset;
6672     curr_len = len;
6673
6674     /* RR Cause RR Cause 10.5.2.31 M V 1 */
6675     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CAUSE);
6676
6677     EXTRANEOUS_DATA_CHECK(curr_len, 0);
6678
6679 }
6680
6681 /*
6682  * 9.1.4 Assignment failure
6683  */
6684 static void
6685 dtap_rr_ass_fail(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
6686 {
6687     guint32     curr_offset;
6688     guint32     consumed;
6689     guint       curr_len;
6690
6691     curr_offset = offset;
6692     curr_len = len;
6693
6694     /* RR Cause RR Cause 10.5.2.31 M V 1 */
6695     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CAUSE);
6696
6697     EXTRANEOUS_DATA_CHECK(curr_len, 0);
6698
6699 }
6700
6701 /*
6702  * 9.1.5 Channel Mode Modify
6703  */
6704 static void
6705 dtap_rr_ch_mode_mod(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
6706 {
6707     guint32     curr_offset;
6708     guint32     consumed;
6709     guint       curr_len;
6710
6711     curr_offset = offset;
6712     curr_len = len;
6713
6714     /* Channel Description 2    10.5.2.5a       M V 3 */
6715     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC2);
6716
6717     /* Channel Mode                             10.5.2.6        M V 1 */
6718     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE);
6719
6720     /* 01 VGCS target mode Indication VGCS target mode Indication 10.5.2.42a O TLV 3 */
6721     ELEM_OPT_TLV(0x01,GSM_A_PDU_TYPE_RR, DE_RR_VGCS_TAR_MODE_IND, NULL);
6722
6723     /* 03 Multi-Rate configuration,     MultiRate configuration 10.5.2.21aa     O TLV 4-8 */
6724     ELEM_OPT_TLV(0x03,GSM_A_PDU_TYPE_RR, DE_RR_MULTIRATE_CONF, NULL);
6725
6726     EXTRANEOUS_DATA_CHECK(curr_len, 0);
6727
6728 }
6729
6730 /*
6731  * 9.1.6 Channel Mode Modify Acknowledge
6732  */
6733 static void
6734 dtap_rr_ch_mode_mod_ack(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
6735 {
6736     guint32     curr_offset;
6737     guint32     consumed;
6738     guint       curr_len;
6739
6740     curr_offset = offset;
6741     curr_len = len;
6742
6743     /* Channel Description 2    10.5.2.5a       M V 3 */
6744     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC2);
6745
6746     /* Channel Mode                             10.5.2.6        M V 1 */
6747     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE);
6748
6749     EXTRANEOUS_DATA_CHECK(curr_len, 0);
6750
6751 }
6752
6753 /*
6754  * 9.1.7 Channel Release
6755  */
6756 static void
6757 dtap_rr_ch_rel(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
6758 {
6759     guint32     curr_offset;
6760     guint32     consumed;
6761     guint       curr_len;
6762
6763     curr_offset = offset;
6764     curr_len = len;
6765
6766     /* RR Cause RR Cause 10.5.2.31 M V 1 */
6767     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CAUSE);
6768
6769     /* 73 BA Range BA Range 10.5.2.1a O TLV 6-7 */
6770     ELEM_OPT_TLV(0x73, GSM_A_PDU_TYPE_RR, DE_RR_BA_RANGE, NULL);
6771
6772     /* 74 Group Channel Description Group Channel Description 10.5.2.14b O TLV 5-13 */
6773     /* ELEM_OPT_TLV(0x74, GSM_A_PDU_TYPE_RR, DE_GRP_CH_DESC, NULL); */
6774
6775     /* 8x Group Cipher Key Number Group Cipher Key Number 10.5.1.10 C TV 1 */
6776     /* ELEM_OPT_TV_SHORT(0x80, GSM_A_PDU_TYPE_RR, DE_GRP_CIP_KEY_NUM, NULL); */
6777
6778     /* Cx GPRS Resumption GPRS Resumption 10.5.2.14c O TV 1 */
6779     ELEM_OPT_TV_SHORT(0xC0, GSM_A_PDU_TYPE_RR, DE_RR_GPRS_RESUMPTION, NULL);
6780
6781     /* 75 BA List Pref BA List Pref 10.5.2.1c O TLV 3-? */
6782     ELEM_OPT_TLV(0x75, GSM_A_PDU_TYPE_RR, DE_RR_BA_LIST_PREF, NULL);
6783
6784     /* 76 UTRAN Freq List 10.5.2.1d O TLV 3-? */
6785     ELEM_OPT_TLV(0x76, GSM_A_PDU_TYPE_RR, DE_RR_UTRAN_FREQ_LIST, NULL);
6786
6787     /* 62 Cell Channel Description Cell Channel Description 10.5.2.1b O TV 17 */
6788     ELEM_OPT_TV(0x62, GSM_A_PDU_TYPE_RR, DE_RR_CELL_CH_DSC, NULL);
6789
6790     /* 62 Cell selection indicator after release of all TCH and SDCCH 10.5.2.1e O TLV 4-? */
6791     ELEM_OPT_TLV(0x77, GSM_A_PDU_TYPE_RR, DE_RR_CELL_SELECT_INDIC, NULL);
6792
6793     EXTRANEOUS_DATA_CHECK(curr_len, 0);
6794
6795 }
6796
6797 /*
6798  * 9.1.8 Channel Request
6799  */
6800 /* This message is NOT follow the basic format, and is only found on RACH - ignored here */
6801
6802 /*
6803  * 9.1.9 Ciphering Mode Command
6804  */
6805 static void
6806 dtap_rr_cip_mode_cmd(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
6807 {
6808     guint32     curr_offset;
6809     guint32     consumed;
6810     guint       curr_len;
6811
6812     curr_offset = offset;
6813     curr_len = len;
6814     lower_nibble = FALSE;
6815
6816     /* Ciphering Mode Setting           10.5.2.9        M V 0.5 */
6817     ELEM_MAND_V_SHORT(GSM_A_PDU_TYPE_RR, DE_RR_CIP_MODE_SET);
6818     /* Cipher Response  10.5.2.10       M V 0.5 */
6819     ELEM_MAND_V_SHORT(GSM_A_PDU_TYPE_RR, DE_RR_CIP_MODE_RESP);
6820
6821     EXTRANEOUS_DATA_CHECK(curr_len, 0);
6822
6823 }
6824 /*
6825  * 9.1.10 Ciphering Mode Complete
6826  */
6827 void
6828 dtap_rr_cip_mode_cpte(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
6829 {
6830     guint32     curr_offset;
6831     guint32     consumed;
6832     guint       curr_len;
6833
6834     curr_offset = offset;
6835     curr_len = len;
6836     lower_nibble = FALSE;
6837
6838     /* Mobile Equipment Identity                10.5.1.4        O TLV */
6839     ELEM_OPT_TLV(0x17, GSM_A_PDU_TYPE_COMMON, DE_MID, "Mobile Equipment Identity");
6840
6841     EXTRANEOUS_DATA_CHECK(curr_len, 0);
6842
6843 }
6844
6845 /*
6846  * 9.1.11 Classmark change
6847  */
6848 static void
6849 dtap_rr_mm_cm_change(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
6850 {
6851     guint32     curr_offset;
6852     guint32     consumed;
6853     guint       curr_len;
6854
6855     curr_offset = offset;
6856     curr_len = len;
6857
6858     /* Mobile Station Classmark 2               10.5.1.6        M LV 4 */
6859     ELEM_MAND_LV(GSM_A_PDU_TYPE_COMMON, DE_MS_CM_2, NULL);
6860     /* 20 Mobile Station Classmark 3    10.5.1.7        C TLV 3-34 */
6861     ELEM_OPT_TLV(0x20, GSM_A_PDU_TYPE_COMMON, DE_MS_CM_3, NULL);
6862
6863     EXTRANEOUS_DATA_CHECK(curr_len, 0);
6864
6865 }
6866
6867 /*
6868  * 9.1.11 UTRAN Classmark Change
6869  */
6870 static void
6871 dtap_rr_utran_classmark_change(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
6872 {
6873     guint32     curr_offset;
6874     guint32     consumed;
6875     guint       curr_len;
6876
6877     curr_offset = offset;
6878     curr_len = len;
6879
6880     /* UTRAN Classmark          10.5.2.7a       M LV 2-? */
6881     ELEM_MAND_LV(GSM_A_PDU_TYPE_RR, DE_RR_UTRAN_CM, NULL);
6882
6883     EXTRANEOUS_DATA_CHECK(curr_len, 0);
6884 }
6885
6886 /*
6887  * 9.1.12 Classmark enquiry
6888  */
6889 static void
6890 dtap_rr_cm_enq(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
6891 {
6892     guint32     curr_offset;
6893     guint32     consumed;
6894     guint       curr_len;
6895
6896     curr_offset = offset;
6897     curr_len = len;
6898
6899     /* 10 Classmark Enquiry Mask        10.5.2.7c       O TLV 3 */
6900     ELEM_OPT_TLV(0x10, GSM_A_PDU_TYPE_RR, DE_RR_CM_ENQ_MASK, NULL);
6901
6902     EXTRANEOUS_DATA_CHECK(curr_len, 0);
6903
6904 }
6905
6906 /*
6907  * 9.1.12b Configuration change command
6908  */
6909 static void
6910 dtap_rr_conf_change_cmd(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
6911 {
6912     guint32 curr_offset;
6913     guint32 consumed;
6914     guint curr_len;
6915
6916     curr_offset = offset;
6917     curr_len = len;
6918
6919     /* Multislot Allocation  10.5.2.21b  M LV 2-11 */
6920     ELEM_MAND_LV(GSM_A_PDU_TYPE_RR, DE_RR_MULT_ALL, NULL);
6921
6922     /* Channel Mode  10.5.2.6  O TV 2 */
6923     ELEM_OPT_TV(0x63,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 1");
6924
6925     /* Channel Mode  10.5.2.6  O TV 2 */
6926     ELEM_OPT_TV(0x11,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 2");
6927
6928     /* Channel Mode  10.5.2.6  O TV 2 */
6929     ELEM_OPT_TV(0x13,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 3");
6930
6931     /* Channel Mode  10.5.2.6  O TV 2 */
6932     ELEM_OPT_TV(0x14,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 4");
6933
6934     /* Channel Mode  10.5.2.6  O TV 2 */
6935     ELEM_OPT_TV(0x15,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 5");
6936
6937     /* Channel Mode  10.5.2.6  O TV 2 */
6938     ELEM_OPT_TV(0x16,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 6");
6939
6940     /* Channel Mode  10.5.2.6  O TV 2 */
6941     ELEM_OPT_TV(0x17,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 7");
6942
6943     /* Channel Mode  10.5.2.6  O TV 2 */
6944     ELEM_OPT_TV(0x18,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 8");
6945
6946     EXTRANEOUS_DATA_CHECK(len, curr_offset - offset);
6947 }
6948
6949 /*
6950  * 9.1.12c      Configuration change acknowledge
6951  */
6952 /* empty message */
6953
6954 /*
6955  * 9.1.12d      Configuration change reject
6956  */
6957 static void
6958 dtap_rr_conf_change_rej(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
6959 {
6960     guint32 curr_offset;
6961     guint32 consumed;
6962     guint curr_len;
6963
6964     curr_offset = offset;
6965     curr_len = len;
6966
6967     /* RR Cause  10.5.2.31  M V 1 */
6968     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CAUSE);
6969
6970     EXTRANEOUS_DATA_CHECK(curr_len, 0);
6971 }
6972
6973
6974 /*
6975  * 9.1.13 Frequency Redefinition
6976  */
6977 static void
6978 dtap_rr_freq_redef(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
6979 {
6980     guint32 curr_offset;
6981     guint32 consumed;
6982     guint curr_len;
6983
6984     curr_offset = offset;
6985     curr_len = len;
6986
6987     /* Channel Description  10.5.2.5  M V 3 */
6988     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC);
6989
6990     /* Mobile Allocation  10.5.2.21  M LV 1-9 */
6991     ELEM_MAND_LV(GSM_A_PDU_TYPE_RR, DE_RR_MOB_ALL, NULL);
6992
6993     /* Starting Time  10.5.2.38  M V 2 */
6994     ELEM_MAND_LV(GSM_A_PDU_TYPE_RR, DE_RR_STARTING_TIME, NULL);
6995
6996     /* Cell Channel Description  10.5.2.1b  O TV 17 */
6997     ELEM_OPT_TV(0x62,GSM_A_PDU_TYPE_RR, DE_RR_CELL_CH_DSC, NULL);
6998
6999     /* Carrier Indication  10.5.2.69  O TV 1 */
7000     ELEM_OPT_TV_SHORT(0x90,GSM_A_PDU_TYPE_RR, DE_RR_CARRIER_IND,NULL);
7001
7002     /* Mobile Allocation  10.5.2.21  O TLV 1-9 */
7003     ELEM_OPT_TLV(0x11, GSM_A_PDU_TYPE_RR, DE_RR_MOB_ALL, " - Mobile Allocation C2");
7004
7005     /* Channel Description 3  10.5.2.5c  O TV 3 */
7006     ELEM_OPT_TV(0x12,GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC3, " - Channel Description C2");
7007
7008     EXTRANEOUS_DATA_CHECK(len, curr_offset - offset);
7009 }
7010
7011 /*
7012  * 9.1.13b GPRS suspension request
7013  */
7014 static void
7015 dtap_rr_gprs_sus_req(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7016 {
7017     guint32     curr_offset;
7018     guint32     consumed;
7019     guint       curr_len;
7020     curr_offset = offset;
7021     curr_len = len;
7022
7023     /* TLLI                                                             10.5.2.41a      M V 4 */
7024     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_TLLI);
7025
7026     /* Routeing Area Identification             10.5.5.15       M V 6 */
7027     ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_RAI);
7028     /* Suspension cause                                 10.5.2.47       M V 1 */
7029     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_SUS_CAU);
7030
7031     /* 01 Service Support                                       10.5.2.57       O TV 2 */
7032     ELEM_OPT_TV_SHORT(0x01,GSM_A_PDU_TYPE_RR, DE_RR_SERV_SUP,NULL);
7033
7034     EXTRANEOUS_DATA_CHECK(len, curr_offset - offset);
7035
7036 }
7037
7038 /*
7039  * 9.1.14 Handover Access
7040  */
7041 /* This message does NOT follow the basic format, and is only found on DCH during initial handover access */
7042
7043 /* 3GPP TS 24.008 version 4.7.0 Release 4
7044  * [3] 9.1.15
7045  */
7046 void
7047 dtap_rr_ho_cmd(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7048 {
7049     guint32     curr_offset;
7050     guint32     consumed;
7051     guint       curr_len;
7052     curr_offset = offset;
7053     curr_len = len;
7054
7055     /* Mandatory Elemets
7056      * Cell description 10.5.2.2
7057      */
7058     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CELL_DSC);
7059
7060     /* Description of the first channel,after time
7061      * Channel Description 2 10.5.2.5a
7062      */
7063     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC2);
7064
7065     /* Handover Reference 10.5.2.15 */
7066     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_HO_REF);
7067
7068     /* Power Command and Access type 10.5.2.28a */
7069     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_POW_CMD_AND_ACC_TYPE);
7070
7071     /* optional elements */
7072
7073     /* Synchronization Indication 10.5.2.39 */
7074     ELEM_OPT_TV_SHORT(0xD0,GSM_A_PDU_TYPE_RR, DE_RR_SYNC_IND,NULL);
7075
7076     /* Frequency Short List 10.5.2.14 */
7077     ELEM_OPT_TV(0x02,GSM_A_PDU_TYPE_RR, DE_RR_FREQ_SHORT_LIST," - Frequency Short List, after time");
7078
7079     /* Frequency List 10.5.2.13 */
7080     ELEM_OPT_TLV(0x05, GSM_A_PDU_TYPE_RR, DE_RR_FREQ_LIST, " - Frequency List, after time");
7081
7082     /* Cell Channel Description 10.5.2.1b */
7083     ELEM_OPT_TV(0x62,GSM_A_PDU_TYPE_RR, DE_RR_CELL_CH_DSC, NULL);
7084
7085     /* Multislot Allocation 10.5.2.21b */
7086     ELEM_OPT_TLV(0x10,GSM_A_PDU_TYPE_RR, DE_RR_MULT_ALL, NULL);
7087
7088     /* Mode of the First Channel(Channel Set 1)) Channel Mode 10.5.2.6*/
7089     ELEM_OPT_TV(0x63,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of the First Channel(Channel Set 1))");
7090
7091     /* Mode of Channel Set 2 Channel Mode 10.5.2.6*/
7092     ELEM_OPT_TV(0x11,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 2");
7093
7094     /* Mode of Channel Set 3 Channel Mode 10.5.2.6*/
7095     ELEM_OPT_TV(0x13,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 3");
7096
7097     /* Mode of Channel Set 4 Channel Mode 10.5.2.6*/
7098     ELEM_OPT_TV(0x14,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 4");
7099
7100     /* Mode of Channel Set 5 Channel Mode 10.5.2.6*/
7101     ELEM_OPT_TV(0x15,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 5");
7102
7103     /* Mode of Channel Set 6 Channel Mode 10.5.2.6*/
7104     ELEM_OPT_TV(0x16,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 6");
7105
7106     /* Mode of Channel Set 7 Channel Mode 10.5.2.6*/
7107     ELEM_OPT_TV(0x17,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 7");
7108
7109     /* Mode of Channel Set 8 Channel Mode 10.5.2.6*/
7110     ELEM_OPT_TV(0x18,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, " - Mode of Channel Set 8");
7111
7112     /* Description of the Second Channel, after time, Channel Description 10.5.2.5 */
7113     ELEM_OPT_TV(0x64,GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC, " - Description of the Second Channel, after time");
7114
7115     /* Mode of the Second Channel, Channel Mode 2 10.5.2.7 */
7116     ELEM_OPT_TV(0x66,GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE2, " - Mode of the Second Channel");
7117
7118     /* Frequency Channel Sequence, after time, Frequency Channel Sequence 10.5.2.12 */
7119     ELEM_OPT_TV(0x69,GSM_A_PDU_TYPE_RR, DE_RR_FREQ_CH_SEQ, " - Frequency Channel Sequence, after time");
7120
7121     /* Mobile Allocation, after time, Mobile Allocation 10.5.2.21 */
7122     ELEM_OPT_TLV(0x72,GSM_A_PDU_TYPE_RR, DE_RR_MOB_ALL, " - Mobile Allocation, after time");
7123
7124     /* Starting Time 10.5.2.38 */
7125     ELEM_OPT_TV(0x7C,GSM_A_PDU_TYPE_RR, DE_RR_STARTING_TIME, NULL);
7126
7127     /* Real Time Difference, Time Difference 10.5.2.41 */
7128     ELEM_OPT_TV(0x7B,GSM_A_PDU_TYPE_RR, DE_RR_TIME_DIFF, " - Real Time Difference");
7129
7130     /* Timing Advance, Timing Advance 10.5.2.40 */
7131     ELEM_OPT_TV(0x7D,GSM_A_PDU_TYPE_RR, DE_RR_TIMING_ADV, NULL);
7132
7133     /* Frequency Short List, before time, Frequency Short List 10.5.2.14 */
7134     ELEM_OPT_TV(0x12,GSM_A_PDU_TYPE_RR, DE_RR_FREQ_SHORT_LIST, " - Frequency Short List, before time");
7135
7136     /* Frequency List, before time,     Frequency List 10.5.2.13 */
7137     ELEM_OPT_TLV(0x19,GSM_A_PDU_TYPE_RR, DE_RR_FREQ_LIST, " - Frequency List, before time");
7138
7139     /* Description of the First Channel, before time,   Channel Description 2 10.5.2.5a*/
7140     ELEM_OPT_TV(0x1c,GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC2, " - Description of the First Channel, before time");
7141
7142     /* Description of the Second Channel, before time,  Channel Description 10.5.2.5*/
7143     ELEM_OPT_TV(0x1d,GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC, " - Description of the Second Channel, before time");
7144
7145     /* Frequency channel sequence before time,  Frequency channel sequence 10.5.2.12*/
7146     ELEM_OPT_TV(0x1e,GSM_A_PDU_TYPE_RR, DE_RR_FREQ_CH_SEQ, " - Frequency channel sequence before time");
7147
7148     /* Mobile Allocation, before time,  Mobile Allocation 10.5.2.21 */
7149     ELEM_OPT_TLV(0x21,GSM_A_PDU_TYPE_RR, DE_RR_MOB_ALL, " - Mobile Allocation, before time");
7150
7151     /* Cipher Mode Setting,     Cipher Mode Setting 10.5.2.9 */
7152     ELEM_OPT_TV_SHORT(0x90,GSM_A_PDU_TYPE_RR, DE_RR_CIP_MODE_SET, NULL);
7153
7154     /* VGCS target mode Indication,     VGCS target mode Indication 10.5.2.42a */
7155     ELEM_OPT_TLV(0x01,GSM_A_PDU_TYPE_RR, DE_RR_VGCS_TAR_MODE_IND, NULL);
7156
7157     /* Multi-Rate configuration,        MultiRate configuration 10.5.2.21a */
7158     ELEM_OPT_TLV(0x03,GSM_A_PDU_TYPE_RR, DE_RR_MULTIRATE_CONF, NULL);
7159
7160     /* Dynamic ARFCN Mapping,   Dynamic ARFCN Mapping 10.5.2.11b */
7161     ELEM_OPT_TLV(0x76,GSM_A_PDU_TYPE_RR, DE_RR_DYN_ARFCN_MAP, NULL);
7162
7163     /* VGCS Ciphering Parameters,       VGCS Ciphering Parameters 10.5.2.42b */
7164     ELEM_OPT_TLV(0x04,GSM_A_PDU_TYPE_RR, DE_RR_VGCS_CIP_PAR, NULL);
7165
7166     /* Dedicated Service Information,   Dedicated Service Information 10.5.2.59 */
7167     ELEM_OPT_TV(0x51,GSM_A_PDU_TYPE_RR, DE_RR_DED_SERV_INF, NULL);
7168
7169     EXTRANEOUS_DATA_CHECK(len, curr_offset - offset);
7170
7171 }
7172
7173 /*
7174  * 9.1.15a Inter System To UTRAN Handover Command
7175  */
7176 static void
7177 dtap_rr_inter_syst_to_utran_ho_cmd(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7178 {
7179     guint32     curr_offset;
7180     guint32     consumed;
7181     guint       curr_len;
7182
7183     curr_offset = offset;
7184     curr_len = len;
7185
7186     /* UTRAN Classmark          10.5.2.51       M LV 2-? */
7187     ELEM_MAND_LV(GSM_A_PDU_TYPE_RR, DE_RR_HO_TO_UTRAN_CMD, NULL);
7188
7189     EXTRANEOUS_DATA_CHECK(curr_len, 0);
7190 }
7191
7192 /* 3GPP TS 24.008 version 4.7.0 Release 4
7193  * [3] 9.1.16
7194  */
7195 static void
7196 dtap_rr_ho_cpte(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7197 {
7198     guint32     curr_offset;
7199     guint32     consumed;
7200     guint       curr_len;
7201     curr_offset = offset;
7202     curr_len = len;
7203
7204     /* RR Cause RR Cause 10.5.2.31 M V 1 */
7205     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CAUSE);
7206
7207     /* 77 Mobile Observed Time Difference       Mobile Time Difference 10.5.2.21a */
7208     ELEM_OPT_TLV(0x77,GSM_A_PDU_TYPE_RR, DE_RR_MOB_TIME_DIFF, " - Mobile Observed Time Difference");
7209
7210     EXTRANEOUS_DATA_CHECK(len, curr_offset - offset);
7211
7212 }
7213
7214 /*
7215  * 9.1.17 Handover failure
7216  */
7217 static void
7218 dtap_rr_ho_fail(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7219 {
7220     guint32     curr_offset;
7221     guint32     consumed;
7222     guint       curr_len;
7223
7224     curr_offset = offset;
7225     curr_len = len;
7226
7227     /* RR Cause RR Cause 10.5.2.31 M V 1 */
7228     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CAUSE);
7229
7230     EXTRANEOUS_DATA_CHECK(curr_len, 0);
7231
7232 }
7233
7234 /*
7235  * 9.1.18 Immediate assignment See 3GPP TS 44.018
7236  */
7237 static void
7238 dtap_rr_imm_ass(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7239 {
7240     guint32     curr_offset;
7241     guint32     consumed;
7242     guint       curr_len;
7243     guint8 oct;
7244     curr_offset = offset;
7245     curr_len = len;
7246
7247     oct = tvb_get_guint8(tvb, curr_offset);
7248
7249     /* NOTE: The order of the mandatory information elements should be chosen so that
7250      * information elements with 1/2 octet of content (type 1) go together in succession.
7251      * The first type 1 information element occupies bits 1 to 4 of octet N,
7252      * the second bits 5 to 8 of octet N, the third bits 1 to 4 of octet N+1 etc.
7253      * If the number of type 1 information elements is odd then bits 5 to 8 of the last octet
7254      *  occupied by these information elements should be treated as spare bits,
7255      * i.e. coded with a "0" in each.
7256      */
7257
7258     /* Page Mode                                        10.5.2.26       M V 1/2 */
7259     ELEM_MAND_V_SHORT(GSM_A_PDU_TYPE_RR, DE_RR_PAGE_MODE);
7260
7261     /* Dedicated mode or TBF            10.5.2.25b      M V 1/2 */
7262     ELEM_MAND_V_SHORT(GSM_A_PDU_TYPE_RR, DE_RR_DED_MOD_OR_TBF);
7263
7264     if((oct&0x10) == 0){
7265         /* Channel Description                  10.5.2.5        C V 3m */
7266         ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC);
7267     }else{
7268         /* Packet Channel Description   10.5.2.25a      C V 3
7269          * If the Dedicated mode or TBF IE indicates that the message assigns a Temporary Block Flow (TBF),
7270          * the mobile station shall consider this information element present in the message.
7271          * If the Dedicated mode or TBF IE indicates that this message is the first of two in a two-message
7272          * assignment of an uplink or downlink TBF, the mobile station shall ignore the contents
7273          * of this information element and regard it as an unnecessary IE.
7274          */
7275         if((oct&0x04) == 0){
7276             ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_PACKET_CH_DESC);
7277         }
7278     }
7279     /* Request Reference                        10.5.2.30       M V 3   */
7280     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_REQ_REF);
7281
7282     /* Timing Advance                           10.5.2.40       M V 1   */
7283     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_TIMING_ADV);
7284     /* Mobile Allocation                        10.5.2.21       M LV 1-9 */
7285     ELEM_MAND_LV(GSM_A_PDU_TYPE_RR, DE_RR_MOB_ALL, NULL);
7286     /* 7C Starting Time                         10.5.2.38       O TV 3  */
7287     ELEM_OPT_TV(0x7C,GSM_A_PDU_TYPE_RR, DE_RR_STARTING_TIME, NULL);
7288     /* IA Rest Octets                           10.5.2.16       M V 0-11 */
7289     if(tvb_length_remaining(tvb,curr_offset) > 0)
7290         ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_IA_REST_OCT);
7291
7292 }
7293
7294 /*
7295  * 9.1.19 Immediate assignment extended
7296  */
7297 static void
7298 dtap_rr_imm_ass_ext(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7299 {
7300     guint32     curr_offset;
7301     guint32     consumed;
7302     guint       curr_len;
7303     guint8 oct;
7304     curr_offset = offset;
7305     curr_len = len;
7306
7307     oct = tvb_get_guint8(tvb, curr_offset);
7308
7309     /* Page Mode                                                10.5.2.26       M V 1/2 */
7310     ELEM_MAND_V_SHORT(GSM_A_PDU_TYPE_RR, DE_RR_PAGE_MODE);
7311     /* Spare Half Octet                                         10.5.1.8        M V 1/2 */
7312     ELEM_MAND_V_SHORT(GSM_A_PDU_TYPE_COMMON, DE_SPARE_NIBBLE);
7313     /* Channel Description 1    Channel Description             10.5.2.5        M V 3 */
7314     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC);
7315     /* Request Reference 1      Request Reference               10.5.2.30       M V 3   */
7316     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_REQ_REF);
7317     /* Timing Advance 1 Timing Advance                          10.5.2.40       M V 1   */
7318     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_TIMING_ADV);
7319     /* Channel Description 2    Channel Description             10.5.2.5        M V 3 */
7320     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC);
7321     /* Request Reference 2      Request Reference               10.5.2.30       M V 3   */
7322     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_REQ_REF);
7323     /* Timing Advance 2 Timing Advance                          10.5.2.40       M V 1   */
7324     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_TIMING_ADV);
7325     /* Mobile Allocation                                        10.5.2.21       M LV 1-9 */
7326     ELEM_MAND_LV(GSM_A_PDU_TYPE_RR, DE_RR_MOB_ALL, NULL);
7327     /* 7C Starting Time                                         10.5.2.38       O TV 3  */
7328     ELEM_OPT_TV(0x7C,GSM_A_PDU_TYPE_RR, DE_RR_STARTING_TIME, NULL);
7329     /* IAX Rest Octets                                          10.5.2.18       M V 0-4 */
7330     if(tvb_length_remaining(tvb,curr_offset) > 0)
7331         ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_IAX_REST_OCT);
7332
7333 }
7334
7335 /*
7336  * 9.1.20 Immediate assignment reject
7337  */
7338 static void
7339 dtap_rr_imm_ass_rej(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7340 {
7341     guint32     curr_offset;
7342     guint32     consumed;
7343     guint       curr_len;
7344     guint8 oct;
7345     curr_offset = offset;
7346     curr_len = len;
7347
7348     oct = tvb_get_guint8(tvb, curr_offset);
7349
7350     /* Page Mode                                        10.5.2.26       M V 1/2 */
7351     ELEM_MAND_V_SHORT(GSM_A_PDU_TYPE_RR, DE_RR_PAGE_MODE);
7352     /* Spare Half Octet         10.5.1.8        M V 1/2 */
7353     ELEM_MAND_V_SHORT(GSM_A_PDU_TYPE_COMMON, DE_SPARE_NIBBLE);
7354     /* Request Reference 1      Request Reference               10.5.2.30       M V 3   */
7355     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_REQ_REF);
7356     /* Wait Indication 1        Wait Indication                 10.5.2.43       M V 1   */
7357     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_WAIT_IND);
7358     /* Request Reference 2      Request Reference               10.5.2.30       M V 3   */
7359     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_REQ_REF);
7360     /* Wait Indication 2        Wait Indication                 10.5.2.43       M V 1   */
7361     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_WAIT_IND);
7362     /* Request Reference 3      Request Reference               10.5.2.30       M V 3   */
7363     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_REQ_REF);
7364     /* Wait Indication 3        Wait Indication                 10.5.2.43       M V 1   */
7365     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_WAIT_IND);
7366     /* Request Reference 4      Request Reference               10.5.2.30       M V 3   */
7367     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_REQ_REF);
7368     /* Wait Indication 4        Wait Indication                 10.5.2.43       M V 1   */
7369     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_WAIT_IND);
7370     /* IAR Rest Octets                          10.5.2.19       M V 3 */
7371     if(tvb_length_remaining(tvb,curr_offset) > 0)
7372         ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_IAR_REST_OCT);
7373
7374 }
7375
7376 /*
7377  * 9.1.21 Measurement report
7378  */
7379 static void
7380 dtap_rr_meas_rep(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7381 {
7382     guint32     curr_offset;
7383     guint32     consumed;
7384     guint       curr_len;
7385
7386     curr_offset = offset;
7387     curr_len = len;
7388
7389     /* Measurement Results 10.5.2.20 M V 16 */
7390     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_MEAS_RES);
7391 }
7392
7393 /*
7394  * 9.1.7 Paging Request Type 1
7395  */
7396 static void
7397 dtap_rr_paging_req_type_1(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7398 {
7399     guint32     curr_offset;
7400     guint32     consumed;
7401     guint       curr_len;
7402
7403     curr_offset = offset;
7404     curr_len = len;
7405     lower_nibble = FALSE;
7406
7407     /* RR Page Mode 10.5.2.26 M V 1/2 */
7408     ELEM_MAND_V_SHORT(GSM_A_PDU_TYPE_RR, DE_RR_PAGE_MODE);
7409
7410     /* RR Channel Needed 10.5.2.8 M V 1/2 */
7411     ELEM_MAND_V_SHORT(GSM_A_PDU_TYPE_RR, DE_RR_CHNL_NEEDED);
7412
7413     /* RR Mobile Identity 10.5.1.4 M LV 2-9 */
7414     ELEM_MAND_LV(GSM_A_PDU_TYPE_COMMON, DE_MID, " - Mobile Identity 1");
7415
7416     /* RR Mobile Identity 10.5.1.4 O TLV 3-10 */
7417     ELEM_OPT_TLV(0x17, GSM_A_PDU_TYPE_COMMON, DE_MID, " - Mobile Identity 2");
7418
7419     /* RR P1 Rest Octets 10.5.2.23 M V 0-17 */
7420     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_P1_REST_OCT);
7421
7422 }
7423
7424 /*
7425  * 9.1.8 Paging Request Type 2
7426  */
7427 static void
7428 dtap_rr_paging_req_type_2(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7429 {
7430     guint32     curr_offset;
7431     guint32     consumed;
7432     guint       curr_len;
7433
7434     curr_offset = offset;
7435     curr_len = len;
7436     lower_nibble = FALSE;
7437
7438     /* RR Page Mode 10.5.2.26 M V 1/2 */
7439     ELEM_MAND_V_SHORT(GSM_A_PDU_TYPE_RR, DE_RR_PAGE_MODE);
7440
7441     /* RR Channel Needed 10.5.2.8 M V 1/2 */
7442     ELEM_MAND_V_SHORT(GSM_A_PDU_TYPE_RR, DE_RR_CHNL_NEEDED);
7443
7444     /* RR TMSI/P-TMSI 10.5.2.42 M V 4 */
7445     proto_tree_add_text(tree, tvb, curr_offset, 4, "Mobile Identity 1");
7446     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_TMSI_PTMSI);
7447
7448     /* RR TMSI/P-TMSI 10.5.2.42 M V 4 */
7449     proto_tree_add_text(tree, tvb, curr_offset, 4, "Mobile Identity 2");
7450     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_TMSI_PTMSI);
7451
7452     /* RR Mobile Identity 10.5.1.4 O TLV 3-10 */
7453     ELEM_OPT_TLV(0x17, GSM_A_PDU_TYPE_COMMON, DE_MID, " - Mobile Identity 3");
7454
7455     /* RR P2 Rest Octets 10.5.2.24 M V 1-11 */
7456     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_P2_REST_OCT);
7457
7458 }
7459
7460 /*
7461  * 9.1.9 Paging Request Type 3
7462  */
7463 static void
7464 dtap_rr_paging_req_type_3(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7465 {
7466     guint32     curr_offset;
7467     guint32     consumed;
7468     guint       curr_len;
7469
7470     curr_offset = offset;
7471     curr_len = len;
7472     lower_nibble = FALSE;
7473
7474     /* RR Page Mode 10.5.2.26 M V 1/2 */
7475     ELEM_MAND_V_SHORT(GSM_A_PDU_TYPE_RR, DE_RR_PAGE_MODE);
7476
7477     /* RR Channel Needed 10.5.2.8 M V 1/2 */
7478     ELEM_MAND_V_SHORT(GSM_A_PDU_TYPE_RR, DE_RR_CHNL_NEEDED);
7479
7480     /* RR TMSI/P-TMSI 10.5.2.42 M V 4 */
7481     proto_tree_add_text(tree, tvb, curr_offset, 4, "Mobile Identity 1");
7482     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_TMSI_PTMSI);
7483
7484     /* RR TMSI/P-TMSI 10.5.2.42 M V 4 */
7485     proto_tree_add_text(tree, tvb, curr_offset, 4, "Mobile Identity 2");
7486     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_TMSI_PTMSI);
7487
7488     /* RR TMSI/P-TMSI 10.5.2.42 M V 4 */
7489     proto_tree_add_text(tree, tvb, curr_offset, 4, "Mobile Identity 3");
7490     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_TMSI_PTMSI);
7491
7492     /* RR TMSI/P-TMSI 10.5.2.42 M V 4 */
7493     proto_tree_add_text(tree, tvb, curr_offset, 4, "Mobile Identity 4");
7494     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_TMSI_PTMSI);
7495
7496     /* RR P3 Rest Octets 10.5.2.25 M V 3 */
7497     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_P3_REST_OCT);
7498
7499 }
7500
7501 /*
7502  * [4] 9.1.25 Paging response
7503  */
7504 static void
7505 dtap_rr_paging_resp(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7506 {
7507     guint32     curr_offset;
7508     guint32     consumed;
7509     guint       curr_len;
7510     guint8      oct;
7511     proto_tree  *subtree;
7512     proto_item  *item;
7513
7514     curr_offset = offset;
7515     curr_len = len;
7516
7517     /*
7518      * special dissection for Cipher Key Sequence Number
7519      */
7520     oct = tvb_get_guint8(tvb, curr_offset);
7521
7522     other_decode_bitfield_value(a_bigbuf, oct, 0xf0, 8);
7523     proto_tree_add_text(tree,
7524                         tvb, curr_offset, 1,
7525                         "%s :  Spare",
7526                         a_bigbuf);
7527
7528     item =
7529         proto_tree_add_text(tree,
7530                             tvb, curr_offset, 1, "%s",
7531                             gsm_common_elem_strings[DE_CIPH_KEY_SEQ_NUM].strptr);
7532
7533     subtree = proto_item_add_subtree(item, ett_gsm_common_elem[DE_CIPH_KEY_SEQ_NUM]);
7534
7535     other_decode_bitfield_value(a_bigbuf, oct, 0x08, 8);
7536     proto_tree_add_text(subtree,
7537                         tvb, curr_offset, 1,
7538                         "%s :  Spare",
7539                         a_bigbuf);
7540
7541     other_decode_bitfield_value(a_bigbuf, oct, 0x07, 8);
7542
7543     switch (oct & 0x07)
7544     {
7545     case 0x07:
7546         proto_tree_add_text(subtree,
7547                             tvb, curr_offset, 1,
7548                             "%s :  Ciphering Key Sequence Number: No key is available",
7549                             a_bigbuf);
7550         break;
7551
7552     default:
7553         proto_tree_add_text(subtree,
7554                             tvb, curr_offset, 1,
7555                             "%s :  Ciphering Key Sequence Number: %u",
7556                             a_bigbuf,
7557                             oct & 0x07);
7558         break;
7559     }
7560
7561     curr_offset++;
7562     curr_len--;
7563
7564     if ((signed)curr_len <= 0) return;
7565
7566     ELEM_MAND_LV(GSM_A_PDU_TYPE_COMMON, DE_MS_CM_2, NULL);
7567
7568     ELEM_MAND_LV(GSM_A_PDU_TYPE_COMMON, DE_MID, NULL);
7569
7570     EXTRANEOUS_DATA_CHECK(curr_len, 0);
7571 }
7572
7573 /*
7574  * [4] 9.1.26 Partial Release
7575  */
7576 static void
7577 dtap_rr_partial_rel(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7578 {
7579     guint32 curr_offset;
7580     guint32 consumed;
7581     guint curr_len;
7582
7583     curr_offset = offset;
7584     curr_len = len;
7585
7586     /* Channel Description  10.5.2.5  M V 3 */
7587     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC);
7588
7589     EXTRANEOUS_DATA_CHECK(curr_len, 0);
7590 }
7591
7592 /*
7593  * [4] 9.1.27 Partial Release Complete
7594  */
7595 /* empty message */
7596
7597 /*
7598  * [4] 9.1.29 Physical Information
7599  */
7600 static void
7601 dtap_rr_phy_info(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7602 {
7603     guint32     curr_offset;
7604     guint32     consumed;
7605     guint       curr_len;
7606
7607     curr_offset = offset;
7608     curr_len = len;
7609
7610     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_TIMING_ADV);
7611
7612     EXTRANEOUS_DATA_CHECK(curr_len, 0);
7613 }
7614
7615 /*
7616  * [4] 9.1.29
7617  */
7618 static void
7619 dtap_rr_rr_status(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7620 {
7621     guint32     curr_offset;
7622     guint32     consumed;
7623     guint       curr_len;
7624
7625     curr_offset = offset;
7626     curr_len = len;
7627
7628     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CAUSE);
7629
7630     EXTRANEOUS_DATA_CHECK(curr_len, 0);
7631 }
7632
7633 /*
7634  * [4] 9.1.31
7635  */
7636 static void
7637 dtap_rr_sys_info_1(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7638 {
7639     guint32     curr_offset;
7640     guint32     consumed;
7641     guint       curr_len;
7642
7643     curr_offset = offset;
7644     curr_len = len;
7645
7646     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CELL_CH_DSC);
7647
7648     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_RACH_CTRL_PARAM);
7649
7650     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_SI1_REST_OCT);
7651 }
7652
7653 /*
7654  * [4] 9.1.32
7655  */
7656 static void
7657 dtap_rr_sys_info_2(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7658 {
7659     guint32     curr_offset;
7660     guint32     consumed;
7661     guint       curr_len;
7662
7663     curr_offset = offset;
7664     curr_len = len;
7665
7666     proto_tree_add_text(tree, tvb, curr_offset, 16, "BCCH Frequency List");
7667     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_NEIGH_CELL_DESC);
7668
7669     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_NCC_PERM);
7670
7671     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_RACH_CTRL_PARAM);
7672 }
7673
7674 /*
7675  * [4] 9.1.33
7676  */
7677 static void
7678 dtap_rr_sys_info_2bis(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7679 {
7680     guint32     curr_offset;
7681     guint32     consumed;
7682     guint       curr_len;
7683
7684     curr_offset = offset;
7685     curr_len = len;
7686
7687     proto_tree_add_text(tree, tvb, curr_offset, 16, "Extended BCCH Frequency List");
7688     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_NEIGH_CELL_DESC);
7689
7690     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_RACH_CTRL_PARAM);
7691 }
7692
7693 /*
7694  * [4] 9.1.34
7695  */
7696 static void
7697 dtap_rr_sys_info_2ter(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7698 {
7699     guint32     curr_offset;
7700     guint32     consumed;
7701     guint       curr_len;
7702
7703     curr_offset = offset;
7704     curr_len = len;
7705
7706     proto_tree_add_text(tree, tvb, curr_offset, 16, "Extended BCCH Frequency List");
7707     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_NEIGH_CELL_DESC2);
7708
7709     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_SI2TER_REST_OCT);
7710 }
7711
7712 /*
7713  * [4] 9.1.34a
7714  */
7715 static void
7716 dtap_rr_sys_info_2quater(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7717 {
7718     guint32     curr_offset;
7719     guint32     consumed;
7720     guint       curr_len;
7721
7722     curr_offset = offset;
7723     curr_len = len;
7724
7725     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_SI2QUATER_REST_OCT);
7726 }
7727
7728 /*
7729  * [4] 9.1.35
7730  */
7731 static void
7732 dtap_rr_sys_info_3(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7733 {
7734     guint32     curr_offset;
7735     guint32     consumed;
7736     guint       curr_len;
7737
7738     curr_offset = offset;
7739     curr_len = len;
7740
7741     ELEM_MAND_V(GSM_A_PDU_TYPE_COMMON, DE_CELL_ID);
7742
7743     ELEM_MAND_V(GSM_A_PDU_TYPE_COMMON, DE_LAI);
7744
7745     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CTRL_CH_DESC);
7746
7747     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CELL_OPT_BCCH);
7748
7749     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CELL_SEL_PARAM);
7750
7751     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_RACH_CTRL_PARAM);
7752
7753     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_SI3_REST_OCT);
7754 }
7755
7756 /*
7757  * [4] 9.1.36
7758  */
7759 static void
7760 dtap_rr_sys_info_4(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7761 {
7762     guint32     curr_offset;
7763     guint32     consumed;
7764     guint       curr_len;
7765
7766     curr_offset = offset;
7767     curr_len = len;
7768
7769     ELEM_MAND_V(GSM_A_PDU_TYPE_COMMON, DE_LAI);
7770
7771     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CELL_SEL_PARAM);
7772
7773     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_RACH_CTRL_PARAM);
7774
7775     ELEM_OPT_TV(0x64, GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC, "CBCH Channel Description");
7776
7777     ELEM_OPT_TV(0x72, GSM_A_PDU_TYPE_RR, DE_RR_MOB_ALL, "CBCH Mobile Allocation");
7778
7779     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_SI4_REST_OCT);
7780 }
7781
7782 /*
7783  * [4] 9.1.37
7784  */
7785 static void
7786 dtap_rr_sys_info_5(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7787 {
7788     guint32     curr_offset;
7789     guint32     consumed;
7790     guint       curr_len;
7791
7792     curr_offset = offset;
7793     curr_len = len;
7794
7795     proto_tree_add_text(tree, tvb, curr_offset, 16, "BCCH Frequency List");
7796     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_NEIGH_CELL_DESC);
7797 }
7798
7799 /*
7800  * [4] 9.1.38
7801  */
7802 static void
7803 dtap_rr_sys_info_5bis(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7804 {
7805     guint32     curr_offset;
7806     guint32     consumed;
7807     guint       curr_len;
7808
7809     curr_offset = offset;
7810     curr_len = len;
7811
7812     proto_tree_add_text(tree, tvb, curr_offset, 16, "Extended BCCH Frequency List");
7813     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_NEIGH_CELL_DESC);
7814 }
7815
7816 /*
7817  * [4] 9.1.39
7818  */
7819 static void
7820 dtap_rr_sys_info_5ter(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7821 {
7822     guint32     curr_offset;
7823     guint32     consumed;
7824     guint       curr_len;
7825
7826     curr_offset = offset;
7827     curr_len = len;
7828
7829     proto_tree_add_text(tree, tvb, curr_offset, 16, "Extended BCCH Frequency List");
7830     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_NEIGH_CELL_DESC2);
7831 }
7832
7833 /*
7834  * [4] 9.1.40
7835  */
7836 static void
7837 dtap_rr_sys_info_6(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7838 {
7839     guint32     curr_offset;
7840     guint32     consumed;
7841     guint       curr_len;
7842
7843     curr_offset = offset;
7844     curr_len = len;
7845
7846     ELEM_MAND_V(GSM_A_PDU_TYPE_COMMON, DE_CELL_ID);
7847
7848     ELEM_MAND_V(GSM_A_PDU_TYPE_COMMON, DE_LAI);
7849
7850     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CELL_OPT_SACCH);
7851
7852     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_NCC_PERM);
7853
7854     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_SI6_REST_OCT);
7855 }
7856
7857 /*
7858  * [4] 9.1.43a
7859  */
7860 static void
7861 dtap_rr_sys_info_13(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7862 {
7863     guint32     curr_offset;
7864     guint32     consumed;
7865     guint       curr_len;
7866
7867     curr_offset = offset;
7868     curr_len = len;
7869
7870     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_SI13_REST_OCT);
7871 }
7872
7873 /*
7874  * [4] 9.1.51 Extended Measurement Order
7875  */
7876 static void
7877 dtap_rr_ext_meas_order(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7878 {
7879     guint32 curr_offset;
7880     guint32 consumed;
7881     guint curr_len;
7882
7883     curr_offset = offset;
7884     curr_len = len;
7885
7886     /* Extended Measurement Frequency List  10.5.2.46  M V 16 */
7887     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_EXT_MEAS_FREQ_LIST);
7888 }
7889
7890 /*
7891  * [4] 9.1.52 Extended Measurement Report
7892  */
7893 static void
7894 dtap_rr_ext_meas_report(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7895 {
7896     guint32 curr_offset;
7897     guint32 consumed;
7898     guint curr_len;
7899
7900     curr_offset = offset;
7901     curr_len = len;
7902
7903     /* Extended Measurement Result  10.5.2.45  M V 16 */
7904     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_EXT_MEAS_RESULT);
7905 }
7906
7907 /*
7908  * 9.1.53 Application Information
7909  */
7910 static void
7911 dtap_rr_app_inf(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
7912 {
7913     guint32     curr_offset;
7914     guint32     consumed;
7915     guint       curr_len;
7916
7917     curr_offset = offset;
7918     curr_len = len;
7919
7920     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_APDU_ID);
7921     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_APDU_FLAGS);
7922     ELEM_MAND_LV(GSM_A_PDU_TYPE_RR, DE_RR_APDU_DATA, NULL);
7923 }
7924
7925 /*
7926  * [4] 9.1.54 Measurement Information
7927  */
7928 static const value_string gsm_a_rr_3g_wait_vals[] = {
7929     { 0, "1 instance that contain 3G Neighbour Cell Description shall be received"},
7930     { 1, "2 instances that contain 3G Neighbour Cell Description shall be received"},
7931     { 2, "3 instances that contain 3G Neighbour Cell Description shall be received"},
7932     { 3, "4 instances that contain 3G Neighbour Cell Description shall be received"},
7933     { 4, "5 instances that contain 3G Neighbour Cell Description shall be received"},
7934     { 5, "6 instances that contain 3G Neighbour Cell Description shall be received"},
7935     { 6, "7 instances that contain 3G Neighbour Cell Description shall be received"},
7936     { 7, "8 instances that contain 3G Neighbour Cell Description shall be received"},
7937     { 0, NULL }
7938 };
7939
7940
7941 static void
7942 sacch_rr_meas_info(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_)
7943 {
7944     proto_tree *subtree, *subtree2;
7945     proto_item *item, *item2;
7946     guint32 curr_offset;
7947     gint bit_offset, bit_offset_sav, bit_offset_sav2;
7948     guint8 value, idx;
7949
7950     curr_offset = offset;
7951     bit_offset = curr_offset << 3;
7952
7953     proto_tree_add_bits_item(tree, hf_gsm_a_rr_ba_ind, tvb, bit_offset, 1, FALSE);
7954     bit_offset += 1;
7955     proto_tree_add_bits_item(tree, hf_gsm_a_rr_3g_ba_ind, tvb, bit_offset, 1, FALSE);
7956     bit_offset += 1;
7957     proto_tree_add_bits_item(tree, hf_gsm_a_rr_mp_change_mark, tvb, bit_offset, 1, FALSE);
7958     bit_offset += 1;
7959     proto_tree_add_bits_item(tree, hf_gsm_a_rr_mi_index, tvb, bit_offset, 4, FALSE);
7960     bit_offset += 4;
7961     proto_tree_add_bits_item(tree, hf_gsm_a_rr_mi_count, tvb, bit_offset, 4, FALSE);
7962     bit_offset += 4;
7963     proto_tree_add_bits_item(tree, hf_gsm_a_rr_pwrc, tvb, bit_offset, 1, FALSE);
7964     bit_offset += 1;
7965     proto_tree_add_bits_item(tree, hf_gsm_a_rr_gsm_report_type, tvb, bit_offset, 1, FALSE);
7966     bit_offset += 1;
7967     proto_tree_add_bits_item(tree, hf_gsm_a_rr_reporting_rate, tvb, bit_offset, 1, FALSE);
7968     bit_offset +=1;
7969     proto_tree_add_bits_item(tree, hf_gsm_a_rr_invalid_bsic_reporting, tvb, bit_offset, 1, FALSE);
7970     bit_offset +=1;
7971     value = tvb_get_bits8(tvb,bit_offset,1);
7972     bit_offset += 1;
7973     if (value)
7974     { /* Real Time Difference Description */
7975         bit_offset += de_rr_rtd_desc(tvb, tree, bit_offset, DE_RR_REST_OCTETS_RTD_DESC);
7976     }
7977     value = tvb_get_bits8(tvb,bit_offset,1);
7978     bit_offset += 1;
7979     if (value)
7980     { /* BSIC Description */
7981         bit_offset += de_rr_bsic_desc(tvb, tree, bit_offset, DE_RR_REST_OCTETS_BSIC_DESC);
7982     }
7983     value = tvb_get_bits8(tvb,bit_offset,1);
7984     bit_offset += 1;
7985     if (value)
7986     { /* Report Priority Description */
7987         bit_offset += de_rr_report_priority_desc(tvb, tree, bit_offset, DE_RR_REST_OCTETS_REPORT_PRIO_DESC);
7988     }
7989     value = tvb_get_bits8(tvb,bit_offset,1);
7990     bit_offset += 1;
7991     if (value)
7992     { /* Measurement Parameters Description */
7993         bit_offset += de_rr_meas_param_desc(tvb, tree, bit_offset, DE_RR_REST_OCTETS_MEAS_PARAM_DESC);
7994     }
7995     value = tvb_get_bits8(tvb,bit_offset,1);
7996     bit_offset += 1;
7997     if (value)
7998     {  /* used for future extensions of the 2G parameters */
7999         value = tvb_get_bits8(tvb,bit_offset,8);
8000         bit_offset += 8 + value + 1;
8001     }
8002     value = tvb_get_bits8(tvb,bit_offset,1);
8003     bit_offset += 1;
8004     if (value)
8005     { /* 3G Neighbour Cell Description */
8006         bit_offset_sav = bit_offset;
8007         item = proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_3G_NEIGH_CELL_DESC].strptr);
8008         subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_3G_NEIGH_CELL_DESC]);
8009         value = tvb_get_bits8(tvb,bit_offset,1);
8010         bit_offset += 1;
8011         if (value)
8012         {
8013             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_3g_wait, tvb, bit_offset, 3, FALSE);
8014             bit_offset += 3;
8015         }
8016         value = tvb_get_bits8(tvb,bit_offset,1);
8017         bit_offset += 1;
8018         if (value)
8019         {
8020             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_index_start_3g, tvb, bit_offset, 7, FALSE);
8021             bit_offset += 7;
8022         }
8023         value = tvb_get_bits8(tvb,bit_offset,1);
8024         bit_offset += 1;
8025         if (value)
8026         {
8027             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_absolute_index_start_emr, tvb, bit_offset, 7, FALSE);
8028             bit_offset += 7;
8029         }
8030         value = tvb_get_bits8(tvb,bit_offset,1);
8031         bit_offset += 1;
8032         if (value)
8033         { /* UTRAN FDD Description */
8034             bit_offset += de_rr_si2quater_meas_info_utran_fdd_desc(tvb, subtree, bit_offset);
8035         }
8036         value = tvb_get_bits8(tvb,bit_offset,1);
8037         bit_offset += 1;
8038         if (value)
8039         { /* UTRAN TDD Description */
8040             bit_offset += de_rr_si2quater_meas_info_utran_tdd_desc(tvb, subtree, bit_offset);
8041         }
8042         value = tvb_get_bits8(tvb,bit_offset,1);
8043         bit_offset += 1;
8044         if (value)
8045         { /* CDMA2000 Description */
8046             bit_offset_sav2 = bit_offset;
8047             item2 = proto_tree_add_text(subtree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_CDMA2000_DESC].strptr);
8048             subtree2 = proto_item_add_subtree(item2, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_CDMA2000_DESC]);
8049             bit_offset += 16; /* cdma2000 frequency band + cdma2000 frequency */
8050             idx = tvb_get_bits8(tvb,bit_offset,5); /* number_cdma2000_cells */
8051             bit_offset += 5;
8052             while (idx)
8053             {
8054                 bit_offset += 9; /* Pilot PN offset */
8055                 if (tvb_get_bits8(tvb,bit_offset,1))
8056                 {
8057                     bit_offset += 1;
8058                     value = tvb_get_bits8(tvb,bit_offset,3);
8059                     switch (value)
8060                     {
8061                     case 0:
8062                         bit_offset += 5; /* TD_MODE + TD_POWER_LEVEL */
8063                         break;
8064                     case 1:
8065                         bit_offset += 2; /* QOF */
8066                         bit_offset += tvb_get_bits8(tvb,bit_offset,3) + 3 + 6; /* WALSH_LEN_A + bit(val(WALSH_LEN_A)+6) */
8067                         break;
8068                     case 2:
8069                         bit_offset += 2; /* QOF */
8070                         bit_offset += tvb_get_bits8(tvb,bit_offset,3) + 3 + 6; /* WALSH_LEN_B + bit(val(WALSH_LEN_B)+6) */
8071                         bit_offset += 4; /* AUX_TD_POWER_LEVEL + TD_MODE */
8072                         break;
8073                     case 3:
8074                         bit_offset += 8; /* SR3_PRIM_PILOT + SR3_PILOT_POWER1 + SR3_PILOT_POWER2 */
8075                         break;
8076                     case 6:
8077                         bit_offset += 10; /* SR3_PRIM_PILOT + SR3_PILOT_POWER1 + SR3_PILOT_POWER2 + QOF */
8078                         bit_offset += tvb_get_bits8(tvb,bit_offset,3) + 3 + 6; /* WALSH_LEN_C + bit(val(WALSH_LEN_C)+6) */
8079                         if (tvb_get_bits8(tvb,bit_offset,1))
8080                         {
8081                             bit_offset += 3; /* 1 + QOF1 */
8082                             bit_offset += tvb_get_bits8(tvb,bit_offset,3) + 3 + 6; /* WALSH_LENGTH1 + bit(val(WALSH_LENGTH1)+6) */
8083                         }
8084                         else
8085                             bit_offset += 1;
8086                         if (tvb_get_bits8(tvb,bit_offset,1))
8087                         {
8088                             bit_offset += 3; /* 1 + QOF2 */
8089                             bit_offset += tvb_get_bits8(tvb,bit_offset,3) + 3 + 6; /* WALSH_LENGTH2 + bit(val(WALSH_LENGTH2)+6) */
8090                         }
8091                         else
8092                             bit_offset += 1;
8093                         break;
8094                     default:
8095                         /* decoding sequence is unknown ! */
8096                         return;
8097                     }
8098                 }
8099                 else
8100                     bit_offset += 1;
8101                 idx -= 1;
8102             }
8103             proto_tree_add_text(subtree2,tvb, bit_offset_sav2>>3, ((bit_offset-bit_offset_sav2)>>3)+1,"Data(Not decoded)");
8104             proto_item_set_len(item2,((bit_offset-bit_offset_sav2)>>3)+1);
8105         }
8106         proto_item_set_len(item,((bit_offset-bit_offset_sav)>>3)+1);
8107     }
8108     value = tvb_get_bits8(tvb,bit_offset,1);
8109     bit_offset += 1;
8110     if (value)
8111     { /* 3G Measurement Parameters Description */
8112         bit_offset_sav = bit_offset;
8113         item = proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_3G_MEAS_PARAM_DESC].strptr);
8114         subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_3G_MEAS_PARAM_DESC]);
8115         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_qsearch_c, tvb, bit_offset, 4, FALSE);
8116         bit_offset += 4;
8117         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_3g_search_prio, tvb, bit_offset, 1, FALSE);
8118         bit_offset += 1;
8119         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_fdd_rep_quant, tvb, bit_offset, 1, FALSE);
8120         bit_offset += 1;
8121         value = tvb_get_bits8(tvb,bit_offset,1);
8122         bit_offset += 1;
8123         if (value)
8124         {
8125             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_fdd_multirat_reporting, tvb, bit_offset, 2, FALSE);
8126             bit_offset += 2;
8127         }
8128         value = tvb_get_bits8(tvb,bit_offset,1);
8129         bit_offset += 1;
8130         if (value)
8131         {
8132             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_fdd_reporting_offset, tvb, bit_offset, 3, FALSE);
8133             bit_offset += 3;
8134             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_fdd_reporting_threshold, tvb, bit_offset, 3, FALSE);
8135             bit_offset += 3;
8136         }
8137         value = tvb_get_bits8(tvb,bit_offset,1);
8138         bit_offset += 1;
8139         if (value)
8140         {
8141             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_tdd_multirat_reporting, tvb, bit_offset, 2, FALSE);
8142             bit_offset += 2;
8143         }
8144         value = tvb_get_bits8(tvb,bit_offset,1);
8145         bit_offset += 1;
8146         if (value)
8147         {
8148             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_tdd_reporting_offset, tvb, bit_offset, 3, FALSE);
8149             bit_offset += 3;
8150             proto_tree_add_bits_item(subtree, hf_gsm_a_rr_tdd_reporting_threshold, tvb, bit_offset, 3, FALSE);
8151             bit_offset += 3;
8152         }
8153         value = tvb_get_bits8(tvb,bit_offset,1);
8154         bit_offset += 1;
8155         if (value)
8156             bit_offset += 2; /* CDMA2000 Multirat Reporting */
8157         value = tvb_get_bits8(tvb,bit_offset,1);
8158         bit_offset += 1;
8159         if (value)
8160             bit_offset += 6; /* CDMA2000 Reporting Offset + CDMA2000 Reporting Threshold */
8161         proto_item_set_len(item,((bit_offset-bit_offset_sav)>>3)+1);
8162     }
8163     if (((curr_offset + len)<<3) - bit_offset > 0)
8164     {
8165         /* There is still room left in the Rest Octets IE */
8166         if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
8167         { /* Additions in Rel-5 */
8168             bit_offset += 1;
8169             value = tvb_get_bits8(tvb,bit_offset,1);
8170             bit_offset += 1;
8171             if (value)
8172             { /* 3G Additional Measurement Parameters Description 2 */
8173                 bit_offset += de_rr_3g_add_meas_param_desc2(tvb, tree, bit_offset);
8174             }
8175             if (((curr_offset + len)<<3) - bit_offset > 0)
8176             {
8177                 /* There is still room left in the Rest Octets IE */
8178                 if (gsm_a_rr_is_bit_high(tvb,bit_offset) == TRUE)
8179                 { /* Additions in Rel-7 */
8180                     bit_offset += 1;
8181                     value = tvb_get_bits8(tvb,bit_offset,1);
8182                     bit_offset += 1;
8183                     if (value)
8184                     {
8185                         proto_tree_add_bits_item(tree, hf_gsm_a_rr_700_reporting_offset, tvb, bit_offset, 3, FALSE);
8186                         bit_offset += 3;
8187                         proto_tree_add_bits_item(tree, hf_gsm_a_rr_700_reporting_threshold, tvb, bit_offset, 3, FALSE);
8188                         bit_offset += 3;
8189                     }
8190                     value = tvb_get_bits8(tvb,bit_offset,1);
8191                     bit_offset += 1;
8192                     if (value)
8193                     {
8194                         proto_tree_add_bits_item(tree, hf_gsm_a_rr_810_reporting_offset, tvb, bit_offset, 3, FALSE);
8195                         bit_offset += 3;
8196                         proto_tree_add_bits_item(tree, hf_gsm_a_rr_810_reporting_threshold, tvb, bit_offset, 3, FALSE);
8197                         bit_offset += 3;
8198                     }
8199                 }
8200                 else
8201                     bit_offset += 1;
8202             }
8203         }
8204         else
8205             bit_offset += 1;
8206     }
8207 }
8208
8209 /*
8210  * [4] 9.1.55 Enhanced Measurement Information
8211  */
8212 static const true_false_string gsm_a_rr_bsic_seen_value = {
8213     "One Cell or more with invalid BSIC and allowed NCC part of BSIC is seen",
8214     "No cell with invalid BSIC and allowed NCC part of BSIC is seen"
8215 };
8216
8217 static const true_false_string gsm_a_rr_scale_value = {
8218     "+10 dB",
8219     "0 dB"
8220 };
8221
8222 static const value_string gsm_a_rr_mean_bep_gmsk_vals[] = {
8223     {  0, "log10(BEP) > -0.60"},
8224     {  1, "-0.70 < log10(BEP) < -0.60"},
8225     {  2, "-0.80 < log10(BEP) < -0.70"},
8226     {  3, "-0.90 < log10(BEP) < -0.80"},
8227     {  4, "-1.00 < log10(BEP) < -0.90"},
8228     {  5, "-1.10 < log10(BEP) < -1.00"},
8229     {  6, "-1.20 < log10(BEP) < -1.10"},
8230     {  7, "-1.30 < log10(BEP) < -1.20"},
8231     {  8, "-1.40 < log10(BEP) < -1.30"},
8232     {  9, "-1.50 < log10(BEP) < -1.40"},
8233     { 10, "-1.60 < log10(BEP) < -1.50"},
8234     { 11, "-1.70 < log10(BEP) < -1.60"},
8235     { 12, "-1.80 < log10(BEP) < -1.70"},
8236     { 13, "-1.90 < log10(BEP) < -1.80"},
8237     { 14, "-2.00 < log10(BEP) < -1.90"},
8238     { 15, "-2.10 < log10(BEP) < -2.00"},
8239     { 16, "-2.20 < log10(BEP) < -2.10"},
8240     { 17, "-2.30 < log10(BEP) < -2.20"},
8241     { 18, "-2.40 < log10(BEP) < -2.30"},
8242     { 19, "-2.50 < log10(BEP) < -2.40"},
8243     { 20, "-2.60 < log10(BEP) < -2.50"},
8244     { 21, "-2.70 < log10(BEP) < -2.60"},
8245     { 22, "-2.80 < log10(BEP) < -2.70"},
8246     { 23, "-2.90 < log10(BEP) < -2.80"},
8247     { 24, "-3.00 < log10(BEP) < -2.90"},
8248     { 25, "-3.10 < log10(BEP) < -3.00"},
8249     { 26, "-3.20 < log10(BEP) < -3.10"},
8250     { 27, "-3.30 < log10(BEP) < -3.20"},
8251     { 28, "-3.40 < log10(BEP) < -3.30"},
8252     { 29, "-3.50 < log10(BEP) < -3.40"},
8253     { 30, "-3.60 < log10(BEP) < -3.50"},
8254     { 31, "log10(BEP) < -3.60"},
8255     {  0, NULL }
8256 };
8257
8258 static const value_string gsm_a_rr_cv_bep_vals[] = {
8259     {  0, "1.75 < CV BEP < 2.00"},
8260     {  1, "1.50 < CV BEP < 1.75"},
8261     {  2, "1.25 < CV BEP < 1.50"},
8262     {  3, "1.00 < CV BEP < 1.25"},
8263     {  4, "0.75 < CV BEP < 1.00"},
8264     {  5, "0.50 < CV BEP < 0.75"},
8265     {  6, "0.25 < CV BEP < 0.50"},
8266     {  7, "0.00 < CV BEP < 0.25"},
8267     {  0, NULL }
8268 };
8269
8270
8271 static void
8272 sacch_rr_enh_meas_report(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
8273 {
8274     proto_tree *subtree;
8275     proto_item *item;
8276     guint32 curr_offset;
8277     gint bit_offset, bit_offset_sav;
8278     guint8 value, idx;
8279
8280     curr_offset = offset;
8281     bit_offset = curr_offset << 3;
8282
8283     proto_tree_add_bits_item(tree, hf_gsm_a_rr_ba_used, tvb, bit_offset, 1, FALSE);
8284     bit_offset += 1;
8285     proto_tree_add_bits_item(tree, hf_gsm_a_rr_3g_ba_used, tvb, bit_offset, 1, FALSE);
8286     bit_offset += 1;
8287     proto_tree_add_bits_item(tree, hf_gsm_a_rr_bsic_seen, tvb, bit_offset, 1, FALSE);
8288     bit_offset += 1;
8289     proto_tree_add_bits_item(tree, hf_gsm_a_rr_scale, tvb, bit_offset, 1, FALSE);
8290     bit_offset += 1;
8291     value = tvb_get_bits8(tvb,bit_offset,1);
8292     bit_offset += 1;
8293     if (value)
8294     { /* Serving cell data */
8295         bit_offset_sav = bit_offset;
8296         item = proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_SERVING_CELL_DATA].strptr);
8297         subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_SERVING_CELL_DATA]);
8298         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_dtx_used, tvb, bit_offset, 1, FALSE);
8299         bit_offset += 1;
8300         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_rxlev_full_serv_cell, tvb, bit_offset, 6, FALSE);
8301         bit_offset += 6;
8302         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_rxqual_full_serv_cell, tvb, bit_offset, 3, FALSE);
8303         bit_offset += 3;
8304         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_mean_bep_gmsk, tvb, bit_offset, 5, FALSE);
8305         bit_offset += 5;
8306         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_mean_cv_bep, tvb, bit_offset, 3, FALSE);
8307         bit_offset += 3;
8308         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_nbr_rcvd_blocks, tvb, bit_offset, 5, FALSE);
8309         bit_offset += 5;
8310         proto_item_set_len(item,((bit_offset-bit_offset_sav)>>3)+1);
8311     }
8312     value = tvb_get_bits8(tvb,bit_offset,1);
8313     bit_offset += 1;
8314     while (value)
8315     { /* Repeated Invalid BSIC Information */
8316         bit_offset_sav = bit_offset;
8317         item = proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_REPEAT_INV_BSIC_INFO].strptr);
8318         subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_REPEAT_INV_BSIC_INFO]);
8319         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_bcch_freq_ncell, tvb, bit_offset, 5, FALSE);
8320         bit_offset += 5;
8321         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_bsic_ncell, tvb, bit_offset, 6, FALSE);
8322         bit_offset += 6;
8323         proto_tree_add_bits_item(subtree, hf_gsm_a_rr_rxlev_ncell, tvb, bit_offset, 6, FALSE);
8324         bit_offset += 6;
8325         proto_item_set_len(item,((bit_offset-bit_offset_sav)>>3)+1);
8326         value = tvb_get_bits8(tvb,bit_offset,1);
8327         bit_offset += 1;
8328     }
8329     value = tvb_get_bits8(tvb,bit_offset,1);
8330     bit_offset += 1;
8331     if (value)
8332     { /* Bitmap Type Reporting */
8333         bit_offset_sav = bit_offset;
8334         item = proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "%s", gsm_rr_rest_octets_elem_strings[DE_RR_REST_OCTETS_BITMAP_TYPE_REPORTING].strptr);
8335         subtree = proto_item_add_subtree(item, ett_gsm_rr_rest_octets_elem[DE_RR_REST_OCTETS_BITMAP_TYPE_REPORTING]);
8336         idx = 0;
8337         while (((guint)(bit_offset>>3) <= (offset + len)) && (idx < 96))
8338         {
8339             value  = tvb_get_bits8(tvb,bit_offset,1);
8340             bit_offset += 1;
8341             if (value)
8342             {
8343                 proto_tree_add_text(subtree, tvb, bit_offset>>3, 1, "Neighbour Cell List index: %u", idx);
8344                 proto_tree_add_bits_item(subtree, hf_gsm_a_rr_reporting_quantity, tvb, bit_offset, 6, FALSE);
8345                 bit_offset += 6;
8346             }
8347             idx += 1;
8348         }
8349     }
8350 }
8351
8352 #define NUM_GSM_DTAP_MSG_RR (sizeof(gsm_a_dtap_msg_rr_strings)/sizeof(value_string))
8353 static gint ett_gsm_dtap_msg_rr[NUM_GSM_DTAP_MSG_RR];
8354 static void (*dtap_msg_rr_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) = {
8355     NULL,       /* Reserved */
8356     dtap_rr_add_ass,            /* Additional Assignment */
8357     dtap_rr_imm_ass,            /* 9.1.18 Immediate assignment  */
8358     dtap_rr_imm_ass_ext,        /* Immediate Assignment Extended */
8359     dtap_rr_imm_ass_rej,        /* Immediate Assignment Reject */
8360
8361     NULL,                       /* DTM Assignment Failure */
8362     NULL,                       /* DTM Reject */
8363     NULL,                       /* DTM Request */
8364     NULL,                       /* Main DCCH Assignment Command */
8365     NULL,                       /* Packet Assignment Command */
8366
8367     dtap_rr_cip_mode_cmd,       /* Ciphering Mode Command */
8368     dtap_rr_cip_mode_cpte,      /* Ciphering Mode Complete */
8369
8370     dtap_rr_conf_change_cmd,    /* Configuration Change Command */
8371     NULL,                       /* Configuration Change Ack. */
8372     dtap_rr_conf_change_rej,    /* Configuration Change Reject */
8373
8374     dtap_rr_ass_cmd,            /* 9.1.2 Assignment Command */
8375     dtap_rr_ass_comp,           /* Assignment Complete */
8376     dtap_rr_ass_fail,           /* Assignment Failure */
8377     dtap_rr_ho_cmd,             /* Handover Command */
8378     dtap_rr_ho_cpte,            /* Handover Complete */
8379     dtap_rr_ho_fail,            /* Handover Failure */
8380     dtap_rr_phy_info,           /* Physical Information */
8381     NULL,                       /* DTM Assignment Command */
8382
8383     NULL,                       /* RR-cell Change Order */
8384     NULL,                       /* PDCH Assignment Command */
8385
8386     dtap_rr_ch_rel,             /* Channel Release */
8387     dtap_rr_partial_rel,        /* Partial Release */
8388     NULL,                       /* Partial Release Complete */
8389
8390     dtap_rr_paging_req_type_1,  /* Paging Request Type 1 */
8391     dtap_rr_paging_req_type_2,  /* Paging Request Type 2 */
8392     dtap_rr_paging_req_type_3,  /* Paging Request Type 3 */
8393     dtap_rr_paging_resp,        /* Paging Response */
8394     NULL,                       /* Notification/NCH */
8395     NULL,                       /* Reserved */
8396     NULL,                       /* Notification/Response */
8397
8398     NULL,                       /* Reserved */
8399
8400     dtap_rr_utran_classmark_change,     /* Utran Classmark Change  */
8401     NULL,                       /* cdma2000 Classmark Change */
8402     dtap_rr_inter_syst_to_utran_ho_cmd, /* Inter System to UTRAN Handover Command */
8403     NULL,                       /* Inter System to cdma2000 Handover Command */
8404
8405     NULL,                       /* System Information Type 8 */
8406     dtap_rr_sys_info_1,         /* System Information Type 1 */
8407     dtap_rr_sys_info_2,         /* System Information Type 2 */
8408     dtap_rr_sys_info_3,         /* System Information Type 3 */
8409     dtap_rr_sys_info_4,         /* System Information Type 4 */
8410     dtap_rr_sys_info_5,         /* System Information Type 5 */
8411     dtap_rr_sys_info_6,         /* System Information Type 6 */
8412     NULL,                       /* System Information Type 7 */
8413
8414     dtap_rr_sys_info_2bis,      /* System Information Type 2bis */
8415     dtap_rr_sys_info_2ter,      /* System Information Type 2ter */
8416     dtap_rr_sys_info_2quater,   /* System Information Type 2quater */
8417     dtap_rr_sys_info_5bis,      /* System Information Type 5bis */
8418     dtap_rr_sys_info_5ter,      /* System Information Type 5ter */
8419     NULL,                       /* System Information Type 9 */
8420     dtap_rr_sys_info_13,        /* System Information Type 13 */
8421
8422     NULL,                       /* System Information Type 16 */
8423     NULL,                       /* System Information Type 17 */
8424
8425     NULL,                       /* System Information Type 18 */
8426     NULL,                       /* System Information Type 19 */
8427     NULL,                       /* System Information Type 20 */
8428
8429     dtap_rr_ch_mode_mod,        /* Channel Mode Modify */
8430     dtap_rr_rr_status,          /* RR Status */
8431     dtap_rr_ch_mode_mod_ack,    /* Channel Mode Modify Acknowledge */
8432     dtap_rr_freq_redef,         /* Frequency Redefinition */
8433     dtap_rr_meas_rep,           /* 9.1.21 Measurement report */
8434     dtap_rr_mm_cm_change,       /* 9.1.11 Classmark Change */
8435     dtap_rr_cm_enq,             /* Classmark Enquiry */
8436     dtap_rr_ext_meas_report,    /* Extended Measurement Report */
8437     dtap_rr_ext_meas_order,     /* Extended Measurement Order */
8438     dtap_rr_gprs_sus_req,       /* 9.1.13b GPRS Suspension Request */
8439
8440     NULL,                       /* VGCS Uplink Grant */
8441     NULL,                       /* Uplink Release */
8442     NULL,                       /* Reserved */
8443     NULL,                       /* Uplink Busy */
8444     NULL,                       /* Talker Indication */
8445
8446     NULL,                       /* UTRAN Classmark Change/Handover To UTRAN Command */  /* spec conflict */
8447
8448     dtap_rr_app_inf,            /* Application Information */
8449
8450     NULL,                       /* NONE */
8451 };
8452
8453 void get_rr_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf_idx, msg_fcn *msg_fcn)
8454 {
8455     gint                        idx;
8456
8457     *msg_str = match_strval_idx((guint32) (oct & DTAP_RR_IEI_MASK), gsm_a_dtap_msg_rr_strings, &idx);
8458     *hf_idx = hf_gsm_a_dtap_msg_rr_type;
8459     if (*msg_str != NULL) {
8460         *ett_tree = ett_gsm_dtap_msg_rr[idx];
8461         *msg_fcn  = dtap_msg_rr_fcn[idx];
8462     }
8463
8464     return;
8465 }
8466 /* This is more or less a copy of the dissect_dtap() code just adding
8467  * L2 Pseudo Length decoding first
8468  * The code should probably be cleaned up.
8469  * The name CCCH might not be correct!
8470  */
8471 static void
8472 dissect_ccch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
8473 {
8474
8475     static gsm_a_tap_rec_t      tap_rec[4];
8476     static gsm_a_tap_rec_t      *tap_p;
8477     static guint                tap_current=0;
8478
8479     void                        (*msg_fcn)(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len);
8480     guint8                      oct;
8481     guint8                      pd;
8482     guint32                     offset, saved_offset;
8483     guint32                     len;
8484     guint32                     oct_1, oct_2;
8485     proto_item                  *ccch_item = NULL;
8486     proto_tree                  *ccch_tree = NULL;
8487     proto_item                  *oct_1_item = NULL;
8488     proto_tree                  *pd_tree = NULL;
8489     proto_tree                  *saved_tree = NULL;
8490     const gchar                 *msg_str;
8491     gint                        ett_tree;
8492     gint                        ti;
8493     int                         hf_idx;
8494     gboolean                    nsd;
8495     guint8                      pseudo_len;
8496     guint32                     curr_offset;
8497     guint32                     consumed;
8498     guint                       curr_len;
8499
8500     len = tvb_length(tvb);
8501
8502     if (len < 2){
8503         /*
8504          * too short to be CCCH
8505          */
8506         call_dissector(data_handle, tvb, pinfo, tree);
8507         return;
8508     }
8509
8510     col_append_str(pinfo->cinfo, COL_INFO, "(CCCH) ");
8511     /*
8512      * set tap record pointer
8513      */
8514     tap_current++;
8515     if (tap_current >= 4)
8516     {
8517         tap_current = 0;
8518     }
8519     tap_p = &tap_rec[tap_current];
8520
8521     offset = 0;
8522     oct_2 = 0;
8523
8524     /* Skip pseeudo hdr here */
8525     offset = 1;
8526
8527     /*
8528      * get protocol discriminator
8529      */
8530     oct_1 = tvb_get_guint8(tvb, offset++);
8531
8532     if ((((oct_1 & DTAP_TI_MASK) >> 4) & DTAP_TIE_PRES_MASK) == DTAP_TIE_PRES_MASK){
8533         /*
8534          * eventhough we don't know if a TI should be in the message yet
8535          * we rely on the TI/SKIP indicator to be 0 to avoid taking this
8536          * octet
8537          */
8538         oct_2 = tvb_get_guint8(tvb, offset++);
8539     }
8540
8541     oct = tvb_get_guint8(tvb, offset);
8542
8543     pd = oct_1 & DTAP_PD_MASK;
8544     ti = -1;
8545     msg_str = NULL;
8546     ett_tree = -1;
8547     hf_idx = -1;
8548     msg_fcn = NULL;
8549     nsd = FALSE;
8550     col_append_fstr(pinfo->cinfo, COL_INFO, "(%s) ",val_to_str(pd,gsm_a_pd_short_str_vals,"Unknown (%u)"));
8551
8552     /*
8553      * octet 1
8554      */
8555     switch (pd){
8556     case 6:
8557         get_rr_msg_params(oct, &msg_str, &ett_tree, &hf_idx, &msg_fcn);
8558         break;
8559
8560     default:
8561         /* XXX - hf_idx is still -1! this is a bug in the implementation, and I don't know how to fix it so simple return here */
8562         return;
8563     }
8564
8565     /*
8566      * create the protocol tree
8567      */
8568     if (msg_str == NULL){
8569         ccch_item = proto_tree_add_protocol_format(tree, proto_a_ccch, tvb, 0, len,
8570                                                    "GSM CCCH - Message Type (0x%02x)",
8571                                                    oct);
8572
8573         ccch_tree = proto_item_add_subtree(ccch_item, ett_ccch_msg);
8574     }else{
8575         ccch_item = proto_tree_add_protocol_format(tree, proto_a_ccch, tvb, 0, -1,
8576                                                    "GSM CCCH - %s", msg_str);
8577
8578         ccch_tree = proto_item_add_subtree(ccch_item, ett_tree);
8579     }
8580
8581     col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", msg_str);
8582
8583     /* back to the begining */
8584     saved_offset = offset;
8585     offset = 0;
8586
8587     curr_offset = offset;
8588     curr_len = len;
8589     len = 1;
8590
8591     /*  L2 Pseudo Length 10.5.2.19 */
8592     pseudo_len = tvb_get_guint8(tvb,offset)>>2;
8593
8594     saved_tree = tree;
8595     tree = ccch_tree;
8596     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_L2_PSEUDO_LEN);
8597     tree = saved_tree;
8598     offset = saved_offset;
8599         len = curr_len;
8600
8601     oct_1_item =
8602         proto_tree_add_text(ccch_tree,
8603                             tvb, 1, 1,
8604                             "Protocol Discriminator: %s",
8605                             val_to_str(pd, protocol_discriminator_vals, "Unknown (%u)"));
8606
8607     pd_tree = proto_item_add_subtree(oct_1_item, ett_ccch_oct_1);
8608
8609     if (ti == -1){
8610         proto_tree_add_item(pd_tree, hf_gsm_a_skip_ind, tvb, 1, 1, FALSE);
8611     }else{
8612         other_decode_bitfield_value(a_bigbuf, oct_1, 0x80, 8);
8613         proto_tree_add_text(pd_tree,tvb, 1, 1,
8614                             "%s :  TI flag: %s",
8615                             a_bigbuf,
8616                             ((oct_1 & 0x80) ?  "allocated by receiver" : "allocated by sender"));
8617
8618         if ((ti & DTAP_TIE_PRES_MASK) == DTAP_TIE_PRES_MASK){
8619             /* ti is extended to next octet */
8620             other_decode_bitfield_value(a_bigbuf, oct_1, 0x70, 8);
8621             proto_tree_add_text(pd_tree, tvb, 1, 1,
8622                                 "%s :  TIO: The TI value is given by the TIE in octet 2",
8623                                 a_bigbuf);
8624         }else{
8625             other_decode_bitfield_value(a_bigbuf, oct_1, 0x70, 8);
8626             proto_tree_add_text(pd_tree,tvb, 1, 1,
8627                                 "%s :  TIO: %u",a_bigbuf,ti & DTAP_TIE_PRES_MASK);
8628         }
8629     }
8630
8631     proto_tree_add_item(pd_tree, hf_gsm_a_L3_protocol_discriminator, tvb, 1, 1, FALSE);
8632
8633     if ((ti != -1) && (ti & DTAP_TIE_PRES_MASK) == DTAP_TIE_PRES_MASK){
8634         proto_tree_add_item(tree, hf_gsm_a_extension, tvb, 2, 1, FALSE);
8635         other_decode_bitfield_value(a_bigbuf, oct_2, DTAP_TIE_MASK, 8);
8636         proto_tree_add_text(pd_tree, tvb, 2, 1,
8637                             "%s :  TIE: %u", a_bigbuf, oct_2 & DTAP_TIE_MASK);
8638     }
8639
8640     /*
8641      * N(SD)
8642      */
8643     if ((pinfo->p2p_dir == P2P_DIR_RECV) &&
8644         nsd)
8645     {
8646         /* XXX */
8647     }
8648
8649     /*
8650      * add DTAP message name
8651      */
8652     proto_tree_add_uint_format(ccch_tree, hf_idx, tvb, offset, 1, oct,
8653                                "Message Type: %s",msg_str ? msg_str : "(Unknown)");
8654
8655     offset++;
8656
8657     tap_p->pdu_type = GSM_A_PDU_TYPE_DTAP;
8658     tap_p->message_type = (nsd ? (oct & 0x3f) : oct);
8659     tap_p->protocol_disc = pd;
8660
8661     tap_queue_packet(gsm_a_tap, pinfo, tap_p);
8662
8663     if (msg_str == NULL)
8664         return;
8665
8666     if (offset >= len)
8667         return;
8668
8669     /*
8670      * decode elements
8671      */
8672     if (msg_fcn == NULL){
8673         proto_tree_add_text(ccch_tree, tvb, offset, len - offset,
8674                             "Message Elements");
8675     }else{
8676         (*msg_fcn)(tvb, ccch_tree, offset, len - offset);
8677     }
8678 }
8679
8680 const value_string gsm_a_sacch_msg_rr_strings[] = {
8681     { 0x00, "System Information Type 10" },
8682     { 0x01, "Notification/FACCH" },
8683     { 0x02, "Uplink Free" },
8684     { 0x04, "Enhanced Measurement Report" },
8685     { 0x05, "Measurement Information" },
8686     { 0x06, "VBS/VGCS Reconfigure" },
8687     { 0x07, "VBS/VGCS Reconfigure2" },
8688     { 0x08, "VGCS Additional Information" },
8689     { 0x09, "VGCS SMS Information" },
8690     {    0, NULL }
8691 };
8692
8693 #define NUM_GSM_SACCH_MSG_RR (sizeof(gsm_a_sacch_msg_rr_strings)/sizeof(value_string))
8694 static gint ett_gsm_sacch_msg_rr[NUM_GSM_SACCH_MSG_RR];
8695 static void (*sacch_msg_rr_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) = {
8696     NULL,                       /* System Information Type 10 */
8697     NULL,                       /* Notification/FACCH */
8698     NULL,                       /* Uplink Free  */
8699     sacch_rr_enh_meas_report,   /* Enhanced Measurement Report */
8700     sacch_rr_meas_info,         /* Measurement Information */
8701     NULL,                       /* VBS/VGCS Reconfigure */
8702     NULL,                       /* VBS/VGCS Reconfigure2 */
8703     NULL,                       /* VGCS Additional Information */
8704     NULL,                       /* VGCS SMS Information */
8705     NULL,                       /* NONE */
8706 };
8707
8708 void get_rr_short_pd_msg_params(guint8 mess_type, const gchar **msg_str, int *ett_tree, int *hf_idx, msg_fcn *msg_fcn)
8709 {
8710     gint                        idx;
8711
8712     *msg_str = match_strval_idx((guint32) mess_type, gsm_a_sacch_msg_rr_strings, &idx);
8713     *hf_idx = hf_gsm_a_sacch_msg_rr_type;
8714     if (*msg_str != NULL) {
8715         *ett_tree = ett_gsm_sacch_msg_rr[idx];
8716         *msg_fcn = sacch_msg_rr_fcn[idx];
8717     }
8718 }
8719
8720 const value_string short_protocol_discriminator_vals[] = {
8721     {0x0, "Radio Resources Management messages"},
8722     {  0, NULL }
8723 };
8724
8725 static void
8726 dissect_sacch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
8727 {
8728     static gsm_a_tap_rec_t      tap_rec[4];
8729     static gsm_a_tap_rec_t      *tap_p;
8730     static guint                tap_current=0;
8731
8732     void                        (*msg_fcn)(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len);
8733     guint8                      oct, short_pd, mess_type;
8734     guint32                     offset;
8735     guint32                     len;
8736     proto_item                  *sacch_item = NULL;
8737     proto_tree                  *sacch_tree = NULL;
8738     const gchar                 *msg_str;
8739     gint                        ett_tree;
8740     int                         hf_idx;
8741
8742     len = tvb_length(tvb);
8743
8744     col_append_str(pinfo->cinfo, COL_INFO, "(SACCH) ");
8745
8746     /*
8747      * set tap record pointer
8748      */
8749     tap_current++;
8750     if (tap_current >= 4)
8751     {
8752         tap_current = 0;
8753     }
8754     tap_p = &tap_rec[tap_current];
8755
8756     offset = 0;
8757
8758     oct = tvb_get_guint8(tvb, offset);
8759
8760     msg_str = NULL;
8761     ett_tree = -1;
8762     hf_idx = -1;
8763     msg_fcn = NULL;
8764
8765     short_pd = (oct & 0x80) >> 7;
8766     mess_type = (oct & 0x7c) >> 2;
8767
8768     if (short_pd == 0)
8769     {
8770         col_append_fstr(pinfo->cinfo, COL_INFO, "(RR) ");
8771         get_rr_short_pd_msg_params(mess_type, &msg_str, &ett_tree, &hf_idx, &msg_fcn);
8772     }
8773     else
8774     {
8775         col_append_fstr(pinfo->cinfo, COL_INFO, "(Unknown) ");
8776     }
8777
8778     /*
8779      * create the protocol tree
8780      */
8781     if (msg_str == NULL){
8782         sacch_item = proto_tree_add_protocol_format(tree, proto_a_sacch, tvb, 0, len,
8783                                                     "GSM SACCH - Message Type (0x%02x)", mess_type);
8784
8785         sacch_tree = proto_item_add_subtree(sacch_item, ett_sacch_msg);
8786     }else{
8787         sacch_item = proto_tree_add_protocol_format(tree, proto_a_sacch, tvb, 0, -1,
8788                                                     "GSM SACCH - %s", msg_str);
8789
8790         sacch_tree = proto_item_add_subtree(sacch_item, ett_tree);
8791
8792         col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", msg_str);
8793     }
8794
8795     if (short_pd == 0)
8796         proto_tree_add_text(sacch_tree,
8797                             tvb, offset, 1,
8798                             "Short Protocol Discriminator: %s",
8799                             val_to_str(short_pd, short_protocol_discriminator_vals, "Unknown (%u)"));
8800
8801     if (hf_idx == -1)
8802         return;
8803
8804     /*
8805      * add SACCH message name
8806      */
8807     proto_tree_add_uint_format(sacch_tree, hf_idx, tvb, offset, 1, oct,
8808                                "Message Type: %s",msg_str ? msg_str : "(Unknown)");
8809
8810     proto_tree_add_text(sacch_tree, tvb, offset, 1,
8811                         "Short Layer 2 header: %u", oct & 0x03);
8812
8813     offset++;
8814
8815     tap_p->pdu_type = GSM_A_PDU_TYPE_SACCH;
8816     tap_p->message_type = mess_type;
8817     tap_p->protocol_disc = short_pd;
8818
8819     tap_queue_packet(gsm_a_tap, pinfo, tap_p);
8820
8821     if (msg_str == NULL)
8822         return;
8823
8824     /*
8825      * decode elements
8826      */
8827     if (msg_fcn == NULL){
8828         proto_tree_add_text(sacch_tree, tvb, offset, len - offset,
8829                             "Message Elements");
8830     }else{
8831         (*msg_fcn)(tvb, sacch_tree, offset, len - offset);
8832     }
8833 }
8834
8835 /* Register the protocol with Wireshark */
8836 void
8837 proto_register_gsm_a_rr(void)
8838 {
8839     guint               i;
8840     guint               last_offset;
8841
8842     /* Setup list of header fields */
8843
8844     static hf_register_info hf[] =
8845         {
8846             { &hf_gsm_a_dtap_msg_rr_type,
8847               { "DTAP Radio Resources Management Message Type", "gsm_a.dtap_msg_rr_type",
8848                 FT_UINT8, BASE_HEX, VALS(gsm_a_dtap_msg_rr_strings), 0x0,
8849                 NULL, HFILL }
8850             },
8851             { &hf_gsm_a_rr_elem_id,
8852               { "Element ID",   "gsm_a_rr.elem_id",
8853                 FT_UINT8, BASE_DEC, NULL, 0,
8854                 NULL, HFILL }
8855             },
8856             { &hf_gsm_a_bcc,
8857               { "BCC","gsm_a.bcc",
8858                 FT_UINT8,BASE_DEC,  NULL, 0x07,
8859                 NULL, HFILL }
8860             },
8861             { &hf_gsm_a_ncc,
8862               { "NCC","gsm_a.ncc",
8863                 FT_UINT8,BASE_DEC,  NULL, 0x38,
8864                 NULL, HFILL }
8865             },
8866             { &hf_gsm_a_bcch_arfcn,
8867               { "BCCH ARFCN(RF channel number)","gsm_a.bcch_arfcn",
8868                 FT_UINT16,BASE_DEC,  NULL, 0x0,
8869                 NULL, HFILL }
8870             },
8871             { &hf_gsm_a_rr_range_nb,
8872               { "Number of Ranges","gsm_a.rr.range_nb",
8873                 FT_UINT8, BASE_DEC,  NULL, 0xff,
8874                 NULL, HFILL }
8875             },
8876             { &hf_gsm_a_rr_range_lower,
8877               { "Range Lower","gsm_a.rr.range_lower",
8878                 FT_UINT16, BASE_DEC,  NULL, 0x0000,
8879                 "ARFCN used as the lower limit of a range of frequencies to be used by the mobile station in cell selection (Range Lower)", HFILL }
8880             },
8881             { &hf_gsm_a_rr_range_higher,
8882               { "Range Higher","gsm_a.rr.range_higher",
8883                 FT_UINT16, BASE_DEC,  NULL, 0x0000,
8884                 "ARFCN used as the higher limit of a range of frequencies to be used by the mobile station in cell selection (Range Higher)", HFILL }
8885             },
8886             { &hf_gsm_a_rr_ba_list_pref_length,
8887               { "Length of BA List Pref","gsm_a.rr.ba_list_pref_length",
8888                 FT_UINT8, BASE_DEC,  NULL, 0xff,
8889                 NULL, HFILL }
8890             },
8891             { &hf_gsm_a_rr_ba_freq,
8892               { "BA Freq","gsm_a.rr.ba_freq",
8893                 FT_UINT16, BASE_DEC,  NULL, 0x0000,
8894                 "ARFCN indicating a single frequency to be used by the mobile station in cell selection and reselection (BA Freq)", HFILL }
8895             },
8896             { &hf_gsm_a_rr_utran_freq_list_length,
8897               { "Length of UTRAN freq list","gsm_a.rr.utran_freq_length",
8898                 FT_UINT8, BASE_DEC,  NULL, 0xff,
8899                 NULL, HFILL }
8900             },
8901             { &hf_gsm_a_rr_ho_ref_val,
8902               { "Handover reference value","gsm_a.rr.ho_ref_val",
8903                 FT_UINT8,BASE_DEC,  NULL, 0x0,
8904                 NULL, HFILL }
8905             },
8906             { &hf_gsm_a_rr_L2_pseudo_len,
8907               { "L2 Pseudo Length value","gsm_a.rr.rr_2_pseudo_len",
8908                 FT_UINT8, BASE_DEC, NULL, 0xfc,
8909                 NULL, HFILL }
8910             },
8911             { &hf_gsm_a_rr_ba_used,
8912               { "BA-USED","gsm_a.rr.ba_used",
8913                 FT_UINT8, BASE_DEC,  NULL, 0x00,
8914                 NULL, HFILL }
8915             },
8916             { &hf_gsm_a_rr_dtx_used,
8917               { "DTX-USED","gsm_a.rr.dtx_used",
8918                 FT_BOOLEAN, BASE_NONE,  TFS(&gsm_a_rr_dtx_vals), 0x0,
8919                 NULL, HFILL }
8920             },
8921             { &hf_gsm_a_rr_3g_ba_used,
8922               { "3G-BA-USED","gsm_a.rr.3g_ba_used",
8923                 FT_UINT8, BASE_DEC, NULL, 0x00,
8924                 NULL, HFILL }
8925             },
8926             { &hf_gsm_a_rr_meas_valid,
8927               { "MEAS-VALID","gsm_a.rr.meas_valid",
8928                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_mv_vals), 0x40,
8929                 NULL, HFILL }
8930             },
8931             { &hf_gsm_a_rr_rxlev_full_serv_cell,
8932               { "RXLEV-FULL-SERVING-CELL","gsm_a.rr.rxlev_full_serv_cell",
8933                 FT_UINT8,BASE_DEC,  VALS(gsm_a_rr_rxlev_vals), 0x00,
8934                 NULL, HFILL }
8935             },
8936             { &hf_gsm_a_rr_rxlev_sub_serv_cell,
8937               { "RXLEV-SUB-SERVING-CELL","gsm_a.rr.rxlev_sub_serv_cell",
8938                 FT_UINT8,BASE_DEC,  VALS(gsm_a_rr_rxlev_vals), 0x3f,
8939                 NULL, HFILL }
8940             },
8941             { &hf_gsm_a_rr_rxqual_full_serv_cell,
8942               { "RXQUAL-FULL-SERVING-CELL","gsm_a.rr.rxqual_full_serv_cell",
8943                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_rxqual_vals), 0x00,
8944                 NULL, HFILL }
8945             },
8946             { &hf_gsm_a_rr_rxqual_sub_serv_cell,
8947               { "RXQUAL-SUB-SERVING-CELL","gsm_a.rr.rxqual_sub_serv_cell",
8948                 FT_UINT8,BASE_DEC,  VALS(gsm_a_rr_rxqual_vals), 0x0e,
8949                 NULL, HFILL }
8950             },
8951             { &hf_gsm_a_rr_no_ncell_m,
8952               { "NO-NCELL-M","gsm_a.rr.no_ncell_m",
8953                 FT_UINT8,BASE_DEC,  VALS(gsm_a_rr_ncell_vals), 0x00,
8954                 NULL, HFILL }
8955             },
8956             { &hf_gsm_a_rr_rxlev_ncell,
8957               { "RXLEV-NCELL","gsm_a.rr.rxlev_ncell",
8958                 FT_UINT8,BASE_DEC, NULL, 0x00,
8959                 NULL, HFILL }
8960             },
8961             { &hf_gsm_a_rr_bcch_freq_ncell,
8962               { "BCCH-FREQ-NCELL","gsm_a.rr.bcch_freq_ncell",
8963                 FT_UINT8,BASE_DEC, NULL, 0x00,
8964                 NULL, HFILL }
8965             },
8966             { &hf_gsm_a_rr_bsic_ncell,
8967               { "BSIC-NCELL","gsm_a.rr.bsic_ncell",
8968                 FT_UINT8,BASE_DEC, NULL, 0x00,
8969                 NULL, HFILL }
8970             },
8971             { &hf_gsm_a_rr_mobile_time_difference,
8972               { "Mobile Timing Difference value (in half bit periods)","gsm_a.rr.mobile_time_difference",
8973                 FT_UINT32,BASE_DEC, NULL, 0xFFFFF8,
8974                 NULL, HFILL }
8975             },
8976             { &hf_gsm_a_rr_pow_cmd_atc,
8977               { "ATC","gsm_a.rr.pow_cmd_atc",
8978                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_pow_cmd_atc_value), 0x80,
8979                 NULL, HFILL }
8980             },
8981             { &hf_gsm_a_rr_page_mode,
8982               { "Page Mode","gsm_a.rr.page_mode",
8983                 FT_UINT8,BASE_DEC,  VALS(gsm_a_rr_page_mode_vals), 0x03,
8984                 NULL, HFILL }
8985             },
8986             { &hf_gsm_a_rr_dedicated_mode_or_tbf,
8987               { "Dedicated mode or TBF","gsm_a.rr.dedicated_mode_or_tbf",
8988                 FT_UINT8,BASE_DEC,  VALS(gsm_a_rr_dedicated_mode_or_tbf_vals), 0x70,
8989                 NULL, HFILL }
8990             },
8991             { &hf_gsm_a_rr_pow_cmd_epc,
8992               { "EPC_mode","gsm_a.rr.pow_cmd_epc",
8993                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_pow_cmd_epc_value), 0x40,
8994                 NULL, HFILL }
8995             },
8996             { &hf_gsm_a_rr_pow_cmd_fpcepc,
8997               { "FPC_EPC","gsm_a.rr.pow_cmd_fpcepc",
8998                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_pow_cmd_fpcepc_value), 0x20,
8999                 NULL, HFILL }
9000             },
9001             { &hf_gsm_a_rr_pow_cmd_powlev,
9002               { "POWER LEVEL","gsm_a.rr.pow_cmd_pow",
9003                 FT_UINT8,BASE_DEC,  NULL, 0x1f,
9004                 NULL, HFILL }
9005             },
9006             { &hf_gsm_a_rr_sync_ind_nci,
9007               { "Normal cell indication(NCI)","gsm_a.rr.sync_ind_nci",
9008                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_sync_ind_nci_value), 0x08,
9009                 NULL, HFILL }
9010             },
9011             { &hf_gsm_a_rr_sync_ind_rot,
9012               { "Report Observed Time Difference(ROT)","gsm_a.rr.sync_ind_rot",
9013                 FT_BOOLEAN,8,  TFS(&sm_a_rr_sync_ind_rot_value), 0x04,
9014                 NULL, HFILL }
9015             },
9016             { &hf_gsm_a_rr_sync_ind_si,
9017               { "Synchronization indication(SI)","gsm_a.rr_sync_ind_si",
9018                 FT_UINT8,BASE_DEC,  VALS(gsm_a_rr_sync_ind_si_vals), 0x03,
9019                 NULL, HFILL }
9020             },
9021             { &hf_gsm_a_rr_format_id,
9022               { "Format Identifier","gsm_a.rr_format_id",
9023                 FT_UINT8,BASE_HEX,  VALS(gsm_a_rr_freq_list_format_id_vals), 0xce,
9024                 NULL, HFILL }
9025             },
9026             { &hf_gsm_a_rr_channel_mode,
9027               { "Channel Mode","gsm_a.rr.channel_mode",
9028                 FT_UINT8,BASE_DEC,  VALS(gsm_a_rr_channel_mode_vals), 0x0,
9029                 NULL, HFILL }
9030             },
9031             { &hf_gsm_a_rr_channel_mode2,
9032               { "Channel Mode 2","gsm_a.rr.channel_mode2",
9033                 FT_UINT8,BASE_DEC,  VALS(gsm_a_rr_channel_mode2_vals), 0x0,
9034                 NULL, HFILL }
9035             },
9036             { &hf_gsm_a_rr_sc,
9037               { "SC","gsm_a.rr.SC",
9038                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_sc_vals), 0x00,
9039                 NULL, HFILL }
9040             },
9041             { &hf_gsm_a_algorithm_id,
9042               { "Algorithm identifier","gsm_a.algorithm_identifier",
9043                 FT_UINT8,BASE_DEC,  VALS(gsm_a_algorithm_identifier_vals), 0x00,
9044                 NULL, HFILL }
9045             },
9046             { &hf_gsm_a_rr_cr,
9047               { "CR","gsm_a.rr.CR",
9048                 FT_UINT8,BASE_DEC,  VALS(gsm_a_rr_cr_vals), 0x00,
9049                 NULL, HFILL }
9050             },
9051             { &hf_gsm_a_rr_multirate_speech_ver,
9052               { "Multirate speech version","gsm_a.rr.multirate_speech_ver",
9053                 FT_UINT8,BASE_DEC,  VALS(multirate_speech_ver_vals), 0xe0,
9054                 NULL, HFILL }
9055             },
9056             { &hf_gsm_a_rr_NCSB,
9057               { "NSCB: Noise Suppression Control Bit","gsm_a.rr.NCSB",
9058                 FT_UINT8,BASE_DEC,  VALS(NSCB_vals), 0x10,
9059                 NULL, HFILL }
9060             },
9061             { &hf_gsm_a_rr_ICMI,
9062               { "ICMI: Initial Codec Mode Indicator","gsm_a.rr.ICMI",
9063                 FT_UINT8,BASE_DEC,  VALS(ICMI_vals), 0x8,
9064                 NULL, HFILL }
9065             },
9066             { &hf_gsm_a_rr_start_mode,
9067               { "Start Mode","gsm_a.rr.start_mode",
9068                 FT_UINT8,BASE_DEC,  NULL, 0x3,
9069                 NULL, HFILL }
9070             },
9071             { &hf_gsm_a_rr_timing_adv,
9072               { "Timing advance value","gsm_a.rr.timing_adv",
9073                 FT_UINT8,BASE_DEC,  NULL, 0x0,
9074                 NULL, HFILL }
9075             },
9076             { &hf_gsm_a_rr_time_diff,
9077               { "Time difference value","gsm_a.rr.time_diff",
9078                 FT_UINT8,BASE_DEC,  NULL, 0x0,
9079                 NULL, HFILL }
9080             },
9081             { &hf_gsm_a_rr_tlli,
9082               { "TLLI","gsm_a.rr.tlli",
9083                 FT_UINT32,BASE_HEX,  NULL, 0x0,
9084                 NULL, HFILL }
9085             },
9086             { &hf_gsm_a_rr_tmsi_ptmsi,
9087               { "TMSI/P-TMSI Value","gsm_a.rr.tmsi_ptmsi",
9088                 FT_UINT32,BASE_HEX,  NULL, 0x0,
9089                 NULL, HFILL }
9090             },
9091             { &hf_gsm_a_rr_target_mode,
9092               { "Target mode","gsm_a.rr.target_mode",
9093                 FT_UINT8,BASE_DEC,  NULL, 0xc0,
9094                 NULL, HFILL }
9095             },
9096             { &hf_gsm_a_rr_wait_indication,
9097               { "Wait Indication","gsm_a.rr.wait_indication",
9098                 FT_UINT8,BASE_DEC,  NULL, 0x00,
9099                 NULL, HFILL }
9100             },
9101             { &hf_gsm_a_rr_seq_code,
9102               { "Sequence Code","gsm_a.rr.seq_code",
9103                 FT_UINT8, BASE_DEC, NULL, 0x00,
9104                 NULL, HFILL }
9105             },
9106
9107             { &hf_gsm_a_rr_group_cipher_key_number,
9108               { "Group cipher key number","gsm_a.rr.Group_cipher_key_number",
9109                 FT_UINT8,BASE_DEC,  NULL, 0x3c,
9110                 NULL, HFILL }
9111             },
9112             { &hf_gsm_a_rr_MBMS_broadcast,
9113               { "MBMS Broadcast","gsm_a.rr.MBMS_broadcast",
9114                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_MBMS_broadcast_value), 0x01,
9115                 NULL, HFILL }
9116             },
9117             { &hf_gsm_a_rr_MBMS_multicast,
9118               { "MBMS Multicast","gsm_a.rr.MBMS_multicast",
9119                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_MBMS_multicast_value), 0x02,
9120                 NULL, HFILL }
9121             },
9122             { &hf_gsm_a_rr_last_segment,
9123               { "Last Segment","gsm_a.rr.last_segment",
9124                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_last_segment_value), 0x01,
9125                 NULL, HFILL }
9126             },
9127             { &hf_gsm_a_rr_carrier_ind,
9128               { "Carrier Indication","gsm_a.rr.carrier_ind",
9129                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_carrier_ind_value), 0x01,
9130                 NULL, HFILL }
9131             },
9132             { &hf_gsm_a_rr_ra,
9133               { "Random Access Information (RA)", "gsm_a_rr_ra",
9134                 FT_UINT8, BASE_DEC, NULL, 0x0,
9135                 NULL, HFILL }
9136             },
9137             { &hf_gsm_a_rr_T1prim,
9138               { "T1'",             "gsm_a.rr.T1prim",
9139                 FT_UINT8, BASE_DEC, NULL, 0xf8,
9140                 NULL, HFILL }
9141             },
9142             { &hf_gsm_a_rr_T3,
9143               { "T3",              "gsm_a.rr.T3",
9144                 FT_UINT16, BASE_DEC, NULL, 0x07e0,
9145                 NULL, HFILL }
9146             },
9147             { &hf_gsm_a_rr_T2,
9148               { "T2",              "gsm_a.rr.T2",
9149                 FT_UINT8, BASE_DEC, NULL, 0x1f,
9150                 NULL, HFILL }
9151             },
9152             { &hf_gsm_a_rr_rfn,
9153               { "RFN",             "gsm_a.rr.rfn",
9154                 FT_UINT16, BASE_DEC, NULL, 0x0,
9155                 "Reduced Frame Number", HFILL }
9156             },
9157             { &hf_gsm_a_rr_RR_cause,
9158               { "RR cause value","gsm_a.rr.RRcause",
9159                 FT_UINT8,BASE_DEC,  VALS(gsm_a_rr_RR_cause_vals), 0x0,
9160                 NULL, HFILL }
9161             },
9162             { &hf_gsm_a_rr_cm_cng_msg_req,
9163               { "CLASSMARK CHANGE","gsm_a.rr_cm_cng_msg_req",
9164                 FT_BOOLEAN,8,  TFS(&gsm_a_msg_req_value), 0x80,
9165                 NULL, HFILL }
9166             },
9167             { &hf_gsm_a_rr_utran_cm_cng_msg_req,
9168               { "UTRAN CLASSMARK CHANGE","gsm_a.rr_utran_cm_cng_msg_req",
9169                 FT_UINT8,BASE_DEC,  VALS(gsm_a_rr_utran_cm_cng_msg_req_vals), 0x70,
9170                 NULL, HFILL }
9171             },
9172             { &hf_gsm_a_rr_cdma200_cm_cng_msg_req,
9173               { "CDMA2000 CLASSMARK CHANGE","gsm_a.rr_cdma200_cm_cng_msg_req",
9174                 FT_BOOLEAN,8,  TFS(&gsm_a_msg_req_value), 0x08,
9175                 NULL, HFILL }
9176             },
9177             { &hf_gsm_a_rr_geran_iu_cm_cng_msg_req,
9178               { "GERAN IU MODE CLASSMARK CHANGE","gsm_a.rr_geran_iu_cm_cng_msg_req",
9179                 FT_BOOLEAN,8,  TFS(&gsm_a_msg_req_value), 0x04,
9180                 NULL, HFILL }
9181             },
9182             { &hf_gsm_a_rr_chnl_needed_ch1,
9183               { "Channel 1","gsm_a.rr_chnl_needed_ch1",
9184                 FT_UINT8,BASE_DEC,  VALS(gsm_a_rr_channel_needed_vals), 0x00,
9185                 NULL, HFILL }
9186             },
9187             { &hf_gsm_a_rr_chnl_needed_ch2,
9188               { "Channel 2","gsm_a.rr_chnl_needed_ch2",
9189                 FT_UINT8,BASE_DEC,  VALS(gsm_a_rr_channel_needed_vals), 0x00,
9190                 NULL, HFILL }
9191             },
9192             { &hf_gsm_a_rr_chnl_needed_ch3,
9193               { "Channel 3","gsm_a.rr_chnl_needed_ch3",
9194                 FT_UINT8,BASE_DEC,  VALS(gsm_a_rr_channel_needed_vals), 0x00,
9195                 NULL, HFILL }
9196             },
9197             { &hf_gsm_a_rr_chnl_needed_ch4,
9198               { "Channel 4","gsm_a.rr_chnl_needed_ch4",
9199                 FT_UINT8,BASE_DEC,  VALS(gsm_a_rr_channel_needed_vals), 0x00,
9200                 NULL, HFILL }
9201             },
9202             { &hf_gsm_a_rr_suspension_cause,
9203               { "Suspension cause value","gsm_a.rr.suspension_cause",
9204                 FT_UINT8,BASE_DEC,  VALS(gsm_a_rr_suspension_cause_vals), 0x0,
9205                 NULL, HFILL }
9206             },
9207             { &hf_gsm_a_rr_apdu_id,
9208               { "APDU ID","gsm_a.rr.apdu_id",
9209                 FT_UINT8,BASE_HEX,  VALS(gsm_a_rr_apdu_id_vals), 0x0f,
9210                 NULL, HFILL }
9211             },
9212             { &hf_gsm_a_rr_apdu_flags,
9213               { "APDU Flags","gsm_a.rr.apdu_flags",
9214                 FT_UINT8,BASE_HEX,  VALS(gsm_a_rr_apdu_flags_vals), 0xf0,
9215                 NULL, HFILL }
9216             },
9217             { &hf_gsm_a_rr_apdu_data,
9218               { "APDU Data","gsm_a.rr.apdu_data",
9219                 FT_BYTES,BASE_NONE,  NULL, 0x00,
9220                 NULL, HFILL }
9221             },
9222             { &hf_gsm_a_rr_set_of_amr_codec_modes_v1_b8,
9223               { "12,2 kbit/s codec rate", "gsm_a.rr.set_of_amr_codec_modes_v1b8",
9224                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_set_of_amr_codec_modes), 0x80,
9225                 NULL, HFILL }
9226             },
9227             { &hf_gsm_a_rr_set_of_amr_codec_modes_v1_b7,
9228               { "10,2 kbit/s codec rate", "gsm_a.rr.set_of_amr_codec_modes_v1b7",
9229                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_set_of_amr_codec_modes), 0x40,
9230                 NULL, HFILL }
9231             },
9232             { &hf_gsm_a_rr_set_of_amr_codec_modes_v1_b6,
9233               { "7,95 kbit/s codec rate", "gsm_a.rr.set_of_amr_codec_modes_v1b6",
9234                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_set_of_amr_codec_modes), 0x20,
9235                 NULL, HFILL }
9236             },
9237             { &hf_gsm_a_rr_set_of_amr_codec_modes_v1_b5,
9238               { "7,40 kbit/s codec rate", "gsm_a.rr.set_of_amr_codec_modes_v1b5",
9239                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_set_of_amr_codec_modes), 0x10,
9240                 NULL, HFILL }
9241             },
9242             { &hf_gsm_a_rr_set_of_amr_codec_modes_v1_b4,
9243               { "6,70 kbit/s codec rate", "gsm_a.rr.set_of_amr_codec_modes_v1b4",
9244                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_set_of_amr_codec_modes), 0x08,
9245                 NULL, HFILL }
9246             },
9247             { &hf_gsm_a_rr_set_of_amr_codec_modes_v1_b3,
9248               { "5,90 kbit/s codec rate", "gsm_a.rr.set_of_amr_codec_modes_v1b3",
9249                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_set_of_amr_codec_modes), 0x04,
9250                 NULL, HFILL }
9251             },
9252             { &hf_gsm_a_rr_set_of_amr_codec_modes_v1_b2,
9253               { "5,15 kbit/s codec rate", "gsm_a.rr.set_of_amr_codec_modes_v1b2",
9254                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_set_of_amr_codec_modes), 0x02,
9255                 NULL, HFILL }
9256             },
9257             { &hf_gsm_a_rr_set_of_amr_codec_modes_v1_b1,
9258               { "4,75 kbit/s codec rate", "gsm_a.rr.set_of_amr_codec_modes_v1b1",
9259                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_set_of_amr_codec_modes), 0x01,
9260                 NULL, HFILL }
9261             },
9262             { &hf_gsm_a_rr_set_of_amr_codec_modes_v2_b5,
9263               { "23,85 kbit/s codec rate", "gsm_a.rr.set_of_amr_codec_modes_v2b5",
9264                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_set_of_amr_codec_modes), 0x10,
9265                 NULL, HFILL }
9266             },
9267             { &hf_gsm_a_rr_set_of_amr_codec_modes_v2_b4,
9268               { "15,85 kbit/s codec rate", "gsm_a.rr.set_of_amr_codec_modes_v2b4",
9269                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_set_of_amr_codec_modes), 0x08,
9270                 NULL, HFILL }
9271             },
9272             { &hf_gsm_a_rr_set_of_amr_codec_modes_v2_b3,
9273               { "12,65 kbit/s codec rate", "gsm_a.rr.set_of_amr_codec_modes_v2b3",
9274                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_set_of_amr_codec_modes), 0x04,
9275                 NULL, HFILL }
9276             },
9277             { &hf_gsm_a_rr_set_of_amr_codec_modes_v2_b2,
9278               { "8,85 kbit/s codec rate", "gsm_a.rr.set_of_amr_codec_modes_v2b2",
9279                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_set_of_amr_codec_modes), 0x02,
9280                 NULL, HFILL }
9281             },
9282             { &hf_gsm_a_rr_set_of_amr_codec_modes_v2_b1,
9283               { "6,60 kbit/s codec rate", "gsm_a.rr.set_of_amr_codec_modes_v2b1",
9284                 FT_BOOLEAN,8,  TFS(&gsm_a_rr_set_of_amr_codec_modes), 0x01,
9285                 NULL, HFILL }
9286             },
9287             { &hf_gsm_a_rr_amr_threshold,
9288               { "AMR Threshold", "gsm_a.rr.amr_threshold",
9289                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_amr_threshold_vals), 0x00,
9290                 NULL, HFILL }
9291             },
9292             { &hf_gsm_a_rr_amr_hysteresis,
9293               { "AMR Hysteresis", "gsm_a.rr.amr_hysteresis",
9294                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_amr_hysteresis_vals), 0x00,
9295                 NULL, HFILL }
9296             },
9297             { &hf_gsm_a_rr_pwrc,
9298               { "PWRC", "gsm_a.rr.pwrc",
9299                 FT_BOOLEAN, BASE_NONE,  NULL, 0x0,
9300                 "Power Control Indicator (PWRC)", HFILL }
9301             },
9302             { &hf_gsm_a_rr_dtx_bcch,
9303               { "DTX (BCCH)", "gsm_a.rr.dtx_bcch",
9304                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_dtx_bcch_vals), 0x30,
9305                 "Discontinuous Transmission (DTX-BCCH)", HFILL }
9306             },
9307             { &hf_gsm_a_rr_dtx_sacch,
9308               { "DTX (SACCH)", "gsm_a.rr.dtx_sacch",
9309                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_dtx_sacch_vals), 0xb0,
9310                 "Discontinuous Transmission (DTX-SACCH)", HFILL }
9311             },
9312             { &hf_gsm_a_rr_radio_link_timeout,
9313               { "Radio Link Timeout", "gsm_a.rr.radio_link_timeout",
9314                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_radio_link_timeout_vals), 0x0f,
9315                 "Radio Link Timeout (s)", HFILL }
9316             },
9317             { &hf_gsm_a_rr_cell_reselect_hyst,
9318               { "Cell Reselection Hysteresis", "gsm_a.rr.cell_reselect_hyst",
9319                 FT_UINT8, BASE_DEC,  NULL, 0xe0,
9320                 "Cell Reselection Hysteresis (dB)", HFILL }
9321             },
9322             { &hf_gsm_a_rr_ms_txpwr_max_cch,
9323               { "MS TXPWR MAX CCH", "gsm_a.rr.ms_txpwr_max_cch",
9324                 FT_UINT8, BASE_DEC,  NULL, 0x1f,
9325                 NULL, HFILL }
9326             },
9327             { &hf_gsm_a_rr_acs,
9328               { "ACS", "gsm_a.rr.acs",
9329                 FT_BOOLEAN, 8,  NULL, 0x80,
9330                 "Additional Reselect Param Indicator (ACS)", HFILL }
9331             },
9332             { &hf_gsm_a_rr_neci,
9333               { "NECI", "gsm_a.rr.neci",
9334                 FT_UINT8, BASE_DEC,  NULL, 0x40,
9335                 "New Establishment Cause Indicator (NECI)", HFILL }
9336             },
9337             { &hf_gsm_a_rr_rxlev_access_min,
9338               { "RXLEV-ACCESS-MIN", "gsm_a.rr.rxlev_access_min",
9339                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_rxlev_vals), 0x3f,
9340                 NULL, HFILL }
9341             },
9342             { &hf_gsm_a_rr_mscr,
9343               { "MSCR", "gsm_a.rr.mscr",
9344                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_mscr_vals), 0x80,
9345                 "MSC Release Indicator (MSCR)", HFILL }
9346             },
9347             { &hf_gsm_a_rr_att,
9348               { "ATT", "gsm_a.rr.att",
9349                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_att_vals), 0x40,
9350                 "Attach Indicator (ATT)", HFILL }
9351             },
9352             { &hf_gsm_a_rr_bs_ag_blks_res,
9353               { "BS_AG_BLKS_RES", "gsm_a.rr.bs_ag_blks_res",
9354                 FT_UINT8, BASE_DEC,  NULL, 0x38,
9355                 "Access Grant Reserved Blocks (BS_AG_BLKS_RES)", HFILL }
9356             },
9357             { &hf_gsm_a_rr_ccch_conf,
9358               { "CCCH-CONF", "gsm_a.rr.ccch_conf",
9359                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_ccch_conf_vals), 0x07,
9360                 NULL, HFILL }
9361             },
9362             { &hf_gsm_a_rr_cbq3,
9363               { "CBQ3", "gsm_a.rr.cbq3",
9364                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_cbq3_vals), 0x00,
9365                 "Cell Bar Qualify 3", HFILL }
9366             },
9367             { &hf_gsm_a_rr_bs_pa_mfrms,
9368               { "BS-PA-MFRMS", "gsm_a.rr.bs_pa_mfrms",
9369                 FT_UINT8, BASE_DEC,  NULL, 0x07,
9370                 NULL, HFILL }
9371             },
9372             { &hf_gsm_a_rr_t3212,
9373               { "T3212", "gsm_a.rr.t3212",
9374                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9375                 "Periodic Update period (T3212) (deci-hours)", HFILL }
9376             },
9377             { &hf_gsm_a_rr_dyn_arfcn_length,
9378               { "Length of Dynamic Mapping", "gsm_a.rr.dyn_arfcn_length",
9379                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9380                 NULL, HFILL }
9381             },
9382             { &hf_gsm_a_rr_gsm_band,
9383               { "GSM Band", "gsm_a.rr.gsm_band",
9384                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_gsm_band_vals), 0x00,
9385                 NULL, HFILL }
9386             },
9387             { &hf_gsm_a_rr_arfcn_first,
9388               { "ARFCN First", "gsm_a.rr.arfcn_first",
9389                 FT_UINT16, BASE_DEC,  NULL, 0x00,
9390                 NULL, HFILL }
9391             },
9392             { &hf_gsm_a_rr_band_offset,
9393               { "Band Offset", "gsm_a.rr.band_offset",
9394                 FT_UINT16, BASE_DEC,  NULL, 0x00,
9395                 NULL, HFILL }
9396             },
9397             { &hf_gsm_a_rr_arfcn_range,
9398               { "ARFCN Range", "gsm_a.rr.arfcn_range",
9399                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9400                 NULL, HFILL }
9401             },
9402             { &hf_gsm_a_rr_lowest_arfcn,
9403               { "Lowest ARFCN", "gsm_a.rr.lowest_arfcn",
9404                 FT_UINT8, BASE_DEC,  NULL, 0x7f,
9405                 NULL, HFILL }
9406             },
9407             { &hf_gsm_a_rr_inc_skip_arfcn,
9408               { "Increment skip ARFCN", "gsm_a.rr.inc_skip_arfcn",
9409                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9410                 NULL, HFILL }
9411             },
9412             { &hf_gsm_a_rr_gprs_resumption_ack,
9413               { "Ack", "gsm_a.rr.gprs_resumption_ack",
9414                 FT_BOOLEAN, 8,  TFS(&gsm_a_rr_gprs_resumption_ack_value), 0x01,
9415                 "GPRS Resumption Ack bit", HFILL }
9416             },
9417             { &hf_gsm_a_rr_ext_ind,
9418               { "EXT-IND", "gsm_a.rr.ext_ind",
9419                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_ext_ind_vals), 0x20,
9420                 "Extension Indication (EXT-IND)", HFILL }
9421             },
9422             { &hf_gsm_a_rr_ba_ind,
9423               { "BA-IND", "gsm_a.rr.ba_ind",
9424                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9425                 "BCCH Allocation Indication (BA-IND)", HFILL }
9426             },
9427             { &hf_gsm_a_rr_multiband_reporting,
9428               { "Multiband Reporting", "gsm_a.rr.multiband_reporting",
9429                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9430                 "Number of cells to be reported in each band if Multiband Reporting", HFILL }
9431             },
9432             { &hf_gsm_a_rr_ncc_permitted,
9433               { "NCC Permitted", "gsm_a.rr.ncc_permitted",
9434                 FT_UINT8, BASE_HEX,  NULL, 0xff,
9435                 NULL, HFILL }
9436             },
9437             { &hf_gsm_a_rr_max_retrans,
9438               { "Max retrans", "gsm_a.rr.max_retrans",
9439                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_max_retrans_vals), 0xc0,
9440                 "Maximum number of retransmissions", HFILL }
9441             },
9442             { &hf_gsm_a_rr_tx_integer,
9443               { "Tx-integer", "gsm_a.rr.tx_integer",
9444                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_tx_integer_vals), 0x3c,
9445                 "Number of Slots to spread Transmission (Tx-integer)", HFILL }
9446             },
9447             { &hf_gsm_a_rr_cell_barr_access,
9448               { "CELL_BARR_ACCESS", "gsm_a.rr.cell_barr_access",
9449                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_cell_barr_access_vals), 0x02,
9450                 "Cell Barred for Access (CELL_BARR_ACCESS)", HFILL }
9451             },
9452             { &hf_gsm_a_rr_re,
9453               { "RE", "gsm_a.rr.re",
9454                 FT_BOOLEAN, 8,  NULL, 0x01,
9455                 "Call re-establishment allowed (RE)", HFILL }
9456             },
9457             { &hf_gsm_a_rr_acc,
9458               { "ACC", "gsm_a.rr.acc",
9459                 FT_UINT16, BASE_HEX,  NULL, 0xffff,
9460                 "Access Control Class N barred (ACC)", HFILL }
9461             },
9462             { &hf_gsm_a_rr_nch_position,
9463               { "NCH Position", "gsm_a.rr.nch_position",
9464                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_nch_position_vals), 0x00,
9465                 NULL, HFILL }
9466             },
9467             { &hf_gsm_a_rr_si2ter_mp_change_mark,
9468               { "SI2ter Measurement Parameter Change Mark", "gsm_a.rr.si2ter_mp_change_mark",
9469                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9470                 NULL, HFILL }
9471             },
9472             { &hf_gsm_a_rr_si2ter_3g_change_mark,
9473               { "SI2ter 3G Change Mark", "gsm_a.rr.si2ter_3g_change_mark",
9474                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9475                 NULL, HFILL }
9476             },
9477             { &hf_gsm_a_rr_si2ter_index,
9478               { "SI2ter Index", "gsm_a.rr.si2ter_index",
9479                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9480                 NULL, HFILL }
9481             },
9482             { &hf_gsm_a_rr_si2ter_count,
9483               { "SI2ter Count", "gsm_a.rr.si2ter_count",
9484                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9485                 NULL, HFILL }
9486             },
9487             { &hf_gsm_a_rr_fdd_uarfcn,
9488               { "FDD UARFCN", "gsm_a.rr.fdd_uarfcn",
9489                 FT_UINT16, BASE_DEC,  NULL, 0x0000,
9490                 NULL, HFILL }
9491             },
9492             { &hf_gsm_a_rr_bandwidth_fdd,
9493               { "Bandwidth FDD", "gsm_a.rr.bandwidth_fdd",
9494                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9495                 NULL, HFILL }
9496             },
9497             { &hf_gsm_a_rr_tdd_uarfcn,
9498               { "TDD UARFCN", "gsm_a.rr.tdd_uarfcn",
9499                 FT_UINT16, BASE_DEC,  NULL, 0x0000,
9500                 NULL, HFILL }
9501             },
9502             { &hf_gsm_a_rr_bandwidth_tdd,
9503               { "Bandwidth TDD", "gsm_a.rr.bandwidth_tdd",
9504                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9505                 NULL, HFILL }
9506             },
9507             { &hf_gsm_a_rr_arfcn,
9508               { "ARFCN", "gsm_a.rr.arfcn",
9509                 FT_UINT16, BASE_DEC,  NULL, 0x0000,
9510                 "Absolute Radio Frequency Channel Number (ARFCN)", HFILL }
9511             },
9512             { &hf_gsm_a_rr_bsic,
9513               { "BSIC", "gsm_a.rr.bsic",
9514                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9515                 "Base Station Identify Code (BSIC)", HFILL }
9516             },
9517             { &hf_gsm_a_rr_qsearch_i,
9518               { "Qsearch I", "gsm_a.rr.qsearch_i",
9519                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_qsearch_x_vals), 0x00,
9520                 "Search for 3G cells if signal level is below (0 7) or above (8 15) threshold (Qsearch I)", HFILL }
9521             },
9522             { &hf_gsm_a_rr_fdd_qoffset,
9523               { "FDD Qoffset", "gsm_a.rr.fdd_qoffset",
9524                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_xdd_qoffset_vals), 0x00,
9525                 "Offset to RLA_C for cell re selection to FDD access technology (FDD Qoffset)", HFILL }
9526             },
9527             { &hf_gsm_a_rr_fdd_qmin,
9528               { "FDD Qmin", "gsm_a.rr.fdd_qmin",
9529                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_fdd_qmin_vals), 0x00,
9530                 "Minimum threshold for Ec/No for UTRAN FDD cell re-selection (FDD Qmin)", HFILL }
9531             },
9532             { &hf_gsm_a_rr_tdd_qoffset,
9533               { "TDD Qoffset", "gsm_a.rr.tdd_qoffset",
9534                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_xdd_qoffset_vals), 0x00,
9535                 "Offset to RLA_C for cell re selection to TDD access technology (TDD Qoffset)", HFILL }
9536             },
9537             { &hf_gsm_a_rr_fdd_qmin_offset,
9538               { "FDD Qmin Offset", "gsm_a.rr.fdd_qmin_offset",
9539                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_fdd_qmin_offset_vals), 0x00,
9540                 "Offset to FDD Qmin value (FDD Qmin Offset)", HFILL }
9541             },
9542             { &hf_gsm_a_rr_fdd_rscpmin,
9543               { "FDD RSCPmin", "gsm_a.rr.fdd_rscpmin",
9544                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_fdd_rscpmin_vals), 0x00,
9545                 "Minimum threshold of RSCP for UTRAN FDD cell re-selection (FDD RSCPmin)", HFILL }
9546             },
9547             { &hf_gsm_a_rr_3g_ba_ind,
9548               { "3G BA-IND", "gsm_a.rr.3g_ba_ind",
9549                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9550                 "3G BCCH Allocation Indication (3G BA-IND)", HFILL }
9551             },
9552             { &hf_gsm_a_rr_mp_change_mark,
9553               { "Measurement Parameter Change Mark", "gsm_a.rr.mp_change_mark",
9554                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9555                 NULL, HFILL }
9556             },
9557             { &hf_gsm_a_rr_si2quater_index,
9558               { "SI2quater Index", "gsm_a.rr.si2quater_index",
9559                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9560                 NULL, HFILL }
9561             },
9562             { &hf_gsm_a_rr_si2quater_count,
9563               { "SI2quater Count", "gsm_a.rr.si2quater_count",
9564                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9565                 NULL, HFILL }
9566             },
9567             { &hf_gsm_a_rr_gsm_report_type,
9568               { "Report Type", "gsm_a.rr.gsm_report_type",
9569                 FT_BOOLEAN, BASE_NONE,  TFS(&gsm_a_rr_gsm_report_type_value), 0x0,
9570                 "Report type the MS shall use (Report Type)", HFILL }
9571             },
9572             { &hf_gsm_a_rr_serving_band_reporting,
9573               { "Serving Band Reporting", "gsm_a.rr.serving_band_reporting",
9574                 FT_UINT8, BASE_DEC, NULL, 0x00,
9575                 "Number of cells reported from the GSM serving frequency band (Serving Band Reporting)", HFILL }
9576             },
9577             { &hf_gsm_a_rr_frequency_scrolling,
9578               { "Frequency Scrolling", "gsm_a.rr.frequency_scrolling",
9579                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_frequency_scrolling_value), 0x0,
9580                 NULL, HFILL }
9581             },
9582             { &hf_gsm_a_rr_rep_priority,
9583               { "Rep Priority", "gsm_a.rr.rep_priority",
9584                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_rep_priority_value), 0x0,
9585                 "Reporting Priority", HFILL }
9586             },
9587             { &hf_gsm_a_rr_report_type,
9588               { "Report Type", "gsm_a.rr.report_type",
9589                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_report_type_value), 0x0,
9590                 NULL, HFILL }
9591             },
9592             { &hf_gsm_a_rr_reporting_rate,
9593               { "Reporting Rate", "gsm_a.rr.reporting_rate",
9594                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_reporting_rate_value), 0x0,
9595                 NULL, HFILL }
9596             },
9597             { &hf_gsm_a_rr_invalid_bsic_reporting,
9598               { "Invalid BSIC Reporting", "gsm_a.rr.invalid_bsic_reporting",
9599                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_invalid_bsic_reporting_value), 0x0,
9600                 NULL, HFILL }
9601             },
9602             { &hf_gsm_a_rr_scale_ord,
9603               { "Scale Ord", "gsm_a.rr.scale_ord",
9604                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_scale_ord_vals), 0x00,
9605                 "Offset used for the reported RXLEV values (Scale Ord)", HFILL }
9606             },
9607             { &hf_gsm_a_rr_900_reporting_offset,
9608               { "900 Reporting Offset", "gsm_a.rr.900_reporting_offset",
9609                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_xxx_reporting_offset_vals), 0x00,
9610                 "Offset to the reported value when prioritising the cells for reporting for GSM frequency band 900 (900 Reporting Offset)", HFILL }
9611             },
9612             { &hf_gsm_a_rr_900_reporting_threshold,
9613               { "900 Reporting Threshold", "gsm_a.rr.900_reporting_threshold",
9614                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_xxx_reporting_threshold_vals), 0x00,
9615                 "Apply priority reporting if the reported value is above threshold for GSM frequency band 900 (900 Reporting Threshold)", HFILL }
9616             },
9617             { &hf_gsm_a_rr_1800_reporting_offset,
9618               { "1800 Reporting Offset", "gsm_a.rr.1800_reporting_offset",
9619                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_xxx_reporting_offset_vals), 0x00,
9620                 "Offset to the reported value when prioritising the cells for reporting for GSM frequency band 1800 (1800 Reporting Offset)", HFILL }
9621             },
9622             { &hf_gsm_a_rr_1800_reporting_threshold,
9623               { "1800 Reporting Threshold", "gsm_a.rr.1800_reporting_threshold",
9624                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_xxx_reporting_threshold_vals), 0x00,
9625                 "Apply priority reporting if the reported value is above threshold for GSM frequency band 1800 (1800 Reporting Threshold)", HFILL }
9626             },
9627             { &hf_gsm_a_rr_400_reporting_offset,
9628               { "400 Reporting Offset", "gsm_a.rr.400_reporting_offset",
9629                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_xxx_reporting_offset_vals), 0x00,
9630                 "Offset to the reported value when prioritising the cells for reporting for GSM frequency band 400 (400 Reporting Offset)", HFILL }
9631             },
9632             { &hf_gsm_a_rr_400_reporting_threshold,
9633               { "400 Reporting Threshold", "gsm_a.rr.400_reporting_threshold",
9634                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_xxx_reporting_threshold_vals), 0x00,
9635                 "Apply priority reporting if the reported value is above threshold for GSM frequency band 400 (400 Reporting Threshold)", HFILL }
9636             },
9637             { &hf_gsm_a_rr_1900_reporting_offset,
9638               { "1900 Reporting Offset", "gsm_a.rr.1900_reporting_offset",
9639                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_xxx_reporting_offset_vals), 0x00,
9640                 "Offset to the reported value when prioritising the cells for reporting for GSM frequency band 1900 (1900 Reporting Offset)", HFILL }
9641             },
9642             { &hf_gsm_a_rr_1900_reporting_threshold,
9643               { "1900 Reporting Threshold", "gsm_a.rr.1900_reporting_threshold",
9644                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_xxx_reporting_threshold_vals), 0x00,
9645                 "Apply priority reporting if the reported value is above threshold for GSM frequency band 1900 (1900 Reporting Threshold)", HFILL }
9646             },
9647             { &hf_gsm_a_rr_850_reporting_offset,
9648               { "850 Reporting Offset", "gsm_a.rr.850_reporting_offset",
9649                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_xxx_reporting_offset_vals), 0x00,
9650                 "Offset to the reported value when prioritising the cells for reporting for GSM frequency band 850 (850 Reporting Offset)", HFILL }
9651             },
9652             { &hf_gsm_a_rr_850_reporting_threshold,
9653               { "850 Reporting Threshold", "gsm_a.rr.900_reporting_threshold",
9654                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_xxx_reporting_threshold_vals), 0x00,
9655                 "Apply priority reporting if the reported value is above threshold for GSM frequency band 850 (850 Reporting Threshold)", HFILL }
9656             },
9657             { &hf_gsm_a_rr_network_control_order,
9658               { "Network Control Order", "gsm_a.rr.network_control_order",
9659                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_network_control_order_vals), 0x00,
9660                 NULL, HFILL }
9661             },
9662             { &hf_gsm_a_rr_nc_non_drx_period,
9663               { "NC Non DRX Period", "gsm_a.rr.nc_non_drx_period",
9664                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_nc_non_drx_period_vals), 0x00,
9665                 NULL, HFILL }
9666             },
9667             { &hf_gsm_a_rr_nc_reporting_period_i,
9668               { "NC Reporting Period I", "gsm_a.rr.nc_reporting_period_i",
9669                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_nc_reporting_period_x_vals), 0x00,
9670                 "NC Reporting Period in Packet Idle mode (NC Reporting Period I)", HFILL }
9671             },
9672             { &hf_gsm_a_rr_nc_reporting_period_t,
9673               { "NC Reporting Period T", "gsm_a.rr.nc_reporting_period_t",
9674                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_nc_reporting_period_x_vals), 0x00,
9675                 "NC Reporting Period in Packet Transfer mode (NC Reporting Period T)", HFILL }
9676             },
9677             { &hf_gsm_a_rr_index_start_3g,
9678               { "Index Start 3G", "gsm_a.rr.index_start_3g",
9679                 FT_UINT8, BASE_DEC, NULL, 0x00,
9680                 NULL, HFILL }
9681             },
9682             { &hf_gsm_a_rr_absolute_index_start_emr,
9683               { "Absolute Index Start EMR", "gsm_a.rr.absolute_index_start_emr",
9684                 FT_UINT8, BASE_DEC, NULL, 0x00,
9685                 NULL, HFILL }
9686             },
9687             { &hf_gsm_a_rr_qsearch_c_initial,
9688               { "QSearch C Initial", "gsm_a.rr.qsearch_c_initial",
9689                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_qsearch_c_initial_value), 0x0,
9690                 "Qsearch value to be used in connected mode before Qsearch C is received (QSearch C Initial)", HFILL }
9691             },
9692             { &hf_gsm_a_rr_fdd_rep_quant,
9693               { "FDD Rep Quant", "gsm_a.rr.fdd_rep_quant",
9694                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_fdd_rep_quant_value), 0x0,
9695                 "FDD Reporting Quantity (FDD Rep Quant)", HFILL }
9696             },
9697             { &hf_gsm_a_rr_fdd_multirat_reporting,
9698               { "FDD Multirat Reporting", "gsm_a.rr.fdd_multirat_reporting",
9699                 FT_UINT8, BASE_DEC, NULL, 0x00,
9700                 "Number of cells from the FDD access technology that shall be included in the list of strongest cells or in the measurement report (FDD Multirat Reporting)", HFILL }
9701             },
9702             { &hf_gsm_a_rr_tdd_multirat_reporting,
9703               { "TDD Multirat Reporting", "gsm_a.rr.tdd_multirat_reporting",
9704                 FT_UINT8, BASE_DEC, NULL, 0x00,
9705                 "Number of cells from the TDD access technology that shall be included in the list of strongest cells or in the measurement report (TDD Multirat Reporting)", HFILL }
9706             },
9707             { &hf_gsm_a_rr_qsearch_p,
9708               { "Qsearch P", "gsm_a.rr.qsearch_p",
9709                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_qsearch_x_vals), 0x00,
9710                 "Search for 3G cells if signal level below threshold (Qsearch P)", HFILL }
9711             },
9712             { &hf_gsm_a_rr_3g_search_prio,
9713               { "3G Search Prio", "gsm_a.rr.3g_search_prio",
9714                 FT_BOOLEAN, BASE_NONE,  TFS(&gsm_a_rr_3g_search_prio_value), 0x0,
9715                 NULL, HFILL }
9716             },
9717             { &hf_gsm_a_rr_fdd_reporting_offset,
9718               { "FDD Reporting Offset", "gsm_a.rr.fdd_reporting_offset",
9719                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_xxx_reporting_offset_vals), 0x00,
9720                 "Offset to the reported value when prioritising the cells for reporting for FDD access technology (FDD Reporting Offset)", HFILL }
9721             },
9722             { &hf_gsm_a_rr_fdd_reporting_threshold,
9723               { "FDD Reporting Threshold", "gsm_a.rr.fdd_reporting_threshold",
9724                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_xxx_reporting_threshold_vals), 0x00,
9725                 "Apply priority reporting if the reported value is above threshold for FDD access technology (FDD Reporting Threshold)", HFILL }
9726             },
9727             { &hf_gsm_a_rr_tdd_reporting_offset,
9728               { "TDD Reporting Offset", "gsm_a.rr.tdd_reporting_offset",
9729                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_xxx_reporting_offset_vals), 0x00,
9730                 "Offset to the reported value when prioritising the cells for reporting for TDD access technology (TDD Reporting Offset)", HFILL }
9731             },
9732             { &hf_gsm_a_rr_tdd_reporting_threshold,
9733               { "TDD Reporting Threshold", "gsm_a.rr.tdd_reporting_threshold",
9734                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_xxx_reporting_threshold_vals), 0x00,
9735                 "Apply priority reporting if the reported value is above threshold for TDD access technology (TDD Reporting Threshold)", HFILL }
9736             },
9737             { &hf_gsm_a_rr_fdd_reporting_threshold_2,
9738               { "FDD Reporting Threshold 2", "gsm_a.rr.fdd_reporting_threshold_2",
9739                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9740                 "Reporting threshold for the CPICH parameter (Ec/No or RSCP) that is not reported according to FDD_REP_QUANT (FDD Reporting Threshold 2)", HFILL }
9741             },
9742             { &hf_gsm_a_rr_3g_ccn_active,
9743               { "3G CCN Active", "gsm_a.rr.3g_ccn_active",
9744                 FT_BOOLEAN, BASE_NONE,  TFS(&gsm_a_rr_3g_ccn_active_value), 0x0,
9745                 NULL, HFILL }
9746             },
9747             { &hf_gsm_a_rr_700_reporting_offset,
9748               { "700 Reporting Offset", "gsm_a.rr.700_reporting_offset",
9749                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_xxx_reporting_offset_vals), 0x00,
9750                 "Offset to the reported value when prioritising the cells for reporting for GSM frequency band 700 (700 Reporting Offset)", HFILL }
9751             },
9752             { &hf_gsm_a_rr_700_reporting_threshold,
9753               { "700 Reporting Threshold", "gsm_a.rr.700_reporting_threshold",
9754                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_xxx_reporting_threshold_vals), 0x00,
9755                 "Apply priority reporting if the reported value is above threshold for GSM frequency band 700 (700 Reporting Threshold)", HFILL }
9756             },
9757             { &hf_gsm_a_rr_810_reporting_offset,
9758               { "810 Reporting Offset", "gsm_a.rr.810_reporting_offset",
9759                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_xxx_reporting_offset_vals), 0x00,
9760                 "Offset to the reported value when prioritising the cells for reporting for GSM frequency band 810 (810 Reporting Offset)", HFILL }
9761             },
9762             { &hf_gsm_a_rr_810_reporting_threshold,
9763               { "810 Reporting Threshold", "gsm_a.rr.810_reporting_threshold",
9764                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_xxx_reporting_threshold_vals), 0x00,
9765                 "Apply priority reporting if the reported value is above threshold for GSM frequency band 810 (810 Reporting Threshold)", HFILL }
9766             },
9767             { &hf_gsm_a_rr_cbq,
9768               { "CBQ", "gsm_a.rr.cbq",
9769                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9770                 "Cell Bar Qualify", HFILL }
9771             },
9772             { &hf_gsm_a_rr_cell_reselect_offset,
9773               { "Cell Reselect Offset", "gsm_a.rr.cell_reselect_offset",
9774                 FT_UINT8, BASE_DEC,  VALS(gsm_a_rr_cell_reselect_offset_vals), 0x00,
9775                 "Offset to the C2 reselection criterion (Cell Reselect Offset)", HFILL }
9776             },
9777             { &hf_gsm_a_rr_temporary_offset,
9778               { "Temporary Offset", "gsm_a.rr.temporary_offset",
9779                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_temporary_offset_vals), 0x0,
9780                 "Negative offset to C2 for the duration of Penalty Time (Temporary Offset)", HFILL }
9781             },
9782             { &hf_gsm_a_rr_penalty_time,
9783               { "Penalty Time", "gsm_a.rr.penalty_time",
9784                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_penalty_time_vals), 0x0,
9785                 "Duration for which the temporary offset is applied (Penalty Time)", HFILL }
9786             },
9787             { &hf_gsm_a_rr_si13_position,
9788               { "SI13 Position", "gsm_a.rr.si13_position",
9789                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_si13_position_vals), 0x0,
9790                 NULL, HFILL }
9791             },
9792             { &hf_gsm_a_rr_power_offset,
9793               { "Power Offset", "gsm_a.rr.power_offset",
9794                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_power_offset_vals), 0x0,
9795                 "Power offset used in conjunction with the MS TXPWR MAX CCH parameter by the class 3 DCS 1800 MS (Power Offset)", HFILL }
9796             },
9797             { &hf_gsm_a_rr_si2quater_position,
9798               { "SI2quater Position", "gsm_a.rr.si2quater_position",
9799                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_si2quater_position_value), 0x0,
9800                 NULL, HFILL }
9801             },
9802             { &hf_gsm_a_rr_si13alt_position,
9803               { "SI13alt Position", "gsm_a.rr.si13alt_position",
9804                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_si13alt_position_value), 0x0,
9805                 NULL, HFILL }
9806             },
9807             { &hf_gsm_a_rr_prio_thr,
9808               { "Prio Thr", "gsm_a.rr.prio_thr",
9809                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_prio_thr_vals), 0x0,
9810                 "Prio signal strength threshold is related to RXLEV ACCESS_MIN (Prio Thr)", HFILL }
9811             },
9812             { &hf_gsm_a_rr_lsa_offset,
9813               { "LSA Offset", "gsm_a.rr.lsa_offset",
9814                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_lsa_offset_vals), 0x0,
9815                 "Offset to be used for LSA cell re selection between cells with the same LSA priorities (LSA Offset)", HFILL }
9816             },
9817             { &hf_gsm_a_rr_paging_channel_restructuring,
9818               { "Paging Channel Restructuring", "gsm_a.rr.paging_channel_restructuring",
9819                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_paging_channel_restructuring_value), 0x0,
9820                 NULL, HFILL }
9821             },
9822             { &hf_gsm_a_rr_nln_sacch,
9823               { "NLN (SACCH)", "gsm_a.rr.nln_sacch",
9824                 FT_UINT8, BASE_DEC, NULL, 0x0,
9825                 NULL, HFILL }
9826             },
9827             { &hf_gsm_a_rr_nln_status_sacch,
9828               { "NLN Status (SACCH)", "gsm_a.rr.nln_status_sacch",
9829                 FT_UINT8, BASE_DEC, NULL, 0x0,
9830                 NULL, HFILL }
9831             },
9832             { &hf_gsm_a_rr_nln_pch,
9833               { "NLN (PCH)", "gsm_a.rr.nln_pch",
9834                 FT_UINT8, BASE_DEC, NULL, 0x0,
9835                 NULL, HFILL }
9836             },
9837             { &hf_gsm_a_rr_nln_status_pch,
9838               { "NLN Status (PCH)", "gsm_a.rr.nln_status_pch",
9839                 FT_UINT8, BASE_DEC, NULL, 0x0,
9840                 NULL, HFILL }
9841             },
9842             { &hf_gsm_a_rr_vbs_vgcs_inband_notifications,
9843               { "Inband Notifications", "gsm_a.rr.vbs_vgcs_inband_notifications",
9844                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_vbs_vgcs_inband_notifications_value), 0x0,
9845                 NULL, HFILL }
9846             },
9847             { &hf_gsm_a_rr_vbs_vgcs_inband_pagings,
9848               { "Inband Pagings", "gsm_a.rr.vbs_vgcs_inband_pagings",
9849                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_vbs_vgcs_inband_pagings_value), 0x0,
9850                 NULL, HFILL }
9851             },
9852             { &hf_gsm_a_rr_rac,
9853               { "RAC", "gsm_a.rr.rac",
9854                 FT_UINT8, BASE_DEC, NULL, 0x0,
9855                 "Routeing Area Code", HFILL }
9856             },
9857             { &hf_gsm_a_rr_max_lapdm,
9858               { "Max LAPDm", "gsm_a.rr.max_lapdm",
9859                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_max_lapdm_vals), 0x0,
9860                 "Maximum number of LAPDm frames on which a layer 3 can be segmented into and be sent on the main DCCH (Max LAPDm)", HFILL }
9861             },
9862             { &hf_gsm_a_rr_gprs_ms_txpwr_max_ccch,
9863               { "GPRS MS TxPwr Max CCH", "gsm_a.rr.gprs_ms_txpwr_max_cch",
9864                 FT_UINT8, BASE_DEC,  NULL, 0x00,
9865                 NULL, HFILL }
9866             },
9867             { &hf_gsm_a_rr_dedicated_mode_mbms_notification_support,
9868               { "Dedicated Mode MBMS Notification Support", "gsm_a.rr.dedicated_mode_mbms_notification_support",
9869                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_dedicated_mode_mbms_notification_support_value), 0x0,
9870                 NULL, HFILL }
9871             },
9872             { &hf_gsm_a_rr_mnci_support,
9873               { "MNCI Support", "gsm_a.rr.mnci_support",
9874                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_mnci_support_value), 0x0,
9875                 "MBMS Neighbouring Cell Information Support (MNCI Support)", HFILL }
9876             },
9877             { &hf_gsm_a_rr_amr_config,
9878               { "AMR Configuration", "gsm_a.rr.amr_config",
9879                 FT_UINT8, BASE_DEC, NULL, 0x0,
9880                 NULL, HFILL }
9881             },
9882             { &hf_gsm_a_rr_bcch_change_mark,
9883               { "BCCH Change Mark", "gsm_a.rr.bcch_change_mark",
9884                 FT_UINT8, BASE_DEC, NULL, 0x0,
9885                 NULL, HFILL }
9886             },
9887             { &hf_gsm_a_rr_si_change_field,
9888               { "SI Change Field", "gsm_a.rr.si_change_field",
9889                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_si_change_field_vals), 0x0,
9890                 NULL, HFILL }
9891             },
9892             { &hf_gsm_a_rr_si13_change_mark,
9893               { "SI13 Change Mark", "gsm_a.rr.si13_change_mark",
9894                 FT_UINT8, BASE_DEC, NULL, 0x0,
9895                 NULL, HFILL }
9896             },
9897             { &hf_gsm_a_rr_hsn,
9898               { "HSN", "gsm_a.rr.hsn",
9899                 FT_UINT8, BASE_DEC, NULL, 0x0,
9900                 "Hopping Sequence Number (HSN)", HFILL }
9901             },
9902             { &hf_gsm_a_rr_rfl_number,
9903               { "RFL Number", "gsm_a.rr.rfl_number",
9904                 FT_UINT8, BASE_DEC, NULL, 0x0,
9905                 "Radio Frequency List Number (RFL Number)", HFILL }
9906             },
9907             { &hf_gsm_a_rr_arfcn_index,
9908               { "ARFCN Index", "gsm_a.rr.arfcn_index",
9909                 FT_UINT8, BASE_DEC, NULL, 0x0,
9910                 NULL, HFILL }
9911             },
9912             { &hf_gsm_a_rr_ma_length,
9913               { "MA Length", "gsm_a.rr.ma_length",
9914                 FT_UINT8, BASE_DEC, NULL, 0x0,
9915                 "Mobile Allocation Length (MA Length)", HFILL }
9916             },
9917             { &hf_gsm_a_rr_psi1_repeat_period,
9918               { "PSI1 Repeat Period", "gsm_a.rr.psi1_repeat_period",
9919                 FT_UINT8, BASE_DEC, VALS(&gsm_a_rr_psi1_repeat_period_vals), 0x0,
9920                 NULL, HFILL }
9921             },
9922             { &hf_gsm_a_rr_pbcch_pb,
9923               { "Pb", "gsm_a.rr.pbcch_pb",
9924                 FT_UINT8, BASE_DEC, VALS(&gsm_a_rr_pbcch_pb_vals), 0x0,
9925                 "Power reduction on PBCCH/PCCCH (Pb)", HFILL }
9926             },
9927             { &hf_gsm_a_rr_pbcch_tsc,
9928               { "TSC", "gsm_a.rr.pbcch_tsc",
9929                 FT_UINT8, BASE_DEC, NULL, 0x0,
9930                 "Training Sequence Code for PBCCH (TSC)", HFILL }
9931             },
9932             { &hf_gsm_a_rr_pbcch_tn,
9933               { "TN", "gsm_a.rr.pbcch_tn",
9934                 FT_UINT8, BASE_DEC, NULL, 0x0,
9935                 "Timeslot Number for PCCH (TN)", HFILL }
9936             },
9937             { &hf_gsm_a_rr_spgc_ccch_sup,
9938               { "SPGC CCCH Sup", "gsm_a.rr.spgc_ccch_sup",
9939                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_spgc_ccch_sup_value), 0x0,
9940                 "Split PG Cycle Code on CCCH Support (SPGC CCCH Sup)", HFILL }
9941             },
9942             { &hf_gsm_a_rr_priority_access_thr,
9943               { "Priority Access Thr", "gsm_a.rr.priority_access_thr",
9944                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_priority_access_thr_vals), 0x0,
9945                 "Priority Access Threshold for packet access (Priority Access Thr)", HFILL }
9946             },
9947             { &hf_gsm_a_rr_nmo,
9948               { "NMO", "gsm_a.rr.nmo",
9949                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_nmo_vals), 0x0,
9950                 "Network mode of Operation (NMO)", HFILL }
9951             },
9952             { &hf_gsm_a_rr_t3168,
9953               { "T3168", "gsm_a.rr.t3168",
9954                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_t3168_vals), 0x0,
9955                 NULL, HFILL }
9956             },
9957             { &hf_gsm_a_rr_t3192,
9958               { "T3192", "gsm_a.rr.t3192",
9959                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_t3192_vals), 0x0,
9960                 NULL, HFILL }
9961             },
9962             { &hf_gsm_a_rr_drx_timer_max,
9963               { "DRX Timer Max", "gsm_a.rr.drx_timer_max",
9964                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_drx_timer_max_vals), 0x0,
9965                 "Discontinuous Reception Timer Max (DRX Timer Max)", HFILL }
9966             },
9967             { &hf_gsm_a_rr_access_burst_type,
9968               { "Access Burst Type", "gsm_a.rr.access_burst_type",
9969                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_access_burst_type_value), 0x0,
9970                 "Format used in the PACKET CHANNEL REQUEST message, the PS HANDOVER ACCESS message, the PTCCH uplink block and in the PACKET CONTROL ACKNOWLEDGMENT message (Access Burst Type)", HFILL }
9971             },
9972             { &hf_gsm_a_rr_control_ack_type,
9973               { "Control Ack Type", "gsm_a.rr.control_ack_type",
9974                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_control_ack_type_value), 0x0,
9975                 "Default format of the PACKET CONTROL ACKNOWLEDGMENT message (Control Ack Type)", HFILL }
9976             },
9977             { &hf_gsm_a_rr_bs_cv_max,
9978               { "BS CV Max", "gsm_a.rr.bs_cv_max",
9979                 FT_UINT8, BASE_DEC, NULL, 0x0,
9980                 "Base Station Countdown Value Maximum (BS CV Max)", HFILL }
9981             },
9982             { &hf_gsm_a_rr_pan_dec,
9983               { "PAN Dec", "gsm_a.rr.pan_dec",
9984                 FT_UINT8, BASE_DEC, NULL, 0x0,
9985                 NULL, HFILL }
9986             },
9987             { &hf_gsm_a_rr_pan_inc,
9988               { "PAN Inc", "gsm_a.rr.pan_inc",
9989                 FT_UINT8, BASE_DEC, NULL, 0x0,
9990                 NULL, HFILL }
9991             },
9992             { &hf_gsm_a_rr_pan_max,
9993               { "PAN Max", "gsm_a.rr.pan_max",
9994                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_pan_max_vals), 0x0,
9995                 NULL, HFILL }
9996             },
9997             { &hf_gsm_a_rr_egprs_packet_channel_request,
9998               { "EGPRS Packet Channel Request", "gsm_a.rr.egprs_packet_channel_request",
9999                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_egprs_packet_channel_request_value), 0x0,
10000                 NULL, HFILL }
10001             },
10002             { &hf_gsm_a_rr_bep_period,
10003               { "BEP Period", "gsm_a.rr.bep_period",
10004                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_bep_period_vals), 0x0,
10005                 NULL, HFILL }
10006             },
10007             { &hf_gsm_a_rr_pfc_feature_mode,
10008               { "PFC Feature Mode", "gsm_a.rr.pfc_feature_mode",
10009                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_pfc_feature_mode_value), 0x0,
10010                 "Packet Flow Context Feature Mode (PFC Feature Mode)", HFILL }
10011             },
10012             { &hf_gsm_a_rr_dtm_support,
10013               { "DTM Support", "gsm_a.rr.dtm_support",
10014                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_dtm_support_value), 0x0,
10015                 "Dual Transfer Mode Support (DTM Support)", HFILL }
10016             },
10017             { &hf_gsm_a_rr_bss_paging_coordination,
10018               { "BSS Paging Coordination", "gsm_a.rr.bss_paging_coordination",
10019                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_bss_paging_coordination_value), 0x0,
10020                 NULL, HFILL }
10021             },
10022             { &hf_gsm_a_rr_ccn_active,
10023               { "CCN Active", "gsm_a.rr.ccn_active",
10024                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_ccn_active_value), 0x0,
10025                 NULL, HFILL }
10026             },
10027             { &hf_gsm_a_rr_nw_ext_utbf,
10028               { "NW Ext UTBF", "gsm_a.rr.nw_ext_utbf",
10029                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_nw_ext_utbf_value), 0x0,
10030                 "Network Extended Uplink TBF (NW Ext UTBF)", HFILL }
10031             },
10032             { &hf_gsm_a_rr_multiple_tbf_capability,
10033               { "Multiple TBF Capability", "gsm_a.rr.multiple_tbf_capability",
10034                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_multiple_tbf_capability_value), 0x0,
10035                 NULL, HFILL }
10036             },
10037             { &hf_gsm_a_rr_ext_utbf_no_data,
10038               { "Ext UTBF No Data", "gsm_a.rr.ext_utbf_no_data",
10039                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_ext_utbf_no_data_value), 0x0,
10040                 NULL, HFILL }
10041             },
10042             { &hf_gsm_a_rr_dtm_enhancements_capability,
10043               { "DTM Enhancements Capability", "gsm_a.rr.dtm_enhancements_capability",
10044                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_dtm_enhancements_capability_value), 0x0,
10045                 NULL, HFILL }
10046             },
10047             { &hf_gsm_a_rr_reduced_latency_access,
10048               { "Reduced Latency Access", "gsm_a.rr.reduced_latency_access",
10049                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_reduced_latency_access_value), 0x0,
10050                 NULL, HFILL }
10051             },
10052             { &hf_gsm_a_rr_alpha,
10053               { "Alpha", "gsm_a.rr.alpha",
10054                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_alpha_vals), 0x0,
10055                 "Alpha parameter for GPR MS output power control (Alpha)", HFILL }
10056             },
10057             { &hf_gsm_a_rr_t_avg_w,
10058               { "T Avg W", "gsm_a.rr.t_avg_w",
10059                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_t_avg_x_vals), 0x0,
10060                 "Signal strength filter period for power control in packet idle mode", HFILL }
10061             },
10062             { &hf_gsm_a_rr_t_avg_t,
10063               { "T Avg T", "gsm_a.rr.t_avg_t",
10064                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_t_avg_x_vals), 0x0,
10065                 "Signal strength filter period for power control in packet transfer mode", HFILL }
10066             },
10067             { &hf_gsm_a_rr_pc_meas_chan,
10068               { "PC Meas Chan", "gsm_a.rr.pc_meas_chan",
10069                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_pc_meas_chan_value), 0x0,
10070                 "Channel used to measure the received power level on the downlink for the purpose of the uplink power control (PC Meas Chan)", HFILL }
10071             },
10072             { &hf_gsm_a_rr_n_avg_i,
10073               { "N Avg I", "gsm_a.rr.n_avg_i",
10074                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_n_avg_i_vals), 0x0,
10075                 "Interfering signal strength filter constant for power control (N Avg I)", HFILL }
10076             },
10077             { &hf_gsm_a_rr_sgsnr,
10078               { "SGSNR", "gsm_a.rr.sgsnr",
10079                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_sgsnr_value), 0x0,
10080                 "SGSN Release (SGSNR)", HFILL }
10081             },
10082             { &hf_gsm_a_rr_si_status_ind,
10083               { "SI Status Ind", "gsm_a.rr.si_status_ind",
10084                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_si_status_ind_value), 0x0,
10085                 NULL, HFILL }
10086             },
10087             { &hf_gsm_a_rr_lb_ms_txpwr_max_cch,
10088               { "LB MS TxPwr Max CCCH", "gsm_a.rr.n_avg_i",
10089                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_n_avg_i_vals), 0x0,
10090                 "Maximum TX power level an MS is allowed to use on all other than DCS 1800 and PCS 1900 frequency bands when accessing the system until otherwise commanded (LB MS TxPwr Max CCCH)", HFILL }
10091             },
10092             { &hf_gsm_a_rr_si2n_support,
10093               { "SI2n Support", "gsm_a.rr.si2n_support",
10094                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_si2n_support_vals), 0x0,
10095                 NULL, HFILL }
10096             },
10097             { &hf_gsm_a_rr_mi_index,
10098               { "Measurement Information Index", "gsm_a.rr.mi_index",
10099                 FT_UINT8, BASE_DEC, NULL, 0x0,
10100                 NULL, HFILL }
10101             },
10102             { &hf_gsm_a_rr_mi_count,
10103               { "Measurement Information Count", "gsm_a.rr.mi_count",
10104                 FT_UINT8, BASE_DEC, NULL, 0x0,
10105                 NULL, HFILL }
10106             },
10107             { &hf_gsm_a_rr_3g_wait,
10108               { "3G Wait", "gsm_a.rr.3g_wait",
10109                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_3g_wait_vals), 0x0,
10110                 NULL, HFILL }
10111             },
10112             { &hf_gsm_a_rr_qsearch_c,
10113               { "Qsearch C", "gsm_a.rr.qsearch_c",
10114                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_qsearch_x_vals), 0x00,
10115                 "Search for 3G cells if signal level is below (0 7) or above (8 15) threshold (Qsearch C)", HFILL }
10116             },
10117             { &hf_gsm_a_rr_bsic_seen,
10118               { "BSIC Seen", "gsm_a.rr.bsic_seen",
10119                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_bsic_seen_value), 0x0,
10120                 NULL, HFILL }
10121             },
10122             { &hf_gsm_a_rr_scale,
10123               { "Scale", "gsm_a.rr.scale",
10124                 FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_rr_scale_value), 0x0,
10125                 "Offset applied for the reported RXLEV values (Scale)", HFILL }
10126             },
10127             { &hf_gsm_a_rr_mean_bep_gmsk,
10128               { "Mean BEP GMSK", "gsm_a.rr.mean_bep_gmsk",
10129                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_mean_bep_gmsk_vals), 0x00,
10130                 "Mean Bit Error Probability in GMSK (Mean BEP GMSK)", HFILL }
10131             },
10132             { &hf_gsm_a_rr_mean_cv_bep,
10133               { "CV BEP", "gsm_a.rr.cv_bep",
10134                 FT_UINT8, BASE_DEC, VALS(gsm_a_rr_cv_bep_vals), 0x00,
10135                 "Coefficient of Variation of the Bit Error Probability (CV BEP)", HFILL }
10136             },
10137             { &hf_gsm_a_rr_nbr_rcvd_blocks,
10138               { "Nb Rcvd Blocks", "gsm_a.rr.nbr_rcvd_blocks",
10139                 FT_UINT8, BASE_DEC, NULL, 0x00,
10140                 "Number of correctly decoded blocks that were completed during the measurement report period (Nb Rcvd Blocks)", HFILL }
10141             },
10142             { &hf_gsm_a_rr_reporting_quantity,
10143               { "Reporting Quantity", "gsm_a.rr.reporting_quantity",
10144                 FT_UINT8, BASE_DEC, NULL, 0x00,
10145                 NULL, HFILL }
10146             }
10147         };
10148
10149     static hf_register_info hf_sacch[] =
10150         {
10151             { &hf_gsm_a_sacch_msg_rr_type,
10152               { "SACCH Radio Resources Management Message Type",        "gsm_a.sacch_msg_rr_type",
10153                 FT_UINT8, BASE_HEX, VALS(gsm_a_sacch_msg_rr_strings), 0x0,
10154                 NULL, HFILL }
10155             }
10156         };
10157
10158         /* Setup protocol subtree array */
10159 #define NUM_INDIVIDUAL_ELEMS    3
10160     gint *ett[NUM_INDIVIDUAL_ELEMS +
10161               NUM_GSM_DTAP_MSG_RR +
10162               NUM_GSM_RR_ELEM +
10163               NUM_GSM_RR_REST_OCTETS_ELEM +
10164               NUM_GSM_SACCH_MSG_RR];
10165
10166     ett[0] = &ett_ccch_msg;
10167     ett[1] = &ett_ccch_oct_1;
10168     ett[2] = &ett_sacch_msg;
10169
10170     last_offset = NUM_INDIVIDUAL_ELEMS;
10171
10172     for (i=0; i < NUM_GSM_DTAP_MSG_RR; i++, last_offset++)
10173     {
10174         ett_gsm_dtap_msg_rr[i] = -1;
10175         ett[last_offset] = &ett_gsm_dtap_msg_rr[i];
10176     }
10177
10178     for (i=0; i < NUM_GSM_RR_ELEM; i++, last_offset++)
10179     {
10180         ett_gsm_rr_elem[i] = -1;
10181         ett[last_offset] = &ett_gsm_rr_elem[i];
10182     }
10183
10184     for (i=0; i < NUM_GSM_RR_REST_OCTETS_ELEM; i++, last_offset++)
10185     {
10186         ett_gsm_rr_rest_octets_elem[i] = -1;
10187         ett[last_offset] = &ett_gsm_rr_rest_octets_elem[i];
10188     }
10189
10190     for (i=0; i < NUM_GSM_SACCH_MSG_RR; i++, last_offset++)
10191     {
10192         ett_gsm_sacch_msg_rr[i] = -1;
10193         ett[last_offset] = &ett_gsm_sacch_msg_rr[i];
10194     }
10195
10196     /* Register the protocol name and description */
10197     proto_a_ccch =
10198         proto_register_protocol("GSM CCCH", "GSM CCCH", "gsm_a_ccch");
10199
10200     proto_register_field_array(proto_a_ccch, hf, array_length(hf));
10201
10202     /* subdissector code */
10203     register_dissector("gsm_a_ccch", dissect_ccch, proto_a_ccch);
10204
10205     /* Register the protocol name and description */
10206     proto_a_sacch =
10207         proto_register_protocol("GSM SACCH", "GSM SACCH", "gsm_a_sacch");
10208
10209     proto_register_field_array(proto_a_sacch, hf_sacch, array_length(hf_sacch));
10210
10211     /* subdissector code */
10212     register_dissector("gsm_a_sacch", dissect_sacch, proto_a_sacch);
10213
10214     /* subtree array (for both sub-dissectors) */
10215     proto_register_subtree_array(ett, array_length(ett));
10216 }
10217
10218 void
10219 proto_reg_handoff_gsm_a_rr(void)
10220 {
10221     data_handle = find_dissector("data");
10222     rrc_irat_ho_info_handle = find_dissector("rrc.irat.irat_ho_info");
10223     rrc_irat_ho_to_utran_cmd_handle = find_dissector("rrc.irat.ho_to_utran_cmd");
10224     rrlp_dissector = find_dissector("rrlp");
10225 }