RRC: Spot more UE transitions
[metze/wireshark/wip.git] / epan / dissectors / asn1 / rrc / packet-rrc-template.c
1 /* packet-rrc.c
2  * Routines for Universal Mobile Telecommunications System (UMTS);
3  * Radio Resource Control (RRC) protocol specification
4  * (3GPP TS 25.331  packet dissection)
5  * Copyright 2006-2010, Anders Broman <anders.broman@ericsson.com>
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  *
25  * Ref: 3GPP TS 25.331 V14.4.0 (2017-09)
26  */
27
28 /**
29  *
30  * TODO:
31  * - Fix ciphering information for circuit switched stuff
32  */
33
34 #include "config.h"
35
36 #include <epan/packet.h>
37 #include <epan/asn1.h>
38 #include <epan/conversation.h>
39 #include <epan/expert.h>
40 #include <epan/proto_data.h>
41
42 #include "packet-ber.h"
43 #include "packet-per.h"
44 #include "packet-rrc.h"
45 #include "packet-gsm_a_common.h"
46 #include "packet-nbap.h"
47 #include "packet-umts_fp.h"
48 #include "packet-umts_mac.h"
49 #include "packet-umts_rlc.h"
50
51 #ifdef _MSC_VER
52 /* disable: "warning C4049: compiler limit : terminating line number emission" */
53 #pragma warning(disable:4049)
54 /* disable: "warning C4146: unary minus operator applied to unsigned type, result still unsigned" */
55 #pragma warning(disable:4146)
56 #endif
57
58 #define PNAME  "Radio Resource Control (RRC) protocol"
59 #define PSNAME "RRC"
60 #define PFNAME "rrc"
61
62 extern int proto_fp;       /*Handler to FP*/
63 extern int proto_umts_mac; /*Handler to MAC*/
64 extern int proto_umts_rlc; /*Handler to RLC*/
65
66 GTree * hsdsch_muxed_flows = NULL;
67 GTree * rrc_ciph_info_tree = NULL;
68 wmem_tree_t* rrc_global_urnti_crnti_map = NULL;
69 static int msg_type _U_;
70
71 /*****************************************************************************/
72 /* Packet private data                                                       */
73 /* For this dissector, all access to actx->private_data should be made       */
74 /* through this API, which ensures that they will not overwrite each other!! */
75 /*****************************************************************************/
76
77 typedef struct umts_rrc_private_data_t
78 {
79   guint32 s_rnc_id; /* The S-RNC ID part of a U-RNTI */
80   guint32 s_rnti; /* The S-RNTI part of a U-RNTI */
81   guint32 new_u_rnti;
82   guint32 current_u_rnti;
83   guint32 scrambling_code;
84   enum nas_sys_info_gsm_map cn_domain;
85   wmem_strbuf_t* digits_strbuf; /* A collection of digits in a string. Used for reconstructing IMSIs or MCC-MNC pairs */
86   gboolean digits_strbuf_parsing_failed_flag; /* Whether an error occured when creating the IMSI/MCC-MNC pair string */
87   guint32 rbid;
88   guint32 rlc_ciphering_sqn; /* Sequence number where ciphering starts in a given bearer */
89   rrc_ciphering_info* ciphering_info;
90   enum rrc_ue_state rrc_state_indicator;
91 } umts_rrc_private_data_t;
92
93
94 /* Helper function to get or create a struct that will be actx->private_data */
95 static umts_rrc_private_data_t* umts_rrc_get_private_data(asn1_ctx_t *actx)
96 {
97   if (actx->private_data != NULL) {
98     return (umts_rrc_private_data_t*)actx->private_data;
99   }
100   else {
101     umts_rrc_private_data_t* new_struct = wmem_new0(wmem_packet_scope(), umts_rrc_private_data_t);
102     actx->private_data = new_struct;
103     return new_struct;
104   }
105 }
106
107 static guint32 private_data_get_s_rnc_id(asn1_ctx_t *actx)
108 {
109   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
110   return private_data->s_rnc_id;
111 }
112
113 static void private_data_set_s_rnc_id(asn1_ctx_t *actx, guint32 s_rnc_id)
114 {
115   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
116   private_data->s_rnc_id = s_rnc_id;
117 }
118
119 static guint32 private_data_get_s_rnti(asn1_ctx_t *actx)
120 {
121   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
122   return private_data->s_rnti;
123 }
124
125 static void private_data_set_s_rnti(asn1_ctx_t *actx, guint32 s_rnti)
126 {
127   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
128   private_data->s_rnti = s_rnti;
129 }
130
131 static guint32 private_data_get_new_u_rnti(asn1_ctx_t *actx)
132 {
133   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
134   return private_data->new_u_rnti;
135 }
136
137 static void private_data_set_new_u_rnti(asn1_ctx_t *actx, guint32 new_u_rnti)
138 {
139   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
140   private_data->new_u_rnti = new_u_rnti;
141 }
142
143 static guint32 private_data_get_current_u_rnti(asn1_ctx_t *actx)
144 {
145   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
146   return private_data->current_u_rnti;
147 }
148
149 static void private_data_set_current_u_rnti(asn1_ctx_t *actx, guint32 current_u_rnti)
150 {
151   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
152   private_data->current_u_rnti = current_u_rnti;
153 }
154
155 static guint32 private_data_get_scrambling_code(asn1_ctx_t *actx)
156 {
157   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
158   return private_data->scrambling_code;
159 }
160
161 static void private_data_set_scrambling_code(asn1_ctx_t *actx, guint32 scrambling_code)
162 {
163   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
164   private_data->scrambling_code = scrambling_code;
165 }
166
167 static enum nas_sys_info_gsm_map private_data_get_cn_domain(asn1_ctx_t *actx)
168 {
169   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
170   return private_data->cn_domain;
171 }
172
173 static void private_data_set_cn_domain(asn1_ctx_t *actx, enum nas_sys_info_gsm_map cn_domain)
174 {
175   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
176   private_data->cn_domain = cn_domain;
177 }
178
179 static wmem_strbuf_t* private_data_get_digits_strbuf(asn1_ctx_t *actx)
180 {
181   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
182   return private_data->digits_strbuf;
183 }
184
185 static void private_data_set_digits_strbuf(asn1_ctx_t *actx, wmem_strbuf_t* digits_strbuf)
186 {
187   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
188   private_data->digits_strbuf = digits_strbuf;
189 }
190
191 static gboolean private_data_get_digits_strbuf_parsing_failed_flag(asn1_ctx_t *actx)
192 {
193   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
194   return private_data->digits_strbuf_parsing_failed_flag;
195 }
196
197 static void private_data_set_digits_strbuf_parsing_failed_flag(asn1_ctx_t *actx, gboolean digits_strbuf_parsing_failed_flag)
198 {
199   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
200   private_data->digits_strbuf_parsing_failed_flag = digits_strbuf_parsing_failed_flag;
201 }
202
203 static guint32 private_data_get_rbid(asn1_ctx_t *actx)
204 {
205   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
206   return private_data->rbid;
207 }
208
209 static void private_data_set_rbid(asn1_ctx_t *actx, guint32 rbid)
210 {
211   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
212   private_data->rbid = rbid;
213 }
214
215 static guint32 private_data_get_rlc_ciphering_sqn(asn1_ctx_t *actx)
216 {
217   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
218   return private_data->rlc_ciphering_sqn;
219 }
220
221 static void private_data_set_rlc_ciphering_sqn(asn1_ctx_t *actx, guint32 rlc_ciphering_sqn)
222 {
223   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
224   private_data->rlc_ciphering_sqn = rlc_ciphering_sqn;
225 }
226
227 static rrc_ciphering_info* private_data_get_ciphering_info(asn1_ctx_t *actx)
228 {
229   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
230   return private_data->ciphering_info;
231 }
232
233 static void private_data_set_ciphering_info(asn1_ctx_t *actx, rrc_ciphering_info* ciphering_info)
234 {
235   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
236   private_data->ciphering_info = ciphering_info;
237 }
238
239 static enum rrc_ue_state private_data_get_rrc_state_indicator(asn1_ctx_t *actx)
240 {
241   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
242   return private_data->rrc_state_indicator;
243 }
244
245 static void private_data_set_rrc_state_indicator(asn1_ctx_t *actx, enum rrc_ue_state rrc_state_indicator)
246 {
247   umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx);
248   private_data->rrc_state_indicator = rrc_state_indicator;
249 }
250
251 /*****************************************************************************/
252
253 static dissector_handle_t gsm_a_dtap_handle;
254 static dissector_handle_t rrc_ue_radio_access_cap_info_handle=NULL;
255 static dissector_handle_t rrc_pcch_handle=NULL;
256 static dissector_handle_t rrc_ul_ccch_handle=NULL;
257 static dissector_handle_t rrc_dl_ccch_handle=NULL;
258 static dissector_handle_t rrc_ul_dcch_handle=NULL;
259 static dissector_handle_t rrc_dl_dcch_handle=NULL;
260 static dissector_handle_t rrc_bcch_fach_handle=NULL;
261 static dissector_handle_t lte_rrc_ue_eutra_cap_handle=NULL;
262 static dissector_handle_t lte_rrc_dl_dcch_handle=NULL;
263 static dissector_handle_t gsm_rlcmac_dl_handle=NULL;
264
265 /* Forward declarations */
266 void proto_register_rrc(void);
267 void proto_reg_handoff_rrc(void);
268 static int dissect_UE_RadioAccessCapabilityInfo_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *);
269 static int dissect_SysInfoTypeSB1_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *);
270 static int dissect_SysInfoTypeSB2_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *);
271 static int dissect_SysInfoType5_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *);
272 static int dissect_SysInfoType11_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *);
273 static int dissect_SysInfoType11bis_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *);
274 static int dissect_SysInfoType11ter_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *);
275 static int dissect_SysInfoType22_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *);
276
277 /* Include constants */
278 #include "packet-rrc-val.h"
279
280 /* Initialize the protocol and registered fields */
281 int proto_rrc = -1;
282 static int hf_test;
283 #include "packet-rrc-hf.c"
284
285 /* Initialize the subtree pointers */
286 static int ett_rrc = -1;
287
288 #include "packet-rrc-ett.c"
289
290 static gint ett_rrc_eutraFeatureGroupIndicators = -1;
291 static gint ett_rrc_cn_CommonGSM_MAP_NAS_SysInfo = -1;
292 static gint ett_rrc_ims_info = -1;
293 static gint ett_rrc_cellIdentity = -1;
294 static gint ett_rrc_cipheringAlgorithmCap = -1;
295 static gint ett_rrc_integrityProtectionAlgorithmCap = -1;
296
297 static expert_field ei_rrc_no_hrnti = EI_INIT;
298
299 /* Global variables */
300 static proto_tree *top_tree;
301
302 static int hf_rrc_eutra_feat_group_ind_1 = -1;
303 static int hf_rrc_eutra_feat_group_ind_2 = -1;
304 static int hf_rrc_eutra_feat_group_ind_3 = -1;
305 static int hf_rrc_eutra_feat_group_ind_4 = -1;
306 static int hf_rrc_ims_info_atgw_trans_det_cont_type = -1;
307 static int hf_rrc_ims_info_atgw_udp_port = -1;
308 static int hf_rrc_ims_info_atgw_ipv4 = -1;
309 static int hf_rrc_ims_info_atgw_ipv6 = -1;
310 static int hf_rrc_cellIdentity_rnc_id = -1;
311 static int hf_rrc_cellIdentity_c_id = -1;
312
313 static const true_false_string rrc_eutra_feat_group_ind_1_val = {
314   "UTRA CELL_PCH to EUTRA RRC_IDLE cell reselection - Supported",
315   "UTRA CELL_PCH to EUTRA RRC_IDLE cell reselection - Not supported"
316 };
317 static const true_false_string rrc_eutra_feat_group_ind_2_val = {
318   "EUTRAN measurements and reporting in connected mode - Supported",
319   "EUTRAN measurements and reporting in connected mode - Not supported"
320 };
321 static const true_false_string rrc_eutra_feat_group_ind_3_val = {
322   "UTRA CELL_FACH absolute priority cell reselection for high priority layers - Supported",
323   "UTRA CELL_FACH absolute priority cell reselection for high priority layers - Not supported"
324 };
325 static const true_false_string rrc_eutra_feat_group_ind_4_val = {
326   "UTRA CELL_FACH absolute priority cell reselection for all layers - Supported",
327   "UTRA CELL_FACH absolute priority cell reselection for all layers - Not supported"
328 };
329 static const value_string rrc_ims_info_atgw_trans_det_cont_type[] = {
330   {0, "ATGW-IPv4-address-and-port"},
331   {1, "ATGW-IPv6-address-and-port"},
332   {2, "ATGW-not-available"},
333   {0, NULL}
334 };
335 static int flowd,type;
336
337 /*Stores how many channels we have detected for a HS-DSCH MAC-flow*/
338 #define    RRC_MAX_NUM_HSDHSCH_MACDFLOW 8
339 static guint8 num_chans_per_flow[RRC_MAX_NUM_HSDHSCH_MACDFLOW];
340
341 /**
342  * Return the maximum counter, useful for initiating counters
343  */
344 #if 0
345 static int get_max_counter(int com_context){
346     int i;
347     guint32 max = 0;
348     rrc_ciphering_info * ciphering_info;
349
350     if( (ciphering_info = g_tree_lookup(rrc_ciph_info_tree, GINT_TO_POINTER((gint)com_context))) == NULL ){
351         return 0;
352     }
353     for(i = 0; i<31; i++){
354         max = MAX(ciphering_info->ps_conf_counters[i][0], max);
355         max = MAX(ciphering_info->ps_conf_counters[i][1], max);
356     }
357     return max;
358 }
359 #endif
360 /** Utility functions used for various comparisons/cleanups in tree **/
361 static gint rrc_key_cmp(gconstpointer b_ptr, gconstpointer a_ptr, gpointer ignore _U_){
362     if( GPOINTER_TO_INT(a_ptr) > GPOINTER_TO_INT(b_ptr) ){
363         return  -1;
364     }
365     return GPOINTER_TO_INT(a_ptr) < GPOINTER_TO_INT(b_ptr);
366 }
367
368 static void rrc_free_key(gpointer key _U_){
369             /*Keys should be de allocated elsewhere.*/
370
371 }
372
373 static void rrc_free_value(gpointer value ){
374             g_free(value);
375 }
376
377 static rrc_ciphering_info*
378 get_or_create_cipher_info(fp_info *fpinf, rlc_info *rlcinf) {
379   rrc_ciphering_info *cipher_info = NULL;
380   guint32 ueid;
381   int i;
382
383   ueid = rlcinf->ueid[fpinf->cur_tb];
384
385   cipher_info = (rrc_ciphering_info *)g_tree_lookup(rrc_ciph_info_tree, GINT_TO_POINTER((gint)ueid));
386   if( cipher_info == NULL ){
387     cipher_info = g_new0(rrc_ciphering_info,1);
388
389     /*Initiate tree with START_PS values.*/
390     if(!cipher_info->start_ps)
391       cipher_info->start_ps = g_tree_new_full(rrc_key_cmp,
392                                         NULL,rrc_free_key,rrc_free_value);
393
394     /*Clear and initialize seq_no matrix*/
395     for(i = 0; i< 31; i++){
396       cipher_info->seq_no[i][0] = -1;
397       cipher_info->seq_no[i][1] = -1;
398     }
399     g_tree_insert(rrc_ciph_info_tree, GINT_TO_POINTER((gint)rlcinf->ueid[fpinf->cur_tb]), cipher_info);
400   }
401   return cipher_info;
402 }
403
404 /* Try to find the NBAP C-RNC Context and, if found, pair it with a given U-RNTI */
405 static void
406 rrc_try_map_urnti_to_crncc(guint32 u_rnti, asn1_ctx_t *actx)
407 {
408   guint32 scrambling_code, crnc_context;
409   /* Getting the user's Uplink Scrambling Code*/
410   scrambling_code = private_data_get_scrambling_code(actx);
411   if (u_rnti != 0 && scrambling_code != 0) {
412     /* Looking for the C-RNC Context mapped to this Scrambling Code */
413     crnc_context = GPOINTER_TO_UINT(wmem_tree_lookup32(nbap_scrambling_code_crncc_map,scrambling_code));
414     if (crnc_context != 0) {
415       /* Mapping the U-RNTI to the C-RNC context*/
416       wmem_tree_insert32(nbap_crncc_urnti_map,crnc_context,GUINT_TO_POINTER(u_rnti));
417     }
418   }
419 }
420
421 #include "packet-rrc-fn.c"
422
423
424 static int
425 dissect_rrc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
426 {
427     /* FIX ME Currently don't know the 'starting point' of this protocol
428      * exported DL-DCCH-Message is the entry point.
429      */
430     proto_item    *rrc_item = NULL;
431     proto_tree    *rrc_tree = NULL;
432     struct rrc_info *rrcinf;
433
434     top_tree = tree;
435     rrcinf = (struct rrc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rrc, 0);
436
437     /* make entry in the Protocol column on summary display */
438     col_set_str(pinfo->cinfo, COL_PROTOCOL, "RRC");
439
440     /*Clear memory*/
441     memset(num_chans_per_flow,0,sizeof(guint8)*RRC_MAX_NUM_HSDHSCH_MACDFLOW);
442
443     /* create the rrc protocol tree */
444     rrc_item = proto_tree_add_item(tree, proto_rrc, tvb, 0, -1, ENC_NA);
445     rrc_tree = proto_item_add_subtree(rrc_item, ett_rrc);
446
447     if (rrcinf) {
448         switch (rrcinf->msgtype[pinfo->fd->subnum]) {
449             case RRC_MESSAGE_TYPE_PCCH:
450                 call_dissector(rrc_pcch_handle, tvb, pinfo, rrc_tree);
451                 break;
452             case RRC_MESSAGE_TYPE_UL_CCCH:
453                 call_dissector(rrc_ul_ccch_handle, tvb, pinfo, rrc_tree);
454                 break;
455             case RRC_MESSAGE_TYPE_DL_CCCH:
456                 call_dissector(rrc_dl_ccch_handle, tvb, pinfo, rrc_tree);
457                 break;
458             case RRC_MESSAGE_TYPE_UL_DCCH:
459                 call_dissector(rrc_ul_dcch_handle, tvb, pinfo, rrc_tree);
460                 break;
461             case RRC_MESSAGE_TYPE_DL_DCCH:
462                 call_dissector(rrc_dl_dcch_handle, tvb, pinfo, rrc_tree);
463                 break;
464             case RRC_MESSAGE_TYPE_BCCH_FACH:
465                 call_dissector(rrc_bcch_fach_handle, tvb, pinfo, rrc_tree);
466                 break;
467             default:
468                 ;
469         }
470     }
471     return tvb_captured_length(tvb);
472 }
473
474 static void
475 rrc_init(void) {
476     /*Initialize structure for muxed flow indication*/
477     hsdsch_muxed_flows = g_tree_new_full(rrc_key_cmp,
478                        NULL,      /* data pointer, optional */
479                        rrc_free_key,
480                        rrc_free_value);
481
482     rrc_ciph_info_tree = g_tree_new_full(rrc_key_cmp,
483                        NULL,      /* data pointer, optional */
484                        NULL,
485                        rrc_free_value);
486
487     /* Global U-RNTI / C-RNTI map to be used in RACH channels */
488     rrc_global_urnti_crnti_map = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
489 }
490
491 static void
492 rrc_cleanup(void) {
493     /*Cleanup*/
494     g_tree_destroy(hsdsch_muxed_flows);
495     g_tree_destroy(rrc_ciph_info_tree);
496 }
497
498 /*--- proto_register_rrc -------------------------------------------*/
499 void proto_register_rrc(void) {
500
501   /* List of fields */
502   static hf_register_info hf[] = {
503
504 #include "packet-rrc-hfarr.c"
505     { &hf_test,
506       { "RAB Test", "rrc.RAB.test",
507         FT_UINT8, BASE_DEC, NULL, 0,
508         "rrc.RAB_Info_r6", HFILL }},
509     { &hf_rrc_eutra_feat_group_ind_1,
510       { "Indicator 1", "rrc.eutra_feat_group_ind_1",
511         FT_BOOLEAN, BASE_NONE, TFS(&rrc_eutra_feat_group_ind_1_val), 0,
512         "EUTRA Feature Group Indicator 1", HFILL }},
513     { &hf_rrc_eutra_feat_group_ind_2,
514       { "Indicator 2", "rrc.eutra_feat_group_ind_2",
515         FT_BOOLEAN, BASE_NONE, TFS(&rrc_eutra_feat_group_ind_2_val), 0,
516         "EUTRA Feature Group Indicator 2", HFILL }},
517     { &hf_rrc_eutra_feat_group_ind_3,
518       { "Indicator 3", "rrc.eutra_feat_group_ind_3",
519         FT_BOOLEAN, BASE_NONE, TFS(&rrc_eutra_feat_group_ind_3_val), 0,
520         "EUTRA Feature Group Indicator 3", HFILL }},
521     { &hf_rrc_eutra_feat_group_ind_4,
522       { "Indicator 4", "rrc.eutra_feat_group_ind_4",
523         FT_BOOLEAN, BASE_NONE, TFS(&rrc_eutra_feat_group_ind_4_val), 0,
524         "EUTRA Feature Group Indicator 4", HFILL }},
525     { &hf_rrc_ims_info_atgw_trans_det_cont_type,
526       { "ATGW transfer details content type", "rrc.rsrvcc_info.ims_info_atgw_trans_det_cont",
527         FT_UINT8, BASE_DEC, VALS(rrc_ims_info_atgw_trans_det_cont_type), 0x3,
528         "rSR-VCC IMS information ATGW transfer details content type", HFILL }},
529     {&hf_rrc_ims_info_atgw_udp_port,
530         {"ATGW UDP port","rrc.rsrvcc_info.ims_info_atgw_udp_port",
531         FT_UINT16,BASE_DEC, NULL, 0x0,
532         "rSR-VCC IMS information ATGW UDP port", HFILL }},
533     { &hf_rrc_ims_info_atgw_ipv4,
534         {"ATGW IPv4", "rrc.rsrvcc_info.ims_info_atgw_ipv4",
535         FT_IPv4, BASE_NONE, NULL, 0x0,
536         "rSR-VCC IMS information ATGW IPv4", HFILL}},
537     { &hf_rrc_ims_info_atgw_ipv6,
538         {"ATGW IPv6", "rrc.rsrvcc_info.ims_info_atgw_ipv6",
539         FT_IPv6, BASE_NONE, NULL, 0x0,
540         "rSR-VCC IMS information ATGW IPv6", HFILL}},
541     { &hf_rrc_cellIdentity_rnc_id,
542         {"RNC Identifier", "rrc.cellIdentity.rnc_id",
543         FT_UINT32, BASE_DEC, NULL, 0,
544         "The RNC Identifier (RNC-Id) part of the Cell Identity", HFILL }},
545     { &hf_rrc_cellIdentity_c_id,
546         {"Cell Identifier", "rrc.cellIdentity.c_id",
547         FT_UINT32, BASE_DEC, NULL, 0,
548         "The Cell Identifier (C-Id) part of the Cell Identity", HFILL }}
549   };
550
551   /* List of subtrees */
552   static gint *ett[] = {
553     &ett_rrc,
554 #include "packet-rrc-ettarr.c"
555     &ett_rrc_eutraFeatureGroupIndicators,
556     &ett_rrc_cn_CommonGSM_MAP_NAS_SysInfo,
557     &ett_rrc_ims_info,
558     &ett_rrc_cellIdentity,
559     &ett_rrc_cipheringAlgorithmCap,
560     &ett_rrc_integrityProtectionAlgorithmCap,
561   };
562
563   static ei_register_info ei[] = {
564      { &ei_rrc_no_hrnti, { "rrc.no_hrnti", PI_SEQUENCE, PI_NOTE, "Did not detect any H-RNTI", EXPFILL }},
565   };
566
567   expert_module_t* expert_rrc;
568
569   /* Register protocol */
570   proto_rrc = proto_register_protocol(PNAME, PSNAME, PFNAME);
571   /* Register fields and subtrees */
572   proto_register_field_array(proto_rrc, hf, array_length(hf));
573   proto_register_subtree_array(ett, array_length(ett));
574   expert_rrc = expert_register_protocol(proto_rrc);
575   expert_register_field_array(expert_rrc, ei, array_length(ei));
576
577   register_dissector("rrc", dissect_rrc, proto_rrc);
578
579 #include "packet-rrc-dis-reg.c"
580
581
582
583
584     register_init_routine(rrc_init);
585     register_cleanup_routine(rrc_cleanup);
586 }
587
588
589 /*--- proto_reg_handoff_rrc ---------------------------------------*/
590 void
591 proto_reg_handoff_rrc(void)
592 {
593   gsm_a_dtap_handle = find_dissector_add_dependency("gsm_a_dtap", proto_rrc);
594   rrc_pcch_handle = find_dissector("rrc.pcch");
595   rrc_ul_ccch_handle = find_dissector("rrc.ul.ccch");
596   rrc_dl_ccch_handle = find_dissector("rrc.dl.ccch");
597   rrc_ul_dcch_handle = find_dissector("rrc.ul.dcch");
598   rrc_dl_dcch_handle = find_dissector("rrc.dl.dcch");
599   rrc_ue_radio_access_cap_info_handle = find_dissector("rrc.ue_radio_access_cap_info");
600   rrc_dl_dcch_handle = find_dissector("rrc.dl.dcch");
601   lte_rrc_ue_eutra_cap_handle = find_dissector_add_dependency("lte-rrc.ue_eutra_cap", proto_rrc);
602   lte_rrc_dl_dcch_handle = find_dissector_add_dependency("lte-rrc.dl.dcch", proto_rrc);
603   rrc_bcch_fach_handle = find_dissector("rrc.bcch.fach");
604   gsm_rlcmac_dl_handle = find_dissector_add_dependency("gsm_rlcmac_dl", proto_rrc);
605 }
606
607