Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / asn1 / nr-rrc / packet-nr-rrc-template.c
blob133d382a43fcdd286cafc090aeef6d0d759d5efb
1 /* packet-nr-rrc-template.c
2 * NR;
3 * Radio Resource Control (RRC) protocol specification
4 * (3GPP TS 38.331 V18.3.0 Release 18) packet dissection
5 * Copyright 2018-2024, Pascal Quantin
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * SPDX-License-Identifier: GPL-2.0-or-later
14 #include "config.h"
16 #include <stdlib.h>
18 #include <epan/packet.h>
19 #include <epan/asn1.h>
20 #include <epan/expert.h>
21 #include <epan/reassemble.h>
22 #include <epan/exceptions.h>
23 #include <epan/show_exception.h>
24 #include <epan/proto_data.h>
25 #include <epan/prefs.h>
26 #include <epan/tfs.h>
27 #include <epan/unit_strings.h>
29 #include <wsutil/array.h>
31 #include <wsutil/str_util.h>
32 #include <wsutil/epochs.h>
34 #include "packet-per.h"
35 #include "packet-gsm_map.h"
36 #include "packet-cell_broadcast.h"
37 #include "packet-mac-nr.h"
38 #include "packet-rlc-nr.h"
39 #include "packet-pdcp-nr.h"
40 #include "packet-rrc.h"
41 #include "packet-lte-rrc.h"
42 #include "packet-nr-rrc.h"
43 #include "packet-gsm_a_common.h"
44 #include "packet-lpp.h"
46 #define PNAME "NR Radio Resource Control (RRC) protocol"
47 #define PSNAME "NR RRC"
48 #define PFNAME "nr-rrc"
50 void proto_register_nr_rrc(void);
51 void proto_reg_handoff_nr_rrc(void);
53 static dissector_handle_t nas_5gs_handle;
54 static dissector_handle_t lte_rrc_conn_reconf_handle;
55 static dissector_handle_t lte_rrc_conn_reconf_compl_handle;
56 static dissector_handle_t lte_rrc_ul_dcch_handle;
57 static dissector_handle_t lte_rrc_dl_dcch_handle;
59 static wmem_map_t *nr_rrc_etws_cmas_dcs_hash;
61 static wmem_map_t *nr_rrc_dcch_segment_ueid_count_hash;
62 static wmem_tree_t *nr_rrc_dcch_segment_id_tree;
64 static reassembly_table nr_rrc_sib7_reassembly_table;
65 static reassembly_table nr_rrc_sib8_reassembly_table;
66 static reassembly_table nr_rrc_dcch_segment_reassembly_table;
68 static bool nr_rrc_nas_in_root_tree;
69 static bool nr_rrc_reassemble_dcch_segments;
71 extern int proto_mac_nr;
72 extern int proto_rlc_nr;
73 extern int proto_pdcp_nr;
75 /* Include constants */
76 #include "packet-nr-rrc-val.h"
78 /* Initialize the protocol and registered fields */
79 static int proto_nr_rrc;
80 #include "packet-nr-rrc-hf.c"
81 static int hf_nr_rrc_serialNumber_gs;
82 static int hf_nr_rrc_serialNumber_msg_code;
83 static int hf_nr_rrc_serialNumber_upd_nb;
84 static int hf_nr_rrc_warningType_value;
85 static int hf_nr_rrc_warningType_emergency_user_alert;
86 static int hf_nr_rrc_warningType_popup;
87 static int hf_nr_rrc_warningMessageSegment_nb_pages;
88 static int hf_nr_rrc_warningMessageSegment_decoded_page;
89 static int hf_nr_rrc_sib7_fragments;
90 static int hf_nr_rrc_sib7_fragment;
91 static int hf_nr_rrc_sib7_fragment_overlap;
92 static int hf_nr_rrc_sib7_fragment_overlap_conflict;
93 static int hf_nr_rrc_sib7_fragment_multiple_tails;
94 static int hf_nr_rrc_sib7_fragment_too_long_fragment;
95 static int hf_nr_rrc_sib7_fragment_error;
96 static int hf_nr_rrc_sib7_fragment_count;
97 static int hf_nr_rrc_sib7_reassembled_in;
98 static int hf_nr_rrc_sib7_reassembled_length;
99 static int hf_nr_rrc_sib7_reassembled_data;
100 static int hf_nr_rrc_sib8_fragments;
101 static int hf_nr_rrc_sib8_fragment;
102 static int hf_nr_rrc_sib8_fragment_overlap;
103 static int hf_nr_rrc_sib8_fragment_overlap_conflict;
104 static int hf_nr_rrc_sib8_fragment_multiple_tails;
105 static int hf_nr_rrc_sib8_fragment_too_long_fragment;
106 static int hf_nr_rrc_sib8_fragment_error;
107 static int hf_nr_rrc_sib8_fragment_count;
108 static int hf_nr_rrc_sib8_reassembled_in;
109 static int hf_nr_rrc_sib8_reassembled_length;
110 static int hf_nr_rrc_sib8_reassembled_data;
111 static int hf_nr_rrc_dcch_segment_fragments;
112 static int hf_nr_rrc_dcch_segment_fragment;
113 static int hf_nr_rrc_dcch_segment_fragment_overlap;
114 static int hf_nr_rrc_dcch_segment_fragment_overlap_conflict;
115 static int hf_nr_rrc_dcch_segment_fragment_multiple_tails;
116 static int hf_nr_rrc_dcch_segment_fragment_too_long_fragment;
117 static int hf_nr_rrc_dcch_segment_fragment_error;
118 static int hf_nr_rrc_dcch_segment_fragment_count;
119 static int hf_nr_rrc_dcch_segment_reassembled_in;
120 static int hf_nr_rrc_dcch_segment_reassembled_length;
121 static int hf_nr_rrc_dcch_segment_reassembled_data;
122 static int hf_nr_rrc_utc_time;
123 static int hf_nr_rrc_local_time;
124 static int hf_nr_rrc_absolute_time;
126 /* Initialize the subtree pointers */
127 static int ett_nr_rrc;
128 #include "packet-nr-rrc-ett.c"
129 static int ett_nr_rrc_DedicatedNAS_Message;
130 static int ett_nr_rrc_targetRAT_MessageContainer;
131 static int ett_nr_rrc_nas_Container;
132 static int ett_nr_rrc_serialNumber;
133 static int ett_nr_rrc_warningType;
134 static int ett_nr_rrc_dataCodingScheme;
135 static int ett_nr_rrc_sib7_fragment;
136 static int ett_nr_rrc_sib7_fragments;
137 static int ett_nr_rrc_sib8_fragment;
138 static int ett_nr_rrc_sib8_fragments;
139 static int ett_nr_rrc_dcch_segment_fragment;
140 static int ett_nr_rrc_dcch_segment_fragments;
141 static int ett_nr_rrc_warningMessageSegment;
142 static int ett_nr_rrc_timeInfo;
143 static int ett_nr_rrc_capabilityRequestFilter;
144 static int ett_nr_rrc_sourceSCG_EUTRA_Config;
145 static int ett_nr_rrc_scg_CellGroupConfigEUTRA;
146 static int ett_nr_rrc_candidateCellInfoListSN_EUTRA;
147 static int ett_nr_rrc_candidateCellInfoListMN_EUTRA;
148 static int ett_nr_rrc_sourceConfigSCG_EUTRA;
149 static int ett_nr_rrc_eutra_SCG;
150 static int ett_nr_rrc_nr_SCG_Response;
151 static int ett_nr_rrc_eutra_SCG_Response;
152 static int ett_nr_rrc_measResultSCG_FailureMRDC;
153 static int ett_nr_rrc_ul_DCCH_MessageNR;
154 static int ett_nr_rrc_ul_DCCH_MessageEUTRA;
155 static int ett_rr_rrc_nas_SecurityParamFromNR;
156 static int ett_nr_rrc_sidelinkUEInformationNR;
157 static int ett_nr_rrc_sidelinkUEInformationEUTRA;
158 static int ett_nr_rrc_ueAssistanceInformationEUTRA;
159 static int ett_nr_rrc_dl_DCCH_MessageNR;
160 static int ett_nr_rrc_dl_DCCH_MessageEUTRA;
161 static int ett_nr_rrc_sl_ConfigDedicatedEUTRA;
162 static int ett_nr_rrc_sl_CapabilityInformationSidelink;
163 static int ett_nr_rrc_measResult_RLF_Report_EUTRA;
164 static int ett_nr_rrc_measResult_RLF_Report_EUTRA_v1690;
165 static int ett_nr_rrc_locationTimestamp_r16;
166 static int ett_nr_rrc_locationCoordinate_r16;
167 static int ett_nr_rrc_locationError_r16;
168 static int ett_nr_rrc_locationSource_r16;
169 static int ett_nr_rrc_velocityEstimate_r16;
170 static int ett_nr_rrc_sensor_MeasurementInformation_r16;
171 static int ett_nr_rrc_sensor_MotionInformation_r16;
172 static int ett_nr_rrc_bandParametersSidelinkEUTRA1_r16;
173 static int ett_nr_rrc_bandParametersSidelinkEUTRA2_r16;
174 static int ett_nr_rrc_sl_ParametersEUTRA1_r16;
175 static int ett_nr_rrc_sl_ParametersEUTRA2_r16;
176 static int ett_nr_rrc_sl_ParametersEUTRA3_r16;
177 static int ett_nr_rrc_absTimeInfo;
178 static int ett_nr_rrc_assistanceDataSIB_Element_r16;
179 static int ett_nr_rrc_sl_V2X_ConfigCommon_r16;
180 static int ett_nr_rrc_tdd_Config_r16;
181 static int ett_nr_rrc_coarseLocationInfo_r17;
182 static int ett_nr_rrc_sl_MeasResultsCandRelay_r17;
183 static int ett_nr_rrc_sl_MeasResultServingRelay_r17;
184 static int ett_nr_rrc_ReferenceLocation_r17;
185 static int ett_nr_rrc_wayPointLocation_r18;
187 static expert_field ei_nr_rrc_number_pages_le15;
189 /* Forward declarations */
190 static int dissect_UECapabilityInformationSidelink_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
191 static int dissect_DL_DCCH_Message_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
192 static int dissect_DL_CCCH_Message_PDU(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_);
193 static int dissect_UL_CCCH_Message_PDU(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_);
194 static int dissect_UERadioAccessCapabilityInformation_PDU(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_);
195 static int dissect_SL_MeasResultListRelay_r17_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
196 static int dissect_SL_MeasResultRelay_r17_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
198 static const unit_name_string units_periodicities = { " periodicity", " periodicities" };
199 static const unit_name_string units_prbs = { " PRB", " PRBs" };
200 static const unit_name_string units_slots = { " slot", " slots" };
202 typedef struct {
203 uint8_t rat_type;
204 uint8_t target_rat_type;
205 uint16_t message_identifier;
206 uint8_t warning_message_segment_type;
207 uint8_t warning_message_segment_number;
208 nr_drb_mac_rlc_mapping_t drb_rlc_mapping;
209 nr_drb_rlc_pdcp_mapping_t drb_pdcp_mapping;
210 lpp_pos_sib_type_t pos_sib_type;
211 pdcp_nr_security_info_t pdcp_security;
212 uint8_t dcch_segment_number;
213 tvbuff_t *dcch_segment;
214 bool dcch_segment_last;
215 } nr_rrc_private_data_t;
217 /* Helper function to get UE identifier from lower layers (in order MAC, RLC, PDCP) */
218 static uint16_t*
219 nr_rrc_get_ueid_from_lower_layers(wmem_allocator_t *scope, struct _packet_info* pinfo)
221 /* Try MAC first */
222 mac_nr_info *p_mac_nr_info = (mac_nr_info *)p_get_proto_data(scope, pinfo, proto_mac_nr, 0);
223 if (p_mac_nr_info != NULL) {
224 return &p_mac_nr_info->ueid;
226 /* Not found, try RLC */
227 rlc_nr_info *p_rlc_nr_info = (rlc_nr_info *)p_get_proto_data(scope, pinfo, proto_rlc_nr, 0);
228 if (p_rlc_nr_info != NULL) {
229 return &p_rlc_nr_info->ueid;
231 /* Not found, try PDCP */
232 pdcp_nr_info *p_pdcp_nr_info = (pdcp_nr_info *)p_get_proto_data(scope, pinfo, proto_pdcp_nr, 0);
233 if (p_pdcp_nr_info != NULL) {
234 return &p_pdcp_nr_info->ueid;
236 /* Nothing found, give up */
237 return NULL;
240 /* Helper function to get or create a struct that will be actx->private_data */
241 static nr_rrc_private_data_t*
242 nr_rrc_get_private_data(asn1_ctx_t *actx)
244 if (actx->private_data == NULL) {
245 actx->private_data = wmem_new0(actx->pinfo->pool, nr_rrc_private_data_t);
247 return (nr_rrc_private_data_t*)actx->private_data;
251 static void
252 nr_rrc_call_dissector(dissector_handle_t handle, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
254 TRY {
255 call_dissector(handle, tvb, pinfo, tree);
257 CATCH_BOUNDS_ERRORS {
258 show_exception(tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
260 ENDTRY;
263 static void
264 nr_rrc_q_RxLevMin_fmt(char *s, uint32_t v)
266 int32_t d = (int32_t)v;
268 snprintf(s, ITEM_LABEL_LENGTH, "%d dB (%d)", 2*d, d);
271 static const value_string nr_rrc_serialNumber_gs_vals[] = {
272 { 0, "Display mode immediate, cell wide"},
273 { 1, "Display mode normal, PLMN wide"},
274 { 2, "Display mode normal, tracking area wide"},
275 { 3, "Display mode normal, cell wide"},
276 { 0, NULL},
279 static const value_string nr_rrc_warningType_vals[] = {
280 { 0, "Earthquake"},
281 { 1, "Tsunami"},
282 { 2, "Earthquake and Tsunami"},
283 { 3, "Test"},
284 { 4, "Other"},
285 { 0, NULL},
288 static const fragment_items nr_rrc_sib7_frag_items = {
289 &ett_nr_rrc_sib7_fragment,
290 &ett_nr_rrc_sib7_fragments,
291 &hf_nr_rrc_sib7_fragments,
292 &hf_nr_rrc_sib7_fragment,
293 &hf_nr_rrc_sib7_fragment_overlap,
294 &hf_nr_rrc_sib7_fragment_overlap_conflict,
295 &hf_nr_rrc_sib7_fragment_multiple_tails,
296 &hf_nr_rrc_sib7_fragment_too_long_fragment,
297 &hf_nr_rrc_sib7_fragment_error,
298 &hf_nr_rrc_sib7_fragment_count,
299 &hf_nr_rrc_sib7_reassembled_in,
300 &hf_nr_rrc_sib7_reassembled_length,
301 &hf_nr_rrc_sib7_reassembled_data,
302 "SIB7 warning message segments"
305 static const fragment_items nr_rrc_sib8_frag_items = {
306 &ett_nr_rrc_sib8_fragment,
307 &ett_nr_rrc_sib8_fragments,
308 &hf_nr_rrc_sib8_fragments,
309 &hf_nr_rrc_sib8_fragment,
310 &hf_nr_rrc_sib8_fragment_overlap,
311 &hf_nr_rrc_sib8_fragment_overlap_conflict,
312 &hf_nr_rrc_sib8_fragment_multiple_tails,
313 &hf_nr_rrc_sib8_fragment_too_long_fragment,
314 &hf_nr_rrc_sib8_fragment_error,
315 &hf_nr_rrc_sib8_fragment_count,
316 &hf_nr_rrc_sib8_reassembled_in,
317 &hf_nr_rrc_sib8_reassembled_length,
318 &hf_nr_rrc_sib8_reassembled_data,
319 "SIB8 warning message segments"
322 static const fragment_items nr_rrc_dcch_segment_frag_items = {
323 &ett_nr_rrc_dcch_segment_fragment,
324 &ett_nr_rrc_dcch_segment_fragments,
325 &hf_nr_rrc_dcch_segment_fragments,
326 &hf_nr_rrc_dcch_segment_fragment,
327 &hf_nr_rrc_dcch_segment_fragment_overlap,
328 &hf_nr_rrc_dcch_segment_fragment_overlap_conflict,
329 &hf_nr_rrc_dcch_segment_fragment_multiple_tails,
330 &hf_nr_rrc_dcch_segment_fragment_too_long_fragment,
331 &hf_nr_rrc_dcch_segment_fragment_error,
332 &hf_nr_rrc_dcch_segment_fragment_count,
333 &hf_nr_rrc_dcch_segment_reassembled_in,
334 &hf_nr_rrc_dcch_segment_reassembled_length,
335 &hf_nr_rrc_dcch_segment_reassembled_data,
336 "DCCH message segments"
339 static void
340 dissect_nr_rrc_warningMessageSegment(tvbuff_t *warning_msg_seg_tvb, proto_tree *tree, packet_info *pinfo, uint8_t dataCodingScheme)
342 uint32_t offset;
343 uint8_t nb_of_pages, length, *str;
344 proto_item *ti;
345 tvbuff_t *cb_data_page_tvb, *cb_data_tvb;
346 int i;
348 nb_of_pages = tvb_get_uint8(warning_msg_seg_tvb, 0);
349 ti = proto_tree_add_uint(tree, hf_nr_rrc_warningMessageSegment_nb_pages, warning_msg_seg_tvb, 0, 1, nb_of_pages);
350 if (nb_of_pages > 15) {
351 expert_add_info_format(pinfo, ti, &ei_nr_rrc_number_pages_le15,
352 "Number of pages should be <=15 (found %u)", nb_of_pages);
353 nb_of_pages = 15;
355 for (i = 0, offset = 1; i < nb_of_pages; i++) {
356 length = tvb_get_uint8(warning_msg_seg_tvb, offset+82);
357 cb_data_page_tvb = tvb_new_subset_length(warning_msg_seg_tvb, offset, length);
358 cb_data_tvb = dissect_cbs_data(dataCodingScheme, cb_data_page_tvb, tree, pinfo, 0);
359 if (cb_data_tvb) {
360 str = tvb_get_string_enc(pinfo->pool, cb_data_tvb, 0, tvb_reported_length(cb_data_tvb), ENC_UTF_8|ENC_NA);
361 proto_tree_add_string_format(tree, hf_nr_rrc_warningMessageSegment_decoded_page, warning_msg_seg_tvb, offset, 83,
362 str, "Decoded Page %u: %s", i+1, str);
364 offset += 83;
368 static const value_string nr_rrc_daylightSavingTime_vals[] = {
369 { 0, "No adjustment for Daylight Saving Time"},
370 { 1, "+1 hour adjustment for Daylight Saving Time"},
371 { 2, "+2 hours adjustment for Daylight Saving Time"},
372 { 3, "Reserved"},
373 { 0, NULL},
376 static void
377 nr_rrc_localTimeOffset_fmt(char *s, uint32_t v)
379 int32_t time_offset = (int32_t) v;
381 snprintf(s, ITEM_LABEL_LENGTH, "UTC time %c %dhr %dmin (%d)",
382 (time_offset < 0) ? '-':'+', abs(time_offset) >> 2,
383 (abs(time_offset) & 0x03) * 15, time_offset);
386 static void
387 nr_rrc_drx_SlotOffset_fmt(char *s, uint32_t v)
389 snprintf(s, ITEM_LABEL_LENGTH, "%g ms (%u)", 1./32 * v, v);
392 static void
393 nr_rrc_Hysteresis_fmt(char *s, uint32_t v)
395 snprintf(s, ITEM_LABEL_LENGTH, "%gdB (%u)", 0.5 * v, v);
398 static void
399 nr_rrc_msg3_DeltaPreamble_fmt(char *s, uint32_t v)
401 int32_t d = (int32_t)v;
403 snprintf(s, ITEM_LABEL_LENGTH, "%ddB (%d)", 2 * d, d);
406 static void
407 nr_rrc_Q_RxLevMin_fmt(char *s, uint32_t v)
409 int32_t d = (int32_t)v;
411 snprintf(s, ITEM_LABEL_LENGTH, "%ddBm (%d)", 2 * d, d);
414 static void
415 nr_rrc_RSRP_RangeEUTRA_fmt(char *s, uint32_t v)
417 if (v == 0) {
418 snprintf(s, ITEM_LABEL_LENGTH, "RSRP < -140dBm (0)");
419 } else if (v < 97) {
420 snprintf(s, ITEM_LABEL_LENGTH, "%ddBm <= RSRP < %ddBm (%u)", v-141, v-140, v);
421 } else {
422 snprintf(s, ITEM_LABEL_LENGTH, "-44dBm <= RSRP (97)");
426 static void
427 nr_rrc_RSRQ_RangeEUTRA_fmt(char *s, uint32_t v)
429 if (v == 0) {
430 snprintf(s, ITEM_LABEL_LENGTH, "RSRQ < -19.5dB (0)");
431 } else if (v < 34) {
432 snprintf(s, ITEM_LABEL_LENGTH, "%.1fdB <= RSRQ < %.1fdB (%u)", ((float)v/2)-20, (((float)v+1)/2)-20, v);
433 } else {
434 snprintf(s, ITEM_LABEL_LENGTH, "-3dB <= RSRQ (34)");
438 static void
439 nr_rrc_SINR_RangeEUTRA_fmt(char *s, uint32_t v)
441 if (v == 0) {
442 snprintf(s, ITEM_LABEL_LENGTH, "SINR < -23dB (0)");
443 } else if (v == 127) {
444 snprintf(s, ITEM_LABEL_LENGTH, "40dB <= SINR (127)");
445 } else {
446 snprintf(s, ITEM_LABEL_LENGTH, "%.1fdB <= SINR < %.1fdB (%u)", (((float)v-1)/2)-23, ((float)v/2)-23, v);
450 static void
451 nr_rrc_ReselectionThreshold_fmt(char *s, uint32_t v)
453 snprintf(s, ITEM_LABEL_LENGTH, "%udB (%u)", 2 * v, v);
456 static void
457 nr_rrc_RSRP_Range_fmt(char *s, uint32_t v)
459 if (v == 0) {
460 snprintf(s, ITEM_LABEL_LENGTH, "SS-RSRP < -156dBm (0)");
461 } else if (v < 126) {
462 snprintf(s, ITEM_LABEL_LENGTH, "%ddBm <= SS-RSRP < %ddBm (%u)", v-157, v-156, v);
463 } else if (v == 126) {
464 snprintf(s, ITEM_LABEL_LENGTH, "-31dBm <= SS-RSRP (126)");
465 } else {
466 snprintf(s, ITEM_LABEL_LENGTH, "infinity (127)");
470 static void
471 nr_rrc_RSRQ_Range_fmt(char *s, uint32_t v)
473 if (v == 0) {
474 snprintf(s, ITEM_LABEL_LENGTH, "SS-RSRQ < -43dB (0)");
475 } else if (v < 127) {
476 snprintf(s, ITEM_LABEL_LENGTH, "%.1fdB <= SS-RSRQ < %.1fdB (%u)", (((float)v-1)/2)-43, ((float)v/2)-43, v);
477 } else {
478 snprintf(s, ITEM_LABEL_LENGTH, "20dB <= SS-RSRQ (127)");
482 static void
483 nr_rrc_SINR_Range_fmt(char *s, uint32_t v)
485 if (v == 0) {
486 snprintf(s, ITEM_LABEL_LENGTH, "SS-SINR < -23dB (0)");
487 } else if (v < 127) {
488 snprintf(s, ITEM_LABEL_LENGTH, "%.1fdB <= SS-SINR < %.1fdB (%u)", (((float)v-1)/2)-23, ((float)v/2)-23, v);
489 } else {
490 snprintf(s, ITEM_LABEL_LENGTH, "40dB <= SS-SINR (127)");
494 static void
495 nr_rrc_dl_1024QAM_TotalWeightedLayers_fmt(char *s, uint32_t v)
497 snprintf(s, ITEM_LABEL_LENGTH, "%u (%u)", 10+(2*v), v);
500 static void
501 nr_rrc_timeConnFailure_r16_fmt(char *s, uint32_t v)
503 snprintf(s, ITEM_LABEL_LENGTH, "%ums (%u)", 100*v, v);
506 static void
507 nr_rrc_RSSI_Range_r16_fmt(char *s, uint32_t v)
509 if (v == 0) {
510 snprintf(s, ITEM_LABEL_LENGTH, "RSSI < -100dBm (0)");
511 } else if (v < 76) {
512 snprintf(s, ITEM_LABEL_LENGTH, "%ddBm <= RSSI < %ddBm (%u)", v-101, v-100, v);
513 } else {
514 snprintf(s, ITEM_LABEL_LENGTH, "-25dBm <= RSSI (76)");
518 static void
519 nr_rrc_RSRQ_RangeEUTRA_r16_fmt(char *s, uint32_t v)
521 int32_t d = (int32_t)v;
523 if (d == -34) {
524 snprintf(s, ITEM_LABEL_LENGTH, "RSRQ < -36dB (-34)");
525 } else if (d < 0) {
526 snprintf(s, ITEM_LABEL_LENGTH, "%.1fdB <= RSRQ < %.1fdB (%d)", (((float)d-1)/2)-19, ((float)d/2)-19, d);
527 } else if (d == 0) {
528 snprintf(s, ITEM_LABEL_LENGTH, "RSRQ < -19.5dB (0)");
529 } else if (d < 34) {
530 snprintf(s, ITEM_LABEL_LENGTH, "%.1fdB <= RSRQ < %.1fdB (%d)", (((float)d-1)/2)-19.5, ((float)d/2)-19.5, d);
531 } else if (d == 34) {
532 snprintf(s, ITEM_LABEL_LENGTH, "-3dB <= RSRQ (34)");
533 } else if (d < 46) {
534 snprintf(s, ITEM_LABEL_LENGTH, "%.1fdB <= RSRQ < %.1fdB (%d)", (((float)d-1)/2)-20, ((float)d/2)-20, d);
535 } else {
536 snprintf(s, ITEM_LABEL_LENGTH, "2.5dB <= RSRQ (46)");
540 static void
541 nr_rrc_utra_FDD_RSCP_r16_fmt(char *s, uint32_t v)
543 int32_t d = (int32_t)v;
545 if (d == -5) {
546 snprintf(s, ITEM_LABEL_LENGTH, "RSCP < -120dBm (-5)");
547 } else if (d < 91) {
548 snprintf(s, ITEM_LABEL_LENGTH, "%ddBm <= RSCP < %ddB (%d)", d-116, d-115, d);
549 } else {
550 snprintf(s, ITEM_LABEL_LENGTH, "-25dBm <= RSCP (91)");
554 static void
555 nr_rrc_utra_FDD_EcN0_r16_fmt(char *s, uint32_t v)
557 if (v == 0) {
558 snprintf(s, ITEM_LABEL_LENGTH, "Ec/No < -24dB (0)");
559 } else if (v < 49) {
560 snprintf(s, ITEM_LABEL_LENGTH, "%.1fdB <= Ec/No < %.1fdB (%u)", (((float)v-1)/2)-24, ((float)v/2)-24, v);
561 } else {
562 snprintf(s, ITEM_LABEL_LENGTH, "0dB <= Ec/No (49)");
566 static void
567 nr_rrc_averageDelay_r16_fmt(char *s, uint32_t v)
569 snprintf(s, ITEM_LABEL_LENGTH, "%.1fms (%u)", (float)v/10, v);
572 static void
573 nr_rrc_measTriggerQuantity_utra_FDD_RSCP_r16_fmt(char *s, uint32_t v)
575 int32_t d = (int32_t)v;
577 snprintf(s, ITEM_LABEL_LENGTH, "%ddBm (%d)", d-115, d);
580 static void
581 nr_rrc_measTriggerQuantity_utra_FDD_EcN0_r16_fmt(char *s, uint32_t v)
583 snprintf(s, ITEM_LABEL_LENGTH, "%.1fdB (%u)", (float)v/2-24.5, v);
586 static void
587 nr_rrc_SRS_RSRP_r16_fmt(char *s, uint32_t v)
589 if (v == 0) {
590 snprintf(s, ITEM_LABEL_LENGTH, "SRS-RSRP < -140dBm (0)");
591 } else if (v < 97) {
592 snprintf(s, ITEM_LABEL_LENGTH, "%ddBm <= SRS-RSRP < %ddB (%u)", v-141, v-140, v);
593 } else if (v == 97) {
594 snprintf(s, ITEM_LABEL_LENGTH, "-44dBm <= SRS-RSRP (97)");
595 } else {
596 snprintf(s, ITEM_LABEL_LENGTH, "Infinity (98)");
600 static void
601 nr_rrc_MeasTriggerQuantityOffset_fmt(char *s, uint32_t v)
603 int32_t d = (int32_t)v;
605 snprintf(s, ITEM_LABEL_LENGTH, "%.1fdB (%d)", (float)d/2, d);
608 static void
609 nr_rrc_TimeSinceCHO_Reconfig_r17_fmt(char *s, uint32_t v)
611 snprintf(s, ITEM_LABEL_LENGTH, "%.1fs (%u)", (float)v/10, v);
614 static void
615 nr_rrc_FlightPathUpdateDistanceThr_r18_fmt(char *s, uint32_t v)
617 snprintf(s, ITEM_LABEL_LENGTH, "%um (%u)", v*5, v);
620 static int
621 dissect_nr_rrc_cg_configinfo_msg(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_)
623 proto_item* ti;
624 proto_tree* sub_tree;
626 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NR RRC");
627 col_set_str(pinfo->cinfo, COL_INFO, "CG-ConfigInfo");
629 ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
630 sub_tree = proto_item_add_subtree(ti, ett_nr_rrc);
631 return dissect_nr_rrc_CG_ConfigInfo_PDU(tvb, pinfo, sub_tree, NULL);
634 static int
635 dissect_nr_rrc_radiobearerconfig_msg(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_)
637 proto_item* ti;
638 proto_tree* sub_tree;
640 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NR RRC");
641 col_set_str(pinfo->cinfo, COL_INFO, "RadioBearerConfig");
643 ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
644 sub_tree = proto_item_add_subtree(ti, ett_nr_rrc);
645 return dissect_nr_rrc_RadioBearerConfig_PDU(tvb, pinfo, sub_tree, NULL);
648 static int
649 dissect_nr_rrc_ue_mrdc_capability_msg(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_)
651 proto_item* ti;
652 proto_tree* sub_tree;
654 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NR RRC");
655 col_set_str(pinfo->cinfo, COL_INFO, "UE-MRDC-Capability");
657 ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
658 sub_tree = proto_item_add_subtree(ti, ett_nr_rrc);
659 return dissect_nr_rrc_UE_MRDC_Capability_PDU(tvb, pinfo, sub_tree, NULL);
662 static int
663 dissect_nr_rrc_ue_nr_capability_msg(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_)
665 proto_item* ti;
666 proto_tree* sub_tree;
668 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NR RRC");
669 col_set_str(pinfo->cinfo, COL_INFO, "UE-NR-Capability");
671 ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
672 sub_tree = proto_item_add_subtree(ti, ett_nr_rrc);
673 return dissect_nr_rrc_UE_NR_Capability_PDU(tvb, pinfo, sub_tree, NULL);
676 static int
677 dissect_nr_rrc_ul_dcch_message_msg(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_)
679 proto_item* ti;
680 proto_tree* sub_tree;
682 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NR RRC");
683 col_set_str(pinfo->cinfo, COL_INFO, "UL-DCCH-Message");
685 ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
686 sub_tree = proto_item_add_subtree(ti, ett_nr_rrc);
687 return dissect_nr_rrc_UL_DCCH_Message_PDU(tvb, pinfo, sub_tree, NULL);
690 static int
691 dissect_nr_rrc_dl_dcch_message_msg(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_)
693 proto_item* ti;
694 proto_tree* sub_tree;
696 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NR RRC");
697 col_set_str(pinfo->cinfo, COL_INFO, "DL-DCCH-Message");
699 ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
700 sub_tree = proto_item_add_subtree(ti, ett_nr_rrc);
701 return dissect_DL_DCCH_Message_PDU(tvb, pinfo, sub_tree, NULL);
704 static int
705 dissect_nr_rrc_dl_ccch_message_msg(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_)
707 proto_item* ti;
708 proto_tree* sub_tree;
710 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NR RRC");
711 col_set_str(pinfo->cinfo, COL_INFO, "DL-CCCH-Message");
713 ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
714 sub_tree = proto_item_add_subtree(ti, ett_nr_rrc);
715 return dissect_DL_CCCH_Message_PDU(tvb, pinfo, sub_tree, NULL);
718 static int
719 dissect_nr_rrc_ul_ccch_message_msg(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_)
721 proto_item* ti;
722 proto_tree* sub_tree;
724 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NR RRC");
725 col_set_str(pinfo->cinfo, COL_INFO, "UL-CCCH-Message");
727 ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
728 sub_tree = proto_item_add_subtree(ti, ett_nr_rrc);
729 return dissect_UL_CCCH_Message_PDU(tvb, pinfo, sub_tree, NULL);
733 static int
734 dissect_nr_rrc_cellgroupconfig_msg(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_)
736 proto_item* ti;
737 proto_tree* sub_tree;
739 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NR RRC");
740 col_set_str(pinfo->cinfo, COL_INFO, "CellGroupConfig");
742 ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
743 sub_tree = proto_item_add_subtree(ti, ett_nr_rrc);
744 return dissect_nr_rrc_CellGroupConfig_PDU(tvb, pinfo, sub_tree, NULL);
747 static int
748 dissect_ueradioaccesscapabilityinformation_msg(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_)
750 proto_item* ti;
751 proto_tree* sub_tree;
753 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NR RRC");
754 col_set_str(pinfo->cinfo, COL_INFO, "UERadioAccessCapabilityInformation");
756 ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
757 sub_tree = proto_item_add_subtree(ti, ett_nr_rrc);
758 return dissect_UERadioAccessCapabilityInformation_PDU(tvb, pinfo, sub_tree, NULL);
761 static int
762 dissect_nr_rrc_measconfig_msg(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_)
764 proto_item* ti;
765 proto_tree* sub_tree;
767 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NR RRC");
768 col_set_str(pinfo->cinfo, COL_INFO, "MeasConfig");
770 ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
771 sub_tree = proto_item_add_subtree(ti, ett_nr_rrc);
772 return dissect_nr_rrc_MeasConfig_PDU(tvb, pinfo, sub_tree, NULL);
775 static int
776 dissect_nr_rrc_measgapconfig_msg(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_)
778 proto_item* ti;
779 proto_tree* sub_tree;
781 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NR RRC");
782 col_set_str(pinfo->cinfo, COL_INFO, "MeasGapConfig");
784 ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
785 sub_tree = proto_item_add_subtree(ti, ett_nr_rrc);
786 return dissect_nr_rrc_MeasGapConfig_PDU(tvb, pinfo, sub_tree, NULL);
789 static int
790 dissect_nr_rrc_handoverpreparationinformation_msg(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_)
792 proto_item* ti;
793 proto_tree* sub_tree;
795 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NR RRC");
796 col_set_str(pinfo->cinfo, COL_INFO, "HandoverPreparationInformation");
798 ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
799 sub_tree = proto_item_add_subtree(ti, ett_nr_rrc);
800 return dissect_nr_rrc_HandoverPreparationInformation_PDU(tvb, pinfo, sub_tree, NULL);
805 static int
806 dissect_nr_rrc_rrcreconfiguration_msg(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_)
808 proto_item* ti;
809 proto_tree* sub_tree;
811 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NR RRC");
812 col_set_str(pinfo->cinfo, COL_INFO, "RRCReconfiguration");
814 ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
815 sub_tree = proto_item_add_subtree(ti, ett_nr_rrc);
816 return dissect_nr_rrc_RRCReconfiguration_PDU(tvb, pinfo, sub_tree, NULL);
820 static int
821 dissect_nr_rrc_rrcreconfigurationcomplete_msg(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_)
823 proto_item* ti;
824 proto_tree* sub_tree;
826 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NR RRC");
827 col_set_str(pinfo->cinfo, COL_INFO, "RRCReconfigurationComplete");
829 ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
830 sub_tree = proto_item_add_subtree(ti, ett_nr_rrc);
831 return dissect_nr_rrc_RRCReconfigurationComplete_PDU(tvb, pinfo, sub_tree, NULL);
835 static int
836 dissect_nr_rrc_ue_capabilityrat_containerlist_msg(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_)
838 proto_item* ti;
839 proto_tree* sub_tree;
841 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NR RRC");
842 col_set_str(pinfo->cinfo, COL_INFO, "UE-CapabilityRAT-ContainerList");
844 ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
845 sub_tree = proto_item_add_subtree(ti, ett_nr_rrc);
846 return dissect_nr_rrc_UE_CapabilityRAT_ContainerList_PDU(tvb, pinfo, sub_tree, NULL);
849 static int
850 dissect_nr_rrc_handovercommand_msg(tvbuff_t* tvb _U_, packet_info* pinfo _U_, proto_tree* tree _U_, void* data _U_)
852 proto_item* ti;
853 proto_tree* sub_tree;
855 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NR RRC");
856 col_set_str(pinfo->cinfo, COL_INFO, "HandoverCommand");
858 ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
859 sub_tree = proto_item_add_subtree(ti, ett_nr_rrc);
860 return dissect_nr_rrc_HandoverCommand_PDU(tvb, pinfo, sub_tree, NULL);
864 #include "packet-nr-rrc-fn.c"
867 dissect_nr_rrc_nr_RLF_Report_r16_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
868 proto_item *prot_ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
869 proto_item_set_hidden(prot_ti);
870 int offset = 0;
871 asn1_ctx_t asn1_ctx;
872 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, false, pinfo);
873 offset = dissect_nr_rrc_T_nr_RLF_Report_r16(tvb, offset, &asn1_ctx, tree, hf_nr_rrc_BCCH_DL_SCH_Message_PDU);
874 offset += 7; offset >>= 3;
875 return offset;
879 dissect_nr_rrc_subCarrierSpacingCommon_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
880 proto_item *prot_ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
881 proto_item_set_hidden(prot_ti);
882 int offset = 0;
883 asn1_ctx_t asn1_ctx;
884 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, false, pinfo);
885 offset = dissect_nr_rrc_T_subCarrierSpacingCommon(tvb, offset, &asn1_ctx, tree, hf_nr_rrc_BCCH_DL_SCH_Message_PDU);
886 offset += 7; offset >>= 3;
887 return offset;
891 dissect_nr_rrc_rach_ConfigCommonIAB_r16_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
892 proto_item *prot_ti = proto_tree_add_item(tree, proto_nr_rrc, tvb, 0, -1, ENC_NA);
893 proto_item_set_hidden(prot_ti);
894 int offset = 0;
895 asn1_ctx_t asn1_ctx;
896 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, false, pinfo);
897 offset = dissect_nr_rrc_T_rach_ConfigCommonIAB_r16(tvb, offset, &asn1_ctx, tree, hf_nr_rrc_BCCH_DL_SCH_Message_PDU);
898 offset += 7; offset >>= 3;
899 return offset;
902 void
903 proto_register_nr_rrc(void) {
905 /* List of fields */
906 static hf_register_info hf[] = {
908 #include "packet-nr-rrc-hfarr.c"
910 { &hf_nr_rrc_serialNumber_gs,
911 { "Geographical Scope", "nr-rrc.serialNumber.gs",
912 FT_UINT16, BASE_DEC, VALS(nr_rrc_serialNumber_gs_vals), 0xc000,
913 NULL, HFILL }},
914 { &hf_nr_rrc_serialNumber_msg_code,
915 { "Message Code", "nr-rrc.serialNumber.msg_code",
916 FT_UINT16, BASE_DEC, NULL, 0x3ff0,
917 NULL, HFILL }},
918 { &hf_nr_rrc_serialNumber_upd_nb,
919 { "Update Number", "nr-rrc.serialNumber.upd_nb",
920 FT_UINT16, BASE_DEC, NULL, 0x000f,
921 NULL, HFILL }},
922 { &hf_nr_rrc_warningType_value,
923 { "Warning Type Value", "nr-rrc.warningType.value",
924 FT_UINT16, BASE_DEC, VALS(nr_rrc_warningType_vals), 0xfe00,
925 NULL, HFILL }},
926 { &hf_nr_rrc_warningType_emergency_user_alert,
927 { "Emergency User Alert", "nr-rrc.warningType.emergency_user_alert",
928 FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0100,
929 NULL, HFILL }},
930 { &hf_nr_rrc_warningType_popup,
931 { "Popup", "nr-rrc.warningType.popup",
932 FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0080,
933 NULL, HFILL }},
934 { &hf_nr_rrc_warningMessageSegment_nb_pages,
935 { "Number of Pages", "nr-rrc.warningMessageSegment.nb_pages",
936 FT_UINT8, BASE_DEC, NULL, 0,
937 NULL, HFILL }},
938 { &hf_nr_rrc_warningMessageSegment_decoded_page,
939 { "Decoded Page", "nr-rrc.warningMessageSegment.decoded_page",
940 FT_STRING, BASE_NONE, NULL, 0,
941 NULL, HFILL }},
942 { &hf_nr_rrc_sib7_fragments,
943 { "Fragments", "nr-rrc.warningMessageSegment.fragments",
944 FT_NONE, BASE_NONE, NULL, 0,
945 NULL, HFILL }},
946 { &hf_nr_rrc_sib7_fragment,
947 { "Fragment", "nr-rrc.warningMessageSegment.fragment",
948 FT_FRAMENUM, BASE_NONE, NULL, 0,
949 NULL, HFILL }},
950 { &hf_nr_rrc_sib7_fragment_overlap,
951 { "Fragment Overlap", "nr-rrc.warningMessageSegment.fragment_overlap",
952 FT_BOOLEAN, BASE_NONE, NULL, 0,
953 NULL, HFILL }},
954 { &hf_nr_rrc_sib7_fragment_overlap_conflict,
955 { "Fragment Overlap Conflict", "nr-rrc.warningMessageSegment.fragment_overlap_conflict",
956 FT_BOOLEAN, BASE_NONE, NULL, 0,
957 NULL, HFILL }},
958 { &hf_nr_rrc_sib7_fragment_multiple_tails,
959 { "Fragment Multiple Tails", "nr-rrc.warningMessageSegment.fragment_multiple_tails",
960 FT_BOOLEAN, BASE_NONE, NULL, 0,
961 NULL, HFILL }},
962 { &hf_nr_rrc_sib7_fragment_too_long_fragment,
963 { "Too Long Fragment", "nr-rrc.warningMessageSegment.fragment_too_long_fragment",
964 FT_BOOLEAN, BASE_NONE, NULL, 0,
965 NULL, HFILL }},
966 { &hf_nr_rrc_sib7_fragment_error,
967 { "Fragment Error", "nr-rrc.warningMessageSegment.fragment_error",
968 FT_FRAMENUM, BASE_NONE, NULL, 0,
969 NULL, HFILL }},
970 { &hf_nr_rrc_sib7_fragment_count,
971 { "Fragment Count", "nr-rrc.warningMessageSegment.fragment_count",
972 FT_UINT32, BASE_DEC, NULL, 0,
973 NULL, HFILL }},
974 { &hf_nr_rrc_sib7_reassembled_in,
975 { "Reassembled In", "nr-rrc.warningMessageSegment.reassembled_in",
976 FT_FRAMENUM, BASE_NONE, NULL, 0,
977 NULL, HFILL }},
978 { &hf_nr_rrc_sib7_reassembled_length,
979 { "Reassembled Length", "nr-rrc.warningMessageSegment.reassembled_length",
980 FT_UINT32, BASE_DEC, NULL, 0,
981 NULL, HFILL }},
982 { &hf_nr_rrc_sib7_reassembled_data,
983 { "Reassembled Data", "nr-rrc.warningMessageSegment.reassembled_data",
984 FT_BYTES, BASE_NONE, NULL, 0,
985 NULL, HFILL }},
986 { &hf_nr_rrc_sib8_fragments,
987 { "Fragments", "nr-rrc.warningMessageSegment.fragments",
988 FT_NONE, BASE_NONE, NULL, 0,
989 NULL, HFILL }},
990 { &hf_nr_rrc_sib8_fragment,
991 { "Fragment", "nr-rrc.warningMessageSegment.fragment",
992 FT_FRAMENUM, BASE_NONE, NULL, 0,
993 NULL, HFILL }},
994 { &hf_nr_rrc_sib8_fragment_overlap,
995 { "Fragment Overlap", "nr-rrc.warningMessageSegment.fragment_overlap",
996 FT_BOOLEAN, BASE_NONE, NULL, 0,
997 NULL, HFILL }},
998 { &hf_nr_rrc_sib8_fragment_overlap_conflict,
999 { "Fragment Overlap Conflict", "nr-rrc.warningMessageSegment.fragment_overlap_conflict",
1000 FT_BOOLEAN, BASE_NONE, NULL, 0,
1001 NULL, HFILL }},
1002 { &hf_nr_rrc_sib8_fragment_multiple_tails,
1003 { "Fragment Multiple Tails", "nr-rrc.warningMessageSegment.fragment_multiple_tails",
1004 FT_BOOLEAN, BASE_NONE, NULL, 0,
1005 NULL, HFILL }},
1006 { &hf_nr_rrc_sib8_fragment_too_long_fragment,
1007 { "Too Long Fragment", "nr-rrc.warningMessageSegment.fragment_too_long_fragment",
1008 FT_BOOLEAN, BASE_NONE, NULL, 0,
1009 NULL, HFILL }},
1010 { &hf_nr_rrc_sib8_fragment_error,
1011 { "Fragment Error", "nr-rrc.warningMessageSegment.fragment_error",
1012 FT_FRAMENUM, BASE_NONE, NULL, 0,
1013 NULL, HFILL }},
1014 { &hf_nr_rrc_sib8_fragment_count,
1015 { "Fragment Count", "nr-rrc.warningMessageSegment.fragment_count",
1016 FT_UINT32, BASE_DEC, NULL, 0,
1017 NULL, HFILL }},
1018 { &hf_nr_rrc_sib8_reassembled_in,
1019 { "Reassembled In", "nr-rrc.warningMessageSegment.reassembled_in",
1020 FT_FRAMENUM, BASE_NONE, NULL, 0,
1021 NULL, HFILL }},
1022 { &hf_nr_rrc_sib8_reassembled_length,
1023 { "Reassembled Length", "nr-rrc.warningMessageSegment.reassembled_length",
1024 FT_UINT32, BASE_DEC, NULL, 0,
1025 NULL, HFILL }},
1026 { &hf_nr_rrc_sib8_reassembled_data,
1027 { "Reassembled Data", "nr-rrc.warningMessageSegment.reassembled_data",
1028 FT_BYTES, BASE_NONE, NULL, 0,
1029 NULL, HFILL }},
1030 { &hf_nr_rrc_dcch_segment_fragments,
1031 { "Fragments", "nr-rrc.dedicatedMessageSegment_r16.fragments",
1032 FT_NONE, BASE_NONE, NULL, 0,
1033 NULL, HFILL }},
1034 { &hf_nr_rrc_dcch_segment_fragment,
1035 { "Fragment", "nr-rrc.dedicatedMessageSegment_r16.fragment",
1036 FT_FRAMENUM, BASE_NONE, NULL, 0,
1037 NULL, HFILL }},
1038 { &hf_nr_rrc_dcch_segment_fragment_overlap,
1039 { "Fragment Overlap", "nr-rrc.dedicatedMessageSegment_r16.fragment_overlap",
1040 FT_BOOLEAN, BASE_NONE, NULL, 0,
1041 NULL, HFILL }},
1042 { &hf_nr_rrc_dcch_segment_fragment_overlap_conflict,
1043 { "Fragment Overlap Conflict", "nr-rrc.dedicatedMessageSegment_r16.fragment_overlap_conflict",
1044 FT_BOOLEAN, BASE_NONE, NULL, 0,
1045 NULL, HFILL }},
1046 { &hf_nr_rrc_dcch_segment_fragment_multiple_tails,
1047 { "Fragment Multiple Tails", "nr-rrc.dedicatedMessageSegment_r16.fragment_multiple_tails",
1048 FT_BOOLEAN, BASE_NONE, NULL, 0,
1049 NULL, HFILL }},
1050 { &hf_nr_rrc_dcch_segment_fragment_too_long_fragment,
1051 { "Too Long Fragment", "nr-rrc.dedicatedMessageSegment_r16.fragment_too_long_fragment",
1052 FT_BOOLEAN, BASE_NONE, NULL, 0,
1053 NULL, HFILL }},
1054 { &hf_nr_rrc_dcch_segment_fragment_error,
1055 { "Fragment Error", "nr-rrc.dedicatedMessageSegment_r16.fragment_error",
1056 FT_FRAMENUM, BASE_NONE, NULL, 0,
1057 NULL, HFILL }},
1058 { &hf_nr_rrc_dcch_segment_fragment_count,
1059 { "Fragment Count", "nr-rrc.dedicatedMessageSegment_r16.fragment_count",
1060 FT_UINT32, BASE_DEC, NULL, 0,
1061 NULL, HFILL }},
1062 { &hf_nr_rrc_dcch_segment_reassembled_in,
1063 { "Reassembled In", "nr-rrc.dedicatedMessageSegment_r16.reassembled_in",
1064 FT_FRAMENUM, BASE_NONE, NULL, 0,
1065 NULL, HFILL }},
1066 { &hf_nr_rrc_dcch_segment_reassembled_length,
1067 { "Reassembled Length", "nr-rrc.dedicatedMessageSegment_r16.reassembled_length",
1068 FT_UINT32, BASE_DEC, NULL, 0,
1069 NULL, HFILL }},
1070 { &hf_nr_rrc_dcch_segment_reassembled_data,
1071 { "Reassembled Data", "nr-rrc.dedicatedMessageSegment_r16.reassembled_data",
1072 FT_BYTES, BASE_NONE, NULL, 0,
1073 NULL, HFILL }},
1074 { &hf_nr_rrc_utc_time,
1075 { "UTC time", "nr-rrc.utc_time",
1076 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0,
1077 NULL, HFILL }},
1078 { &hf_nr_rrc_local_time,
1079 { "Local time", "nr-rrc.local_time",
1080 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
1081 NULL, HFILL }},
1082 { &hf_nr_rrc_absolute_time,
1083 { "Absolute time", "nr-rrc.absolute_time",
1084 FT_STRING, BASE_NONE, NULL, 0x0,
1085 NULL, HFILL }},
1088 static int *ett[] = {
1089 &ett_nr_rrc,
1090 #include "packet-nr-rrc-ettarr.c"
1091 &ett_nr_rrc_DedicatedNAS_Message,
1092 &ett_nr_rrc_targetRAT_MessageContainer,
1093 &ett_nr_rrc_nas_Container,
1094 &ett_nr_rrc_serialNumber,
1095 &ett_nr_rrc_warningType,
1096 &ett_nr_rrc_dataCodingScheme,
1097 &ett_nr_rrc_sib7_fragment,
1098 &ett_nr_rrc_sib7_fragments,
1099 &ett_nr_rrc_sib8_fragment,
1100 &ett_nr_rrc_sib8_fragments,
1101 &ett_nr_rrc_dcch_segment_fragment,
1102 &ett_nr_rrc_dcch_segment_fragments,
1103 &ett_nr_rrc_warningMessageSegment,
1104 &ett_nr_rrc_timeInfo,
1105 &ett_nr_rrc_capabilityRequestFilter,
1106 &ett_nr_rrc_sourceSCG_EUTRA_Config,
1107 &ett_nr_rrc_scg_CellGroupConfigEUTRA,
1108 &ett_nr_rrc_candidateCellInfoListSN_EUTRA,
1109 &ett_nr_rrc_candidateCellInfoListMN_EUTRA,
1110 &ett_nr_rrc_sourceConfigSCG_EUTRA,
1111 &ett_nr_rrc_eutra_SCG,
1112 &ett_nr_rrc_nr_SCG_Response,
1113 &ett_nr_rrc_eutra_SCG_Response,
1114 &ett_nr_rrc_measResultSCG_FailureMRDC,
1115 &ett_nr_rrc_ul_DCCH_MessageNR,
1116 &ett_nr_rrc_ul_DCCH_MessageEUTRA,
1117 &ett_rr_rrc_nas_SecurityParamFromNR,
1118 &ett_nr_rrc_sidelinkUEInformationNR,
1119 &ett_nr_rrc_sidelinkUEInformationEUTRA,
1120 &ett_nr_rrc_ueAssistanceInformationEUTRA,
1121 &ett_nr_rrc_dl_DCCH_MessageNR,
1122 &ett_nr_rrc_dl_DCCH_MessageEUTRA,
1123 &ett_nr_rrc_sl_ConfigDedicatedEUTRA,
1124 &ett_nr_rrc_sl_CapabilityInformationSidelink,
1125 &ett_nr_rrc_measResult_RLF_Report_EUTRA,
1126 &ett_nr_rrc_measResult_RLF_Report_EUTRA_v1690,
1127 &ett_nr_rrc_locationTimestamp_r16,
1128 &ett_nr_rrc_locationCoordinate_r16,
1129 &ett_nr_rrc_locationError_r16,
1130 &ett_nr_rrc_locationSource_r16,
1131 &ett_nr_rrc_velocityEstimate_r16,
1132 &ett_nr_rrc_sensor_MeasurementInformation_r16,
1133 &ett_nr_rrc_sensor_MotionInformation_r16,
1134 &ett_nr_rrc_bandParametersSidelinkEUTRA1_r16,
1135 &ett_nr_rrc_bandParametersSidelinkEUTRA2_r16,
1136 &ett_nr_rrc_sl_ParametersEUTRA1_r16,
1137 &ett_nr_rrc_sl_ParametersEUTRA2_r16,
1138 &ett_nr_rrc_sl_ParametersEUTRA3_r16,
1139 &ett_nr_rrc_absTimeInfo,
1140 &ett_nr_rrc_assistanceDataSIB_Element_r16,
1141 &ett_nr_rrc_sl_V2X_ConfigCommon_r16,
1142 &ett_nr_rrc_tdd_Config_r16,
1143 &ett_nr_rrc_coarseLocationInfo_r17,
1144 &ett_nr_rrc_sl_MeasResultsCandRelay_r17,
1145 &ett_nr_rrc_sl_MeasResultServingRelay_r17,
1146 &ett_nr_rrc_ReferenceLocation_r17,
1147 &ett_nr_rrc_wayPointLocation_r18
1150 static ei_register_info ei[] = {
1151 { &ei_nr_rrc_number_pages_le15, { "nr-rrc.number_pages_le15", PI_MALFORMED, PI_ERROR, "Number of pages should be <=15", EXPFILL }},
1154 expert_module_t* expert_nr_rrc;
1155 module_t *nr_rrc_module;
1157 /* Register protocol */
1158 proto_nr_rrc = proto_register_protocol(PNAME, PSNAME, PFNAME);
1160 /* Register fields and subtrees */
1161 proto_register_field_array(proto_nr_rrc, hf, array_length(hf));
1162 proto_register_subtree_array(ett, array_length(ett));
1163 expert_nr_rrc = expert_register_protocol(proto_nr_rrc);
1164 expert_register_field_array(expert_nr_rrc, ei, array_length(ei));
1166 /* Register the dissectors defined in nr-rrc.cnf */
1167 register_dissector("nr-rrc.cg_configinfo", dissect_nr_rrc_cg_configinfo_msg, proto_nr_rrc);
1168 register_dissector("nr-rrc.radiobearerconfig", dissect_nr_rrc_radiobearerconfig_msg, proto_nr_rrc);
1169 register_dissector("nr-rrc.rrc_reconf_msg", dissect_nr_rrc_rrcreconfiguration_msg, proto_nr_rrc);
1170 register_dissector("nr-rrc.rrc_reconf_compl_msg", dissect_nr_rrc_rrcreconfigurationcomplete_msg, proto_nr_rrc);
1171 register_dissector("nr-rrc.ue_capabilityrat_containerlist", dissect_nr_rrc_ue_capabilityrat_containerlist_msg, proto_nr_rrc);
1172 register_dissector("nr-rrc.ue_mrdc_cap_msg", dissect_nr_rrc_ue_mrdc_capability_msg, proto_nr_rrc);
1173 register_dissector("nr-rrc.ue_nr_cap_msg", dissect_nr_rrc_ue_nr_capability_msg, proto_nr_rrc);
1174 register_dissector("nr-rrc.ul.dcch_msg_msg", dissect_nr_rrc_ul_dcch_message_msg, proto_nr_rrc);
1175 register_dissector("nr-rrc.dl.dcch_msg_msg", dissect_nr_rrc_dl_dcch_message_msg, proto_nr_rrc);
1176 register_dissector("nr-rrc.ul.ccch_msg_msg", dissect_nr_rrc_ul_ccch_message_msg, proto_nr_rrc);
1177 register_dissector("nr-rrc.dl.ccch_msg_msg", dissect_nr_rrc_dl_ccch_message_msg, proto_nr_rrc);
1178 register_dissector("nr-rrc.cellgroupconfig_msg", dissect_nr_rrc_cellgroupconfig_msg, proto_nr_rrc);
1179 register_dissector("nr-rrc.ue_radio_access_cap_info_msg", dissect_ueradioaccesscapabilityinformation_msg, proto_nr_rrc);
1180 register_dissector("nr-rrc.measconfig_msg", dissect_nr_rrc_measconfig_msg, proto_nr_rrc);
1181 register_dissector("nr-rrc.measgapconfig_msg", dissect_nr_rrc_measgapconfig_msg, proto_nr_rrc);
1182 register_dissector("nr-rrc.handoverpreparationinformation_msg", dissect_nr_rrc_handoverpreparationinformation_msg, proto_nr_rrc);
1183 register_dissector("nr-rrc.handovercommand_msg", dissect_nr_rrc_handovercommand_msg, proto_nr_rrc);
1184 /*#include "packet-nr-rrc-dis-reg.c" */
1185 #include "packet-nr-rrc-dis-reg.c"
1187 nr_rrc_etws_cmas_dcs_hash = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(),
1188 g_direct_hash, g_direct_equal);
1189 nr_rrc_dcch_segment_ueid_count_hash = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(),
1190 g_direct_hash, g_direct_equal);
1191 nr_rrc_dcch_segment_id_tree = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
1193 reassembly_table_register(&nr_rrc_sib7_reassembly_table,
1194 &addresses_reassembly_table_functions);
1195 reassembly_table_register(&nr_rrc_sib8_reassembly_table,
1196 &addresses_reassembly_table_functions);
1197 reassembly_table_register(&nr_rrc_dcch_segment_reassembly_table,
1198 &addresses_reassembly_table_functions);
1200 /* Register configuration preferences */
1201 nr_rrc_module = prefs_register_protocol(proto_nr_rrc, NULL);
1202 prefs_register_bool_preference(nr_rrc_module, "nas_in_root_tree",
1203 "Show NAS PDU in root packet details",
1204 "Whether the NAS PDU should be shown in the root packet details tree",
1205 &nr_rrc_nas_in_root_tree);
1206 prefs_register_bool_preference(nr_rrc_module, "reassemble_dcch_segments",
1207 "Try to reassemble DCCH segmented messages",
1208 "Whether the NR RRC dissector should attempt to reassemble DCCH segmented messages",
1209 &nr_rrc_reassemble_dcch_segments);
1212 void
1213 proto_reg_handoff_nr_rrc(void)
1215 nas_5gs_handle = find_dissector("nas-5gs");
1216 lte_rrc_conn_reconf_handle = find_dissector("lte-rrc.rrc_conn_reconf");
1217 lte_rrc_conn_reconf_compl_handle = find_dissector("lte-rrc.rrc_conn_reconf_compl");
1218 lte_rrc_ul_dcch_handle = find_dissector("lte-rrc.ul.dcch");
1219 lte_rrc_dl_dcch_handle = find_dissector("lte-rrc.dl.dcch");