File: | builds/wireshark/wireshark/epan/dissectors/packet-ecpri.c |
Warning: | line 802, column 25 Value stored to 'remaining_length' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* packet-ecpri.c |
2 | * Routines for eCPRI dissection |
3 | * Copyright 2019, Maximilian Kohler <[email protected]> |
4 | * Copyright 2024, Tomasz Woszczynski <[email protected]> |
5 | * |
6 | * Wireshark - Network traffic analyzer |
7 | * By Gerald Combs <[email protected]> |
8 | * Copyright 1998 Gerald Combs |
9 | * |
10 | * SPDX-License-Identifier: GPL-2.0-or-later |
11 | * |
12 | * ------------------------------------------------------------------------------------------------ |
13 | * eCPRI Transport Network V1.2 -- Specifications |
14 | * http://www.cpri.info/downloads/Requirements_for_the_eCPRI_Transport_Network_V1_2_2018_06_25.pdf |
15 | * eCPRI Transport Network V2.0 -- Specifications |
16 | * https://www.cpri.info/downloads/eCPRI_v_2.0_2019_05_10c.pdf |
17 | * |
18 | * May carry ORAN FH-CUS (packet-oran.c) - Message Types, 0, 2, 5 |
19 | * See https://specifications.o-ran.org/specifications, WG4, Fronthaul Interfaces Workgroup |
20 | * ------------------------------------------------------------------------------------------------ |
21 | */ |
22 | |
23 | #include "config.h" |
24 | #include <epan/packet.h> |
25 | #include <epan/prefs.h> |
26 | #include <epan/expert.h> |
27 | #include <epan/etypes.h> |
28 | #include <epan/tfs.h> |
29 | #include <epan/unit_strings.h> |
30 | #include <proto.h> |
31 | |
32 | #include "epan/dissectors/packet-ptp.h" |
33 | |
34 | /**************************************************************************************************/ |
35 | /* Definition for eCPRI lengths */ |
36 | /**************************************************************************************************/ |
37 | /* eCPRI Common Header (4 Bytes) */ |
38 | #define ECPRI_HEADER_LENGTH4 4 |
39 | /* Message Type Length */ |
40 | #define ECPRI_MSG_TYPE_0_PAYLOAD_MIN_LENGTH4 4 |
41 | #define ECPRI_MSG_TYPE_1_PAYLOAD_MIN_LENGTH4 4 |
42 | #define ECPRI_MSG_TYPE_2_PAYLOAD_MIN_LENGTH4 4 |
43 | #define ECPRI_MSG_TYPE_3_PAYLOAD_MIN_LENGTH8 8 |
44 | #define ECPRI_MSG_TYPE_4_PAYLOAD_MIN_LENGTH12 12 |
45 | #define ECPRI_MSG_TYPE_5_PAYLOAD_MIN_LENGTH20 20 |
46 | #define ECPRI_MSG_TYPE_6_PAYLOAD_MIN_LENGTH3 3 |
47 | #define ECPRI_MSG_TYPE_7_PAYLOAD_MIN_LENGTH4 4 |
48 | #define ECPRI_MSG_TYPE_8_PAYLOAD_MIN_LENGTH9 9 |
49 | #define ECPRI_MSG_TYPE_11_PAYLOAD_LENGTH12 12 |
50 | #define ECPRI_MSG_TYPE_7_ELEMENT_SIZE8 8 |
51 | |
52 | /**************************************************************************************************/ |
53 | /* Definition for Action Types in Message Type 5: One-way Delay Measurement */ |
54 | /**************************************************************************************************/ |
55 | #define ECPRI_MSG_TYPE_5_REQ0x00 0x00 |
56 | #define ECPRI_MSG_TYPE_5_REQ_FOLLOWUP0x01 0x01 |
57 | #define ECPRI_MSG_TYPE_5_RESPONSE0x02 0x02 |
58 | #define ECPRI_MSG_TYPE_5_REMOTE_REQ0x03 0x03 |
59 | #define ECPRI_MSG_TYPE_5_REMOTE_REQ_FOLLOWUP0x04 0x04 |
60 | #define ECPRI_MSG_TYPE_5_FOLLOWUP0x05 0x05 |
61 | #define ECPRI_MSG_TYPE_5_RESERVED_MIN0x06 0x06 |
62 | #define ECPRI_MSG_TYPE_5_RESERVED_MAX0xFF 0xFF |
63 | |
64 | /**************************************************************************************************/ |
65 | /* Definition for Event Types in Message Type 7: Event Indication */ |
66 | /**************************************************************************************************/ |
67 | #define ECPRI_MSG_TYPE_7_FAULT_INDICATION0x00 0x00 |
68 | #define ECPRI_MSG_TYPE_7_FAULT_INDICATION_ACK0x01 0x01 |
69 | #define ECPRI_MSG_TYPE_7_NOTIF_INDICATION0x02 0x02 |
70 | #define ECPRI_MSG_TYPE_7_SYNC_REQUEST0x03 0x03 |
71 | #define ECPRI_MSG_TYPE_7_SYNC_ACK0x04 0x04 |
72 | #define ECPRI_MSG_TYPE_7_SYNC_END_INDICATION0x05 0x05 |
73 | #define ECPRI_MSG_TYPE_7_RESERVED_MIN0x06 0x06 |
74 | #define ECPRI_MSG_TYPE_7_RESERVED_MAX0xFF 0xFF |
75 | |
76 | /**************************************************************************************************/ |
77 | /* Definition for Fault/Notification Ranges in Message Type 7: Event Indication */ |
78 | /**************************************************************************************************/ |
79 | #define ECPRI_MSG_TYPE_7_FAULTS_MIN0x000 0x000 |
80 | #define ECPRI_MSG_TYPE_7_FAULTS_MAX0x3FF 0x3FF |
81 | #define ECPRI_MSG_TYPE_7_NOTIF_MIN0x400 0x400 |
82 | #define ECPRI_MSG_TYPE_7_NOTIF_MAX0x7FF 0x7FF |
83 | #define ECPRI_MSG_TYPE_7_VENDOR_MIN0x800 0x800 |
84 | #define ECPRI_MSG_TYPE_7_VENDOR_MAX0xFFF 0xFFF |
85 | |
86 | /**************************************************************************************************/ |
87 | /* Definition for Action Types in Message Type 11: IWF Delay Control */ |
88 | /**************************************************************************************************/ |
89 | #define ECPRI_MSG_TYPE_11_REQUEST_GET_DELAYS0x00 0x00 |
90 | #define ECPRI_MSG_TYPE_11_RESPONSE_GET_DELAYS0x01 0x01 |
91 | #define ECPRI_MSG_TYPE_11_RESERVED_MIN0x02 0x02 |
92 | #define ECPRI_MSG_TYPE_11_RESERVED_MAX0xFF 0xFF |
93 | |
94 | /**************************************************************************************************/ |
95 | /* Function Prototypes */ |
96 | /**************************************************************************************************/ |
97 | void proto_register_ecpri(void); |
98 | void proto_reg_handoff_ecpri(void); |
99 | |
100 | /**************************************************************************************************/ |
101 | /* Initialize the subtree pointers */ |
102 | /**************************************************************************************************/ |
103 | static int ett_ecpri; |
104 | static int ett_ecpri_header; |
105 | static int ett_ecpri_payload; |
106 | static int ett_ecpri_timestamp; |
107 | static int ett_ecpri_element; |
108 | |
109 | /**************************************************************************************************/ |
110 | /* Initialize the protocol and registered fields */ |
111 | /**************************************************************************************************/ |
112 | static int proto_ecpri; |
113 | |
114 | static int hf_payload; |
115 | |
116 | /* Fields for eCPRI Common Header */ |
117 | static int hf_common_header; |
118 | static int hf_common_header_ecpri_protocol_revision; |
119 | static int hf_common_header_reserved; |
120 | static int hf_common_header_c_bit; |
121 | static int hf_common_header_ecpri_message_type; |
122 | static int hf_common_header_ecpri_payload_size; |
123 | |
124 | /* Fields for Message Type 0: IQ Data */ |
125 | static int hf_iq_data_pc_id; |
126 | static int hf_iq_data_seq_id; |
127 | static int hf_iq_data_iq_samples_of_user_data; |
128 | |
129 | /* Fields for Message Type 1: Bit Sequence */ |
130 | static int hf_bit_sequence_pc_id; |
131 | static int hf_bit_sequence_seq_id; |
132 | static int hf_bit_sequence_bit_sequence_of_user_data; |
133 | |
134 | /* Fields for Message Type 2: Real-Time Control Data */ |
135 | static int hf_real_time_control_data_rtc_id; |
136 | static int hf_real_time_control_data_seq_id; |
137 | static int hf_real_time_control_data_rtc_data; |
138 | |
139 | /* Fields for Message Type 3: Generic Data Transfer */ |
140 | static int hf_generic_data_transfer_pc_id; |
141 | static int hf_generic_data_transfer_seq_id; |
142 | static int hf_generic_data_transfer_data_transferred; |
143 | |
144 | /* Fields for Message Type 4: Remote Memory Access */ |
145 | static int hf_remote_memory_access_id; |
146 | static int hf_remote_memory_access_read_write; |
147 | static int hf_remote_memory_access_request_response; |
148 | static int hf_remote_memory_access_element_id; |
149 | static int hf_remote_memory_access_address; |
150 | static int hf_remote_memory_access_data_length; |
151 | static int hf_remote_memory_access_data; |
152 | |
153 | /* Fields for Message Type 5: One-Way Delay Measurement */ |
154 | static int hf_one_way_delay_measurement_id; |
155 | static int hf_one_way_delay_measurement_action_type; |
156 | static int hf_one_way_delay_measurement_timestamp; |
157 | static int hf_one_way_delay_measurement_timestamp_seconds; |
158 | static int hf_one_way_delay_measurement_timestamp_nanoseconds; |
159 | static int hf_one_way_delay_measurement_compensation_value; |
160 | static int hf_one_way_delay_measurement_compensation_value_subns; |
161 | static int hf_one_way_delay_measurement_dummy_bytes; |
162 | |
163 | /* Fields for Message Type 6: Remote Reset */ |
164 | static int hf_remote_reset_reset_id; |
165 | static int hf_remote_reset_reset_code; |
166 | static int hf_remote_reset_vendor_specific_payload; |
167 | |
168 | /* Fields for Message Type 7: Event Indication */ |
169 | static int hf_event_indication_event_id; |
170 | static int hf_event_indication_event_type; |
171 | static int hf_event_indication_sequence_number; |
172 | static int hf_event_indication_number_of_faults_notifications; |
173 | static int hf_event_indication_element; |
174 | static int hf_event_indication_element_id; |
175 | static int hf_event_indication_raise_cease; |
176 | static int hf_event_indication_fault_notification; |
177 | static int hf_event_indication_additional_information; |
178 | |
179 | /* Fields for Message Type 8: IWF Start-Up */ |
180 | static int hf_iwf_start_up_pc_id; |
181 | static int hf_iwf_start_up_hyperframe_number; /* #Z field */ |
182 | static int hf_iwf_start_up_subframe_number; /* #X field */ |
183 | static int hf_iwf_start_up_timestamp; |
184 | static int hf_iwf_start_up_fec_bit_indicator; |
185 | static int hf_iwf_start_up_scrambling_bit_indicator; |
186 | static int hf_iwf_start_up_line_rate; |
187 | static int hf_iwf_start_up_data_transferred; |
188 | |
189 | /* Fields for Message Type 11: IWF Delay Control */ |
190 | static int hf_iwf_delay_control_pc_id; |
191 | static int hf_iwf_delay_control_delay_control_id; |
192 | static int hf_iwf_delay_control_action_type; |
193 | static int hf_iwf_delay_control_delay_a; |
194 | static int hf_iwf_delay_control_delay_b; |
195 | |
196 | /* Overall length of eCPRI frame */ |
197 | static int hf_ecpri_length; |
198 | |
199 | /**************************************************************************************************/ |
200 | /* Preference to use the eCPRI Specification 1.2 encoding */ |
201 | /**************************************************************************************************/ |
202 | static bool_Bool pref_message_type_decoding = true1; |
203 | |
204 | /**************************************************************************************************/ |
205 | /* eCPRI Handle */ |
206 | /**************************************************************************************************/ |
207 | static dissector_handle_t ecpri_handle; |
208 | |
209 | /**************************************************************************************************/ |
210 | /* Initialize expert info fields */ |
211 | /**************************************************************************************************/ |
212 | static expert_field ei_ecpri_frame_length; |
213 | static expert_field ei_payload_size; |
214 | static expert_field ei_comp_val; |
215 | static expert_field ei_time_stamp; |
216 | static expert_field ei_compensation_value_nonzero; |
217 | static expert_field ei_data_length; |
218 | static expert_field ei_c_bit; |
219 | static expert_field ei_fault_notif; |
220 | static expert_field ei_number_faults; |
221 | static expert_field ei_iwf_delay_control_action_type; |
222 | static expert_field ei_ecpri_not_dis_yet; |
223 | |
224 | /**************************************************************************************************/ |
225 | /* Field Encoding of Message Types */ |
226 | /**************************************************************************************************/ |
227 | |
228 | #define ECPRI_MESSAGE_TYPE_IQ_DATA0 0 |
229 | #define ECPRI_MESSAGE_TYPE_BIT_SEQUENCE1 1 |
230 | #define ECPRI_MESSAGE_TYPE_REAL_TIME_CONTROL_DATA2 2 |
231 | #define ECPRI_MESSAGE_TYPE_GENERIC_DATA_TRANSFER3 3 |
232 | #define ECPRI_MESSAGE_TYPE_REMOTE_MEMORY_ACCESS4 4 |
233 | #define ECPRI_MESSAGE_TYPE_ONE_WAY_DELAY_MEASUREMENT5 5 |
234 | #define ECPRI_MESSAGE_TYPE_REMOTE_RESET6 6 |
235 | #define ECPRI_MESSAGE_TYPE_EVENT_INDICATION7 7 |
236 | #define ECPRI_MESSAGE_TYPE_IWF_STARTUP8 8 |
237 | #define ECPRI_MESSAGE_TYPE_IWF_OPERATION9 9 |
238 | #define ECPRI_MESSAGE_TYPE_IWF_MAPPING10 10 |
239 | #define ECPRI_MESSAGE_TYPE_IWF_DELAY_CONTROL11 11 |
240 | |
241 | static const range_string ecpri_msg_types[] = { |
242 | /* Message Types (3.2.4) */ |
243 | { ECPRI_MESSAGE_TYPE_IQ_DATA0, ECPRI_MESSAGE_TYPE_IQ_DATA0, "IQ Data" }, |
244 | { ECPRI_MESSAGE_TYPE_BIT_SEQUENCE1, ECPRI_MESSAGE_TYPE_BIT_SEQUENCE1, "Bit Sequence" }, |
245 | { ECPRI_MESSAGE_TYPE_REAL_TIME_CONTROL_DATA2, ECPRI_MESSAGE_TYPE_REAL_TIME_CONTROL_DATA2, "Real-Time Control Data" }, |
246 | { ECPRI_MESSAGE_TYPE_GENERIC_DATA_TRANSFER3, ECPRI_MESSAGE_TYPE_GENERIC_DATA_TRANSFER3, "Generic Data Transfer" }, |
247 | { ECPRI_MESSAGE_TYPE_REMOTE_MEMORY_ACCESS4, ECPRI_MESSAGE_TYPE_REMOTE_MEMORY_ACCESS4, "Remote Memory Access" }, |
248 | { ECPRI_MESSAGE_TYPE_ONE_WAY_DELAY_MEASUREMENT5, ECPRI_MESSAGE_TYPE_ONE_WAY_DELAY_MEASUREMENT5, "One-Way Delay Measurement" }, |
249 | { ECPRI_MESSAGE_TYPE_REMOTE_RESET6, ECPRI_MESSAGE_TYPE_REMOTE_RESET6, "Remote Reset" }, |
250 | { ECPRI_MESSAGE_TYPE_EVENT_INDICATION7, ECPRI_MESSAGE_TYPE_EVENT_INDICATION7, "Event Indication" }, |
251 | { ECPRI_MESSAGE_TYPE_IWF_STARTUP8, ECPRI_MESSAGE_TYPE_IWF_STARTUP8, "IWF Start-Up" }, |
252 | { ECPRI_MESSAGE_TYPE_IWF_OPERATION9, ECPRI_MESSAGE_TYPE_IWF_OPERATION9, "IWF Operation" }, |
253 | { ECPRI_MESSAGE_TYPE_IWF_MAPPING10, ECPRI_MESSAGE_TYPE_IWF_MAPPING10, "IWF Mapping" }, |
254 | { ECPRI_MESSAGE_TYPE_IWF_DELAY_CONTROL11, ECPRI_MESSAGE_TYPE_IWF_DELAY_CONTROL11, "IWF Delay Control" }, |
255 | /* Message Types 12 - 63*/ |
256 | { 12, 63, "Reserved" }, |
257 | /* Message Types 64 - 255 */ |
258 | { 64, 255, "Vendor Specific" }, |
259 | { 0, 0, NULL((void*)0) } |
260 | }; |
261 | |
262 | /**************************************************************************************************/ |
263 | /* Field Encoding of Message Type 4: Remote Memory Access */ |
264 | /**************************************************************************************************/ |
265 | static const value_string remote_memory_access_read_write_coding[] = { |
266 | { 0x0, "Read" }, |
267 | { 0x1, "Write" }, |
268 | { 0x2, "Write_No_resp" }, |
269 | { 0x3, "Reserved" }, |
270 | { 0x4, "Reserved" }, |
271 | { 0x5, "Reserved" }, |
272 | { 0x6, "Reserved" }, |
273 | { 0x7, "Reserved" }, |
274 | { 0x8, "Reserved" }, |
275 | { 0x9, "Reserved" }, |
276 | { 0xA, "Reserved" }, |
277 | { 0xB, "Reserved" }, |
278 | { 0xC, "Reserved" }, |
279 | { 0xD, "Reserved" }, |
280 | { 0xE, "Reserved" }, |
281 | { 0xF, "Reserved" }, |
282 | { 0, NULL((void*)0) } |
283 | }; |
284 | |
285 | static const value_string remote_memory_access_request_response_coding[] = { |
286 | { 0x0, "Request" }, |
287 | { 0x1, "Response" }, |
288 | { 0x2, "Failure" }, |
289 | { 0x3, "Reserved" }, |
290 | { 0x4, "Reserved" }, |
291 | { 0x5, "Reserved" }, |
292 | { 0x6, "Reserved" }, |
293 | { 0x7, "Reserved" }, |
294 | { 0x8, "Reserved" }, |
295 | { 0x9, "Reserved" }, |
296 | { 0xA, "Reserved" }, |
297 | { 0xB, "Reserved" }, |
298 | { 0xC, "Reserved" }, |
299 | { 0xD, "Reserved" }, |
300 | { 0xE, "Reserved" }, |
301 | { 0xF, "Reserved" }, |
302 | { 0, NULL((void*)0) } |
303 | }; |
304 | |
305 | /**************************************************************************************************/ |
306 | /* Field Encoding of Message Type 5: One-way Delay Measurement */ |
307 | /**************************************************************************************************/ |
308 | static const range_string one_way_delay_measurement_action_type_coding[] = { |
309 | { 0x00, 0x00, "Request" }, |
310 | { 0x01, 0x01, "Request with Follow_Up" }, |
311 | { 0x02, 0x02, "Response" }, |
312 | { 0x03, 0x03, "Remote Request" }, |
313 | { 0x04, 0x04, "Remote request with Follow_Up" }, |
314 | { 0x05, 0x05, "Follow_Up" }, |
315 | { 0x06, 0xFF, "Reserved" }, |
316 | { 0, 0, NULL((void*)0) } |
317 | }; |
318 | |
319 | /**************************************************************************************************/ |
320 | /* Field Encoding of Message Type 6: Remote Reset */ |
321 | /**************************************************************************************************/ |
322 | static const range_string remote_reset_reset_coding[] = { |
323 | { 0x00, 0x00, "Reserved" }, |
324 | { 0x01, 0x01, "Remote reset request" }, |
325 | { 0x02, 0x02, "Remote reset response" }, |
326 | { 0x03, 0xFF, "Reserved" }, |
327 | { 0, 0, NULL((void*)0) } |
328 | }; |
329 | |
330 | /**************************************************************************************************/ |
331 | /* Field Encoding of Message Type 7: Event Indication */ |
332 | /**************************************************************************************************/ |
333 | static const range_string event_indication_event_type_coding[] = { |
334 | { 0x00, 0x00, "Fault(s) Indication" }, |
335 | { 0x01, 0x01, "Fault(s) Indication Acknowledge" }, |
336 | { 0x02, 0x02, "Notification(s) Indication" }, |
337 | { 0x03, 0x03, "Synchronization Request" }, |
338 | { 0x04, 0x04, "Synchronization Acknowledge" }, |
339 | { 0x05, 0x05, "Synchronization End Indication" }, |
340 | { 0x06, 0xFF, "Reserved" }, |
341 | { 0, 0, NULL((void*)0) } |
342 | }; |
343 | |
344 | static const range_string event_indication_element_id_coding[] = { |
345 | { 0x0000, 0xFFFE, "Vendor specific usage" }, |
346 | { 0xFFFF, 0xFFFF, "Fault/Notification applicable for all Elements" }, |
347 | { 0, 0, NULL((void*)0) } |
348 | }; |
349 | |
350 | static const value_string event_indication_raise_ceased_coding[] = { |
351 | { 0x00, "Raise a fault" }, |
352 | { 0x01, "Cease a fault" }, |
353 | { 0x02, "Reserved" }, |
354 | { 0x03, "Reserved" }, |
355 | { 0x04, "Reserved" }, |
356 | { 0x05, "Reserved" }, |
357 | { 0x06, "Reserved" }, |
358 | { 0x07, "Reserved" }, |
359 | { 0x08, "Reserved" }, |
360 | { 0x09, "Reserved" }, |
361 | { 0x0A, "Reserved" }, |
362 | { 0x0B, "Reserved" }, |
363 | { 0x0C, "Reserved" }, |
364 | { 0x0D, "Reserved" }, |
365 | { 0x0E, "Reserved" }, |
366 | { 0x0F, "Reserved" }, |
367 | { 0, NULL((void*)0) } |
368 | }; |
369 | |
370 | static const range_string event_indication_fault_notif_coding[] = { |
371 | /* eCPRI reserved Faults from 0x000 to 0x3FF */ |
372 | { 0x000, 0x000, "General Userplane HW Fault" }, |
373 | { 0x001, 0x001, "General Userplane SW Fault" }, |
374 | { 0x002, 0x3FF, "eCPRI reserved Faults" }, |
375 | /* eCPRI reserved Notifications from 0x400 to 0x7FF */ |
376 | { 0x400, 0x400, "Unknown message type received" }, |
377 | { 0x401, 0x401, "Userplane data buffer underflow" }, |
378 | { 0x402, 0x402, "Userplane data buffer overflow" }, |
379 | { 0x403, 0x403, "Userplane data arrived too early" }, |
380 | { 0x404, 0x404, "Userplane data received too late" }, |
381 | { 0x405, 0x7FF, "eCPRI reserved Notifications" }, |
382 | /* Vendor Specific Fault Indication and Notification from 0x800 to 0xFFF */ |
383 | { 0x800, 0xFFF, "Vendor Specific Fault Indication/Notification" }, |
384 | { 0, 0, NULL((void*)0) } |
385 | }; |
386 | |
387 | /**************************************************************************************************/ |
388 | /* Field Encoding of Message Type 8: IWF Start-Up */ |
389 | /**************************************************************************************************/ |
390 | static const range_string iwf_start_up_line_rate_coding[] = { |
391 | { 0x00, 0x00, "Reserved" }, |
392 | { 0x01, 0x01, "CPRI line bit rate option 1" }, |
393 | { 0x02, 0x02, "CPRI line bit rate option 2" }, |
394 | { 0x03, 0x03, "CPRI line bit rate option 3" }, |
395 | { 0x04, 0x04, "CPRI line bit rate option 4" }, |
396 | { 0x05, 0x05, "CPRI line bit rate option 5" }, |
397 | { 0x06, 0x06, "CPRI line bit rate option 6" }, |
398 | { 0x07, 0x07, "CPRI line bit rate option 7" }, |
399 | { 0x08, 0x08, "CPRI line bit rate option 7A" }, |
400 | { 0x09, 0x09, "CPRI line bit rate option 8" }, |
401 | { 0x0A, 0x0A, "CPRI line bit rate option 9" }, |
402 | { 0x0B, 0x0B, "CPRI line bit rate option 10" }, |
403 | { 0x0C, 0x1F, "Reserved" }, |
404 | { 0, 0, NULL((void*)0) } |
405 | }; |
406 | |
407 | /**************************************************************************************************/ |
408 | /* Field Encoding of Message Type 11: IWF Delay Control */ |
409 | /**************************************************************************************************/ |
410 | static const range_string iwf_delay_control_action_type_coding[] = { |
411 | { 0x00, 0x00, "Request get delays" }, |
412 | { 0x01, 0x01, "Response get delays" }, |
413 | { 0x02, 0xFF, "Reserved" }, |
414 | { 0, 0, NULL((void*)0) } |
415 | }; |
416 | |
417 | static const true_false_string tfs_c_bit = |
418 | { |
419 | "Another eCPRI message follows this one with eCPRI PDU", |
420 | "This eCPRI message is last one inside eCPRI PDU" |
421 | }; |
422 | |
423 | static dissector_handle_t oran_fh_handle; |
424 | |
425 | /**************************************************************************************************/ |
426 | /* Implementation of the functions */ |
427 | /**************************************************************************************************/ |
428 | static int dissect_ecpri(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U___attribute__((unused))) |
429 | { |
430 | tvbuff_t *next_tvb; |
431 | |
432 | /* Proto Items/Trees for eCPRI */ |
433 | proto_item *ecpri_item; |
434 | proto_tree *ecpri_tree; |
435 | |
436 | /* Proto Items/Trees for eCPRI Common Header */ |
437 | proto_item *header_item; |
438 | proto_tree *header_tree; |
439 | proto_item *ti_payload_size; |
440 | proto_item *ti_c_bit; |
441 | |
442 | /* Proto Items/Trees for eCPRI Payload */ |
443 | proto_item *payload_item; |
444 | proto_tree *payload_tree; |
445 | /* Proto Items/Trees for Message Type 4: Remote Memory Access */ |
446 | proto_item *ti_data_length; |
447 | /* Proto Items/Trees for Message Type 5: One-way Delay Measurement */ |
448 | proto_item *timestamp_item; |
449 | proto_tree *timestamp_tree; |
450 | proto_tree *comp_tree; |
451 | /* Proto Items/Trees for Message Type 7: Event Indication */ |
452 | proto_item *element_item; |
453 | proto_tree *element_tree; |
454 | proto_item *ti_num_faults; |
455 | proto_item *ti_fault_notif; |
456 | |
457 | int offset; |
458 | uint32_t msg_type; |
459 | uint32_t event_type; |
460 | uint32_t concatenation; |
461 | uint32_t num_faults_notif; |
462 | uint32_t action_type; |
463 | uint32_t fault_notif; |
464 | uint16_t payload_size; |
465 | uint32_t data_length; |
466 | uint16_t reported_length; |
467 | uint16_t remaining_length; |
468 | uint32_t time_stamp_ns; |
469 | uint64_t time_stamp_s; |
470 | int64_t comp_val; |
471 | |
472 | reported_length = tvb_reported_length(tvb); |
473 | |
474 | /* Check of eCPRI min. length (header-length) */ |
475 | if (reported_length < ECPRI_HEADER_LENGTH4) |
476 | return 0; |
477 | |
478 | /* Set column of protocol eCPRI */ |
479 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "eCPRI"); |
480 | col_clear(pinfo->cinfo, COL_INFO); |
481 | |
482 | offset = 0; |
483 | concatenation = tvb_get_uint8(tvb, offset) & 0x01; |
484 | if (concatenation != 0x00) |
485 | { |
486 | col_append_str(pinfo->cinfo, COL_INFO, "Concatenation"); |
487 | } |
488 | |
489 | /* do-while loop for concatenation check */ |
490 | bool_Bool concatenation_bit; |
491 | do |
492 | { |
493 | /* 4-byte boundary check for concatenation */ |
494 | if (offset % 4 != 0) |
495 | { |
496 | offset = offset + 4 - (offset % 4); |
497 | } |
498 | |
499 | /* Read Payload Size */ |
500 | payload_size = tvb_get_ntohs(tvb, offset+2); |
501 | |
502 | /* eCPRI tree */ |
503 | if (payload_size + ECPRI_HEADER_LENGTH4 <= reported_length) |
504 | { |
505 | ecpri_item = proto_tree_add_item(tree, proto_ecpri, tvb, offset, payload_size + ECPRI_HEADER_LENGTH4, ENC_NA0x00000000); |
506 | } |
507 | else |
508 | { |
509 | ecpri_item = proto_tree_add_item(tree, proto_ecpri, tvb, offset, -1, ENC_NA0x00000000); |
510 | expert_add_info_format( |
511 | pinfo, ecpri_item, &ei_ecpri_frame_length, |
512 | "eCPRI frame length %u is too small, Should be min. %d", |
513 | reported_length, payload_size + ECPRI_HEADER_LENGTH4); |
514 | } |
515 | ecpri_tree = proto_item_add_subtree(ecpri_item, ett_ecpri); |
516 | |
517 | /* eCPRI header subtree */ |
518 | header_item = proto_tree_add_string_format(ecpri_tree, hf_common_header, tvb, offset, ECPRI_HEADER_LENGTH4, "", "eCPRI Common Header"); |
519 | header_tree = proto_item_add_subtree(header_item, ett_ecpri_header); |
520 | |
521 | /* eCPRI Protocol Revision */ |
522 | proto_tree_add_item(header_tree, hf_common_header_ecpri_protocol_revision, tvb, offset, 1, ENC_NA0x00000000); |
523 | /* Reserved */ |
524 | proto_tree_add_item(header_tree, hf_common_header_reserved, tvb, offset, 1, ENC_NA0x00000000); |
525 | /* Concatenated */ |
526 | ti_c_bit = proto_tree_add_item_ret_boolean(header_tree, hf_common_header_c_bit, tvb, offset, 1, ENC_NA0x00000000, &concatenation_bit); |
527 | offset += 1; |
528 | |
529 | /* eCPRI Message Type */ |
530 | proto_tree_add_item_ret_uint(header_tree, hf_common_header_ecpri_message_type, tvb, offset, 1, ENC_NA0x00000000, &msg_type); |
531 | /* Append Message Type into info column & header item */ |
532 | col_append_sep_fstr(pinfo->cinfo, COL_INFO, ",", "Message Type: %s", try_rval_to_str(msg_type, ecpri_msg_types)); |
533 | proto_item_append_text(header_item, " MessageType: %s", try_rval_to_str(msg_type, ecpri_msg_types)); |
534 | offset += 1; |
535 | |
536 | /* eCPRI Payload Size */ |
537 | ti_payload_size = proto_tree_add_item(header_tree, hf_common_header_ecpri_payload_size, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
538 | offset += 2; |
539 | |
540 | /* eCPRI payload-subtree */ |
541 | /* Length Check */ |
542 | if (reported_length >= ECPRI_HEADER_LENGTH4 + payload_size) |
543 | { |
544 | /* OK, add undecoded payload */ |
545 | payload_item = proto_tree_add_item(ecpri_tree, hf_payload, tvb, offset, payload_size, ENC_NA0x00000000); |
546 | } |
547 | else |
548 | { |
549 | expert_add_info_format( |
550 | pinfo, ti_payload_size, &ei_payload_size, |
551 | "Payload Size %u is too big, maximal %u is possible", |
552 | payload_size, reported_length - ECPRI_HEADER_LENGTH4); |
553 | payload_item = proto_tree_add_item(ecpri_tree, hf_payload, tvb, offset, -1, ENC_NA0x00000000); |
554 | } |
555 | |
556 | payload_tree = proto_item_add_subtree(payload_item, ett_ecpri_payload); |
557 | remaining_length = reported_length - offset; |
558 | |
559 | /* Call the FH CUS dissector if preference set */ |
560 | if (pref_message_type_decoding) |
561 | { |
562 | tvbuff_t *fh_tvb = tvb_new_subset_length(tvb, offset, payload_size); |
563 | /***********************************************************************************************/ |
564 | /* See whether O-RAN fronthaul sub-dissector handles this, otherwise decode as vanilla eCPRI */ |
565 | /* N.B. FH CUS dissector only handles: */ |
566 | /* - message type 0 (IQ DATA) */ |
567 | /* - message type 2 (RT CTRL DATA) */ |
568 | /***********************************************************************************************/ |
569 | if (call_dissector_only(oran_fh_handle, fh_tvb, pinfo, tree, &msg_type)) |
570 | { |
571 | /* Assume that it has claimed the entire tvb */ |
572 | offset = tvb_reported_length(tvb); |
573 | } |
574 | else |
575 | { |
576 | /* ORAN FH-CUS dissector didn't handle it */ |
577 | switch (msg_type) |
578 | { |
579 | case ECPRI_MESSAGE_TYPE_IQ_DATA0: /* Message Type 0: 3.2.4.1. IQ Data */ |
580 | /* N.B. if ORAN dissector is enabled, it will handle this type instead! */ |
581 | if (payload_size < ECPRI_MSG_TYPE_0_PAYLOAD_MIN_LENGTH4) |
582 | { |
583 | expert_add_info_format( |
584 | pinfo, ti_payload_size, &ei_payload_size, |
585 | "Payload Size %u is too small for encoding Message Type %u. Should be min. %d", |
586 | payload_size, msg_type, ECPRI_MSG_TYPE_0_PAYLOAD_MIN_LENGTH4); |
587 | |
588 | offset += payload_size; |
589 | break; |
590 | } |
591 | |
592 | if (remaining_length >= ECPRI_MSG_TYPE_0_PAYLOAD_MIN_LENGTH4) |
593 | { |
594 | proto_tree_add_item(payload_tree, hf_iq_data_pc_id, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
595 | offset += 2; |
596 | proto_tree_add_item(payload_tree, hf_iq_data_seq_id, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
597 | offset += 2; |
598 | remaining_length -= ECPRI_MSG_TYPE_0_PAYLOAD_MIN_LENGTH4; |
599 | if (remaining_length >= payload_size - ECPRI_MSG_TYPE_0_PAYLOAD_MIN_LENGTH4) |
600 | { |
601 | proto_tree_add_item(payload_tree, hf_iq_data_iq_samples_of_user_data, tvb, offset, payload_size - ECPRI_MSG_TYPE_0_PAYLOAD_MIN_LENGTH4, ENC_NA0x00000000); |
602 | offset += payload_size - ECPRI_MSG_TYPE_0_PAYLOAD_MIN_LENGTH4; |
603 | } |
604 | } |
605 | break; |
606 | case ECPRI_MESSAGE_TYPE_BIT_SEQUENCE1: /* Message Type 1: 3.2.4.2. Bit Sequence */ |
607 | if (payload_size < ECPRI_MSG_TYPE_1_PAYLOAD_MIN_LENGTH4) |
608 | { |
609 | expert_add_info_format( |
610 | pinfo, ti_payload_size, &ei_payload_size, |
611 | "Payload Size %u is too small for encoding Message Type %u. Should be min. %d", |
612 | payload_size, msg_type, ECPRI_MSG_TYPE_1_PAYLOAD_MIN_LENGTH4); |
613 | |
614 | offset += payload_size; |
615 | break; |
616 | } |
617 | |
618 | if (remaining_length >= ECPRI_MSG_TYPE_1_PAYLOAD_MIN_LENGTH4) |
619 | { |
620 | proto_tree_add_item(payload_tree, hf_bit_sequence_pc_id, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
621 | offset += 2; |
622 | proto_tree_add_item(payload_tree, hf_bit_sequence_seq_id, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
623 | offset += 2; |
624 | remaining_length -= ECPRI_MSG_TYPE_1_PAYLOAD_MIN_LENGTH4; |
625 | if (remaining_length >= payload_size - ECPRI_MSG_TYPE_1_PAYLOAD_MIN_LENGTH4) |
626 | { |
627 | proto_tree_add_item(payload_tree, hf_bit_sequence_bit_sequence_of_user_data, tvb, offset, payload_size - ECPRI_MSG_TYPE_1_PAYLOAD_MIN_LENGTH4, ENC_NA0x00000000); |
628 | offset += payload_size - ECPRI_MSG_TYPE_1_PAYLOAD_MIN_LENGTH4; |
629 | } |
630 | } |
631 | break; |
632 | |
633 | case ECPRI_MESSAGE_TYPE_REAL_TIME_CONTROL_DATA2: /* Message Type 2: 3.2.4.3. Real-Time Control Data */ |
634 | /* N.B. if ORAN dissector is enabled, it will handle this type instead! */ |
635 | if (payload_size < ECPRI_MSG_TYPE_2_PAYLOAD_MIN_LENGTH4) |
636 | { |
637 | expert_add_info_format( |
638 | pinfo, ti_payload_size, &ei_payload_size, |
639 | "Payload Size %u is too small for encoding Message Type %u. Should be min. %d", |
640 | payload_size, msg_type, ECPRI_MSG_TYPE_2_PAYLOAD_MIN_LENGTH4); |
641 | |
642 | offset += payload_size; |
643 | break; |
644 | } |
645 | |
646 | if (remaining_length >= ECPRI_MSG_TYPE_2_PAYLOAD_MIN_LENGTH4) |
647 | { |
648 | proto_tree_add_item(payload_tree, hf_real_time_control_data_rtc_id, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
649 | offset += 2; |
650 | proto_tree_add_item(payload_tree, hf_real_time_control_data_seq_id, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
651 | offset += 2; |
652 | remaining_length -= ECPRI_MSG_TYPE_2_PAYLOAD_MIN_LENGTH4; |
653 | if (remaining_length >= payload_size - ECPRI_MSG_TYPE_2_PAYLOAD_MIN_LENGTH4) |
654 | { |
655 | proto_tree_add_item(payload_tree, hf_real_time_control_data_rtc_data, tvb, offset, payload_size - ECPRI_MSG_TYPE_2_PAYLOAD_MIN_LENGTH4, ENC_NA0x00000000); |
656 | offset += payload_size - ECPRI_MSG_TYPE_2_PAYLOAD_MIN_LENGTH4; |
657 | } |
658 | } |
659 | break; |
660 | |
661 | case ECPRI_MESSAGE_TYPE_GENERIC_DATA_TRANSFER3: /* Message Type 3: 3.2.4.4. Generic Data Transfer */ |
662 | if (payload_size < ECPRI_MSG_TYPE_3_PAYLOAD_MIN_LENGTH8) |
663 | { |
664 | expert_add_info_format( |
665 | pinfo, ti_payload_size, &ei_payload_size, |
666 | "Payload Size %u is too small for encoding Message Type %u. Should be min. %d", |
667 | payload_size, msg_type, ECPRI_MSG_TYPE_3_PAYLOAD_MIN_LENGTH8); |
668 | |
669 | offset += payload_size; |
670 | break; |
671 | } |
672 | |
673 | if (remaining_length >= ECPRI_MSG_TYPE_3_PAYLOAD_MIN_LENGTH8) |
674 | { |
675 | proto_tree_add_item(payload_tree, hf_generic_data_transfer_pc_id, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
676 | offset += 4; |
677 | proto_tree_add_item(payload_tree, hf_generic_data_transfer_seq_id, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
678 | offset += 4; |
679 | remaining_length -= ECPRI_MSG_TYPE_3_PAYLOAD_MIN_LENGTH8; |
680 | if (remaining_length >= payload_size - ECPRI_MSG_TYPE_3_PAYLOAD_MIN_LENGTH8) |
681 | { |
682 | proto_tree_add_item(payload_tree, hf_generic_data_transfer_data_transferred, tvb, offset, payload_size - ECPRI_MSG_TYPE_3_PAYLOAD_MIN_LENGTH8, ENC_NA0x00000000); |
683 | offset += payload_size - ECPRI_MSG_TYPE_3_PAYLOAD_MIN_LENGTH8; |
684 | } |
685 | } |
686 | break; |
687 | |
688 | case ECPRI_MESSAGE_TYPE_REMOTE_MEMORY_ACCESS4: /* Message Type 4: 3.2.4.5. Remote Memory Access */ |
689 | if (payload_size < ECPRI_MSG_TYPE_4_PAYLOAD_MIN_LENGTH12) |
690 | { |
691 | expert_add_info_format( |
692 | pinfo, ti_payload_size, &ei_payload_size, |
693 | "Payload Size %u is too small for encoding Message Type %u. Should be min. %d", |
694 | payload_size, msg_type, ECPRI_MSG_TYPE_4_PAYLOAD_MIN_LENGTH12); |
695 | |
696 | offset += payload_size; |
697 | break; |
698 | } |
699 | |
700 | if (remaining_length >= ECPRI_MSG_TYPE_4_PAYLOAD_MIN_LENGTH12) |
701 | { |
702 | proto_tree_add_item(payload_tree, hf_remote_memory_access_id, tvb, offset, 1, ENC_NA0x00000000); |
703 | offset += 1; |
704 | proto_tree_add_item(payload_tree, hf_remote_memory_access_read_write, tvb, offset, 1, ENC_NA0x00000000); |
705 | proto_tree_add_item(payload_tree, hf_remote_memory_access_request_response, tvb, offset, 1, ENC_NA0x00000000); |
706 | offset += 1; |
707 | proto_tree_add_item(payload_tree, hf_remote_memory_access_element_id, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
708 | offset += 2; |
709 | proto_tree_add_item(payload_tree, hf_remote_memory_access_address, tvb, offset, 6, ENC_NA0x00000000); |
710 | offset += 6; |
711 | ti_data_length = proto_tree_add_item_ret_uint(payload_tree, hf_remote_memory_access_data_length, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &data_length); |
712 | offset += 2; |
713 | remaining_length -= ECPRI_MSG_TYPE_4_PAYLOAD_MIN_LENGTH12; |
714 | if (remaining_length >= (payload_size - ECPRI_MSG_TYPE_4_PAYLOAD_MIN_LENGTH12)) |
715 | { |
716 | if (data_length == ((uint32_t)(payload_size - ECPRI_MSG_TYPE_4_PAYLOAD_MIN_LENGTH12))) |
717 | { |
718 | proto_tree_add_item(payload_tree, hf_remote_memory_access_data, tvb, offset, payload_size - ECPRI_MSG_TYPE_4_PAYLOAD_MIN_LENGTH12, ENC_NA0x00000000); |
719 | offset += payload_size - ECPRI_MSG_TYPE_4_PAYLOAD_MIN_LENGTH12; |
720 | } |
721 | else if (data_length < ((uint32_t)(payload_size - ECPRI_MSG_TYPE_4_PAYLOAD_MIN_LENGTH12))) |
722 | { |
723 | expert_add_info_format( |
724 | pinfo, ti_data_length, &ei_data_length, |
725 | "Data Length %u is too small, should be %u", |
726 | data_length, payload_size - ECPRI_MSG_TYPE_4_PAYLOAD_MIN_LENGTH12); |
727 | } |
728 | else |
729 | { |
730 | expert_add_info_format( |
731 | pinfo, ti_data_length, &ei_data_length, |
732 | "Data Length %u is too big, should be %u", |
733 | data_length, payload_size - ECPRI_MSG_TYPE_4_PAYLOAD_MIN_LENGTH12); |
734 | } |
735 | } |
736 | } |
737 | break; |
738 | |
739 | case ECPRI_MESSAGE_TYPE_ONE_WAY_DELAY_MEASUREMENT5: /* Message Type 5: 3.2.4.6. One-way Delay Measurement */ |
740 | if (payload_size < ECPRI_MSG_TYPE_5_PAYLOAD_MIN_LENGTH20) |
741 | { |
742 | expert_add_info_format( |
743 | pinfo, ti_payload_size, &ei_payload_size, |
744 | "Payload Size %u is too small for encoding Message Type %u. Should be min. %d", |
745 | payload_size, msg_type, ECPRI_MSG_TYPE_5_PAYLOAD_MIN_LENGTH20); |
746 | |
747 | offset += payload_size; |
748 | break; |
749 | } |
750 | |
751 | if (remaining_length >= ECPRI_MSG_TYPE_5_PAYLOAD_MIN_LENGTH20) |
752 | { |
753 | /* Measurement ID (1 byte) */ |
754 | proto_tree_add_item(ecpri_tree, hf_one_way_delay_measurement_id, tvb, offset, 1, ENC_NA0x00000000); |
755 | offset += 1; |
756 | /* Action Type (1 byte) */ |
757 | proto_tree_add_item_ret_uint(ecpri_tree, hf_one_way_delay_measurement_action_type, tvb, offset, 1, ENC_NA0x00000000, &action_type); |
758 | offset += 1; |
759 | |
760 | /* Time Stamp for seconds and nano-seconds (6 bytes seconds, 4 bytes nanoseconds) */ |
761 | timestamp_item = proto_tree_add_item(ecpri_tree, hf_one_way_delay_measurement_timestamp, tvb, offset, 10, ENC_NA0x00000000); |
762 | timestamp_tree = proto_item_add_subtree(timestamp_item, ett_ecpri_timestamp); |
763 | proto_tree_add_item_ret_uint64(timestamp_tree, hf_one_way_delay_measurement_timestamp_seconds, tvb, offset, 6, ENC_BIG_ENDIAN0x00000000, &time_stamp_s); |
764 | offset += 6; |
765 | proto_tree_add_item_ret_uint(timestamp_tree, hf_one_way_delay_measurement_timestamp_nanoseconds, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000, &time_stamp_ns); |
766 | offset += 4; |
767 | /* Isn't set for all action types */ |
768 | if (action_type != ECPRI_MSG_TYPE_5_REQ0x00 && |
769 | action_type != ECPRI_MSG_TYPE_5_RESPONSE0x02 && |
770 | action_type != ECPRI_MSG_TYPE_5_FOLLOWUP0x05 && |
771 | time_stamp_s != 0 && time_stamp_ns != 0) |
772 | { |
773 | expert_add_info_format( |
774 | pinfo, timestamp_item, &ei_time_stamp, |
775 | "Time stamp is not defined for Action Type %u (%s), should be 0", |
776 | action_type, rval_to_str_const(action_type, one_way_delay_measurement_action_type_coding, "Unknown")); |
777 | } |
778 | else { |
779 | /* Show value in ts root */ |
780 | proto_item_append_text(timestamp_item, " (%" PRId64"l" "d" ".%09u seconds)", time_stamp_s, time_stamp_ns); |
781 | } |
782 | |
783 | /* Compensation value (8 bytes). Same format as PTP's correctionField */ |
784 | dissect_ptp_v2_timeInterval(tvb, (uint16_t*)&offset, ecpri_tree, "Compensation value", |
785 | hf_one_way_delay_measurement_compensation_value, |
786 | hf_one_way_delay_measurement_compensation_value_subns, |
787 | &comp_tree, |
788 | &comp_val); |
789 | /* Isn't set for all Action Types */ |
790 | if (action_type != ECPRI_MSG_TYPE_5_REQ0x00 && |
791 | action_type != ECPRI_MSG_TYPE_5_RESPONSE0x02 && |
792 | action_type != ECPRI_MSG_TYPE_5_FOLLOWUP0x05 && |
793 | comp_val != 0) |
794 | { |
795 | expert_add_info_format( |
796 | pinfo, comp_tree, &ei_compensation_value_nonzero, |
797 | "Compensation Value is not defined for Action Type %u (%s), should be 0", |
798 | action_type, rval_to_str_const(action_type, one_way_delay_measurement_action_type_coding, "Unknown")); |
799 | } |
800 | |
801 | /* Any remaining bytes are dummy */ |
802 | remaining_length -= ECPRI_MSG_TYPE_5_PAYLOAD_MIN_LENGTH20; |
Value stored to 'remaining_length' is never read | |
803 | if ((payload_size - ECPRI_MSG_TYPE_5_PAYLOAD_MIN_LENGTH20) > 0) |
804 | { |
805 | proto_tree_add_item(ecpri_tree, hf_one_way_delay_measurement_dummy_bytes, tvb, offset, payload_size - ECPRI_MSG_TYPE_5_PAYLOAD_MIN_LENGTH20, ENC_NA0x00000000); |
806 | offset += (payload_size - ECPRI_MSG_TYPE_5_PAYLOAD_MIN_LENGTH20); |
807 | } |
808 | } |
809 | break; |
810 | |
811 | case ECPRI_MESSAGE_TYPE_REMOTE_RESET6: /* Message Type 6: 3.2.4.7. Remote Reset */ |
812 | if (payload_size < ECPRI_MSG_TYPE_6_PAYLOAD_MIN_LENGTH3) |
813 | { |
814 | expert_add_info_format( |
815 | pinfo, ti_payload_size, &ei_payload_size, |
816 | "Payload Size %u is too small for encoding Message Type %u. Should be min. %d", |
817 | payload_size, msg_type, ECPRI_MSG_TYPE_6_PAYLOAD_MIN_LENGTH3); |
818 | |
819 | offset += payload_size; |
820 | break; |
821 | } |
822 | |
823 | if (remaining_length >= ECPRI_MSG_TYPE_6_PAYLOAD_MIN_LENGTH3) |
824 | { |
825 | proto_tree_add_item(payload_tree, hf_remote_reset_reset_id, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
826 | offset += 2; |
827 | proto_tree_add_item(payload_tree, hf_remote_reset_reset_code, tvb, offset, 1, ENC_NA0x00000000); |
828 | offset += 1; |
829 | remaining_length -= ECPRI_MSG_TYPE_6_PAYLOAD_MIN_LENGTH3; |
830 | if (remaining_length >= payload_size - ECPRI_MSG_TYPE_6_PAYLOAD_MIN_LENGTH3) |
831 | { |
832 | proto_tree_add_item(payload_tree, hf_remote_reset_vendor_specific_payload, tvb, offset, payload_size - ECPRI_MSG_TYPE_6_PAYLOAD_MIN_LENGTH3, ENC_NA0x00000000); |
833 | offset += payload_size - ECPRI_MSG_TYPE_6_PAYLOAD_MIN_LENGTH3; |
834 | } |
835 | } |
836 | break; |
837 | |
838 | case ECPRI_MESSAGE_TYPE_EVENT_INDICATION7: /* Message Type 7: 3.2.4.8. Event Indication */ |
839 | if (payload_size < ECPRI_MSG_TYPE_7_PAYLOAD_MIN_LENGTH4) |
840 | { |
841 | expert_add_info_format( |
842 | pinfo, ti_payload_size, &ei_payload_size, |
843 | "Payload Size %u is too small for encoding Message Type %u. Should be min. %d", |
844 | payload_size, msg_type, ECPRI_MSG_TYPE_7_PAYLOAD_MIN_LENGTH4); |
845 | |
846 | offset += payload_size; |
847 | break; |
848 | } |
849 | |
850 | if (remaining_length >= ECPRI_MSG_TYPE_7_PAYLOAD_MIN_LENGTH4) |
851 | { |
852 | proto_tree_add_item(payload_tree, hf_event_indication_event_id, tvb, offset, 1, ENC_NA0x00000000); |
853 | offset += 1; |
854 | proto_tree_add_item_ret_uint(payload_tree, hf_event_indication_event_type, tvb, offset, 1, ENC_NA0x00000000, &event_type); |
855 | offset += 1; |
856 | proto_tree_add_item(payload_tree, hf_event_indication_sequence_number, tvb, offset, 1, ENC_NA0x00000000); |
857 | offset += 1; |
858 | ti_num_faults = proto_tree_add_item_ret_uint(payload_tree, hf_event_indication_number_of_faults_notifications, tvb, offset, 1, ENC_NA0x00000000, &num_faults_notif); |
859 | offset += 1; |
860 | /* Only for Event Type Fault Indication (0x00) and Notification Indication (0x02) */ |
861 | if (event_type == ECPRI_MSG_TYPE_7_FAULT_INDICATION0x00 || event_type == ECPRI_MSG_TYPE_7_NOTIF_INDICATION0x02) |
862 | { |
863 | /* These two Event Types should have notifications or faults */ |
864 | if (num_faults_notif == 0) |
865 | { |
866 | expert_add_info_format( |
867 | pinfo, ti_num_faults, &ei_number_faults, |
868 | "Number of Faults/Notif %u should be > 0", |
869 | num_faults_notif); |
870 | break; |
871 | } |
872 | |
873 | /* Check Size of Elements */ |
874 | const uint16_t expected_payload_size = ECPRI_MSG_TYPE_7_PAYLOAD_MIN_LENGTH4 + num_faults_notif * ECPRI_MSG_TYPE_7_ELEMENT_SIZE8; |
875 | if (payload_size == expected_payload_size) |
876 | { |
877 | /* Dissect elements in loop */ |
878 | for (uint32_t i = 0; i < num_faults_notif; i++) |
879 | { |
880 | element_item = proto_tree_add_item(payload_tree, hf_event_indication_element, tvb, offset, ECPRI_MSG_TYPE_7_ELEMENT_SIZE8, ENC_NA0x00000000); |
881 | proto_item_prepend_text(element_item, "#%u: ", i + 1); |
882 | element_tree = proto_item_add_subtree(element_item, ett_ecpri_element); |
883 | |
884 | proto_tree_add_item(element_tree, hf_event_indication_element_id, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
885 | offset += 2; |
886 | proto_tree_add_item(element_tree, hf_event_indication_raise_cease, tvb, offset, 1, ENC_NA0x00000000); |
887 | ti_fault_notif = proto_tree_add_item_ret_uint(element_tree, hf_event_indication_fault_notification, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &fault_notif); |
888 | |
889 | /* Faults and Notifications cannot be mixed */ |
890 | const bool_Bool is_fault_event = event_type == ECPRI_MSG_TYPE_7_FAULT_INDICATION0x00; |
891 | const bool_Bool is_notif_event = event_type == ECPRI_MSG_TYPE_7_NOTIF_INDICATION0x02; |
892 | |
893 | const bool_Bool is_fault_notif_in_fault_range = fault_notif <= ECPRI_MSG_TYPE_7_FAULTS_MAX0x3FF; |
894 | |
895 | const bool_Bool is_fault_notif_in_notif_range = |
896 | fault_notif >= ECPRI_MSG_TYPE_7_NOTIF_MIN0x400 && |
897 | fault_notif <= ECPRI_MSG_TYPE_7_NOTIF_MAX0x7FF; |
898 | |
899 | const bool_Bool is_fault_notif_in_vendor_range = |
900 | fault_notif >= ECPRI_MSG_TYPE_7_VENDOR_MIN0x800 && |
901 | fault_notif <= ECPRI_MSG_TYPE_7_VENDOR_MAX0xFFF; |
902 | |
903 | if (is_fault_event && !(is_fault_notif_in_fault_range || is_fault_notif_in_vendor_range)) |
904 | { |
905 | expert_add_info_format( |
906 | pinfo, ti_fault_notif, &ei_fault_notif, |
907 | "Only Faults are permitted with Event Type Faults Indication (0x%.2X)", |
908 | event_type); |
909 | } |
910 | else if (is_notif_event && !(is_fault_notif_in_notif_range || is_fault_notif_in_vendor_range)) |
911 | { |
912 | expert_add_info_format( |
913 | pinfo, ti_fault_notif, &ei_fault_notif, |
914 | "Only Notifications are permitted with Event Type Notifications Indication (0x%.2X)", |
915 | event_type); |
916 | } |
917 | offset += 2; |
918 | proto_tree_add_item(element_tree, hf_event_indication_additional_information, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
919 | offset += 4; |
920 | } |
921 | } |
922 | else if (payload_size < expected_payload_size) |
923 | { |
924 | expert_add_info_format( |
925 | pinfo, ti_num_faults, &ei_number_faults, |
926 | "Number of Faults/Notif %u is maybe too big", |
927 | num_faults_notif); |
928 | |
929 | expert_add_info_format( |
930 | pinfo, ti_payload_size, &ei_payload_size, |
931 | "Payload Size is maybe too small: %u", |
932 | payload_size); |
933 | } |
934 | else |
935 | { |
936 | expert_add_info_format( |
937 | pinfo, ti_num_faults, &ei_number_faults, |
938 | "Number of Faults/Notif %u is maybe too small", |
939 | num_faults_notif); |
940 | |
941 | expert_add_info_format( |
942 | pinfo, ti_payload_size, &ei_payload_size, |
943 | "Payload Size is maybe too big: %u", |
944 | payload_size); |
945 | } |
946 | |
947 | } |
948 | else if ( |
949 | event_type == ECPRI_MSG_TYPE_7_FAULT_INDICATION_ACK0x01 || |
950 | event_type == ECPRI_MSG_TYPE_7_SYNC_REQUEST0x03 || |
951 | event_type == ECPRI_MSG_TYPE_7_SYNC_ACK0x04 || |
952 | event_type == ECPRI_MSG_TYPE_7_SYNC_END_INDICATION0x05) |
953 | { |
954 | /* Number of Faults/Notifs should be 0, only 4 Byte possible*/ |
955 | if (payload_size > 4) |
956 | { |
957 | expert_add_info_format( |
958 | pinfo, ti_payload_size, &ei_payload_size, |
959 | "Payload Size %u should be 4", |
960 | payload_size); |
961 | } |
962 | /* These Event Types shouldn't have faults or notifications */ |
963 | if (num_faults_notif != 0) |
964 | { |
965 | expert_add_info_format( |
966 | pinfo, ti_num_faults, &ei_number_faults, |
967 | "Number of Faults/Notif %u should be 0", |
968 | num_faults_notif); |
969 | } |
970 | } |
971 | else |
972 | { |
973 | /* These Event Types are reserved, don't know how to decode */ |
974 | if (num_faults_notif != 0) |
975 | { |
976 | expert_add_info_format( |
977 | pinfo, ti_num_faults, &ei_number_faults, |
978 | "Number of Faults/Notif %u, but no knowledge about encoding, because Event Type is reserved.", |
979 | num_faults_notif); |
980 | } |
981 | } |
982 | } |
983 | break; |
984 | |
985 | case ECPRI_MESSAGE_TYPE_IWF_STARTUP8: /* Message Type 8: 3.2.4.9. IWF Start-Up */ |
986 | if (payload_size < ECPRI_MSG_TYPE_8_PAYLOAD_MIN_LENGTH9) |
987 | { |
988 | expert_add_info_format( |
989 | pinfo, ti_payload_size, &ei_payload_size, |
990 | "Payload Size %u is too small for encoding Message Type %u. Should be min. %d", |
991 | payload_size, msg_type, ECPRI_MSG_TYPE_8_PAYLOAD_MIN_LENGTH9); |
992 | |
993 | offset += payload_size; |
994 | break; |
995 | } |
996 | |
997 | if (remaining_length >= ECPRI_MSG_TYPE_8_PAYLOAD_MIN_LENGTH9) |
998 | { |
999 | proto_tree_add_item(payload_tree, hf_iwf_start_up_pc_id, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
1000 | offset += 2; |
1001 | |
1002 | proto_tree_add_item(payload_tree, hf_iwf_start_up_hyperframe_number, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000); |
1003 | offset += 1; |
1004 | |
1005 | proto_tree_add_item(payload_tree, hf_iwf_start_up_subframe_number, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000); |
1006 | offset += 1; |
1007 | |
1008 | /* Time Stamp as nanoseconds */ |
1009 | proto_tree_add_item(payload_tree, hf_iwf_start_up_timestamp, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000); |
1010 | offset += 4; |
1011 | |
1012 | /* F, S, r (skipped), Line Rate */ |
1013 | proto_tree_add_item(payload_tree, hf_iwf_start_up_fec_bit_indicator, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000); |
1014 | proto_tree_add_item(payload_tree, hf_iwf_start_up_scrambling_bit_indicator, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000); |
1015 | proto_tree_add_item(payload_tree, hf_iwf_start_up_line_rate, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000); |
1016 | offset += 1; |
1017 | |
1018 | remaining_length -= ECPRI_MSG_TYPE_8_PAYLOAD_MIN_LENGTH9; |
1019 | if (remaining_length >= payload_size - ECPRI_MSG_TYPE_8_PAYLOAD_MIN_LENGTH9) |
1020 | { |
1021 | proto_tree_add_item(payload_tree, hf_iwf_start_up_data_transferred, tvb, offset, payload_size - ECPRI_MSG_TYPE_8_PAYLOAD_MIN_LENGTH9, ENC_NA0x00000000); |
1022 | offset += payload_size - ECPRI_MSG_TYPE_8_PAYLOAD_MIN_LENGTH9; |
1023 | } |
1024 | } |
1025 | break; |
1026 | case ECPRI_MESSAGE_TYPE_IWF_OPERATION9: /* Message Type 9: 3.2.4.10. IWF Operation */ |
1027 | proto_tree_add_expert(payload_tree, pinfo, &ei_ecpri_not_dis_yet, tvb, offset, -1); |
1028 | break; |
1029 | case ECPRI_MESSAGE_TYPE_IWF_MAPPING10: /* Message Type 10: 3.2.4.11. IWF Mapping */ |
1030 | proto_tree_add_expert(payload_tree, pinfo, &ei_ecpri_not_dis_yet, tvb, offset, -1); |
1031 | break; |
1032 | case ECPRI_MESSAGE_TYPE_IWF_DELAY_CONTROL11: /* Message Type 11: 3.2.4.12. IWF Delay Control */ |
1033 | if (payload_size != ECPRI_MSG_TYPE_11_PAYLOAD_LENGTH12) |
1034 | { |
1035 | expert_add_info_format( |
1036 | pinfo, ti_payload_size, &ei_payload_size, |
1037 | "Payload Size %u is too small or too big for encoding Message Type %u. Should be exactly %d", |
1038 | payload_size, msg_type, ECPRI_MSG_TYPE_11_PAYLOAD_LENGTH12); |
1039 | |
1040 | offset += payload_size; |
1041 | break; |
1042 | } |
1043 | |
1044 | if (remaining_length >= ECPRI_MSG_TYPE_11_PAYLOAD_LENGTH12) |
1045 | { |
1046 | proto_tree_add_item(payload_tree, hf_iwf_delay_control_pc_id, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000); |
1047 | offset += 2; |
1048 | |
1049 | proto_tree_add_item(payload_tree, hf_iwf_delay_control_delay_control_id, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000); |
1050 | offset += 1; |
1051 | |
1052 | proto_item *ti_iwf_delay_control_action_type; |
1053 | uint32_t iwf_delay_control_action_type; |
1054 | ti_iwf_delay_control_action_type = proto_tree_add_item_ret_uint( |
1055 | payload_tree, hf_iwf_delay_control_action_type, tvb, offset, 1, ENC_NA0x00000000, &iwf_delay_control_action_type); |
1056 | offset += 1; |
1057 | |
1058 | proto_item *ti_iwf_delay_control_delay_a; |
1059 | uint32_t iwf_delay_control_delay_a; |
1060 | ti_iwf_delay_control_delay_a = proto_tree_add_item_ret_uint( |
1061 | payload_tree, hf_iwf_delay_control_delay_a, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000, &iwf_delay_control_delay_a); |
1062 | proto_item_append_text(ti_iwf_delay_control_delay_a, " = %fns", iwf_delay_control_delay_a / 16.0); |
1063 | offset += 4; |
1064 | |
1065 | proto_item *ti_iwf_delay_control_delay_b; |
1066 | uint32_t iwf_delay_control_delay_b; |
1067 | ti_iwf_delay_control_delay_b = proto_tree_add_item_ret_uint( |
1068 | payload_tree, hf_iwf_delay_control_delay_b, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000, &iwf_delay_control_delay_b); |
1069 | proto_item_append_text(ti_iwf_delay_control_delay_b, " = %fns", iwf_delay_control_delay_b / 16.0); |
1070 | offset += 4; |
1071 | |
1072 | const bool_Bool is_action_type_req = iwf_delay_control_action_type == ECPRI_MSG_TYPE_11_REQUEST_GET_DELAYS0x00; |
1073 | const bool_Bool are_delays_zero = iwf_delay_control_delay_a == 0 && iwf_delay_control_delay_b == 0; |
1074 | if (is_action_type_req && !are_delays_zero) |
1075 | { |
1076 | expert_add_info_format( |
1077 | pinfo, ti_iwf_delay_control_action_type, &ei_iwf_delay_control_action_type, |
1078 | "Action Type %u is Request Get Delays, but Delays are not 0", |
1079 | iwf_delay_control_action_type); |
1080 | } |
1081 | else if (!is_action_type_req && are_delays_zero) |
1082 | { |
1083 | expert_add_info_format( |
1084 | pinfo, ti_iwf_delay_control_action_type, &ei_iwf_delay_control_action_type, |
1085 | "Action Type %u is not Request Get Delays, but Delays are 0", |
1086 | iwf_delay_control_action_type); |
1087 | } |
1088 | } |
1089 | break; |
1090 | default: |
1091 | /* Reserved or Vendor Specific */ |
1092 | offset += payload_size; |
1093 | break; |
1094 | } |
1095 | } |
1096 | } |
1097 | /* If Preference not chosen, Payload will be not decoded */ |
1098 | else |
1099 | { |
1100 | if (reported_length >= offset + payload_size) |
1101 | { |
1102 | offset += payload_size; |
1103 | } |
1104 | } |
1105 | } while (concatenation_bit != 0 && ((reported_length - offset) >= ECPRI_HEADER_LENGTH4)); |
1106 | |
1107 | /* Expecting last concatenation bit to be false */ |
1108 | if (concatenation_bit != false0) |
1109 | { |
1110 | expert_add_info_format(pinfo, ti_c_bit, &ei_c_bit, "Concatenation Bit is 1, should be 0"); |
1111 | } |
1112 | |
1113 | /* Not dissected buffer - any remainder passed to data dissector */ |
1114 | if (offset != 0) |
1115 | { |
1116 | next_tvb = tvb_new_subset_remaining(tvb, offset); |
1117 | call_data_dissector(next_tvb, pinfo, tree); |
1118 | } |
1119 | |
1120 | /* Overall eCPRI length (based upon reported length of tvb passed in) */ |
1121 | proto_item *length_ti = proto_tree_add_uint(ecpri_tree, hf_ecpri_length, tvb, 0, 0, reported_length); |
1122 | proto_item_set_generated(length_ti); |
1123 | |
1124 | return reported_length; |
1125 | } |
1126 | |
1127 | void proto_register_ecpri(void) |
1128 | { |
1129 | static hf_register_info hf[] = { |
1130 | /* eCPRI Common Header */ |
1131 | { &hf_common_header, { "eCPRI Common Header", "ecpri.header", FT_STRING, BASE_NONE, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1132 | { &hf_common_header_ecpri_protocol_revision, { "Protocol Revision", "ecpri.revision", FT_UINT8, BASE_DEC, NULL((void*)0), 0xF0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1133 | { &hf_common_header_reserved, { "Reserved", "ecpri.reserved", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0E, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1134 | { &hf_common_header_c_bit, { "C-Bit", "ecpri.cbit", FT_BOOLEAN, 8, TFS(&tfs_c_bit)((0 ? (const struct true_false_string*)0 : ((&tfs_c_bit)) )), 0x01, "Concatenation indicator", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1135 | { &hf_common_header_ecpri_message_type, { "Message Type", "ecpri.type", FT_UINT8, BASE_HEX|BASE_RANGE_STRING0x00000100, RVALS(ecpri_msg_types)((0 ? (const struct _range_string*)0 : ((ecpri_msg_types)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1136 | { &hf_common_header_ecpri_payload_size, { "Payload Size", "ecpri.size", FT_UINT16, BASE_DEC, NULL((void*)0), 0x0, "Size of eCPRI message payload in bytes", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1137 | /* eCPRI Payload */ |
1138 | { &hf_payload, { "eCPRI Payload", "ecpri.payload", FT_BYTES, SEP_COLON, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1139 | { &hf_ecpri_length, { "eCPRI Length", "ecpri.length", FT_UINT32, BASE_DEC, NULL((void*)0), 0x0, "Length in bytes, including header", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1140 | /* Message Type 0: IQ Data */ |
1141 | { &hf_iq_data_pc_id, { "PC_ID", "ecpri.pcid", FT_UINT16, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1142 | { &hf_iq_data_seq_id, { "SEQ_ID", "ecpri.iqd.seqid", FT_UINT16, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1143 | { &hf_iq_data_iq_samples_of_user_data, { "IQ Samples of User Data", "ecpri.iqd.iqdata", FT_BYTES, SEP_COLON, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1144 | /* Message Type 1: Bit Sequence */ |
1145 | { &hf_bit_sequence_pc_id, { "PC_ID", "ecpri.pcid", FT_UINT16, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1146 | { &hf_bit_sequence_seq_id, { "SEQ_ID", "ecpri.bs.seqid", FT_UINT16, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1147 | { &hf_bit_sequence_bit_sequence_of_user_data, { "Bit Sequence", "ecpri.bs.bitseq", FT_BYTES, SEP_COLON, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1148 | /* Message Type 2: Real-Time Control Data */ |
1149 | { &hf_real_time_control_data_rtc_id, { "RTC_ID", "ecpri.rtcd.rtcid", FT_UINT16, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1150 | { &hf_real_time_control_data_seq_id, { "SEQ_ID", "ecpri.rtcd.seqid", FT_UINT16, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1151 | { &hf_real_time_control_data_rtc_data, { "Real-Time Control Data", "ecpri.rtcd.rtcdata", FT_BYTES, SEP_COLON, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1152 | /* Message Type 3: Generic Data Transfer */ |
1153 | { &hf_generic_data_transfer_pc_id, { "PC_ID", "ecpri.pcid", FT_UINT32, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1154 | { &hf_generic_data_transfer_seq_id, { "SEQ_ID", "ecpri.gdt.seqid", FT_UINT32, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1155 | { &hf_generic_data_transfer_data_transferred, { "Data transferred", "ecpri.gdt.gendata", FT_BYTES, SEP_COLON, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1156 | /* Message Type 4: Remote Memory Access */ |
1157 | { &hf_remote_memory_access_id, { "Remote Memory Access ID", "ecpri.rma.rmaid", FT_UINT8, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1158 | { &hf_remote_memory_access_read_write, { "Read/Write", "ecpri.rma.rw", FT_UINT8, BASE_HEX, VALS(remote_memory_access_read_write_coding)((0 ? (const struct _value_string*)0 : ((remote_memory_access_read_write_coding )))), 0xF0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1159 | { &hf_remote_memory_access_request_response, { "Request/Response", "ecpri.rma.reqresp", FT_UINT8, BASE_HEX, VALS(remote_memory_access_request_response_coding)((0 ? (const struct _value_string*)0 : ((remote_memory_access_request_response_coding )))), 0x0F, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1160 | { &hf_remote_memory_access_element_id, { "Element ID", "ecpri.rma.elementid", FT_UINT16, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1161 | { &hf_remote_memory_access_address, { "Address", "ecpri.rma.address", FT_BYTES, SEP_COLON, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1162 | { &hf_remote_memory_access_data_length, { "Data Length", "ecpri.rma.datalength", FT_UINT16, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1163 | { &hf_remote_memory_access_data, { "Data", "ecpri.rma.rmadata", FT_BYTES, SEP_COLON, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1164 | /* Message Type 5: One-Way Delay Measurement */ |
1165 | { &hf_one_way_delay_measurement_id, { "Measurement ID", "ecpri.owdm.measurementid", FT_UINT8, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1166 | { &hf_one_way_delay_measurement_action_type, { "Action Type", "ecpri.owdm.actiontype", FT_UINT8, BASE_HEX|BASE_RANGE_STRING0x00000100, RVALS(one_way_delay_measurement_action_type_coding)((0 ? (const struct _range_string*)0 : ((one_way_delay_measurement_action_type_coding )))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1167 | { &hf_one_way_delay_measurement_timestamp, { "Timestamp", "ecpri.owdm.timestamp", FT_BYTES, SEP_COLON, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1168 | { &hf_one_way_delay_measurement_timestamp_seconds, { "Seconds", "ecpri.owdm.sec", FT_UINT48, BASE_DEC|BASE_UNIT_STRING0x00001000, UNS(&units_seconds)((0 ? (const struct unit_name_string*)0 : ((&units_seconds )))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1169 | { &hf_one_way_delay_measurement_timestamp_nanoseconds, { "Nanoseconds", "ecpri.owdm.nanosec", FT_UINT32, BASE_DEC|BASE_UNIT_STRING0x00001000, UNS(&units_nanoseconds)((0 ? (const struct unit_name_string*)0 : ((&units_nanoseconds )))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1170 | { &hf_one_way_delay_measurement_compensation_value, { "Compensation", "ecpri.owdm.compval", FT_INT64, BASE_DEC|BASE_UNIT_STRING0x00001000, UNS(&units_nanosecond_nanoseconds)((0 ? (const struct unit_name_string*)0 : ((&units_nanosecond_nanoseconds )))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1171 | { &hf_one_way_delay_measurement_compensation_value_subns, { "Compensation (subns)", "ecpri.owdm.compval-subns", FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING0x00001000, UNS(&units_nanosecond_nanoseconds)((0 ? (const struct unit_name_string*)0 : ((&units_nanosecond_nanoseconds )))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1172 | { &hf_one_way_delay_measurement_dummy_bytes, { "Dummy bytes", "ecpri.owdm.owdmdata", FT_BYTES, SEP_COLON, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1173 | /* Message Type 6: Remote Reset */ |
1174 | { &hf_remote_reset_reset_id, { "Reset ID", "ecpri.rr.resetid", FT_UINT16, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1175 | { &hf_remote_reset_reset_code, { "Reset Code Op", "ecpri.rr.resetcode", FT_UINT8, BASE_HEX|BASE_RANGE_STRING0x00000100, RVALS(remote_reset_reset_coding)((0 ? (const struct _range_string*)0 : ((remote_reset_reset_coding )))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1176 | { &hf_remote_reset_vendor_specific_payload, { "Vendor Specific Payload", "ecpri.rr.vendorpayload", FT_BYTES, SEP_COLON, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1177 | /* Message Type 7: Event Indication */ |
1178 | { &hf_event_indication_event_id, { "Event ID", "ecpri.ei.eventid", FT_UINT8, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1179 | { &hf_event_indication_event_type, { "Event Type", "ecpri.ei.eventtype", FT_UINT8, BASE_HEX|BASE_RANGE_STRING0x00000100, RVALS(event_indication_event_type_coding)((0 ? (const struct _range_string*)0 : ((event_indication_event_type_coding )))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1180 | { &hf_event_indication_sequence_number, { "Sequence Number", "ecpri.ei.seqnum", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1181 | { &hf_event_indication_number_of_faults_notifications, { "Number of Faults/Notifications", "ecpri.ei.numberfaultnotif", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1182 | { &hf_event_indication_element, { "Element", "ecpri.ei.element", FT_BYTES, SEP_COLON, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1183 | { &hf_event_indication_element_id, { "Element ID", "ecpri.ei.elementid", FT_UINT16, BASE_HEX|BASE_RANGE_STRING0x00000100, RVALS(event_indication_element_id_coding)((0 ? (const struct _range_string*)0 : ((event_indication_element_id_coding )))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1184 | { &hf_event_indication_raise_cease, { "Raise/Cease", "ecpri.ei.raisecease", FT_UINT8, BASE_HEX, VALS(event_indication_raise_ceased_coding)((0 ? (const struct _value_string*)0 : ((event_indication_raise_ceased_coding )))), 0xF0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1185 | { &hf_event_indication_fault_notification, { "Fault/Notification", "ecpri.ei.faultnotif", FT_UINT16, BASE_HEX|BASE_RANGE_STRING0x00000100, RVALS(event_indication_fault_notif_coding)((0 ? (const struct _range_string*)0 : ((event_indication_fault_notif_coding )))), 0x0FFF, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1186 | { &hf_event_indication_additional_information, { "Additional Information", "ecpri.ei.addinfo", FT_UINT32, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1187 | /* Message Type 8: IWF Start-Up */ |
1188 | { &hf_iwf_start_up_pc_id, { "PC_ID", "ecpri.pcid", FT_UINT16, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1189 | { &hf_iwf_start_up_hyperframe_number, { "Hyperframe Number #Z", "ecpri.iwfsu.hfn", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1190 | { &hf_iwf_start_up_subframe_number, { "Subframe Number #Y", "ecpri.iwfsu.sfn", FT_UINT8, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1191 | { &hf_iwf_start_up_timestamp, { "Timestamp", "ecpri.iwfsu.timestamp", FT_UINT32, BASE_DEC|BASE_UNIT_STRING0x00001000, UNS(&units_nanoseconds)((0 ? (const struct unit_name_string*)0 : ((&units_nanoseconds )))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1192 | { &hf_iwf_start_up_fec_bit_indicator, { "FEC Bit Indicator", "ecpri.iwfsu.fecbit", FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled)((0 ? (const struct true_false_string*)0 : ((&tfs_enabled_disabled )))), 0x80, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1193 | { &hf_iwf_start_up_scrambling_bit_indicator, { "Scrambling Bit Indicator", "ecpri.iwfsu.scramblingbit", FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled)((0 ? (const struct true_false_string*)0 : ((&tfs_enabled_disabled )))), 0x40, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1194 | { &hf_iwf_start_up_line_rate, { "Line Rate", "ecpri.iwfsu.linerate", FT_UINT8, BASE_HEX|BASE_RANGE_STRING0x00000100, RVALS(iwf_start_up_line_rate_coding)((0 ? (const struct _range_string*)0 : ((iwf_start_up_line_rate_coding )))), 0x1F, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1195 | { &hf_iwf_start_up_data_transferred, { "Data transferred", "ecpri.iwfsu.vendorpayload", FT_BYTES, SEP_COLON, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1196 | /* Message Type 11: IWF Delay Control */ |
1197 | { &hf_iwf_delay_control_pc_id, { "PC_ID", "ecpri.pcid", FT_UINT16, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1198 | { &hf_iwf_delay_control_delay_control_id, { "Delay Control ID", "ecpri.iwfdc.id", FT_UINT8, BASE_HEX, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1199 | { &hf_iwf_delay_control_action_type, { "Action Type", "ecpri.iwfdc.actiontype", FT_UINT8, BASE_HEX|BASE_RANGE_STRING0x00000100, RVALS(iwf_delay_control_action_type_coding)((0 ? (const struct _range_string*)0 : ((iwf_delay_control_action_type_coding )))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1200 | { &hf_iwf_delay_control_delay_a, { "Delay A", "ecpri.iwfdc.delaya", FT_UINT32, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1201 | { &hf_iwf_delay_control_delay_b, { "Delay B", "ecpri.iwfdc.delayb", FT_UINT32, BASE_DEC, NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } }, |
1202 | }; |
1203 | |
1204 | /* Setup protocol subtree array */ |
1205 | static int *ett[] = { |
1206 | &ett_ecpri, |
1207 | &ett_ecpri_header, |
1208 | &ett_ecpri_payload, |
1209 | &ett_ecpri_timestamp, |
1210 | &ett_ecpri_element |
1211 | }; |
1212 | |
1213 | static ei_register_info ei[] = { |
1214 | { &ei_ecpri_frame_length, { "ecpri.frame.length.invalid", PI_PROTOCOL0x09000000, PI_ERROR0x00800000, "Invalid eCPRI Frame Length", EXPFILL0, ((void*)0), 0, {0, {((void*)0), ((void*)0), FT_NONE, BASE_NONE , ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE, -1, ((void *)0)}} }}, |
1215 | { &ei_payload_size, { "ecpri.payload.size.invalid", PI_PROTOCOL0x09000000, PI_ERROR0x00800000, "Invalid Payload Size", EXPFILL0, ((void*)0), 0, {0, {((void*)0), ((void*)0), FT_NONE, BASE_NONE , ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE, -1, ((void *)0)}} }}, |
1216 | { &ei_data_length, { "ecpri.data.length.invalid", PI_PROTOCOL0x09000000, PI_ERROR0x00800000, "Invalid Data Length", EXPFILL0, ((void*)0), 0, {0, {((void*)0), ((void*)0), FT_NONE, BASE_NONE , ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE, -1, ((void *)0)}} }}, |
1217 | { &ei_comp_val, { "ecpri.comp.val.invalid", PI_PROTOCOL0x09000000, PI_ERROR0x00800000, "Invalid Compensation Value", EXPFILL0, ((void*)0), 0, {0, {((void*)0), ((void*)0), FT_NONE, BASE_NONE , ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE, -1, ((void *)0)}} }}, |
1218 | { &ei_time_stamp, { "ecpri.time.stamp.invalid", PI_PROTOCOL0x09000000, PI_ERROR0x00800000, "Invalid Time Stamp", EXPFILL0, ((void*)0), 0, {0, {((void*)0), ((void*)0), FT_NONE, BASE_NONE , ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE, -1, ((void *)0)}} }}, |
1219 | { &ei_compensation_value_nonzero, { "ecpri.compensation-value.nonzero", PI_PROTOCOL0x09000000, PI_WARN0x00600000, "Compensation Value should be zero", EXPFILL0, ((void*)0), 0, {0, {((void*)0), ((void*)0), FT_NONE, BASE_NONE , ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE, -1, ((void *)0)}} }}, |
1220 | { &ei_c_bit, { "ecpri.concat.bit.invalid", PI_PROTOCOL0x09000000, PI_ERROR0x00800000, "Invalid Concatenation Bit", EXPFILL0, ((void*)0), 0, {0, {((void*)0), ((void*)0), FT_NONE, BASE_NONE , ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE, -1, ((void *)0)}} }}, |
1221 | { &ei_fault_notif, { "ecpri.fault.notif.invalid", PI_PROTOCOL0x09000000, PI_ERROR0x00800000, "Invalid Fault/Notification", EXPFILL0, ((void*)0), 0, {0, {((void*)0), ((void*)0), FT_NONE, BASE_NONE , ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE, -1, ((void *)0)}} }}, |
1222 | { &ei_number_faults, { "ecpri.num.faults.invalid", PI_PROTOCOL0x09000000, PI_ERROR0x00800000, "Invalid Number of Faults", EXPFILL0, ((void*)0), 0, {0, {((void*)0), ((void*)0), FT_NONE, BASE_NONE , ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE, -1, ((void *)0)}} }}, |
1223 | { &ei_iwf_delay_control_action_type, { "ecpri.action.type.invalid", PI_PROTOCOL0x09000000, PI_ERROR0x00800000, "Invalid Action Type", EXPFILL0, ((void*)0), 0, {0, {((void*)0), ((void*)0), FT_NONE, BASE_NONE , ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE, -1, ((void *)0)}} }}, |
1224 | { &ei_ecpri_not_dis_yet, { "ecpri.not_dissected_yet", PI_PROTOCOL0x09000000, PI_NOTE0x00400000, "Not dissected yet", EXPFILL0, ((void*)0), 0, {0, {((void*)0), ((void*)0), FT_NONE, BASE_NONE , ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE, -1, ((void *)0)}} }} |
1225 | }; |
1226 | |
1227 | expert_module_t* expert_ecpri; |
1228 | module_t* ecpri_module; |
1229 | |
1230 | /* Register the protocol name and description */ |
1231 | proto_ecpri = proto_register_protocol("evolved Common Public Radio Interface", /* Protoname */ |
1232 | "eCPRI", /* Proto Shortname */ |
1233 | "ecpri"); /* Proto Abbrev */ |
1234 | ecpri_handle = register_dissector("ecpri", dissect_ecpri, proto_ecpri); |
1235 | |
1236 | |
1237 | /* Required function calls to register the header fields and subtrees used */ |
1238 | proto_register_field_array(proto_ecpri, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0])); |
1239 | proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0])); |
1240 | /* Register Expert Info */ |
1241 | expert_ecpri = expert_register_protocol(proto_ecpri); |
1242 | expert_register_field_array(expert_ecpri, ei, array_length(ei)(sizeof (ei) / sizeof (ei)[0])); |
1243 | /* Register Preference */ |
1244 | ecpri_module = prefs_register_protocol(proto_ecpri, NULL((void*)0)); |
1245 | /* If not set, it shows which message type was used, but no decoding of payload */ |
1246 | prefs_register_bool_preference(ecpri_module, |
1247 | "ecpripref.msg.decoding", |
1248 | "Decode Message Types", |
1249 | "Decode the Message Types according to eCPRI Specification V2.0", |
1250 | &pref_message_type_decoding); |
1251 | } |
1252 | |
1253 | void proto_reg_handoff_ecpri(void) |
1254 | { |
1255 | dissector_add_uint("ethertype", ETHERTYPE_ECPRI0xAEFE, ecpri_handle); /* Ethertypes 0xAEFE */ |
1256 | dissector_add_uint_range_with_preference("udp.port", "", ecpri_handle); /* UDP Port Preference */ |
1257 | |
1258 | oran_fh_handle = find_dissector("oran_fh_cus"); |
1259 | } |
1260 | |
1261 | /* |
1262 | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
1263 | * |
1264 | * Local variables: |
1265 | * c-basic-offset: 4 |
1266 | * tab-width: 8 |
1267 | * indent-tabs-mode: nil |
1268 | * End: |
1269 | * |
1270 | * vi: set shiftwidth=4 tabstop=8 expandtab: |
1271 | * :indentSize=4:tabSize=8:noTabs=true: |
1272 | */ |