epan/dissectors/pidl/ C99 drsuapi
[wireshark-sm.git] / epan / dissectors / asn1 / ngap / packet-ngap-template.c
blob97e3e66449b08ce5e75a39f4fc7aca6b006c2a72
1 /* packet-ngap.c
2 * Routines for NG-RAN NG Application Protocol (NGAP) packet dissection
3 * Copyright 2018, Anders Broman <anders.broman@ericsson.com>
4 * Copyright 2018-2024, Pascal Quantin <pascal@wireshark.org>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
12 * References: 3GPP TS 38.413 v18.3.0 (2024-09)
15 #include "config.h"
16 #include <stdio.h>
18 #include <epan/packet.h>
19 #include <epan/strutil.h>
20 #include <epan/asn1.h>
21 #include <epan/prefs.h>
22 #include <epan/sctpppids.h>
23 #include <epan/expert.h>
24 #include <epan/proto_data.h>
25 #include <epan/conversation.h>
26 #include <epan/exceptions.h>
27 #include <epan/show_exception.h>
28 #include <epan/tap.h>
29 #include <epan/stats_tree.h>
30 #include <epan/tfs.h>
31 #include <epan/unit_strings.h>
32 #include <wsutil/wsjson.h>
33 #include <wsutil/array.h>
35 #include "packet-ngap.h"
36 #include "packet-per.h"
37 #include "packet-e212.h"
38 #include "packet-s1ap.h"
39 #include "packet-ranap.h"
40 #include "packet-rrc.h"
41 #include "packet-lte-rrc.h"
42 #include "packet-nr-rrc.h"
43 #include "packet-gsm_map.h"
44 #include "packet-cell_broadcast.h"
45 #include "packet-ntp.h"
46 #include "packet-gsm_a_common.h"
47 #include "packet-media-type.h"
49 #define PNAME "NG Application Protocol"
50 #define PSNAME "NGAP"
51 #define PFNAME "ngap"
53 /* Dissector will use SCTP PPID 18 or SCTP port. IANA assigned port = 36412 */
54 #define SCTP_PORT_NGAP 38412
56 void proto_register_ngap(void);
57 void proto_reg_handoff_ngap(void);
59 static dissector_handle_t ngap_handle;
60 static dissector_handle_t ngap_media_type_handle;
61 static dissector_handle_t nas_5gs_handle;
62 static dissector_handle_t nr_rrc_ue_radio_paging_info_handle;
63 static dissector_handle_t nr_rrc_ue_radio_access_cap_info_handle;
64 static dissector_handle_t lte_rrc_ue_radio_paging_info_handle;
65 static dissector_handle_t lte_rrc_ue_radio_access_cap_info_handle;
66 static dissector_handle_t lte_rrc_ue_radio_paging_info_nb_handle;
67 static dissector_handle_t lte_rrc_ue_radio_access_cap_info_nb_handle;
68 static dissector_handle_t nrppa_handle;
70 static int proto_json;
72 #include "packet-ngap-val.h"
74 /* Initialize the protocol and registered fields */
75 static int proto_ngap;
76 static int hf_ngap_transportLayerAddressIPv4;
77 static int hf_ngap_transportLayerAddressIPv6;
78 static int hf_ngap_SerialNumber_gs;
79 static int hf_ngap_SerialNumber_msg_code;
80 static int hf_ngap_SerialNumber_upd_nb;
81 static int hf_ngap_WarningType_value;
82 static int hf_ngap_WarningType_emergency_user_alert;
83 static int hf_ngap_WarningType_popup;
84 static int hf_ngap_WarningMessageContents_nb_pages;
85 static int hf_ngap_WarningMessageContents_decoded_page;
86 static int hf_ngap_NGRANTraceID_TraceID;
87 static int hf_ngap_NGRANTraceID_TraceRecordingSessionReference;
88 static int hf_ngap_InterfacesToTrace_NG_C;
89 static int hf_ngap_InterfacesToTrace_Xn_C;
90 static int hf_ngap_InterfacesToTrace_Uu;
91 static int hf_ngap_InterfacesToTrace_F1_C;
92 static int hf_ngap_InterfacesToTrace_E1;
93 static int hf_ngap_InterfacesToTrace_reserved;
94 static int hf_ngap_RATRestrictionInformation_e_UTRA;
95 static int hf_ngap_RATRestrictionInformation_nR;
96 static int hf_ngap_RATRestrictionInformation_nR_unlicensed;
97 static int hf_ngap_RATRestrictionInformation_reserved;
98 static int hf_ngap_primaryRATRestriction_e_UTRA;
99 static int hf_ngap_primaryRATRestriction_nR;
100 static int hf_ngap_primaryRATRestriction_nR_unlicensed;
101 static int hf_ngap_primaryRATRestriction_nR_LEO;
102 static int hf_ngap_primaryRATRestriction_nR_MEO;
103 static int hf_ngap_primaryRATRestriction_nR_GEO;
104 static int hf_ngap_primaryRATRestriction_nR_OTHERSAT;
105 static int hf_ngap_primaryRATRestriction_e_UTRA_LEO;
106 static int hf_ngap_primaryRATRestriction_e_UTRA_MEO;
107 static int hf_ngap_primaryRATRestriction_e_UTRA_GEO;
108 static int hf_ngap_primaryRATRestriction_e_UTRA_OTHERSAT;
109 static int hf_ngap_primaryRATRestriction_reserved;
110 static int hf_ngap_secondaryRATRestriction_e_UTRA;
111 static int hf_ngap_secondaryRATRestriction_nR;
112 static int hf_ngap_secondaryRATRestriction_e_UTRA_unlicensed;
113 static int hf_ngap_secondaryRATRestriction_nR_unlicensed;
114 static int hf_ngap_secondaryRATRestriction_reserved;
115 static int hf_ngap_NrencryptionAlgorithms_nea1;
116 static int hf_ngap_NrencryptionAlgorithms_nea2;
117 static int hf_ngap_NrencryptionAlgorithms_nea3;
118 static int hf_ngap_NrencryptionAlgorithms_reserved;
119 static int hf_ngap_NrintegrityProtectionAlgorithms_nia1;
120 static int hf_ngap_NrintegrityProtectionAlgorithms_nia2;
121 static int hf_ngap_NrintegrityProtectionAlgorithms_nia3;
122 static int hf_ngap_NrintegrityProtectionAlgorithms_reserved;
123 static int hf_ngap_EUTRAencryptionAlgorithms_eea1;
124 static int hf_ngap_EUTRAencryptionAlgorithms_eea2;
125 static int hf_ngap_EUTRAencryptionAlgorithms_eea3;
126 static int hf_ngap_EUTRAencryptionAlgorithms_reserved;
127 static int hf_ngap_EUTRAintegrityProtectionAlgorithms_eia1;
128 static int hf_ngap_EUTRAintegrityProtectionAlgorithms_eia2;
129 static int hf_ngap_EUTRAintegrityProtectionAlgorithms_eia3;
130 static int hf_ngap_EUTRAintegrityProtectionAlgorithms_eia7;
131 static int hf_ngap_EUTRAintegrityProtectionAlgorithms_reserved;
132 static int hf_ngap_MeasurementsToActivate_M1;
133 static int hf_ngap_MeasurementsToActivate_M2;
134 static int hf_ngap_MeasurementsToActivate_M4;
135 static int hf_ngap_MeasurementsToActivate_M5;
136 static int hf_ngap_MeasurementsToActivate_M6;
137 static int hf_ngap_MeasurementsToActivate_M7;
138 static int hf_ngap_MeasurementsToActivate_M1_from_event;
139 static int hf_ngap_MeasurementsToActivate_reserved;
140 static int hf_ngap_MDT_Location_Information_GNSS;
141 static int hf_ngap_MDT_Location_Information_reserved;
142 static int hf_ngap_GlobalCable_ID_str;
143 static int hf_ngap_UpdateFeedback_CN_PDB_DL;
144 static int hf_ngap_UpdateFeedback_CN_PDB_UL;
145 static int hf_ngap_UpdateFeedback_reserved;
146 #include "packet-ngap-hf.c"
148 /* Initialize the subtree pointers */
149 static int ett_ngap;
150 static int ett_ngap_TransportLayerAddress;
151 static int ett_ngap_DataCodingScheme;
152 static int ett_ngap_SerialNumber;
153 static int ett_ngap_WarningType;
154 static int ett_ngap_WarningMessageContents;
155 static int ett_ngap_PLMNIdentity;
156 static int ett_ngap_NGAP_Message;
157 static int ett_ngap_NGRANTraceID;
158 static int ett_ngap_InterfacesToTrace;
159 static int ett_ngap_SourceToTarget_TransparentContainer;
160 static int ett_ngap_TargetToSource_TransparentContainer;
161 static int ett_ngap_RRCContainer;
162 static int ett_ngap_RATRestrictionInformation;
163 static int ett_ngap_primaryRATRestriction;
164 static int ett_ngap_secondaryRATRestriction;
165 static int ett_ngap_NrencryptionAlgorithms;
166 static int ett_ngap_NrintegrityProtectionAlgorithms;
167 static int ett_ngap_EUTRAencryptionAlgorithms;
168 static int ett_ngap_EUTRAintegrityProtectionAlgorithms;
169 static int ett_ngap_UERadioCapabilityForPagingOfNR;
170 static int ett_ngap_UERadioCapabilityForPagingOfEUTRA;
171 static int ett_ngap_UERadioCapability;
172 static int ett_ngap_LastVisitedEUTRANCellInformation;
173 static int ett_ngap_LastVisitedUTRANCellInformation;
174 static int ett_ngap_LastVisitedGERANCellInformation;
175 static int ett_ngap_NASSecurityParametersFromNGRAN;
176 static int ett_ngap_NASC;
177 static int ett_ngap_NAS_PDU;
178 static int ett_ngap_EN_DCSONConfigurationTransfer;
179 static int ett_ngap_BurstArrivalTime;
180 static int ett_ngap_CoverageEnhancementLevel;
181 static int ett_ngap_MDTModeEutra;
182 static int ett_ngap_MeasurementsToActivate;
183 static int ett_ngap_MDT_Location_Information;
184 static int ett_ngap_NRMobilityHistoryReport;
185 static int ett_ngap_LTEUERLFReportContainer;
186 static int ett_ngap_NRUERLFReportContainer;
187 static int ett_ngap_TargettoSource_Failure_TransparentContainer;
188 static int ett_ngap_UERadioCapabilityForPagingOfNB_IoT;
189 static int ett_ngap_GlobalCable_ID;
190 static int ett_ngap_UpdateFeedback;
191 static int ett_ngap_successfulHOReportContainer;
192 static int ett_ngap_successfulPSCellChangeReportContainer;
193 #include "packet-ngap-ett.c"
195 static expert_field ei_ngap_number_pages_le15;
197 enum{
198 INITIATING_MESSAGE,
199 SUCCESSFUL_OUTCOME,
200 UNSUCCESSFUL_OUTCOME
203 /* NGAP stats - Tap interface */
205 static void set_stats_message_type(packet_info *pinfo, int type);
207 static const uint8_t *st_str_packets = "Total Packets";
208 static const uint8_t *st_str_packet_types = "NGAP Packet Types";
210 static int st_node_packets = -1;
211 static int st_node_packet_types = -1;
212 static int ngap_tap;
214 struct ngap_tap_t {
215 int ngap_mtype;
218 #define MTYPE_AMF_CONFIGURATION_UPDATE 1
219 #define MTYPE_AMF_CONFIGURATION_UPDATE_ACK 2
220 #define MTYPE_AMF_CONFIGURATION_UPDATE_FAILURE 3
221 #define MTYPE_AMF_CP_RELOCATION_IND 4
222 #define MTYPE_AMF_STATUS_IND 5
223 #define MTYPE_BROADCAST_SESSION_MODIFICATION_REQUEST 6
224 #define MTYPE_BROADCAST_SESSION_MODIFICATION_RESPONSE 7
225 #define MTYPE_BROADCAST_SESSION_MODIFICATION_FAILURE 8
226 #define MTYPE_BROADCAST_SESSION_RELEASE_REQUEST 9
227 #define MTYPE_BROADCAST_SESSION_RELEASE_RESPONSE 10
228 #define MTYPE_BROADCAST_SESSION_RELEASE_REQUIRED 11
229 #define MTYPE_BROADCAST_SESSION_SETUP_REQUEST 12
230 #define MTYPE_BROADCAST_SESSION_SETUP_RESPONSE 13
231 #define MTYPE_BROADCAST_SESSION_SETUP_FAILURE 14
232 #define MTYPE_BROADCAST_SESSION_TRANSPORT_REQUEST 15
233 #define MTYPE_BROADCAST_SESSION_TRANSPORT_RESPONSE 16
234 #define MTYPE_BROADCAST_SESSION_TRANSPORT_FAILURE 17
235 #define MTYPE_CELL_TRAFFIC_TRACE 18
236 #define MTYPE_CONNECTION_ESTAB_IND 19
237 #define MTYPE_DEACTIVATE_TRACE 20
238 #define MTYPE_DISTRIBUTION_SETUP_REQUEST 21
239 #define MTYPE_DISTRIBUTION_SETUP_RESPONSE 22
240 #define MTYPE_DISTRIBUTION_SETUP_FAILURE 23
241 #define MTYPE_DISTRIBUTION_RELEASE_REQUEST 24
242 #define MTYPE_DISTRIBUTION_RELEASE_RESPONSE 25
243 #define MTYPE_DOWNLINK_NAS_TRANSPORT 26
244 #define MTYPE_DOWNLINK_NON_UE_ASSOCIATED_NR_PPA_TRANSPORT 27
245 #define MTYPE_DOWNLINK_RAN_CONFIGURATION_TRANSFER 28
246 #define MTYPE_DOWNLINK_RAN_EARLY_STATUS_TRANSFER 29
247 #define MTYPE_DOWNLINK_RAN_STATUS_TRANSFER 30
248 #define MTYPE_DOWNLINK_UE_ASSOCIATED_NR_PPA_TRANSPORT 31
249 #define MTYPE_ERROR_INDICATION 32
250 #define MTYPE_HANDOVER_CANCEL 33
251 #define MTYPE_HANDOVER_CANCEL_ACK 34
252 #define MTYPE_HANDOVER_NOTIFY 35
253 #define MTYPE_HANDOVER_REQUIRED 36
254 #define MTYPE_HANDOVER_COMMAND 37
255 #define MTYPE_HANDOVER_PREPARATION_FAILURE 38
256 #define MTYPE_HANDOVER_REQUEST 39
257 #define MTYPE_HANDOVER_REQUEST_ACK 40
258 #define MTYPE_HANDOVER_FAILURE 41
259 #define MTYPE_HANDOVER_SUCCESS 42
260 #define MTYPE_INITIAL_CONTEXT_SETUP_REQUEST 43
261 #define MTYPE_INITIAL_CONTEXT_SETUP_RESPONSE 44
262 #define MTYPE_INITIAL_CONTEXT_SETUP_FAILURE 45
263 #define MTYPE_INITIAL_UE_MESSAGE 46
264 #define MTYPE_LOCATION_REPORT 47
265 #define MTYPE_LOCATION_REPORTING_CONTROL 48
266 #define MTYPE_LOCATION_REPORTING_FAILURE_IND 49
267 #define MTYPE_MT_COMMUNICATION_HANDLING_REQUEST 50
268 #define MTYPE_MT_COMMUNICATION_HANDLING_RESPONSE 51
269 #define MTYPE_MT_COMMUNICATION_HANDLING_FAILURE 52
270 #define MTYPE_MULTICAST_SESSION_ACTIVATION_REQUEST 53
271 #define MTYPE_MULTICAST_SESSION_ACTIVATION_RESPONSE 54
272 #define MTYPE_MULTICAST_SESSION_ACTIVATION_FAILURE 55
273 #define MTYPE_MULTICAST_SESSION_DEACTIVATION_REQUEST 56
274 #define MTYPE_MULTICAST_SESSION_DEACTIVATION_RESPONSE 57
275 #define MTYPE_MULTICAST_SESSION_UPDATE_REQUEST 58
276 #define MTYPE_MULTICAST_SESSION_UPDATE_RESPONSE 59
277 #define MTYPE_MULTICAST_SESSION_UPDATE_FAILURE 60
278 #define MTYPE_MULTICAST_GROUP_PAGING 61
279 #define MTYPE_NAS_NON_DELIVERY_IND 62
280 #define MTYPE_NG_RESET 63
281 #define MTYPE_NG_RESET_ACK 64
282 #define MTYPE_NG_SETUP_REQUEST 65
283 #define MTYPE_NG_SETUP_RESPONSE 66
284 #define MTYPE_NG_SETUP_FAILURE 67
285 #define MTYPE_OVERLOAD_START 68
286 #define MTYPE_OVERLOAD_STOP 69
287 #define MTYPE_PAGING 70
288 #define MTYPE_PATH_SWITCH_REQUEST 71
289 #define MTYPE_PATH_SWITCH_REQUEST_ACK 72
290 #define MTYPE_PATH_SWITCH_REQUEST_FAILURE 73
291 #define MTYPE_PDU_SESSION_RESOURCE_MODIFY_REQUEST 74
292 #define MTYPE_PDU_SESSION_RESOURCE_MODIFY_RESPONSE 75
293 #define MTYPE_PDU_SESSION_RESOURCE_MODIFY_IND 76
294 #define MTYPE_PDU_SESSION_RESOURCE_MODIFY_CONFIRM 77
295 #define MTYPE_PDU_SESSION_RESOURCE_NOTIFY 78
296 #define MTYPE_PDU_SESSION_RESOURCE_RELEASE_COMMAND 79
297 #define MTYPE_PDU_SESSION_RESOURCE_RELEASE_RESPONSE 80
298 #define MTYPE_PDU_SESSION_RESOURCE_SETUP_REQUEST 81
299 #define MTYPE_PDU_SESSION_RESOURCE_SETUP_RESPONSE 82
300 #define MTYPE_PRIVATE_MESSAGE 83
301 #define MTYPE_PWS_CANCEL_REQUEST 84
302 #define MTYPE_PWS_CANCEL_RESPONSE 85
303 #define MTYPE_PWS_FAILURE_INDICATION 86
304 #define MTYPE_PWS_RESTART_INDICATION 87
305 #define MTYPE_RAN_CONFIGURATION_UPDATE 88
306 #define MTYPE_RAN_CONFIGURATION_UPDATE_ACK 89
307 #define MTYPE_RAN_CONFIGURATION_UPDATE_FAILURE 90
308 #define MTYPE_RAN_CP_RELOCATION_IND 91
309 #define MTYPE_RAN_PAGING_REQUEST 92
310 #define MTYPE_REROUTE_NAS_REQUEST 93
311 #define MTYPE_RETRIEVE_UE_INFORMATION 94
312 #define MTYPE_RRC_INACTIVE_TRANSITION_REPORT 95
313 #define MTYPE_SECONDARY_RAT_DATA_USAGE_REPORT 96
314 #define MTYPE_TIMING_SYNCHRONISATION_STATUS_REQUEST 97
315 #define MTYPE_TIMING_SYNCHRONISATION_STATUS_RESPONSE 98
316 #define MTYPE_TIMING_SYNCHRONISATION_STATUS_FAILURE 99
317 #define MTYPE_TIMING_SYNCHRONISATION_STATUS_REPORT 100
318 #define MTYPE_TRACE_FAILURE_IND 101
319 #define MTYPE_TRACE_START 102
320 #define MTYPE_UE_CONTEXT_MODIFICATION_REQUEST 103
321 #define MTYPE_UE_CONTEXT_MODIFICATION_RESPONSE 104
322 #define MTYPE_UE_CONTEXT_MODIFICATION_FAILURE 105
323 #define MTYPE_UE_CONTEXT_RELEASE_COMMAND 106
324 #define MTYPE_UE_CONTEXT_RELEASE_COMPLETE 107
325 #define MTYPE_UE_CONTEXT_RELEASE_REQUEST 108
326 #define MTYPE_UE_CONTEXT_RESUME_REQUEST 109
327 #define MTYPE_UE_CONTEXT_RESUME_RESPONSE 110
328 #define MTYPE_UE_CONTEXT_RESUME_FAILURE 111
329 #define MTYPE_UE_CONTEXT_SUSPEND_REQUEST 112
330 #define MTYPE_UE_CONTEXT_SUSPEND_RESPONSE 113
331 #define MTYPE_UE_CONTEXT_SUSPEND_FAILURE 114
332 #define MTYPE_UE_INFORMATION_TRANSFER 115
333 #define MTYPE_UE_RADIO_CAPABILITY_CHECK_REQUEST 116
334 #define MTYPE_UE_RADIO_CAPABILITY_CHECK_RESPONSE 117
335 #define MTYPE_UE_RADIO_CAPABILITY_ID_MAPPING_REQUEST 118
336 #define MTYPE_UE_RADIO_CAPABILITY_ID_MAPPING_RESPONSE 119
337 #define MTYPE_UE_RADIO_CAPABILITY_INFO_IND 120
338 #define MTYPE_UE_TN_LAB_BINDING_RELEASE_REQUEST 121
339 #define MTYPE_UPLINK_NAS_TRANSPORT 122
340 #define MTYPE_UPLINK_NON_UE_ASSOCIATED_NR_PPA_TRANSPORT 123
341 #define MTYPE_UPLINK_RAN_CONFIGURATION_TRANSFER 124
342 #define MTYPE_UPLINK_RAN_EARLY_STATUS_TRANSFER 125
343 #define MTYPE_UPLINK_RAN_STATUS_TRANSFER 126
344 #define MTYPE_UPLINK_UE_ASSOCIATED_NR_PPA_TRANSPORT 127
345 #define MTYPE_WRITE_REPLACE_WARNING_REQUEST 128
346 #define MTYPE_WRITE_REPLACE_WARNING_RESPONSE 129
347 #define MTYPE_UPLINK_RIM_INFORMATION_TRANSFER 130
348 #define MTYPE_DOWNLINK_RIM_INFORMATION_TRANSFER 131
351 /* Value Strings. TODO: ext? */
352 static const value_string mtype_names[] = {
353 { MTYPE_AMF_CONFIGURATION_UPDATE, "AMFConfigurationUpdate" },
354 { MTYPE_AMF_CONFIGURATION_UPDATE_ACK, "AMFConfigurationUpdateAcknowledge" },
355 { MTYPE_AMF_CONFIGURATION_UPDATE_FAILURE, "AMFConfigurationUpdateFailure" },
356 { MTYPE_AMF_CP_RELOCATION_IND, "AMFCPRelocationIndication" },
357 { MTYPE_AMF_STATUS_IND, "AMFStatusIndication" },
358 { MTYPE_BROADCAST_SESSION_MODIFICATION_REQUEST, "BroadcastSessionModificationRequest" },
359 { MTYPE_BROADCAST_SESSION_MODIFICATION_RESPONSE, "BroadcastSessionModificationResponse" },
360 { MTYPE_BROADCAST_SESSION_MODIFICATION_FAILURE, "BroadcastSessionModificationFailure" },
361 { MTYPE_BROADCAST_SESSION_RELEASE_REQUEST, "BroadcastSessionReleaseRequest" },
362 { MTYPE_BROADCAST_SESSION_RELEASE_RESPONSE, "BroadcastSessionReleaseResponse" },
363 { MTYPE_BROADCAST_SESSION_RELEASE_REQUIRED, "BroadcastSessionReleaseRequired" },
364 { MTYPE_BROADCAST_SESSION_SETUP_REQUEST, "BroadcastSessionSetupRequest" },
365 { MTYPE_BROADCAST_SESSION_SETUP_RESPONSE, "BroadcastSessionSetupResponse" },
366 { MTYPE_BROADCAST_SESSION_SETUP_FAILURE, "BroadcastSessionSetupFailure" },
367 { MTYPE_BROADCAST_SESSION_TRANSPORT_REQUEST, "BroadcastSessionTransportRequest" },
368 { MTYPE_BROADCAST_SESSION_TRANSPORT_RESPONSE, "BroadcastSessionTransportResponse" },
369 { MTYPE_BROADCAST_SESSION_TRANSPORT_FAILURE, "BroadcastSessionTransportFailure" },
370 { MTYPE_CELL_TRAFFIC_TRACE, "CellTrafficTrace" },
371 { MTYPE_CONNECTION_ESTAB_IND, "ConnectionEstablishmentIndication" },
372 { MTYPE_DEACTIVATE_TRACE, "DeactivateTrace" },
373 { MTYPE_DISTRIBUTION_SETUP_REQUEST, "DistributionSetupRequest" },
374 { MTYPE_DISTRIBUTION_SETUP_RESPONSE, "DistributionSetupResponse" },
375 { MTYPE_DISTRIBUTION_SETUP_FAILURE, "DistributionSetupFailure" },
376 { MTYPE_DISTRIBUTION_RELEASE_REQUEST, "DistributionReleaseRequest" },
377 { MTYPE_DISTRIBUTION_RELEASE_RESPONSE, "DistributionReleaseResponse" },
378 { MTYPE_DOWNLINK_NAS_TRANSPORT, "DownlinkNASTransport" },
379 { MTYPE_DOWNLINK_NON_UE_ASSOCIATED_NR_PPA_TRANSPORT, "DownlinkNonUEAssociatedNRPPaTransport" },
380 { MTYPE_DOWNLINK_RAN_CONFIGURATION_TRANSFER, "DownlinkRANConfigurationTransfer" },
381 { MTYPE_DOWNLINK_RAN_EARLY_STATUS_TRANSFER, "DownlinkRANEarlyStatusTransfer" },
382 { MTYPE_DOWNLINK_RAN_STATUS_TRANSFER, "DownlinkRANStatusTransfer" },
383 { MTYPE_DOWNLINK_UE_ASSOCIATED_NR_PPA_TRANSPORT, "DownlinkUEAssociatedNRPPaTransport" },
384 { MTYPE_ERROR_INDICATION, "ErrorIndication" },
385 { MTYPE_HANDOVER_CANCEL, "HandoverCancel" },
386 { MTYPE_HANDOVER_CANCEL_ACK, "HandoverCancelAcknowledge" },
387 { MTYPE_HANDOVER_NOTIFY, "HandoverNotify" },
388 { MTYPE_HANDOVER_REQUIRED, "HandoverRequired" },
389 { MTYPE_HANDOVER_COMMAND, "HandoverCommand" },
390 { MTYPE_HANDOVER_PREPARATION_FAILURE, "HandoverPreparationFailure" },
391 { MTYPE_HANDOVER_REQUEST, "HandoverRequest" },
392 { MTYPE_HANDOVER_REQUEST_ACK, "HandoverRequestAcknowledge" },
393 { MTYPE_HANDOVER_FAILURE, "HandoverFailure" },
394 { MTYPE_HANDOVER_SUCCESS, "HandoverSuccess" },
395 { MTYPE_INITIAL_CONTEXT_SETUP_REQUEST, "InitialContextSetupRequest" },
396 { MTYPE_INITIAL_CONTEXT_SETUP_RESPONSE, "InitialContextSetupResponse" },
397 { MTYPE_INITIAL_CONTEXT_SETUP_FAILURE, "InitialContextSetupFailure" },
398 { MTYPE_INITIAL_UE_MESSAGE, "InitialUEMessage" },
399 { MTYPE_LOCATION_REPORT, "LocationReport" },
400 { MTYPE_LOCATION_REPORTING_CONTROL, "LocationReportingControl" },
401 { MTYPE_LOCATION_REPORTING_FAILURE_IND, "LocationReportingFailureIndication" },
402 { MTYPE_MT_COMMUNICATION_HANDLING_REQUEST, "MTCommunicationHandlingRequest" },
403 { MTYPE_MT_COMMUNICATION_HANDLING_RESPONSE, "MTCommunicationHandlingResponse" },
404 { MTYPE_MT_COMMUNICATION_HANDLING_FAILURE, "MTCommunicationHandlingFailure" },
405 { MTYPE_MULTICAST_SESSION_ACTIVATION_REQUEST, "MulticastSessionActivationRequest" },
406 { MTYPE_MULTICAST_SESSION_ACTIVATION_RESPONSE, "MulticastSessionActivationResponse" },
407 { MTYPE_MULTICAST_SESSION_ACTIVATION_FAILURE, "MulticastSessionActivationFailure" },
408 { MTYPE_MULTICAST_SESSION_DEACTIVATION_REQUEST, "MulticastSessionDeactivationRequest" },
409 { MTYPE_MULTICAST_SESSION_DEACTIVATION_RESPONSE, "MulticastSessionDeactivationResponse" },
410 { MTYPE_MULTICAST_SESSION_UPDATE_REQUEST, "MulticastSessionUpdateRequest" },
411 { MTYPE_MULTICAST_SESSION_UPDATE_RESPONSE, "MulticastSessionUpdateResponse" },
412 { MTYPE_MULTICAST_SESSION_UPDATE_FAILURE, "MulticastSessionUpdateFailure" },
413 { MTYPE_MULTICAST_GROUP_PAGING, "MulticastGroupPaging" },
414 { MTYPE_NAS_NON_DELIVERY_IND, "NASNonDeliveryIndication" },
415 { MTYPE_NG_RESET, "NGReset" },
416 { MTYPE_NG_RESET_ACK, "NGResetAcknowledge" },
417 { MTYPE_NG_SETUP_REQUEST, "NGSetupRequest" },
418 { MTYPE_NG_SETUP_RESPONSE, "NGSetupResponse" },
419 { MTYPE_NG_SETUP_FAILURE, "NGSetupFailure" },
420 { MTYPE_OVERLOAD_START, "OverloadStart" },
421 { MTYPE_OVERLOAD_STOP, "OverloadStop" },
422 { MTYPE_PAGING, "Paging" },
423 { MTYPE_PATH_SWITCH_REQUEST, "PathSwitchRequest" },
424 { MTYPE_PATH_SWITCH_REQUEST_ACK, "PathSwitchRequestAcknowledge" },
425 { MTYPE_PATH_SWITCH_REQUEST_FAILURE, "PathSwitchRequestFailure" },
426 { MTYPE_PDU_SESSION_RESOURCE_MODIFY_REQUEST, "PDUSessionResourceModifyRequest" },
427 { MTYPE_PDU_SESSION_RESOURCE_MODIFY_RESPONSE, "PDUSessionResourceModifyResponse" },
428 { MTYPE_PDU_SESSION_RESOURCE_MODIFY_IND, "PDUSessionResourceModifyIndication" },
429 { MTYPE_PDU_SESSION_RESOURCE_MODIFY_CONFIRM, "PDUSessionResourceModifyConfirm" },
430 { MTYPE_PDU_SESSION_RESOURCE_NOTIFY, "PDUSessionResourceNotify" },
431 { MTYPE_PDU_SESSION_RESOURCE_RELEASE_COMMAND, "PDUSessionResourceReleaseCommand" },
432 { MTYPE_PDU_SESSION_RESOURCE_RELEASE_RESPONSE, "PDUSessionResourceReleaseResponse" },
433 { MTYPE_PDU_SESSION_RESOURCE_SETUP_REQUEST, "PDUSessionResourceSetupRequest" },
434 { MTYPE_PDU_SESSION_RESOURCE_SETUP_RESPONSE, "PDUSessionResourceSetupResponse" },
435 { MTYPE_PRIVATE_MESSAGE, "PrivateMessage" },
436 { MTYPE_PWS_CANCEL_REQUEST, "PWSCancelRequest" },
437 { MTYPE_PWS_CANCEL_RESPONSE, "PWSCancelResponse" },
438 { MTYPE_PWS_FAILURE_INDICATION, "PWSFailureIndication" },
439 { MTYPE_PWS_RESTART_INDICATION, "PWSRestartIndication" },
440 { MTYPE_RAN_CONFIGURATION_UPDATE, "RANConfigurationUpdate" },
441 { MTYPE_RAN_CONFIGURATION_UPDATE_ACK, "RANConfigurationUpdateAcknowledge" },
442 { MTYPE_RAN_CONFIGURATION_UPDATE_FAILURE, "RANConfigurationUpdateFailure" },
443 { MTYPE_RAN_CP_RELOCATION_IND, "RANCPRelocationIndication" },
444 { MTYPE_RAN_PAGING_REQUEST, "RANPagingRequest" },
445 { MTYPE_REROUTE_NAS_REQUEST, "RerouteNASRequest" },
446 { MTYPE_RETRIEVE_UE_INFORMATION, "RetrieveUEInformation" },
447 { MTYPE_RRC_INACTIVE_TRANSITION_REPORT, "RRCInactiveTransitionReport" },
448 { MTYPE_SECONDARY_RAT_DATA_USAGE_REPORT, "SecondaryRATDataUsageReport" },
449 { MTYPE_TIMING_SYNCHRONISATION_STATUS_REQUEST, "TimingSynchronisationStatusRequest" },
450 { MTYPE_TIMING_SYNCHRONISATION_STATUS_RESPONSE, "TimingSynchronisationStatusResponse" },
451 { MTYPE_TIMING_SYNCHRONISATION_STATUS_FAILURE, "TimingSynchronisationStatusFailure" },
452 { MTYPE_TIMING_SYNCHRONISATION_STATUS_REPORT, "TimingSynchronisationStatusReport" },
453 { MTYPE_TRACE_FAILURE_IND, "TraceFailureIndication" },
454 { MTYPE_TRACE_START, "TraceStart" },
455 { MTYPE_UE_CONTEXT_MODIFICATION_REQUEST, "UEContextModificationRequest" },
456 { MTYPE_UE_CONTEXT_MODIFICATION_RESPONSE, "UEContextModificationResponse" },
457 { MTYPE_UE_CONTEXT_MODIFICATION_FAILURE, "UEContextModificationFailure" },
458 { MTYPE_UE_CONTEXT_RELEASE_COMMAND, "UEContextReleaseCommand" },
459 { MTYPE_UE_CONTEXT_RELEASE_COMPLETE, "UEContextReleaseComplete" },
460 { MTYPE_UE_CONTEXT_RELEASE_REQUEST, "UEContextReleaseRequest" },
461 { MTYPE_UE_CONTEXT_RESUME_REQUEST, "UEContextResumeRequest" },
462 { MTYPE_UE_CONTEXT_RESUME_RESPONSE, "UEContextResumeResponse" },
463 { MTYPE_UE_CONTEXT_RESUME_FAILURE, "UEContextResumeFailure" },
464 { MTYPE_UE_CONTEXT_SUSPEND_REQUEST, "UEContextSuspendRequest" },
465 { MTYPE_UE_CONTEXT_SUSPEND_RESPONSE, "UEContextSuspendResponse" },
466 { MTYPE_UE_CONTEXT_SUSPEND_FAILURE, "UEContextSuspendFailure" },
467 { MTYPE_UE_INFORMATION_TRANSFER, "UEInformationTransfer" },
468 { MTYPE_UE_RADIO_CAPABILITY_CHECK_REQUEST, "UERadioCapabilityCheckRequest" },
469 { MTYPE_UE_RADIO_CAPABILITY_CHECK_RESPONSE, "UERadioCapabilityCheckResponse" },
470 { MTYPE_UE_RADIO_CAPABILITY_ID_MAPPING_REQUEST, "UERadioCapabilityIDMappingRequest" },
471 { MTYPE_UE_RADIO_CAPABILITY_ID_MAPPING_RESPONSE, "UERadioCapabilityIDMappingResponse" },
472 { MTYPE_UE_RADIO_CAPABILITY_INFO_IND, "UERadioCapabilityInfoIndication" },
473 { MTYPE_UE_TN_LAB_BINDING_RELEASE_REQUEST, "UETNLABindingReleaseRequest" },
474 { MTYPE_UPLINK_NAS_TRANSPORT, "UplinkNASTransport" },
475 { MTYPE_UPLINK_NON_UE_ASSOCIATED_NR_PPA_TRANSPORT, "UplinkNonUEAssociatedNRPPaTransport" },
476 { MTYPE_UPLINK_RAN_CONFIGURATION_TRANSFER, "UplinkRANConfigurationTransfer" },
477 { MTYPE_UPLINK_RAN_EARLY_STATUS_TRANSFER, "UplinkRANEarlyStatusTransfer" },
478 { MTYPE_UPLINK_RAN_STATUS_TRANSFER, "UplinkRANStatusTransfer" },
479 { MTYPE_UPLINK_UE_ASSOCIATED_NR_PPA_TRANSPORT, "UplinkUEAssociatedNRPPaTransport" },
480 { MTYPE_WRITE_REPLACE_WARNING_REQUEST, "WriteReplaceWarningRequest" },
481 { MTYPE_WRITE_REPLACE_WARNING_RESPONSE, "WriteReplaceWarningResponse" },
482 { MTYPE_UPLINK_RIM_INFORMATION_TRANSFER, "UplinkRIMInformationTransfer" },
483 { MTYPE_DOWNLINK_RIM_INFORMATION_TRANSFER, "DownlinkRIMInformationTransfer" },
484 { 0, NULL }
488 typedef struct _ngap_ctx_t {
489 uint32_t message_type;
490 uint32_t ProcedureCode;
491 uint32_t ProtocolIE_ID;
492 uint32_t ProtocolExtensionID;
493 } ngap_ctx_t;
495 struct ngap_conv_info {
496 address addr_a;
497 uint32_t port_a;
498 GlobalRANNodeID_enum ranmode_id_a;
499 address addr_b;
500 uint32_t port_b;
501 GlobalRANNodeID_enum ranmode_id_b;
502 wmem_map_t *nbiot_ta;
503 wmem_tree_t *nbiot_ran_ue_ngap_id;
506 enum {
507 SOURCE_TO_TARGET_TRANSPARENT_CONTAINER = 1,
508 TARGET_TO_SOURCE_TRANSPARENT_CONTAINER
511 struct ngap_supported_ta {
512 uint32_t tac;
513 wmem_array_t *plmn;
516 struct ngap_tai {
517 uint32_t plmn;
518 uint32_t tac;
521 struct ngap_private_data {
522 struct ngap_conv_info *ngap_conv;
523 uint32_t procedure_code;
524 uint32_t protocol_ie_id;
525 uint32_t protocol_extension_id;
526 uint32_t message_type;
527 uint32_t handover_type_value;
528 uint8_t data_coding_scheme;
529 uint8_t transparent_container_type;
530 bool is_qos_flow_notify;
531 struct ngap_supported_ta *supported_ta;
532 struct ngap_tai *tai;
533 uint32_t ran_ue_ngap_id;
534 e212_number_type_t number_type;
535 int8_t qos_flow_add_info_rel_type;
536 struct ngap_tap_t *stats_tap;
539 enum {
540 NGAP_NG_RAN_CONTAINER_AUTOMATIC,
541 NGAP_NG_RAN_CONTAINER_GNB,
542 NGAP_NG_RAN_CONTAINER_NG_ENB
545 static const enum_val_t ngap_target_ng_ran_container_vals[] = {
546 {"automatic", "automatic", NGAP_NG_RAN_CONTAINER_AUTOMATIC},
547 {"gnb", "gNB", NGAP_NG_RAN_CONTAINER_GNB},
548 {"ng-enb","ng-eNB", NGAP_NG_RAN_CONTAINER_NG_ENB},
549 {NULL, NULL, -1}
552 enum {
553 NGAP_LTE_CONTAINER_AUTOMATIC,
554 NGAP_LTE_CONTAINER_LEGACY,
555 NGAP_LTE_CONTAINER_NBIOT
558 static const enum_val_t ngap_lte_container_vals[] = {
559 {"automatic", "Automatic", NGAP_LTE_CONTAINER_AUTOMATIC},
560 {"legacy", "Legacy LTE", NGAP_LTE_CONTAINER_LEGACY},
561 {"nb-iot","NB-IoT", NGAP_LTE_CONTAINER_NBIOT},
562 {NULL, NULL, -1}
565 /* Global variables */
566 static range_t *gbl_ngapSctpRange;
567 static bool ngap_dissect_container = true;
568 static int ngap_dissect_target_ng_ran_container_as = NGAP_NG_RAN_CONTAINER_AUTOMATIC;
569 static int ngap_dissect_lte_container_as = NGAP_LTE_CONTAINER_AUTOMATIC;
571 /* Dissector tables */
572 static dissector_table_t ngap_ies_dissector_table;
573 static dissector_table_t ngap_ies_p1_dissector_table;
574 static dissector_table_t ngap_ies_p2_dissector_table;
575 static dissector_table_t ngap_extension_dissector_table;
576 static dissector_table_t ngap_proc_imsg_dissector_table;
577 static dissector_table_t ngap_proc_sout_dissector_table;
578 static dissector_table_t ngap_proc_uout_dissector_table;
579 static dissector_table_t ngap_n2_ie_type_dissector_table;
581 static proto_tree *top_tree;
583 static void set_message_label(asn1_ctx_t *actx, int type)
585 const char *label = val_to_str_const(type, mtype_names, "Unknown");
586 col_append_sep_str(actx->pinfo->cinfo, COL_INFO, NULL, label);
587 /* N.B. would like to be able to use actx->subTree.top_tree, but not easy to set.. */
588 proto_item_append_text(top_tree, " (%s)", label);
592 static int dissect_ProtocolIEFieldValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *);
593 /* Currently not used
594 static int dissect_ProtocolIEFieldPairFirstValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
595 static int dissect_ProtocolIEFieldPairSecondValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
597 static int dissect_ProtocolExtensionFieldExtensionValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *);
598 static int dissect_InitiatingMessageValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *);
599 static int dissect_SuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *);
600 static int dissect_UnsuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *);
602 static int dissect_InitialUEMessage_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data);
603 static int dissect_PDUSessionResourceReleaseResponseTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
604 static int dissect_HandoverRequestAcknowledgeTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
605 static int dissect_PDUSessionResourceModifyUnsuccessfulTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
606 static int dissect_PDUSessionResourceSetupUnsuccessfulTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
607 static int dissect_HandoverResourceAllocationUnsuccessfulTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
608 static int dissect_PathSwitchRequestSetupFailedTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
609 static int dissect_HandoverCommandTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
610 static int dissect_HandoverRequiredTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
611 static int dissect_PDUSessionResourceModifyConfirmTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
612 static int dissect_PDUSessionResourceModifyIndicationTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
613 static int dissect_PDUSessionResourceModifyRequestTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
614 static int dissect_PDUSessionResourceModifyResponseTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
615 static int dissect_PDUSessionResourceNotifyTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
616 static int dissect_PDUSessionResourceNotifyReleasedTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
617 static int dissect_PathSwitchRequestUnsuccessfulTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
618 static int dissect_PDUSessionResourceSetupRequestTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
619 static int dissect_PDUSessionResourceSetupResponseTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
620 static int dissect_PathSwitchRequestAcknowledgeTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
621 static int dissect_PathSwitchRequestTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
622 static int dissect_HandoverPreparationUnsuccessfulTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
623 static int dissect_PDUSessionResourceReleaseCommandTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
624 static int dissect_TargetNGRANNode_ToSourceNGRANNode_FailureTransparentContainer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
625 static int dissect_SecondaryRATDataUsageReportTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
626 static int dissect_PDUSessionResourceModifyIndicationUnsuccessfulTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
627 static int dissect_ngap_AlternativeQoSParaSetNotifyIndex(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
628 static int dissect_UEContextResumeRequestTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
629 static int dissect_UEContextResumeResponseTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
630 static int dissect_UEContextSuspendRequestTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
631 static int dissect_MBSSessionSetupOrModRequestTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
632 static int dissect_MBSSessionSetupOrModResponseTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
633 static int dissect_MBSSessionSetupOrModFailureTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
634 static int dissect_MBSSessionReleaseResponseTransfer_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_);
636 static const value_string ngap_serialNumber_gs_vals[] = {
637 { 0, "Display mode immediate, cell wide"},
638 { 1, "Display mode normal, PLMN wide"},
639 { 2, "Display mode normal, tracking area wide"},
640 { 3, "Display mode normal, cell wide"},
641 { 0, NULL},
644 static const value_string ngap_warningType_vals[] = {
645 { 0, "Earthquake"},
646 { 1, "Tsunami"},
647 { 2, "Earthquake and Tsunami"},
648 { 3, "Test"},
649 { 4, "Other"},
650 { 0, NULL},
653 static void
654 dissect_ngap_warningMessageContents(tvbuff_t *warning_msg_tvb, proto_tree *tree, packet_info *pinfo, uint8_t dcs, int hf_nb_pages, int hf_decoded_page)
656 uint32_t offset;
657 uint8_t nb_of_pages, length, *str;
658 proto_item *ti;
659 tvbuff_t *cb_data_page_tvb, *cb_data_tvb;
660 int i;
662 nb_of_pages = tvb_get_uint8(warning_msg_tvb, 0);
663 ti = proto_tree_add_uint(tree, hf_nb_pages, warning_msg_tvb, 0, 1, nb_of_pages);
664 if (nb_of_pages > 15) {
665 expert_add_info_format(pinfo, ti, &ei_ngap_number_pages_le15,
666 "Number of pages should be <=15 (found %u)", nb_of_pages);
667 nb_of_pages = 15;
669 for (i = 0, offset = 1; i < nb_of_pages; i++) {
670 length = tvb_get_uint8(warning_msg_tvb, offset+82);
671 cb_data_page_tvb = tvb_new_subset_length(warning_msg_tvb, offset, length);
672 cb_data_tvb = dissect_cbs_data(dcs, cb_data_page_tvb, tree, pinfo, 0);
673 if (cb_data_tvb) {
674 str = tvb_get_string_enc(pinfo->pool, cb_data_tvb, 0, tvb_reported_length(cb_data_tvb), ENC_UTF_8|ENC_NA);
675 proto_tree_add_string_format(tree, hf_decoded_page, warning_msg_tvb, offset, 83,
676 str, "Decoded Page %u: %s", i+1, str);
678 offset += 83;
682 static void
683 ngap_PacketLossRate_fmt(char *s, uint32_t v)
685 snprintf(s, ITEM_LABEL_LENGTH, "%.1f%% (%u)", (float)v/10, v);
688 static void
689 ngap_PacketDelayBudget_fmt(char *s, uint32_t v)
691 snprintf(s, ITEM_LABEL_LENGTH, "%.1fms (%u)", (float)v/2, v);
694 static void
695 ngap_TimeUEStayedInCellEnhancedGranularity_fmt(char *s, uint32_t v)
697 snprintf(s, ITEM_LABEL_LENGTH, "%.1fs", ((float)v)/10);
700 static void
701 ngap_PeriodicRegistrationUpdateTimer_fmt(char *s, uint32_t v)
703 uint32_t val = v & 0x1f;
705 switch (v>>5) {
706 case 0:
707 snprintf(s, ITEM_LABEL_LENGTH, "%u min (%u)", val * 10, v);
708 break;
709 case 1:
710 default:
711 snprintf(s, ITEM_LABEL_LENGTH, "%u hr (%u)", val, v);
712 break;
713 case 2:
714 snprintf(s, ITEM_LABEL_LENGTH, "%u hr (%u)", val * 10, v);
715 break;
716 case 3:
717 snprintf(s, ITEM_LABEL_LENGTH, "%u sec (%u)", val * 2, v);
718 break;
719 case 4:
720 snprintf(s, ITEM_LABEL_LENGTH, "%u sec (%u)", val * 30, v);
721 break;
722 case 5:
723 snprintf(s, ITEM_LABEL_LENGTH, "%u min (%u)", val, v);
724 break;
725 case 7:
726 snprintf(s, ITEM_LABEL_LENGTH, "deactivated (%u)", v);
727 break;
731 static void
732 ngap_ExtendedPacketDelayBudget_fmt(char *s, uint32_t v)
734 snprintf(s, ITEM_LABEL_LENGTH, "%.2fms (%u)", (float)v/100, v);
737 static void
738 ngap_Threshold_RSRP_fmt(char *s, uint32_t v)
740 snprintf(s, ITEM_LABEL_LENGTH, "%ddBm (%u)", (int32_t)v-156, v);
743 static void
744 ngap_Threshold_RSRQ_fmt(char *s, uint32_t v)
746 snprintf(s, ITEM_LABEL_LENGTH, "%.1fdB (%u)", ((float)v/2)-43, v);
749 static void
750 ngap_Threshold_SINR_fmt(char *s, uint32_t v)
752 snprintf(s, ITEM_LABEL_LENGTH, "%.1fdB (%u)", ((float)v/2)-23, v);
755 static void
756 ngap_N6Jitter_fmt(char *s, uint32_t v)
758 snprintf(s, ITEM_LABEL_LENGTH, "%.1fms (%d)", (float)v/2, (int32_t)v);
761 static struct ngap_private_data*
762 ngap_get_private_data(packet_info *pinfo)
764 struct ngap_private_data *ngap_data = (struct ngap_private_data*)p_get_proto_data(pinfo->pool, pinfo, proto_ngap, 0);
765 if (!ngap_data) {
766 ngap_data = wmem_new0(pinfo->pool, struct ngap_private_data);
767 ngap_data->handover_type_value = -1;
768 ngap_data->qos_flow_add_info_rel_type = -1;
769 p_add_proto_data(pinfo->pool, pinfo, proto_ngap, 0, ngap_data);
771 return ngap_data;
774 static GlobalRANNodeID_enum
775 ngap_get_ranmode_id(address *addr, uint32_t port, packet_info *pinfo)
777 struct ngap_private_data *ngap_data = ngap_get_private_data(pinfo);
778 GlobalRANNodeID_enum ranmode_id = (GlobalRANNodeID_enum)-1;
780 if (ngap_data->ngap_conv) {
781 if (addresses_equal(addr, &ngap_data->ngap_conv->addr_a) && port == ngap_data->ngap_conv->port_a) {
782 ranmode_id = ngap_data->ngap_conv->ranmode_id_a;
783 } else if (addresses_equal(addr, &ngap_data->ngap_conv->addr_b) && port == ngap_data->ngap_conv->port_b) {
784 ranmode_id = ngap_data->ngap_conv->ranmode_id_b;
787 return ranmode_id;
790 static bool
791 ngap_is_nbiot_ue(packet_info *pinfo)
793 struct ngap_private_data *ngap_data = ngap_get_private_data(pinfo);
795 if (ngap_data->ngap_conv) {
796 wmem_tree_key_t tree_key[3];
797 uint32_t *id;
799 tree_key[0].length = 1;
800 tree_key[0].key = &ngap_data->ran_ue_ngap_id;
801 tree_key[1].length = 1;
802 tree_key[1].key = &pinfo->num;
803 tree_key[2].length = 0;
804 tree_key[2].key = NULL;
805 id = (uint32_t*)wmem_tree_lookup32_array_le(ngap_data->ngap_conv->nbiot_ran_ue_ngap_id, tree_key);
806 if (id && (*id == ngap_data->ran_ue_ngap_id)) {
807 return true;
810 return false;
813 static const true_false_string ngap_not_updated_updated = {
814 "Not updated",
815 "Updated"
818 #include "packet-ngap-fn.c"
820 static int dissect_ProtocolIEFieldValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
822 ngap_ctx_t ngap_ctx;
823 struct ngap_private_data *ngap_data = ngap_get_private_data(pinfo);
825 ngap_ctx.message_type = ngap_data->message_type;
826 ngap_ctx.ProcedureCode = ngap_data->procedure_code;
827 ngap_ctx.ProtocolIE_ID = ngap_data->protocol_ie_id;
828 ngap_ctx.ProtocolExtensionID = ngap_data->protocol_extension_id;
830 return (dissector_try_uint_with_data(ngap_ies_dissector_table, ngap_data->protocol_ie_id, tvb, pinfo, tree, false, &ngap_ctx)) ? tvb_captured_length(tvb) : 0;
832 /* Currently not used
833 static int dissect_ProtocolIEFieldPairFirstValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
835 struct ngap_private_data *ngap_data = ngap_get_private_data(pinfo);
837 return (dissector_try_uint(ngap_ies_p1_dissector_table, ngap_data->protocol_ie_id, tvb, pinfo, tree)) ? tvb_captured_length(tvb) : 0;
840 static int dissect_ProtocolIEFieldPairSecondValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
842 struct ngap_private_data *ngap_data = ngap_get_private_data(pinfo);
844 return (dissector_try_uint(ngap_ies_p2_dissector_table, ngap_data->protocol_ie_id, tvb, pinfo, tree)) ? tvb_captured_length(tvb) : 0;
848 static int dissect_ProtocolExtensionFieldExtensionValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
850 ngap_ctx_t ngap_ctx;
851 struct ngap_private_data *ngap_data = ngap_get_private_data(pinfo);
853 ngap_ctx.message_type = ngap_data->message_type;
854 ngap_ctx.ProcedureCode = ngap_data->procedure_code;
855 ngap_ctx.ProtocolIE_ID = ngap_data->protocol_ie_id;
856 ngap_ctx.ProtocolExtensionID = ngap_data->protocol_extension_id;
858 return (dissector_try_uint_with_data(ngap_extension_dissector_table, ngap_data->protocol_extension_id, tvb, pinfo, tree, true, &ngap_ctx)) ? tvb_captured_length(tvb) : 0;
861 static int dissect_InitiatingMessageValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
863 struct ngap_private_data *ngap_data = ngap_get_private_data(pinfo);
865 return (dissector_try_uint_with_data(ngap_proc_imsg_dissector_table, ngap_data->procedure_code, tvb, pinfo, tree, true, data)) ? tvb_captured_length(tvb) : 0;
868 static int dissect_SuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
870 struct ngap_private_data *ngap_data = ngap_get_private_data(pinfo);
872 return (dissector_try_uint_with_data(ngap_proc_sout_dissector_table, ngap_data->procedure_code, tvb, pinfo, tree, true, data)) ? tvb_captured_length(tvb) : 0;
875 static int dissect_UnsuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
877 struct ngap_private_data *ngap_data = ngap_get_private_data(pinfo);
879 return (dissector_try_uint_with_data(ngap_proc_uout_dissector_table, ngap_data->procedure_code, tvb, pinfo, tree, true, data)) ? tvb_captured_length(tvb) : 0;
882 static int dissect_QosFlowAdditionalInfoListRel_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
884 if (ngap_get_private_data(pinfo)->qos_flow_add_info_rel_type == 0)
885 return dissect_QosFlowAdditionalInfoListRelCom_PDU(tvb, pinfo, tree, data);
886 else
887 return dissect_QosFlowAdditionalInfoListRelRes_PDU(tvb, pinfo, tree, data);
890 static void
891 ngap_stats_tree_init(stats_tree *st)
893 st_node_packets = stats_tree_create_node(st, st_str_packets, 0, STAT_DT_INT, true);
894 st_node_packet_types = stats_tree_create_pivot(st, st_str_packet_types, st_node_packets);
897 static tap_packet_status
898 ngap_stats_tree_packet(stats_tree* st, packet_info* pinfo _U_,
899 epan_dissect_t* edt _U_ , const void* p, tap_flags_t flags _U_)
901 const struct ngap_tap_t *pi = (const struct ngap_tap_t *) p;
903 tick_stat_node(st, st_str_packets, 0, false);
904 stats_tree_tick_pivot(st, st_node_packet_types,
905 val_to_str(pi->ngap_mtype, mtype_names,
906 "Unknown packet type (%d)"));
907 return TAP_PACKET_REDRAW;
910 static void set_stats_message_type(packet_info *pinfo, int type)
912 struct ngap_private_data* priv_data = ngap_get_private_data(pinfo);
913 priv_data->stats_tap->ngap_mtype = type;
917 static int
918 dissect_ngap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
920 proto_item *ngap_item = NULL;
921 proto_tree *ngap_tree = NULL;
922 conversation_t *conversation;
923 struct ngap_private_data *ngap_data;
924 struct ngap_tap_t *ngap_info;
926 /* make entry in the Protocol column on summary display */
927 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NGAP");
928 col_clear(pinfo->cinfo, COL_INFO);
930 ngap_info = wmem_new(pinfo->pool, struct ngap_tap_t);
931 ngap_info->ngap_mtype = 0; /* unknown/invalid */
933 /* create the ngap protocol tree */
934 ngap_item = proto_tree_add_item(tree, proto_ngap, tvb, 0, -1, ENC_NA);
935 ngap_tree = proto_item_add_subtree(ngap_item, ett_ngap);
937 /* Store top-level tree */
938 top_tree = ngap_tree;
940 /* Add stats tap to private struct */
941 struct ngap_private_data *priv_data = ngap_get_private_data(pinfo);
942 priv_data->stats_tap = ngap_info;
944 ngap_data = ngap_get_private_data(pinfo);
945 conversation = find_or_create_conversation(pinfo);
946 ngap_data->ngap_conv = (struct ngap_conv_info *)conversation_get_proto_data(conversation, proto_ngap);
947 if (!ngap_data->ngap_conv) {
948 ngap_data->ngap_conv = wmem_new0(wmem_file_scope(), struct ngap_conv_info);
949 copy_address_wmem(wmem_file_scope(), &ngap_data->ngap_conv->addr_a, &pinfo->src);
950 ngap_data->ngap_conv->port_a = pinfo->srcport;
951 ngap_data->ngap_conv->ranmode_id_a = (GlobalRANNodeID_enum)-1;
952 copy_address_wmem(wmem_file_scope(), &ngap_data->ngap_conv->addr_b, &pinfo->dst);
953 ngap_data->ngap_conv->port_b = pinfo->destport;
954 ngap_data->ngap_conv->ranmode_id_b = (GlobalRANNodeID_enum)-1;
955 ngap_data->ngap_conv->nbiot_ta = wmem_map_new(wmem_file_scope(), wmem_int64_hash, g_int64_equal);
956 ngap_data->ngap_conv->nbiot_ran_ue_ngap_id = wmem_tree_new(wmem_file_scope());
957 conversation_add_proto_data(conversation, proto_ngap, ngap_data->ngap_conv);
960 dissect_NGAP_PDU_PDU(tvb, pinfo, ngap_tree, NULL);
962 tap_queue_packet(ngap_tap, pinfo, ngap_info);
963 return tvb_captured_length(tvb);
966 static bool
967 find_n2_info_content(char *json_data, jsmntok_t *token, const char *n2_info_content,
968 const char *content_id, dissector_handle_t *subdissector)
970 jsmntok_t *n2_info_content_token, *ngap_data_token;
971 char *str;
972 double ngap_msg_type;
974 n2_info_content_token = json_get_object(json_data, token, n2_info_content);
975 if (!n2_info_content_token)
976 return false;
977 ngap_data_token = json_get_object(json_data, n2_info_content_token, "ngapData");
978 if (!ngap_data_token)
979 return false;
980 str = json_get_string(json_data, ngap_data_token, "contentId");
981 if (!str || strcmp(str, content_id))
982 return false;
983 str = json_get_string(json_data, n2_info_content_token, "ngapIeType");
984 if (str)
985 *subdissector = dissector_get_string_handle(ngap_n2_ie_type_dissector_table, str);
986 else if (json_get_double(json_data, n2_info_content_token, "ngapMessageType", &ngap_msg_type))
987 *subdissector = ngap_handle;
988 else
989 *subdissector = NULL;
990 return true;
993 /* 3GPP TS 29.502 chapter 6.1.6.4.3 and 29.518 chapter 6.1.6.4.3 */
994 static int
995 dissect_ngap_media_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
997 int ret;
998 char *json_data;
999 const char *n2_info_class;
1000 jsmntok_t *tokens, *cur_tok;
1001 dissector_handle_t subdissector = NULL;
1002 tvbuff_t* json_tvb = (tvbuff_t*)p_get_proto_data(pinfo->pool, pinfo, proto_json, 0);
1003 media_content_info_t *content_info = (media_content_info_t *)data;
1005 if (!json_tvb || !content_info || !content_info->content_id)
1006 return 0;
1008 json_data = tvb_get_string_enc(pinfo->pool, json_tvb, 0, tvb_reported_length(json_tvb), ENC_UTF_8|ENC_NA);
1009 ret = json_parse(json_data, NULL, 0);
1010 if (ret <= 0)
1011 return 0;
1012 tokens = wmem_alloc_array(pinfo->pool, jsmntok_t, ret);
1013 if (json_parse(json_data, tokens, ret) <= 0)
1014 return 0;
1015 cur_tok = json_get_object(json_data, tokens, "n2InfoContainer");
1016 if (!cur_tok) {
1017 /* look for n2Information too*/
1018 cur_tok = json_get_object(json_data, tokens, "n2Information");
1020 if (cur_tok) {
1021 n2_info_class = json_get_string(json_data, cur_tok, "n2InformationClass");
1022 if (n2_info_class) {
1023 if (!strcmp(n2_info_class, "SM")) {
1024 cur_tok = json_get_object(json_data, cur_tok, "smInfo");
1025 if (cur_tok && find_n2_info_content(json_data, cur_tok, "n2InfoContent",
1026 content_info->content_id, &subdissector))
1027 goto found;
1029 if (!strcmp(n2_info_class, "RAN")) {
1030 cur_tok = json_get_object(json_data, cur_tok, "ranInfo");
1031 if (cur_tok && find_n2_info_content(json_data, cur_tok, "n2InfoContent",
1032 content_info->content_id, &subdissector))
1033 goto found;
1035 if (!strcmp(n2_info_class, "NRPPa")) {
1036 cur_tok = json_get_object(json_data, cur_tok, "nrppaInfo");
1037 if (cur_tok && find_n2_info_content(json_data, cur_tok, "nrppaPdu",
1038 content_info->content_id, &subdissector))
1039 goto found;
1041 if (!strcmp(n2_info_class, "PWS") ||
1042 !strcmp(n2_info_class, "PWS-BCAL") ||
1043 !strcmp(n2_info_class, "PWS-RF")) {
1044 cur_tok = json_get_object(json_data, cur_tok, "pwsInfo");
1045 if (cur_tok && find_n2_info_content(json_data, cur_tok, "pwsContainer",
1046 content_info->content_id, &subdissector))
1047 goto found;
1051 cur_tok = json_get_object(json_data, tokens, "n2SmInfo");
1052 if (cur_tok) {
1053 const char *content_id_str = json_get_string(json_data, cur_tok, "contentId");
1054 if (content_id_str && !strcmp(content_id_str, content_info->content_id)) {
1055 const char *str = json_get_string(json_data, tokens, "n2SmInfoType");
1056 if (str)
1057 subdissector = dissector_get_string_handle(ngap_n2_ie_type_dissector_table, str);
1058 else
1059 subdissector = NULL;
1060 goto found;
1063 if (find_n2_info_content(json_data, tokens, "n2MbsSmInfo",
1064 content_info->content_id, &subdissector))
1065 goto found;
1066 cur_tok = json_get_array(json_data, tokens, "pduSessionList");
1067 if (cur_tok) {
1068 int i, count;
1069 count = json_get_array_len(cur_tok);
1070 for (i = 0; i < count; i++) {
1071 jsmntok_t *array_tok = json_get_array_index(cur_tok, i);
1072 if (find_n2_info_content(json_data, array_tok, "n2InfoContent",
1073 content_info->content_id, &subdissector))
1074 goto found;
1077 if (find_n2_info_content(json_data, tokens, "sourceToTargetData",
1078 content_info->content_id, &subdissector))
1079 goto found;
1080 if (find_n2_info_content(json_data, tokens, "targetToSourceData",
1081 content_info->content_id, &subdissector))
1082 goto found;
1083 if (find_n2_info_content(json_data, tokens, "targetToSourceFailureData",
1084 content_info->content_id, &subdissector))
1085 goto found;
1086 if (find_n2_info_content(json_data, tokens, "ueRadioCapability",
1087 content_info->content_id, &subdissector))
1088 goto found;
1090 found:
1091 if (subdissector) {
1092 proto_item *ngap_item;
1093 proto_tree *ngap_tree;
1094 bool save_writable;
1096 col_append_sep_str(pinfo->cinfo, COL_PROTOCOL, "/", "NGAP");
1097 if (subdissector != ngap_handle) {
1098 ngap_item = proto_tree_add_item(tree, proto_ngap, tvb, 0, -1, ENC_NA);
1099 ngap_tree = proto_item_add_subtree(ngap_item, ett_ngap);
1100 } else {
1101 ngap_tree = tree;
1103 save_writable = col_get_writable(pinfo->cinfo, COL_PROTOCOL);
1104 col_set_writable(pinfo->cinfo, COL_PROTOCOL, false);
1105 call_dissector_with_data(subdissector, tvb, pinfo, ngap_tree, NULL);
1106 col_set_writable(pinfo->cinfo, COL_PROTOCOL, save_writable);
1107 return tvb_captured_length(tvb);
1108 } else {
1109 return 0;
1113 static void
1114 apply_ngap_prefs(void)
1116 gbl_ngapSctpRange = prefs_get_range_value("ngap", "sctp.port");
1119 /*--- proto_reg_handoff_ngap ---------------------------------------*/
1120 void
1121 proto_reg_handoff_ngap(void)
1123 nas_5gs_handle = find_dissector_add_dependency("nas-5gs", proto_ngap);
1124 nr_rrc_ue_radio_paging_info_handle = find_dissector_add_dependency("nr-rrc.ue_radio_paging_info", proto_ngap);
1125 nr_rrc_ue_radio_access_cap_info_handle = find_dissector_add_dependency("nr-rrc.ue_radio_access_cap_info", proto_ngap);
1126 lte_rrc_ue_radio_paging_info_handle = find_dissector_add_dependency("lte-rrc.ue_radio_paging_info", proto_ngap);
1127 lte_rrc_ue_radio_access_cap_info_handle = find_dissector_add_dependency("lte-rrc.ue_radio_access_cap_info", proto_ngap);
1128 lte_rrc_ue_radio_paging_info_nb_handle = find_dissector_add_dependency("lte-rrc.ue_radio_paging_info.nb", proto_ngap);
1129 lte_rrc_ue_radio_access_cap_info_nb_handle = find_dissector_add_dependency("lte-rrc.ue_radio_access_cap_info.nb", proto_ngap);
1130 dissector_add_uint("sctp.ppi", NGAP_PROTOCOL_ID, ngap_handle);
1131 dissector_add_uint("ngap.extension", id_QosFlowAdditionalInfoList, create_dissector_handle(dissect_QosFlowAdditionalInfoListRel_PDU, proto_ngap));
1132 #include "packet-ngap-dis-tab.c"
1134 dissector_add_string("media_type", "application/vnd.3gpp.ngap", ngap_media_type_handle);
1136 nrppa_handle = find_dissector_add_dependency("nrppa", proto_ngap);
1137 proto_json = proto_get_id_by_filter_name("json");
1139 dissector_add_uint_with_preference("sctp.port", SCTP_PORT_NGAP, ngap_handle);
1141 stats_tree_register("ngap", "ngap", "NGAP", 0,
1142 ngap_stats_tree_packet, ngap_stats_tree_init, NULL);
1143 apply_ngap_prefs();
1146 /*--- proto_register_ngap -------------------------------------------*/
1147 void proto_register_ngap(void) {
1149 /* List of fields */
1151 static hf_register_info hf[] = {
1152 { &hf_ngap_transportLayerAddressIPv4,
1153 { "TransportLayerAddress (IPv4)", "ngap.TransportLayerAddressIPv4",
1154 FT_IPv4, BASE_NONE, NULL, 0,
1155 NULL, HFILL }},
1156 { &hf_ngap_transportLayerAddressIPv6,
1157 { "TransportLayerAddress (IPv6)", "ngap.TransportLayerAddressIPv6",
1158 FT_IPv6, BASE_NONE, NULL, 0,
1159 NULL, HFILL }},
1160 { &hf_ngap_WarningMessageContents_nb_pages,
1161 { "Number of Pages", "ngap.WarningMessageContents.nb_pages",
1162 FT_UINT8, BASE_DEC, NULL, 0,
1163 NULL, HFILL }},
1164 { &hf_ngap_SerialNumber_gs,
1165 { "Geographical Scope", "ngap.SerialNumber.gs",
1166 FT_UINT16, BASE_DEC, VALS(ngap_serialNumber_gs_vals), 0xc000,
1167 NULL, HFILL }},
1168 { &hf_ngap_SerialNumber_msg_code,
1169 { "Message Code", "ngap.SerialNumber.msg_code",
1170 FT_UINT16, BASE_DEC, NULL, 0x3ff0,
1171 NULL, HFILL }},
1172 { &hf_ngap_SerialNumber_upd_nb,
1173 { "Update Number", "ngap.SerialNumber.upd_nb",
1174 FT_UINT16, BASE_DEC, NULL, 0x000f,
1175 NULL, HFILL }},
1176 { &hf_ngap_WarningType_value,
1177 { "Warning Type Value", "ngap.WarningType.value",
1178 FT_UINT16, BASE_DEC, VALS(ngap_warningType_vals), 0xfe00,
1179 NULL, HFILL }},
1180 { &hf_ngap_WarningType_emergency_user_alert,
1181 { "Emergency User Alert", "ngap.WarningType.emergency_user_alert",
1182 FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0100,
1183 NULL, HFILL }},
1184 { &hf_ngap_WarningType_popup,
1185 { "Popup", "ngap.WarningType.popup",
1186 FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0080,
1187 NULL, HFILL }},
1188 { &hf_ngap_WarningMessageContents_decoded_page,
1189 { "Decoded Page", "ngap.WarningMessageContents.decoded_page",
1190 FT_STRING, BASE_NONE, NULL, 0,
1191 NULL, HFILL }},
1192 { &hf_ngap_NGRANTraceID_TraceID,
1193 { "TraceID", "ngap.NGRANTraceID.TraceID",
1194 FT_UINT24, BASE_HEX, NULL, 0,
1195 NULL, HFILL }},
1196 { &hf_ngap_NGRANTraceID_TraceRecordingSessionReference,
1197 { "TraceRecordingSessionReference", "ngap.NGRANTraceID.TraceRecordingSessionReference",
1198 FT_UINT16, BASE_HEX, NULL, 0,
1199 NULL, HFILL }},
1200 { &hf_ngap_InterfacesToTrace_NG_C,
1201 { "NG-C", "ngap.InterfacesToTrace.NG_C",
1202 FT_BOOLEAN, 8, NULL, 0x80,
1203 NULL, HFILL }},
1204 { &hf_ngap_InterfacesToTrace_Xn_C,
1205 { "Xn-C", "ngap.InterfacesToTrace.Xn_C",
1206 FT_BOOLEAN, 8, NULL, 0x40,
1207 NULL, HFILL }},
1208 { &hf_ngap_InterfacesToTrace_Uu,
1209 { "Uu", "ngap.InterfacesToTrace.Uu",
1210 FT_BOOLEAN, 8, NULL, 0x20,
1211 NULL, HFILL }},
1212 { &hf_ngap_InterfacesToTrace_F1_C,
1213 { "F1-C", "ngap.InterfacesToTrace.F1_C",
1214 FT_BOOLEAN, 8, NULL, 0x10,
1215 NULL, HFILL }},
1216 { &hf_ngap_InterfacesToTrace_E1,
1217 { "E1", "ngap.InterfacesToTrace.E1",
1218 FT_BOOLEAN, 8, NULL, 0x08,
1219 NULL, HFILL }},
1220 { &hf_ngap_InterfacesToTrace_reserved,
1221 { "Reserved", "ngap.InterfacesToTrace.reserved",
1222 FT_UINT8, BASE_HEX, NULL, 0x07,
1223 NULL, HFILL }},
1224 { &hf_ngap_RATRestrictionInformation_e_UTRA,
1225 { "e-UTRA", "ngap.RATRestrictionInformation.e_UTRA",
1226 FT_BOOLEAN, 8, TFS(&tfs_restricted_not_restricted), 0x80,
1227 NULL, HFILL }},
1228 { &hf_ngap_RATRestrictionInformation_nR,
1229 { "nR", "ngap.RATRestrictionInformation.nR",
1230 FT_BOOLEAN, 8, TFS(&tfs_restricted_not_restricted), 0x40,
1231 NULL, HFILL }},
1232 { &hf_ngap_RATRestrictionInformation_nR_unlicensed,
1233 { "nR-unlicensed", "ngap.RATRestrictionInformation.nR_unlicensed",
1234 FT_BOOLEAN, 8, TFS(&tfs_restricted_not_restricted), 0x20,
1235 NULL, HFILL }},
1236 { &hf_ngap_RATRestrictionInformation_reserved,
1237 { "reserved", "ngap.RATRestrictionInformation.reserved",
1238 FT_UINT8, BASE_HEX, NULL, 0x1f,
1239 NULL, HFILL }},
1240 { &hf_ngap_primaryRATRestriction_e_UTRA,
1241 { "e-UTRA", "ngap.primaryRATRestriction.e_UTRA",
1242 FT_BOOLEAN, 8, TFS(&tfs_restricted_not_restricted), 0x80,
1243 NULL, HFILL }},
1244 { &hf_ngap_primaryRATRestriction_nR,
1245 { "nR", "ngap.primaryRATRestriction.nR",
1246 FT_BOOLEAN, 8, TFS(&tfs_restricted_not_restricted), 0x40,
1247 NULL, HFILL }},
1248 { &hf_ngap_primaryRATRestriction_nR_unlicensed,
1249 { "nR-unlicensed", "ngap.primaryRATRestriction.nR_unlicensed",
1250 FT_BOOLEAN, 8, TFS(&tfs_restricted_not_restricted), 0x20,
1251 NULL, HFILL }},
1252 { &hf_ngap_primaryRATRestriction_nR_LEO,
1253 { "nR-LEO", "ngap.primaryRATRestriction.nR_LEO",
1254 FT_BOOLEAN, 8, TFS(&tfs_restricted_not_restricted), 0x10,
1255 NULL, HFILL }},
1256 { &hf_ngap_primaryRATRestriction_nR_MEO,
1257 { "nR-MEO", "ngap.primaryRATRestriction.nR_MEO",
1258 FT_BOOLEAN, 8, TFS(&tfs_restricted_not_restricted), 0x08,
1259 NULL, HFILL }},
1260 { &hf_ngap_primaryRATRestriction_nR_GEO,
1261 { "nR-GEO", "ngap.primaryRATRestriction.nR_GEO",
1262 FT_BOOLEAN, 8, TFS(&tfs_restricted_not_restricted), 0x04,
1263 NULL, HFILL }},
1264 { &hf_ngap_primaryRATRestriction_nR_OTHERSAT,
1265 { "nR-OTHERSAT", "ngap.primaryRATRestriction.nR_OTHERSAT",
1266 FT_BOOLEAN, 8, TFS(&tfs_restricted_not_restricted), 0x02,
1267 NULL, HFILL }},
1268 { &hf_ngap_primaryRATRestriction_e_UTRA_LEO,
1269 { "e-UTRA-LEO", "ngap.primaryRATRestriction.e_UTRA_LEO",
1270 FT_BOOLEAN, 8, TFS(&tfs_restricted_not_restricted), 0x01,
1271 NULL, HFILL }},
1272 { &hf_ngap_primaryRATRestriction_e_UTRA_MEO,
1273 { "e-UTRA-MEO", "ngap.primaryRATRestriction.e_UTRA_MEO",
1274 FT_BOOLEAN, 8, TFS(&tfs_restricted_not_restricted), 0x80,
1275 NULL, HFILL }},
1276 { &hf_ngap_primaryRATRestriction_e_UTRA_GEO,
1277 { "e-UTRA-GEO", "ngap.primaryRATRestriction.e_UTRA_GEO",
1278 FT_BOOLEAN, 8, TFS(&tfs_restricted_not_restricted), 0x40,
1279 NULL, HFILL }},
1280 { &hf_ngap_primaryRATRestriction_e_UTRA_OTHERSAT,
1281 { "e-UTRA-OTHERSAT", "ngap.primaryRATRestriction.e_UTRA_LEO",
1282 FT_BOOLEAN, 8, TFS(&tfs_restricted_not_restricted), 0x20,
1283 NULL, HFILL }},
1284 { &hf_ngap_primaryRATRestriction_reserved,
1285 { "reserved", "ngap.primaryRATRestriction.reserved",
1286 FT_UINT8, BASE_HEX, NULL, 0x1f,
1287 NULL, HFILL }},
1288 { &hf_ngap_secondaryRATRestriction_e_UTRA,
1289 { "e-UTRA", "ngap.secondaryRATRestriction.e_UTRA",
1290 FT_BOOLEAN, 8, TFS(&tfs_restricted_not_restricted), 0x80,
1291 NULL, HFILL }},
1292 { &hf_ngap_secondaryRATRestriction_nR,
1293 { "nR", "ngap.secondaryRATRestriction.nR",
1294 FT_BOOLEAN, 8, TFS(&tfs_restricted_not_restricted), 0x40,
1295 NULL, HFILL }},
1296 { &hf_ngap_secondaryRATRestriction_e_UTRA_unlicensed,
1297 { "e-UTRA-unlicensed", "ngap.secondaryRATRestriction.e_UTRA_unlicensed",
1298 FT_BOOLEAN, 8, TFS(&tfs_restricted_not_restricted), 0x20,
1299 NULL, HFILL }},
1300 { &hf_ngap_secondaryRATRestriction_nR_unlicensed,
1301 { "nR-unlicensed", "ngap.secondaryRATRestriction.nR_unlicensed",
1302 FT_BOOLEAN, 8, TFS(&tfs_restricted_not_restricted), 0x10,
1303 NULL, HFILL }},
1304 { &hf_ngap_secondaryRATRestriction_reserved,
1305 { "reserved", "ngap.secondaryRATRestriction.reserved",
1306 FT_UINT8, BASE_HEX, NULL, 0x0f,
1307 NULL, HFILL }},
1308 { &hf_ngap_NrencryptionAlgorithms_nea1,
1309 { "128-NEA1", "ngap.NrencryptionAlgorithms.nea1",
1310 FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x8000,
1311 NULL, HFILL }},
1312 { &hf_ngap_NrencryptionAlgorithms_nea2,
1313 { "128-NEA2", "ngap.NrencryptionAlgorithms.nea2",
1314 FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x4000,
1315 NULL, HFILL }},
1316 { &hf_ngap_NrencryptionAlgorithms_nea3,
1317 { "128-NEA3", "ngap.NrencryptionAlgorithms.nea3",
1318 FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x2000,
1319 NULL, HFILL }},
1320 { &hf_ngap_NrencryptionAlgorithms_reserved,
1321 { "Reserved", "ngap.NrencryptionAlgorithms.reserved",
1322 FT_UINT16, BASE_HEX, NULL, 0x1fff,
1323 NULL, HFILL }},
1324 { &hf_ngap_NrintegrityProtectionAlgorithms_nia1,
1325 { "128-NIA1", "ngap.NrintegrityProtectionAlgorithms.nia1",
1326 FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x8000,
1327 NULL, HFILL }},
1328 { &hf_ngap_NrintegrityProtectionAlgorithms_nia2,
1329 { "128-NIA2", "ngap.NrintegrityProtectionAlgorithms.nia2",
1330 FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x4000,
1331 NULL, HFILL }},
1332 { &hf_ngap_NrintegrityProtectionAlgorithms_nia3,
1333 { "128-NIA3", "ngap.NrintegrityProtectionAlgorithms.nia3",
1334 FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x2000,
1335 NULL, HFILL }},
1336 { &hf_ngap_NrintegrityProtectionAlgorithms_reserved,
1337 { "Reserved", "ngap.NrintegrityProtectionAlgorithms.reserved",
1338 FT_UINT16, BASE_HEX, NULL, 0x1fff,
1339 NULL, HFILL }},
1340 { &hf_ngap_EUTRAencryptionAlgorithms_eea1,
1341 { "128-EEA1", "ngap.EUTRAencryptionAlgorithms.eea1",
1342 FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x8000,
1343 NULL, HFILL }},
1344 { &hf_ngap_EUTRAencryptionAlgorithms_eea2,
1345 { "128-EEA2", "ngap.EUTRAencryptionAlgorithms.eea2",
1346 FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x4000,
1347 NULL, HFILL }},
1348 { &hf_ngap_EUTRAencryptionAlgorithms_eea3,
1349 { "128-EEA3", "ngap.EUTRAencryptionAlgorithms.eea3",
1350 FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x2000,
1351 NULL, HFILL }},
1352 { &hf_ngap_EUTRAencryptionAlgorithms_reserved,
1353 { "Reserved", "ngap.EUTRAencryptionAlgorithms.reserved",
1354 FT_UINT16, BASE_HEX, NULL, 0x1fff,
1355 NULL, HFILL }},
1356 { &hf_ngap_EUTRAintegrityProtectionAlgorithms_eia1,
1357 { "128-EIA1", "ngap.EUTRAintegrityProtectionAlgorithms.eia1",
1358 FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x8000,
1359 NULL, HFILL }},
1360 { &hf_ngap_EUTRAintegrityProtectionAlgorithms_eia2,
1361 { "128-EIA2", "ngap.EUTRAintegrityProtectionAlgorithms.eia2",
1362 FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x4000,
1363 NULL, HFILL }},
1364 { &hf_ngap_EUTRAintegrityProtectionAlgorithms_eia3,
1365 { "128-EIA3", "ngap.EUTRAintegrityProtectionAlgorithms.eia3",
1366 FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x2000,
1367 NULL, HFILL }},
1368 { &hf_ngap_EUTRAintegrityProtectionAlgorithms_eia7,
1369 { "EIA7", "ngap.EUTRAintegrityProtectionAlgorithms.eia7",
1370 FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x0200,
1371 NULL, HFILL }},
1372 { &hf_ngap_EUTRAintegrityProtectionAlgorithms_reserved,
1373 { "Reserved", "ngap.EUTRAintegrityProtectionAlgorithms.reserved",
1374 FT_UINT16, BASE_HEX, NULL, 0x1dff,
1375 NULL, HFILL }},
1376 { &hf_ngap_MeasurementsToActivate_M1,
1377 { "M1", "ngap.MeasurementsToActivate.M1",
1378 FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x80,
1379 NULL, HFILL }},
1380 { &hf_ngap_MeasurementsToActivate_M2,
1381 { "M2", "ngap.MeasurementsToActivate.M2",
1382 FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x40,
1383 NULL, HFILL }},
1384 { &hf_ngap_MeasurementsToActivate_M4,
1385 { "M4", "ngap.MeasurementsToActivate.M4",
1386 FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x20,
1387 NULL, HFILL }},
1388 { &hf_ngap_MeasurementsToActivate_M5,
1389 { "M5", "ngap.MeasurementsToActivate.M5",
1390 FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x10,
1391 NULL, HFILL }},
1392 { &hf_ngap_MeasurementsToActivate_M6,
1393 { "M6", "ngap.MeasurementsToActivate.M6",
1394 FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x08,
1395 NULL, HFILL }},
1396 { &hf_ngap_MeasurementsToActivate_M7,
1397 { "M7", "ngap.MeasurementsToActivate.M7",
1398 FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x04,
1399 NULL, HFILL }},
1400 { &hf_ngap_MeasurementsToActivate_M1_from_event,
1401 { "M1 from event", "ngap.MeasurementsToActivate.M1_from_event",
1402 FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x02,
1403 NULL, HFILL }},
1404 { &hf_ngap_MeasurementsToActivate_reserved,
1405 { "Reserved", "ngap.MeasurementsToActivate.reserved",
1406 FT_BOOLEAN, 8, NULL, 0x01,
1407 NULL, HFILL }},
1408 { &hf_ngap_MDT_Location_Information_GNSS,
1409 { "GNSS", "ngap.MDT_Location_Information.GNSS",
1410 FT_BOOLEAN, 8, TFS(&tfs_activated_deactivated), 0x80,
1411 NULL, HFILL }},
1412 { &hf_ngap_MDT_Location_Information_reserved,
1413 { "Reserved", "ngap.MDT_Location_Information.reserved",
1414 FT_UINT8, BASE_HEX, NULL, 0x7f,
1415 NULL, HFILL }},
1416 { &hf_ngap_GlobalCable_ID_str,
1417 { "GlobalCable-ID", "ngap.GlobalCable_ID.str",
1418 FT_STRING, BASE_NONE, NULL, 0,
1419 NULL, HFILL }},
1420 { &hf_ngap_UpdateFeedback_CN_PDB_DL,
1421 { "CN PDB DL", "ngap.UpdateFeedback.CN_PDB_DL",
1422 FT_BOOLEAN, 8, TFS(&ngap_not_updated_updated), 0x80,
1423 NULL, HFILL }},
1424 { &hf_ngap_UpdateFeedback_CN_PDB_UL,
1425 { "CN PDB UL", "ngap.UpdateFeedback.CN_PDB_UL",
1426 FT_BOOLEAN, 8, TFS(&ngap_not_updated_updated), 0x40,
1427 NULL, HFILL }},
1428 { &hf_ngap_UpdateFeedback_reserved,
1429 { "Reserved", "ngap.UpdateFeedback.reserved",
1430 FT_UINT8, BASE_HEX, NULL, 0x3f,
1431 NULL, HFILL }},
1432 #include "packet-ngap-hfarr.c"
1435 /* List of subtrees */
1436 static int *ett[] = {
1437 &ett_ngap,
1438 &ett_ngap_TransportLayerAddress,
1439 &ett_ngap_DataCodingScheme,
1440 &ett_ngap_SerialNumber,
1441 &ett_ngap_WarningType,
1442 &ett_ngap_WarningMessageContents,
1443 &ett_ngap_PLMNIdentity,
1444 &ett_ngap_NGAP_Message,
1445 &ett_ngap_NGRANTraceID,
1446 &ett_ngap_InterfacesToTrace,
1447 &ett_ngap_SourceToTarget_TransparentContainer,
1448 &ett_ngap_TargetToSource_TransparentContainer,
1449 &ett_ngap_RRCContainer,
1450 &ett_ngap_RATRestrictionInformation,
1451 &ett_ngap_primaryRATRestriction,
1452 &ett_ngap_secondaryRATRestriction,
1453 &ett_ngap_NrencryptionAlgorithms,
1454 &ett_ngap_NrintegrityProtectionAlgorithms,
1455 &ett_ngap_EUTRAencryptionAlgorithms,
1456 &ett_ngap_EUTRAintegrityProtectionAlgorithms,
1457 &ett_ngap_UERadioCapabilityForPagingOfNR,
1458 &ett_ngap_UERadioCapabilityForPagingOfEUTRA,
1459 &ett_ngap_UERadioCapability,
1460 &ett_ngap_LastVisitedEUTRANCellInformation,
1461 &ett_ngap_LastVisitedUTRANCellInformation,
1462 &ett_ngap_LastVisitedGERANCellInformation,
1463 &ett_ngap_NASSecurityParametersFromNGRAN,
1464 &ett_ngap_NASC,
1465 &ett_ngap_NAS_PDU,
1466 &ett_ngap_EN_DCSONConfigurationTransfer,
1467 &ett_ngap_BurstArrivalTime,
1468 &ett_ngap_CoverageEnhancementLevel,
1469 &ett_ngap_MDTModeEutra,
1470 &ett_ngap_MeasurementsToActivate,
1471 &ett_ngap_MDT_Location_Information,
1472 &ett_ngap_NRMobilityHistoryReport,
1473 &ett_ngap_LTEUERLFReportContainer,
1474 &ett_ngap_NRUERLFReportContainer,
1475 &ett_ngap_TargettoSource_Failure_TransparentContainer,
1476 &ett_ngap_UERadioCapabilityForPagingOfNB_IoT,
1477 &ett_ngap_GlobalCable_ID,
1478 &ett_ngap_UpdateFeedback,
1479 &ett_ngap_successfulHOReportContainer,
1480 &ett_ngap_successfulPSCellChangeReportContainer,
1481 #include "packet-ngap-ettarr.c"
1484 static ei_register_info ei[] = {
1485 { &ei_ngap_number_pages_le15, { "ngap.number_pages_le15", PI_MALFORMED, PI_ERROR, "Number of pages should be <=15", EXPFILL }}
1488 module_t *ngap_module;
1489 expert_module_t* expert_ngap;
1491 /* Register protocol */
1492 proto_ngap = proto_register_protocol(PNAME, PSNAME, PFNAME);
1493 /* Register fields and subtrees */
1494 proto_register_field_array(proto_ngap, hf, array_length(hf));
1495 proto_register_subtree_array(ett, array_length(ett));
1496 expert_ngap = expert_register_protocol(proto_ngap);
1497 expert_register_field_array(expert_ngap, ei, array_length(ei));
1499 /* Register dissector */
1500 ngap_handle = register_dissector("ngap", dissect_ngap, proto_ngap);
1501 ngap_media_type_handle = register_dissector("ngap_media_type", dissect_ngap_media_type, proto_ngap);
1503 /* Register dissector tables */
1504 ngap_ies_dissector_table = register_dissector_table("ngap.ies", "NGAP-PROTOCOL-IES", proto_ngap, FT_UINT32, BASE_DEC);
1505 ngap_ies_p1_dissector_table = register_dissector_table("ngap.ies.pair.first", "NGAP-PROTOCOL-IES-PAIR FirstValue", proto_ngap, FT_UINT32, BASE_DEC);
1506 ngap_ies_p2_dissector_table = register_dissector_table("ngap.ies.pair.second", "NGAP-PROTOCOL-IES-PAIR SecondValue", proto_ngap, FT_UINT32, BASE_DEC);
1507 ngap_extension_dissector_table = register_dissector_table("ngap.extension", "NGAP-PROTOCOL-EXTENSION", proto_ngap, FT_UINT32, BASE_DEC);
1508 ngap_proc_imsg_dissector_table = register_dissector_table("ngap.proc.imsg", "NGAP-ELEMENTARY-PROCEDURE InitiatingMessage", proto_ngap, FT_UINT32, BASE_DEC);
1509 ngap_proc_sout_dissector_table = register_dissector_table("ngap.proc.sout", "NGAP-ELEMENTARY-PROCEDURE SuccessfulOutcome", proto_ngap, FT_UINT32, BASE_DEC);
1510 ngap_proc_uout_dissector_table = register_dissector_table("ngap.proc.uout", "NGAP-ELEMENTARY-PROCEDURE UnsuccessfulOutcome", proto_ngap, FT_UINT32, BASE_DEC);
1511 ngap_n2_ie_type_dissector_table = register_dissector_table("ngap.n2_ie_type", "NGAP N2 IE Type", proto_ngap, FT_STRING, STRING_CASE_SENSITIVE);
1513 /* Register configuration options for ports */
1514 ngap_module = prefs_register_protocol(proto_ngap, apply_ngap_prefs);
1516 prefs_register_bool_preference(ngap_module, "dissect_container",
1517 "Dissect TransparentContainer",
1518 "Dissect TransparentContainers that are opaque to NGAP",
1519 &ngap_dissect_container);
1520 prefs_register_enum_preference(ngap_module, "dissect_target_ng_ran_container_as",
1521 "Dissect target NG-RAN container as",
1522 "Select whether target NG-RAN container should be decoded automatically"
1523 " (based on NG Setup procedure) or manually",
1524 &ngap_dissect_target_ng_ran_container_as, ngap_target_ng_ran_container_vals, false);
1525 prefs_register_enum_preference(ngap_module, "dissect_lte_container_as", "Dissect LTE container as",
1526 "Select whether LTE container should be dissected as NB-IOT or legacy LTE",
1527 &ngap_dissect_lte_container_as, ngap_lte_container_vals, false);
1529 ngap_tap = register_tap("ngap");
1533 * Editor modelines
1535 * Local Variables:
1536 * c-basic-offset: 2
1537 * tab-width: 8
1538 * indent-tabs-mode: nil
1539 * End:
1541 * ex: set shiftwidth=2 tabstop=8 expandtab:
1542 * :indentSize=2:tabSize=8:noTabs=true: