2 * Routines for AVB-TP (Audio Video Bridging - Transport Protocol) dissection
3 * Copyright 2010, Torrey Atcitty <tatcitty@harman.com>
4 * Dave Olsen <dave.olsen@harman.com>
5 * Levi Pearson <levi.pearson@harman.com>
7 * Copyright 2011, Thomas Bottom <tom.bottom@labxtechnologies.com>
9 * Copyright 2016, Andreas Leibold <andreas.leibold@harman.com>
10 * Dissection for the following 1722 subtypes added:
11 * Clock Reference Format (CRF).
12 * IEC 61883-4 MPEG-TS data transmission.
13 * IEC 61883-6 audio/music data transmission protocol improved.
14 * Changes to meet 1722 Draft 15 specification.
16 * Copyright 2017, Marouen Ghodhbane <marouen.ghodhbane@nxp.com>
17 * Dissection for the 1722 Compressed Video subtype added.
18 * CVF Format subtype supported: H264 and MJPEG
19 * The dissection meets the 1722-2016 specification.
21 * Wireshark - Network traffic analyzer
22 * By Gerald Combs <gerald@wireshark.org>
23 * Copyright 1998 Gerald Combs
25 * SPDX-License-Identifier: GPL-2.0-or-later
27 * The 1722 Protocol specification can be found at the following:
28 * http://grouper.ieee.org/groups/1722/
34 #include <epan/packet.h>
35 #include <epan/expert.h>
36 #include <epan/etypes.h>
38 void proto_register_1722(void);
39 void proto_reg_handoff_1722(void);
40 void proto_register_1722_crf(void);
41 void proto_reg_handoff_1722_crf(void);
42 void proto_register_1722_aaf(void);
43 void proto_reg_handoff_1722_aaf(void);
44 void proto_register_1722_61883(void);
45 void proto_reg_handoff_1722_61883(void);
46 void proto_register_1722_cvf(void);
47 void proto_reg_handoff_1722_cvf(void);
49 /**************************************************************************************************/
52 /**************************************************************************************************/
53 #define IEEE_1722_SUBTYPE_61883 0x00
54 #define IEEE_1722_SUBTYPE_AAF 0x02
55 #define IEEE_1722_SUBTYPE_CVF 0x03
56 #define IEEE_1722_SUBTYPE_CRF 0x04
59 #define IEEE_1722_SV_MASK 0x80
60 #define IEEE_1722_VER_MASK 0x70
62 /**************************************************************************************************/
63 /* subtype IEC 61883 */
65 /**************************************************************************************************/
66 #define IEEE_1722_CIP_HEADER_SIZE 8
67 #define IEEE_1722_61883_TAG_NO_CIP 0x00
68 #define IEEE_1722_61883_TAG_CIP 0x40
69 #define IEEE_1722_61883_CHANNEL_AVTP 31
70 #define IEEE_1722_61883_SID_AVTP 63
71 #define IEEE_1722_61883_4_LEN_SOURCE_PACKET 192
72 #define IEEE_1722_61883_4_LEN_SP_TIMESTAMP 4
73 #define IEEE_1722_61883_4 0x20
74 #define IEEE_1722_61883_6 0x10
77 #define IEEE_1722_MR_MASK 0x08
78 #define IEEE_1722_GV_MASK 0x02
79 #define IEEE_1722_TV_MASK 0x01
80 #define IEEE_1722_TU_MASK 0x01
81 #define IEEE_1722_TAG_MASK 0xc0
82 #define IEEE_1722_CHANNEL_MASK 0x3f
83 #define IEEE_1722_TCODE_MASK 0xf0
84 #define IEEE_1722_SY_MASK 0x0f
85 #define IEEE_1722_QI1_MASK 0xc0
86 #define IEEE_1722_SID_MASK 0x3f
87 #define IEEE_1722_FN_MASK 0xc0
88 #define IEEE_1722_QPC_MASK 0x38
89 #define IEEE_1722_SPH_MASK 0x04
90 #define IEEE_1722_QI2_MASK 0xc0
91 #define IEEE_1722_FMT_MASK 0x3f
92 #define IEEE_1722_FDF_TSF_MASK 0x80
93 #define IEEE_1722_FDF_MASK 0xf8
95 /**************************************************************************************************/
98 /**************************************************************************************************/
99 #define IEEE_1722_AAF_FORMAT_USER 0x00
100 #define IEEE_1722_AAF_FORMAT_FLOAT_32_BIT 0x01
101 #define IEEE_1722_AAF_FORMAT_INT_32_BIT 0x02
102 #define IEEE_1722_AAF_FORMAT_INT_24_BIT 0x03
103 #define IEEE_1722_AAF_FORMAT_INT_16_BIT 0x04
104 #define IEEE_1722_AAF_FORMAT_AES3_32_BIT 0x05
106 /* Bit Field Masks */
107 #define IEEE_1722_MR_MASK 0x08
108 #define IEEE_1722_TV_MASK 0x01
109 #define IEEE_1722_SEQ_NUM_MASK 0x00
110 #define IEEE_1722_TU_MASK 0x01
111 #define IEEE_1722_STREAM_ID_MASK 0x00
112 #define IEEE_1722_TIMESTAMP_MASK 0x00
113 #define IEEE_1722_FORMAT_MASK 0x00
114 #define IEEE_1722_NOM_SAMPLE_RATE_MASK 0xf000
115 #define IEEE_1722_CHANNEL_PER_FRAME_MASK 0x03ff
116 #define IEEE_1722_BIT_DEPTH_MASK 0x00
117 #define IEEE_1722_AES3_DATA_TYPE_H_MASK 0x00
118 #define IEEE_1722_STREAM_DATA_LENGTH_MASK 0x00
119 #define IEEE_1722_AES3_DATA_TYPE_REFERENCE_MASK 0xe0
120 #define IEEE_1722_SP_MASK 0x10
121 #define IEEE_1722_EVT_MASK 0x0f
122 #define IEEE_1722_AES3_DATA_TYPE_L_MASK 0x00
123 #define IEEE_1722_DATA_MASK 0x00
124 #define IEEE_1722_SAMPLE_MASK 0x00
126 /**************************************************************************************************/
129 /**************************************************************************************************/
130 #define IEEE_1722_CVF_FORMAT_SUBTYPE_MJPEG 0x00
131 #define IEEE_1722_CVF_FORMAT_SUBTYPE_H264 0x01
132 #define IEEE_1722_CVF_FORMAT_SUBTYPE_JPEG2000 0x02
134 /* Bit Field Masks */
135 #define IEEE_1722_MR_MASK 0x08
136 #define IEEE_1722_TV_MASK 0x01
137 #define IEEE_1722_SEQ_NUM_MASK 0x00
138 #define IEEE_1722_TU_MASK 0x01
139 #define IEEE_1722_STREAM_ID_MASK 0x00
140 #define IEEE_1722_TIMESTAMP_MASK 0x00
141 #define IEEE_1722_FORMAT_MASK 0x00
142 #define IEEE_1722_FORMAT_SUBTYPE_MASK 0x00
143 #define IEEE_1722_CVF_H264_TIMESTAMP_MASK 0x00
144 #define IEEE_1722_CVF_H264_FORBIDDEN_MASK 0x80
145 #define IEEE_1722_CVF_H264_NRI_MASK 0x60
146 #define IEEE_1722_CVF_H264_NAL_TYPE_MASK 0x1f
147 #define IEEE_1722_CVF_MJPEG_TS_MASK 0x00
148 #define IEEE_1722_CVF_MJPEG_FRAGMENT_OFFSET_MASK 0x00
149 #define IEEE_1722_CVF_MJPEG_TYPE_MASK 0x00
150 #define IEEE_1722_CVF_MJPEG_Q_MASK 0x00
151 #define IEEE_1722_CVF_MJPEG_WIDTH_MASK 0x00
152 #define IEEE_1722_CVF_MJPEG_HEIGHT_MASK 0x00
153 #define IEEE_1722_MARKER_BIT_MASK 0x10
154 #define IEEE_1722_EVT_MASK 0x0f
156 /**************************************************************************************************/
159 /**************************************************************************************************/
160 #define IEEE_1722_CRF_TIMESTAMP_SIZE 8 /* size of the CRF timestamp in bytes */
162 /* Bit Field Masks */
163 #define IEEE_1722_MR_MASK 0x08
164 #define IEEE_1722_FS_MASK 0x02
165 #define IEEE_1722_TU_MASK 0x01
166 #define IEEE_1722_PULL_MASK 0xe0000000
167 #define IEEE_1722_BASE_FREQUENCY_MASK 0x1fffffff
169 /**************************************************************************************************/
172 /**************************************************************************************************/
173 static const range_string subtype_range_rvals[] = {
174 { 0, 0, "IEC 61883/IIDC Format" },
175 { 1, 1, "MMA Streams" },
176 { 2, 2, "AVTP Audio Format" },
177 { 3, 3, "Compressed Video Format" },
178 { 4, 4, "Clock Reference Format" },
179 { 5, 5, "Time Synchronous Control Format" },
180 { 6, 6, "SDI Video Format" },
181 { 7, 7, "Raw Video Format" },
182 { 8, 0x6d, "Reserved for future protocols" },
183 { 0x6e, 0x6e, "AES Encrypted Format Continuous" },
184 { 0x6f, 0x6f, "Vendor Specific Format Stream" },
185 { 0x70, 0x7e, "Reserved for future protocols" },
186 { 0x7f, 0x7f, "Experimental Format Stream" },
187 { 0x80, 0x81, "Reserved for future protocols" },
188 { 0x82, 0x82, "Non Time Synchronous Control Format" },
189 { 0x83, 0xed, "Reserved for future protocols" },
190 { 0xec, 0xec, "ECC Signed Control Format" },
191 { 0xed, 0xed, "ECC Encrypted Control Format" },
192 { 0xee, 0xee, "AES Encrypted Format Discrete" },
193 { 0xef, 0xf9, "Reserved for future protocols" },
194 { 0xfa, 0xfa, "AVDECC Discovery Protocol" },
195 { 0xfb, 0xfb, "AVDECC Enumeration and Control Protocol" },
196 { 0xfc, 0xfc, "AVDECC Connection Management Protocol" },
197 { 0xfd, 0xfd, "Reserved for future protocols" },
198 { 0xfe, 0xfe, "MAAP" },
199 { 0xff, 0xff, "Experimental Format Control" },
203 /* Initialize the protocol and registered fields */
204 static int proto_1722 = -1;
205 static int hf_1722_subtype = -1;
206 static int hf_1722_svfield = -1;
207 static int hf_1722_verfield = -1;
209 /* Initialize the subtree pointers */
210 static int ett_1722 = -1;
212 static dissector_table_t avb_dissector_table;
214 /**************************************************************************************************/
215 /* subtype IEC 61883 */
217 /**************************************************************************************************/
218 static const value_string tag_vals [] = {
219 {0, "No CIP header included"},
220 {1, "CIP header included"},
221 {2, "Reserved by IEEE 1394.1 clock adjustment"},
222 {3, "Global asynchronous stream packet format"},
226 static const range_string format_rvals [] = {
227 {0, 0, "DVCR transmission"},
228 {1, 0x0f, "Reserved"},
229 {IEEE_1722_61883_4, IEEE_1722_61883_4, "IEC 61883-4: MPEG2-TS data transmission"},
230 {0x11, 0x1d, "Reserved"},
231 {0x1e, 0x1e, "Free (vendor unique)"},
232 {0x1f, 0x1f, "Reserved"},
233 {IEEE_1722_61883_6, IEEE_1722_61883_6, "IEC 61883-6: Audio and music transmission"},
234 {0x21, 0x21, "ITU-R B0.1294 System B transmission"},
235 {0x22, 0x2d, "Reserved"},
236 {0x3e, 0x3e, "Free (vendor unique)"},
237 {0x3f, 0x3f, "No data"},
241 static const value_string fraction_number_vals [] = {
243 {1, "Divided into 2 datablocks"},
244 {2, "Divided into 4 datablocks"},
245 {3, "Divided into 8 datablocks"},
249 static const range_string fdf_rvals [] = {
250 {0x00, 0x07, "Basic format for AM824"},
251 {0x08, 0x0f, "Basic format for AM824. Transmission rate may be controlled by an AV/C command set"},
252 {0x10, 0x17, "Basic format for 24-bit*4 audio pack"},
253 {0x18, 0x1f, "Reserved"},
254 {0x20, 0x27, "Basic format for 32-bit floating-point data"},
255 {0x28, 0x2f, "Reserved"},
256 {0x30, 0x37, "Basic format for 32-bit generic data"},
257 {0x38, 0x3f, "Reserved"},
258 {0x40, 0xfe, "Reserved"},
259 {0xff, 0xff, "Packet for NO-DATA"},
263 static const range_string syt_rvals [] = {
264 {0x0000, 0x0bff, "Timestamp"},
265 {0x0c00, 0x0fff, "Reserved"},
266 {0x1000, 0x1bff, "Timestamp"},
267 {0x1c00, 0x1fff, "Reserved"},
268 {0x2000, 0x2bff, "Timestamp"},
269 {0x2c00, 0x2fff, "Reserved"},
270 {0x3000, 0x3bff, "Timestamp"},
271 {0x3c00, 0x3fff, "Reserved"},
272 {0x4000, 0x4bff, "Timestamp"},
273 {0x4c00, 0x4fff, "Reserved"},
274 {0x5000, 0x5bff, "Timestamp"},
275 {0x5c00, 0x5fff, "Reserved"},
276 {0x6000, 0x6bff, "Timestamp"},
277 {0x6c00, 0x6fff, "Reserved"},
278 {0x7000, 0x7bff, "Timestamp"},
279 {0x7c00, 0x7fff, "Reserved"},
280 {0x8000, 0x8bff, "Timestamp"},
281 {0x8c00, 0x8fff, "Reserved"},
282 {0x9000, 0x9bff, "Timestamp"},
283 {0x9c00, 0x9fff, "Reserved"},
284 {0xa000, 0xabff, "Timestamp"},
285 {0xac00, 0xafff, "Reserved"},
286 {0xb000, 0xbbff, "Timestamp"},
287 {0xbc00, 0xbfff, "Reserved"},
288 {0xc000, 0xcbff, "Timestamp"},
289 {0xcc00, 0xcfff, "Reserved"},
290 {0xd000, 0xdbff, "Timestamp"},
291 {0xdc00, 0xdfff, "Reserved"},
292 {0xe000, 0xebff, "Timestamp"},
293 {0xec00, 0xefff, "Reserved"},
294 {0xf000, 0xfbff, "Timestamp"},
295 {0xfc00, 0xfffe, "Reserved"},
296 {0xffff, 0xffff, "No information"},
300 /* Initialize the protocol and registered fields */
301 static int proto_1722_61883 = -1;
302 static int hf_1722_61883_mrfield = -1;
303 static int hf_1722_61883_gvfield = -1;
304 static int hf_1722_61883_tvfield = -1;
305 static int hf_1722_61883_seqnum = -1;
306 static int hf_1722_61883_tufield = -1;
307 static int hf_1722_61883_stream_id = -1;
308 static int hf_1722_61883_avtp_timestamp = -1;
309 static int hf_1722_61883_gateway_info = -1;
310 static int hf_1722_61883_stream_data_length = -1;
311 static int hf_1722_61883_tag = -1;
312 static int hf_1722_61883_channel = -1;
313 static int hf_1722_61883_tcode = -1;
314 static int hf_1722_61883_sy = -1;
315 static int hf_1722_61883_cip_qi1 = -1;
316 static int hf_1722_61883_cip_sid = -1;
317 static int hf_1722_61883_cip_dbs = -1;
318 static int hf_1722_61883_cip_fn = -1;
319 static int hf_1722_61883_cip_qpc = -1;
320 static int hf_1722_61883_cip_sph = -1;
321 static int hf_1722_61883_cip_dbc = -1;
322 static int hf_1722_61883_cip_qi2 = -1;
323 static int hf_1722_61883_cip_fmt = -1;
324 static int hf_1722_61883_cip_fdf_no_syt = -1;
325 static int hf_1722_61883_cip_fdf_tsf = -1;
326 static int hf_1722_61883_cip_fdf = -1;
327 static int hf_1722_61883_cip_syt = -1;
328 static int hf_1722_61883_audio_data = -1;
329 static int hf_1722_61883_label = -1;
330 static int hf_1722_61883_sample = -1;
331 static int hf_1722_61883_video_data = -1;
332 static int hf_1722_61883_source_packet_header_timestamp = -1;
334 /* Initialize the subtree pointers */
335 static int ett_1722_61883 = -1;
336 static int ett_1722_61883_audio = -1;
337 static int ett_1722_61883_sample = -1;
338 static int ett_1722_61883_video = -1;
340 /* Initialize expert fields */
341 static expert_field ei_1722_61883_incorrect_tag = EI_INIT;
342 static expert_field ei_1722_61883_incorrect_tcode = EI_INIT;
343 static expert_field ei_1722_61883_incorrect_qi1 = EI_INIT;
344 static expert_field ei_1722_61883_incorrect_qpc = EI_INIT;
345 static expert_field ei_1722_61883_incorrect_qi2 = EI_INIT;
346 static expert_field ei_1722_61883_unknown_format = EI_INIT;
347 static expert_field ei_1722_61883_incorrect_channel_sid = EI_INIT;
348 static expert_field ei_1722_61883_incorrect_datalen = EI_INIT;
349 static expert_field ei_1722_61883_4_incorrect_cip_fn = EI_INIT;
350 static expert_field ei_1722_61883_4_incorrect_cip_dbs = EI_INIT;
351 static expert_field ei_1722_61883_4_incorrect_cip_sph = EI_INIT;
352 static expert_field ei_1722_61883_6_incorrect_cip_fn = EI_INIT;
353 static expert_field ei_1722_61883_6_incorrect_cip_sph = EI_INIT;
354 static expert_field ei_1722_61883_incorrect_cip_fdf = EI_INIT;
356 /**************************************************************************************************/
359 /**************************************************************************************************/
360 static const range_string aaf_format_range_rvals [] = {
361 {0, 0, "User specified"},
362 {1, 1, "32bit floating point"},
363 {2, 2, "32bit integer"},
364 {3, 3, "24bit integer"},
365 {4, 4, "16bit integer"},
366 {5, 5, "32bit AES3 format"},
367 {6, 0xff, "Reserved"},
371 static const range_string aaf_nominal_sample_rate_range_rvals [] = {
372 {0, 0, "User specified"},
383 {0xb, 0xf, "Reserved"},
387 static const value_string aaf_sparse_timestamp_vals [] = {
388 {0, "Normal operation, timestamp in every AAF AVTPDU"},
389 {1, "Sparse mode, timestamp in every eighth AAF AVTPDU"},
393 /* Initialize the protocol and registered fields */
394 static int proto_1722_aaf = -1;
395 static int hf_1722_aaf_mrfield = -1;
396 static int hf_1722_aaf_tvfield = -1;
397 static int hf_1722_aaf_seqnum = -1;
398 static int hf_1722_aaf_tufield = -1;
399 static int hf_1722_aaf_stream_id = -1;
400 static int hf_1722_aaf_avtp_timestamp = -1;
401 static int hf_1722_aaf_format = -1;
402 static int hf_1722_aaf_nominal_sample_rate = -1;
403 static int hf_1722_aaf_bit_depth = -1;
404 static int hf_1722_aaf_stream_data_length = -1;
405 static int hf_1722_aaf_sparse_timestamp = -1;
406 static int hf_1722_aaf_evtfield = -1;
407 static int hf_1722_aaf_channels_per_frame = -1;
408 static int hf_1722_aaf_data = -1;
409 static int hf_1722_aaf_sample = -1;
411 /* Initialize the subtree pointers */
412 static int ett_1722_aaf = -1;
413 static int ett_1722_aaf_audio = -1;
414 static int ett_1722_aaf_sample = -1;
416 /* Initialize expert fields */
417 static expert_field ei_aaf_sample_width = EI_INIT;
418 static expert_field ei_aaf_reserved_format = EI_INIT;
419 static expert_field ei_aaf_aes3_format = EI_INIT;
420 static expert_field ei_aaf_channels_per_frame = EI_INIT;
421 static expert_field ei_aaf_incorrect_bit_depth = EI_INIT;
423 /**************************************************************************************************/
426 /**************************************************************************************************/
427 static const range_string crf_pull_range_rvals [] = {
438 static const range_string crf_type_range_rvals [] = {
439 {0, 0, "User Specified"},
440 {1, 1, "Audio Sample Timestamp"},
441 {2, 2, "Video Frame Sync Timestamp"},
442 {3, 3, "Video Line Sync Timestamp"},
443 {4, 4, "Machine Cycle Timestamp"},
444 {5, 0xff, "Reserved"},
448 /* Initialize the protocol and registered fields */
449 static int proto_1722_crf = -1;
450 static int hf_1722_crf_mrfield = -1;
451 static int hf_1722_crf_fsfield = -1;
452 static int hf_1722_crf_tufield = -1;
453 static int hf_1722_crf_seqnum = -1;
454 static int hf_1722_crf_type = -1;
455 static int hf_1722_crf_stream_id = -1;
456 static int hf_1722_crf_pull = -1;
457 static int hf_1722_crf_base_frequency = -1;
458 static int hf_1722_crf_data_length = -1;
459 static int hf_1722_crf_timestamp_interval = -1;
460 static int hf_1722_crf_timestamp_data = -1;
461 static int hf_1722_crf_timestamp = -1;
463 /* Initialize the subtree pointers */
464 static int ett_1722_crf = -1;
465 static int ett_1722_crf_timestamp = -1;
467 /* Initialize expert fields */
468 static expert_field ei_crf_datalen = EI_INIT;
470 /**************************************************************************************************/
473 /**************************************************************************************************/
474 static const range_string cvf_format_range_rvals [] = {
476 {2, 2, "RFC payload type"},
477 {3, 0xff, "Reserved"},
481 static const true_false_string tfs_marker_bit_set_not_set = { "Marker Bit is set", "Marker bit not set" };
483 static const range_string cvf_format_subtype_range_rvals [] = {
484 {0, 0, "MJPEG Format (RFC2435)"},
485 {1, 1, "H264 Format"},
486 {2, 2, "JPEG 2000 Video"},
487 {3, 0xff, "Reserved"},
491 static const range_string cvf_h264_nal_type_range_rvals [] = {
492 {0x00, 0x00, "Undefined"},
493 {0x01, 0x17, "Single Nal Unit Packet"},
494 {0x18, 0x18, "STAP-A"},
495 {0x19, 0x19, "STAP-B"},
496 {0x1a, 0x1a, "MTAP16"},
497 {0x1b, 0x1b, "MTAP24"},
498 {0x1c, 0x1c, "FU-A"},
499 {0x1d, 0x1d, "FU-B"},
500 {0x1e, 0xff, "Unspecified"},
504 static const range_string cvf_mjpeg_ts_range_rvals [] = {
505 {0, 0, "MJPEG TYPE SPEC PROGRESSIVE"},
506 {1, 1, "MJPEG TYPE SPEC ODD"},
507 {2, 2, "MJPEG TYPE SPEC EVEN"},
508 {3, 3, "MJPEG TYPE SPEC SINGLE"},
509 {3, 0xff, "Unspecified"},
513 /* Initialize the protocol and registered fields */
515 static int proto_1722_cvf = -1;
516 static int hf_1722_cvf_mrfield = -1;
517 static int hf_1722_cvf_tvfield = -1;
518 static int hf_1722_cvf_seqnum = -1;
519 static int hf_1722_cvf_tufield = -1;
520 static int hf_1722_cvf_stream_id = -1;
521 static int hf_1722_cvf_avtp_timestamp = -1;
522 static int hf_1722_cvf_format = -1;
523 static int hf_1722_cvf_format_subtype = -1;
524 static int hf_1722_cvf_stream_data_length = -1;
525 static int hf_1722_cvf_evtfield = -1;
526 static int hf_1722_cvf_marker_bit = -1;
527 static int hf_1722_cvf_h264_timestamp = -1;
528 static int hf_1722_cvf_h264_forbidden_bit = -1;
529 static int hf_1722_cvf_h264_nri = -1;
530 static int hf_1722_cvf_h264_nal_type = -1;
531 static int hf_1722_cvf_mjpeg_ts = -1;
532 static int hf_1722_cvf_mjpeg_fragment_offset = -1;
533 static int hf_1722_cvf_mjpeg_type = -1;
534 static int hf_1722_cvf_mjpeg_q = -1;
535 static int hf_1722_cvf_mjpeg_width = -1;
536 static int hf_1722_cvf_mjpeg_height = -1;
538 /* Initialize the subtree pointers */
539 static int ett_1722_cvf = -1;
541 /* Initialize expert fields */
542 static expert_field ei_cvf_jpeg2000_format = EI_INIT;
543 static expert_field ei_cvf_reserved_format = EI_INIT;
545 /**************************************************************************************************/
546 /* 1722 dissector implementation */
548 /**************************************************************************************************/
549 static int dissect_1722(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
552 proto_tree *ieee1722_tree;
555 const gint *fields[] = {
561 col_set_str(pinfo->cinfo, COL_PROTOCOL, "IEEE1722");
562 col_set_str(pinfo->cinfo, COL_INFO, "AVB Transportation Protocol");
564 ti = proto_tree_add_item(tree, proto_1722, tvb, 0, -1, ENC_NA);
565 ieee1722_tree = proto_item_add_subtree(ti, ett_1722);
567 proto_tree_add_item_ret_uint(ieee1722_tree, hf_1722_subtype, tvb, offset, 1, ENC_BIG_ENDIAN, &subtype);
569 proto_tree_add_bitmask_list(ieee1722_tree, tvb, offset, 1, fields, ENC_NA);
571 /* call any registered subtype dissectors which use only the common AVTPDU (e.g. 1722.1, MAAP, 61883, AAF, CRF or CVF) */
572 if (dissector_try_uint(avb_dissector_table, subtype, tvb, pinfo, tree))
573 return tvb_captured_length(tvb);
575 return tvb_captured_length(tvb);
578 /* Register the protocol with Wireshark */
579 void proto_register_1722(void)
581 static hf_register_info hf[] = {
583 { "AVBTP Subtype", "ieee1722.subtype",
584 FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(subtype_range_rvals), 0x00, NULL, HFILL }
587 { "AVTP Stream ID Valid", "ieee1722.svfield",
588 FT_BOOLEAN, 8, NULL, IEEE_1722_SV_MASK, NULL, HFILL }
591 { "AVTP Version", "ieee1722.verfield",
592 FT_UINT8, BASE_HEX, NULL, IEEE_1722_VER_MASK, NULL, HFILL }
596 static gint *ett[] = {
600 /* Register the protocol name and description */
601 proto_1722 = proto_register_protocol("IEEE 1722 Protocol", "IEEE1722", "ieee1722");
603 /* Required function calls to register the header fields and subtrees used */
604 proto_register_field_array(proto_1722, hf, array_length(hf));
605 proto_register_subtree_array(ett, array_length(ett));
607 /* Sub-dissector for 1772.1, 1722 AAF, 1722 CRF, 1722 61883, 1722 CVF */
608 avb_dissector_table = register_dissector_table("ieee1722.subtype",
609 "IEEE1722 AVBTP Subtype", proto_1722, FT_UINT8, BASE_HEX);
612 void proto_reg_handoff_1722(void)
614 dissector_handle_t avbtp_handle;
616 avbtp_handle = create_dissector_handle(dissect_1722, proto_1722);
617 dissector_add_uint("ethertype", ETHERTYPE_AVBTP, avbtp_handle);
620 /**************************************************************************************************/
621 /* IEC 61883 dissector implementation */
623 /**************************************************************************************************/
624 static int dissect_1722_61883(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
627 proto_tree *ti_61883_tree;
628 proto_tree *ti_channel;
629 proto_tree *ti_datalen;
630 proto_tree *ti_cip_fn;
631 proto_tree *ti_cip_dbs;
632 proto_tree *ti_cip_sph;
633 proto_tree *ti_cip_fmt;
634 proto_tree *ti_cip_fdf;
635 proto_tree *ti_audio_tree;
636 proto_tree *ti_sample_tree;
637 proto_tree *ti_video_tree;
652 guint numSourcePackets = 0;
655 const gint *fields[] = {
656 &hf_1722_61883_mrfield,
657 &hf_1722_61883_gvfield,
658 &hf_1722_61883_tvfield,
662 ti = proto_tree_add_item(tree, proto_1722_61883, tvb, 0, -1, ENC_NA);
663 ti_61883_tree = proto_item_add_subtree(ti, ett_1722_61883);
665 proto_tree_add_bitmask_list(ti_61883_tree, tvb, offset, 1, fields, ENC_NA);
667 proto_tree_add_item(ti_61883_tree, hf_1722_61883_seqnum, tvb, offset, 1, ENC_BIG_ENDIAN);
669 proto_tree_add_item(ti_61883_tree, hf_1722_61883_tufield, tvb, offset, 1, ENC_BIG_ENDIAN);
671 proto_tree_add_item(ti_61883_tree, hf_1722_61883_stream_id, tvb, offset, 8, ENC_BIG_ENDIAN);
674 proto_tree_add_item(ti_61883_tree, hf_1722_61883_avtp_timestamp, tvb, offset, 4, ENC_BIG_ENDIAN);
676 proto_tree_add_item(ti_61883_tree, hf_1722_61883_gateway_info, tvb, offset, 4, ENC_BIG_ENDIAN);
679 ti_datalen = proto_tree_add_item_ret_uint(ti_61883_tree, hf_1722_61883_stream_data_length, tvb, offset, 2, ENC_BIG_ENDIAN, &datalen);
682 /* tag field defines if CIP header is included or not */
683 ti = proto_tree_add_item(ti_61883_tree, hf_1722_61883_tag, tvb, offset, 1, ENC_BIG_ENDIAN);
685 tag = tvb_get_guint8(tvb, offset) & IEEE_1722_TAG_MASK;
688 expert_add_info(pinfo, ti, &ei_1722_61883_incorrect_tag);
691 ti_channel = proto_tree_add_item(ti_61883_tree, hf_1722_61883_channel, tvb, offset, 1, ENC_BIG_ENDIAN);
692 channel = tvb_get_guint8(tvb, offset) & IEEE_1722_CHANNEL_MASK;
693 if (channel != IEEE_1722_61883_CHANNEL_AVTP)
695 proto_item_append_text(ti_channel, ": Originating Source ID from an IEEE 1394 serial bus");
699 proto_item_append_text(ti_channel, ": Originating source is on AVTP network (native AVTP)");
703 ti = proto_tree_add_item(ti_61883_tree, hf_1722_61883_tcode, tvb, offset, 1, ENC_BIG_ENDIAN);
704 tcode = tvb_get_guint8(tvb, offset) & IEEE_1722_TCODE_MASK;
707 expert_add_info(pinfo, ti, &ei_1722_61883_incorrect_tcode);
710 proto_tree_add_item(ti_61883_tree, hf_1722_61883_sy, tvb, offset, 1, ENC_BIG_ENDIAN);
714 case IEEE_1722_61883_TAG_NO_CIP:
715 proto_item_prepend_text(ti, "IIDC 1394 video payload:");
717 case IEEE_1722_61883_TAG_CIP:
718 ti = proto_tree_add_item(ti_61883_tree, hf_1722_61883_cip_qi1, tvb, offset, 1, ENC_BIG_ENDIAN);
719 cip_qi1 = tvb_get_guint8(tvb, offset) & IEEE_1722_QI1_MASK;
722 expert_add_info(pinfo, ti, &ei_1722_61883_incorrect_qi1);
725 ti = proto_tree_add_item(ti_61883_tree, hf_1722_61883_cip_sid, tvb, offset, 1, ENC_BIG_ENDIAN);
726 cip_sid = tvb_get_guint8(tvb, offset) & IEEE_1722_SID_MASK;
727 if (cip_sid != IEEE_1722_61883_SID_AVTP)
729 proto_item_append_text(ti, ": Originating Source ID from an IEEE 1394 serial bus");
730 if (channel == IEEE_1722_61883_CHANNEL_AVTP)
732 expert_add_info(pinfo, ti, &ei_1722_61883_incorrect_channel_sid);
733 expert_add_info(pinfo, ti_channel, &ei_1722_61883_incorrect_channel_sid);
739 proto_item_append_text(ti, ": Originating source is on AVTP network");
740 if (channel != IEEE_1722_61883_CHANNEL_AVTP)
742 expert_add_info(pinfo, ti, &ei_1722_61883_incorrect_channel_sid);
743 expert_add_info(pinfo, ti_channel, &ei_1722_61883_incorrect_channel_sid);
748 ti_cip_dbs = proto_tree_add_item(ti_61883_tree, hf_1722_61883_cip_dbs, tvb, offset, 1, ENC_BIG_ENDIAN);
749 cip_dbs = tvb_get_guint8(tvb, offset);
751 ti_cip_fn = proto_tree_add_item(ti_61883_tree, hf_1722_61883_cip_fn, tvb, offset, 1, ENC_BIG_ENDIAN);
753 switch (tvb_get_guint8(tvb, offset) & IEEE_1722_FN_MASK) {
770 ti = proto_tree_add_item(ti_61883_tree, hf_1722_61883_cip_qpc, tvb, offset, 1, ENC_BIG_ENDIAN);
771 cip_qpc = tvb_get_guint8(tvb, offset) & IEEE_1722_QPC_MASK;
774 expert_add_info(pinfo, ti, &ei_1722_61883_incorrect_qpc);
777 ti_cip_sph = proto_tree_add_item(ti_61883_tree, hf_1722_61883_cip_sph, tvb, offset, 1, ENC_BIG_ENDIAN);
778 cip_sph = tvb_get_guint8(tvb, offset) & IEEE_1722_SPH_MASK;
780 proto_tree_add_item(ti_61883_tree, hf_1722_61883_cip_dbc, tvb, offset, 1, ENC_BIG_ENDIAN);
783 ti = proto_tree_add_item(ti_61883_tree, hf_1722_61883_cip_qi2, tvb, offset, 1, ENC_BIG_ENDIAN);
784 cip_qi2 = tvb_get_guint8(tvb, offset) & IEEE_1722_QI2_MASK;
787 expert_add_info(pinfo, ti, &ei_1722_61883_incorrect_qi2);
790 /* Check format field for 61883-4 MPEG-TS video or 61883-6 for audio */
791 ti_cip_fmt = proto_tree_add_item(ti_61883_tree, hf_1722_61883_cip_fmt, tvb, offset, 1, ENC_BIG_ENDIAN);
792 cip_fmt = tvb_get_guint8(tvb, offset) & IEEE_1722_FMT_MASK;
795 if ((cip_fmt & 0x20) == 0)
797 proto_tree_add_item(ti_61883_tree, hf_1722_61883_cip_fdf, tvb, offset, 1, ENC_BIG_ENDIAN);
799 proto_tree_add_item(ti_61883_tree, hf_1722_61883_cip_syt, tvb, offset, 2, ENC_BIG_ENDIAN);
804 ti_cip_fdf = proto_tree_add_item(ti_61883_tree, hf_1722_61883_cip_fdf_no_syt, tvb, offset, 3, ENC_BIG_ENDIAN);
805 if (((tvb_get_guint8(tvb, offset) & 0x007fffff) != 0))
807 expert_add_info(pinfo, ti_cip_fdf, &ei_1722_61883_incorrect_cip_fdf);
810 proto_tree_add_item(ti_61883_tree, hf_1722_61883_cip_fdf_tsf, tvb, offset, 3, ENC_BIG_ENDIAN);
814 /* Calculate the remaining size by subtracting the CIP header size from the value in the packet data length field */
815 datalen -= IEEE_1722_CIP_HEADER_SIZE;
826 case IEEE_1722_61883_6:
829 expert_add_info(pinfo, ti_cip_fn, &ei_1722_61883_6_incorrect_cip_fn);
833 expert_add_info(pinfo, ti_cip_sph, &ei_1722_61883_6_incorrect_cip_sph);
836 /* Make the Audio sample tree. */
837 ti = proto_tree_add_item(ti_61883_tree, hf_1722_61883_audio_data, tvb, offset, datalen, ENC_NA);
838 ti_audio_tree = proto_item_add_subtree(ti, ett_1722_61883_audio);
839 if ((datalen % (db_size*4)) != 0)
841 expert_add_info(pinfo, ti, &ei_1722_61883_incorrect_datalen);
842 expert_add_info(pinfo, ti_datalen, &ei_1722_61883_incorrect_datalen);
844 numSourcePackets = datalen / (db_size*4);
847 /* Loop through all samples and add them to the audio tree. */
848 for (j = 0; j < numSourcePackets; j++) {
849 ti_sample_tree = proto_tree_add_subtree_format(ti_audio_tree, tvb, offset, 1, ett_1722_61883_sample, NULL, "Sample %d", j+1);
850 for (i = 0; i < db_size; i++) {
851 proto_tree_add_item(ti_sample_tree, hf_1722_61883_label, tvb, offset, 1, ENC_BIG_ENDIAN);
853 proto_tree_add_item(ti_sample_tree, hf_1722_61883_sample, tvb, offset, 3, ENC_NA);
859 case IEEE_1722_61883_4:
862 expert_add_info(pinfo, ti_cip_dbs, &ei_1722_61883_4_incorrect_cip_dbs);
866 expert_add_info(pinfo, ti_cip_fn, &ei_1722_61883_4_incorrect_cip_fn);
870 expert_add_info(pinfo, ti_cip_sph, &ei_1722_61883_4_incorrect_cip_sph);
872 /* Make the video tree. */
873 ti = proto_tree_add_item(ti_61883_tree, hf_1722_61883_video_data, tvb, offset, datalen, ENC_NA);
874 ti_video_tree = proto_item_add_subtree(ti, ett_1722_61883_video);
875 if ((datalen % IEEE_1722_61883_4_LEN_SOURCE_PACKET) != 0)
877 expert_add_info(pinfo, ti, &ei_1722_61883_incorrect_datalen);
878 expert_add_info(pinfo, ti_datalen, &ei_1722_61883_incorrect_datalen);
880 numSourcePackets = datalen / IEEE_1722_61883_4_LEN_SOURCE_PACKET;
883 /* Loop through all packets and add them to the video tree. */
884 for (j = 0; j < numSourcePackets; j++) {
885 proto_tree_add_item(ti_video_tree, hf_1722_61883_source_packet_header_timestamp, tvb, offset, IEEE_1722_61883_4_LEN_SP_TIMESTAMP, ENC_BIG_ENDIAN);
886 offset += IEEE_1722_61883_4_LEN_SP_TIMESTAMP;
887 proto_tree_add_item(ti_video_tree, hf_1722_61883_video_data, tvb, offset, (IEEE_1722_61883_4_LEN_SOURCE_PACKET - IEEE_1722_61883_4_LEN_SP_TIMESTAMP), ENC_NA);
888 offset += (IEEE_1722_61883_4_LEN_SOURCE_PACKET - IEEE_1722_61883_4_LEN_SP_TIMESTAMP);
893 expert_add_info(pinfo, ti_cip_fmt, &ei_1722_61883_unknown_format);
900 return tvb_captured_length(tvb);
903 void proto_register_1722_61883(void)
905 static hf_register_info hf[] = {
906 { &hf_1722_61883_mrfield,
907 { "Media Clock Restart", "61883.mrfield",
908 FT_BOOLEAN, 8, NULL, IEEE_1722_MR_MASK, NULL, HFILL }
910 { &hf_1722_61883_gvfield,
911 { "Gateway Info Valid", "61883.gvfield",
912 FT_BOOLEAN, 8, NULL, IEEE_1722_GV_MASK, NULL, HFILL }
914 { &hf_1722_61883_tvfield,
915 { "Timestamp Valid", "61883.tvfield",
916 FT_BOOLEAN, 8, NULL, IEEE_1722_TV_MASK, NULL, HFILL }
918 { &hf_1722_61883_seqnum,
919 { "Sequence Number", "61883.seqnum",
920 FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL }
922 { &hf_1722_61883_tufield,
923 { "Timestamp Uncertain", "61883.tufield",
924 FT_BOOLEAN, 8, NULL, IEEE_1722_TU_MASK, NULL, HFILL }
926 { &hf_1722_61883_stream_id,
927 { "Stream ID", "61883.stream_id",
928 FT_UINT64, BASE_HEX, NULL, 0x00, NULL, HFILL }
930 { &hf_1722_61883_avtp_timestamp,
931 { "AVTP Timestamp", "61883.avtp_timestamp",
932 FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL }
934 { &hf_1722_61883_gateway_info,
935 { "Gateway Info", "61883.gateway_info",
936 FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL }
938 { &hf_1722_61883_stream_data_length,
939 { "1394 Stream Data Length", "61883.stream_data_len",
940 FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x00, NULL, HFILL }
942 { &hf_1722_61883_tag,
943 { "1394 Packet Format Tag", "61883.tag",
944 FT_UINT8, BASE_HEX, VALS(tag_vals), IEEE_1722_TAG_MASK, NULL, HFILL }
946 { &hf_1722_61883_channel,
947 { "1394 Packet Channel", "61883.channel",
948 FT_UINT8, BASE_DEC, NULL, IEEE_1722_CHANNEL_MASK, NULL, HFILL }
950 { &hf_1722_61883_tcode,
951 { "1394 Packet Tcode", "61883.tcode",
952 FT_UINT8, BASE_HEX, NULL, IEEE_1722_TCODE_MASK, NULL, HFILL }
955 { "1394 App-specific Control", "61883.sy",
956 FT_UINT8, BASE_HEX, NULL, IEEE_1722_SY_MASK, NULL, HFILL }
958 { &hf_1722_61883_cip_qi1,
959 { "CIP Quadlet Indicator 1", "61883.qi1",
960 FT_UINT8, BASE_HEX, NULL, IEEE_1722_QI1_MASK, NULL, HFILL }
962 { &hf_1722_61883_cip_sid,
963 { "CIP Source ID", "61883.sid",
964 FT_UINT8, BASE_DEC, NULL, IEEE_1722_SID_MASK, NULL, HFILL }
966 { &hf_1722_61883_cip_dbs,
967 { "CIP Data Block Size", "61883.dbs",
968 FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL }
970 { &hf_1722_61883_cip_fn,
971 { "CIP Fraction Number", "61883.fn",
972 FT_UINT8, BASE_HEX, VALS(fraction_number_vals), IEEE_1722_FN_MASK, NULL, HFILL }
974 { &hf_1722_61883_cip_qpc,
975 { "CIP Quadlet Padding Count", "61883.qpc",
976 FT_UINT8, BASE_HEX, NULL, IEEE_1722_QPC_MASK, NULL, HFILL }
978 { &hf_1722_61883_cip_sph,
979 { "CIP Source Packet Header", "61883.sph",
980 FT_BOOLEAN, 8, NULL, IEEE_1722_SPH_MASK, NULL, HFILL }
982 { &hf_1722_61883_cip_dbc,
983 { "CIP Data Block Continuity", "61883.dbc",
984 FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL }
986 { &hf_1722_61883_cip_qi2,
987 { "CIP Quadlet Indicator 2", "61883.qi2",
988 FT_UINT8, BASE_HEX, NULL, IEEE_1722_QI2_MASK, NULL, HFILL }
990 { &hf_1722_61883_cip_fmt,
991 { "CIP Format ID", "61883.fmt",
992 FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(format_rvals), IEEE_1722_FMT_MASK, NULL, HFILL }
994 { &hf_1722_61883_cip_fdf_no_syt,
995 { "CIP Format Dependent Field", "61883.fdf_no_syt",
996 FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL }
998 { &hf_1722_61883_cip_fdf_tsf,
999 { "Time shift flag", "61883.fdf_tsf",
1000 FT_BOOLEAN, 8, NULL, IEEE_1722_FDF_TSF_MASK, NULL, HFILL }
1002 { &hf_1722_61883_cip_fdf,
1003 { "CIP Format Dependent Field", "61883.fdf",
1004 FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(fdf_rvals), IEEE_1722_FDF_MASK, NULL, HFILL }
1006 { &hf_1722_61883_cip_syt,
1007 { "CIP SYT", "61883.syt",
1008 FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(syt_rvals), 0x00, NULL, HFILL }
1010 { &hf_1722_61883_audio_data,
1011 { "Audio Data", "61883.audiodata",
1012 FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL }
1014 { &hf_1722_61883_label,
1015 { "Label", "61883.audiodata.sample.label",
1016 FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL }
1018 { &hf_1722_61883_sample,
1019 { "Sample", "61883.audiodata.sample.sampledata",
1020 FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL }
1022 { &hf_1722_61883_video_data,
1023 { "Video Data", "61883.videodata",
1024 FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL }
1026 { &hf_1722_61883_source_packet_header_timestamp,
1027 { "Source Packet Header Timestamp", "61883.spht",
1028 FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL }
1032 static gint *ett[] = {
1034 &ett_1722_61883_audio,
1035 &ett_1722_61883_sample,
1036 &ett_1722_61883_video
1039 static ei_register_info ei[] = {
1040 { &ei_1722_61883_incorrect_tag, { "61883.incorrect_tag", PI_PROTOCOL, PI_WARN,
1041 "Incorrect tag field, only 0x00 and 0x01 supported for AVTP", EXPFILL }},
1042 { &ei_1722_61883_incorrect_tcode, { "61883.incorrect_tcode", PI_PROTOCOL, PI_WARN,
1043 "Incorrect tcode, talker shall set this field to 0x0A", EXPFILL }},
1044 { &ei_1722_61883_incorrect_qi1, { "61883.incorrect_qi1", PI_PROTOCOL, PI_WARN,
1045 "Incorrect quadlet indicator 1 field, talker shall set this field to 0x00", EXPFILL }},
1046 { &ei_1722_61883_incorrect_qpc, { "61883.incorrect_qpc", PI_PROTOCOL, PI_WARN,
1047 "Incorrect quadlet padding count field, shall be set to 0", EXPFILL }},
1048 { &ei_1722_61883_incorrect_qi2, { "61883.incorrect_qi2", PI_PROTOCOL, PI_WARN,
1049 "Incorrect quadlet indicator 2 field, talker shall set this field to 0x02", EXPFILL }},
1050 { &ei_1722_61883_unknown_format, { "61883.unknown_format", PI_PROTOCOL, PI_NOTE,
1051 "IEC 61883 format not dissected yet", EXPFILL }},
1052 { &ei_1722_61883_incorrect_channel_sid, { "61883.incorrect_channel_sid", PI_PROTOCOL, PI_WARN,
1053 "1394 Packet Channel and Source ID don`t match", EXPFILL }},
1054 { &ei_1722_61883_incorrect_datalen, { "61883.incorrect_datalen", PI_PROTOCOL, PI_WARN,
1055 "Incorrect stream data length field, must be multiple of 192 plus 8 bytes CIP header", EXPFILL }},
1056 { &ei_1722_61883_4_incorrect_cip_fn, { "61883.4_incorrect_cip_fn", PI_PROTOCOL, PI_WARN,
1057 "Incorrect fraction number, shall be 8 for IEC 61883-4", EXPFILL }},
1058 { &ei_1722_61883_4_incorrect_cip_dbs, { "61883.4_incorrect_cip_dbs", PI_PROTOCOL, PI_WARN,
1059 "Incorrect data block size, shall be 6 for IEC 61883-4", EXPFILL }},
1060 { &ei_1722_61883_4_incorrect_cip_sph, { "61883.4_incorrect_cip_sph", PI_PROTOCOL, PI_WARN,
1061 "Incorrect source packet header value, shall be 1 for IEC 61883-4", EXPFILL }},
1062 { &ei_1722_61883_6_incorrect_cip_fn, { "61883.6_incorrect_cip_fn", PI_PROTOCOL, PI_WARN,
1063 "Incorrect fraction number, shall be 0 for IEC 61883-6", EXPFILL }},
1064 { &ei_1722_61883_6_incorrect_cip_sph, { "61883.6_incorrect_cip_sph", PI_PROTOCOL, PI_WARN,
1065 "Incorrect source packet header value, shall be 0 for IEC 61883-6", EXPFILL }},
1066 { &ei_1722_61883_incorrect_cip_fdf, { "61883.6_incorrect_cip_fdf", PI_PROTOCOL, PI_WARN,
1067 "Incorrect frame dependent field value, shall be 0", EXPFILL }}
1070 expert_module_t* expert_1722_61883;
1072 /* Register the protocol name and description */
1073 proto_1722_61883 = proto_register_protocol(
1074 "IEC 61883 Protocol", /* name */
1075 "IEC 61883", /* short name */
1076 "61883"); /* abbrev */
1078 /* Required function calls to register the header fields and subtrees used */
1079 proto_register_field_array(proto_1722_61883, hf, array_length(hf));
1080 proto_register_subtree_array(ett, array_length(ett));
1081 expert_1722_61883 = expert_register_protocol(proto_1722_61883);
1082 expert_register_field_array(expert_1722_61883, ei, array_length(ei));
1085 void proto_reg_handoff_1722_61883(void)
1087 dissector_handle_t avb1722_61883_handle;
1089 avb1722_61883_handle = create_dissector_handle(dissect_1722_61883, proto_1722_61883);
1090 dissector_add_uint("ieee1722.subtype", IEEE_1722_SUBTYPE_61883, avb1722_61883_handle);
1093 /**************************************************************************************************/
1094 /* 1722 AAF dissector implementation */
1096 /**************************************************************************************************/
1097 static int dissect_1722_aaf (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1100 proto_tree *ti_aaf_tree;
1101 proto_tree *ti_channels_per_frame;
1102 proto_tree *ti_format;
1103 proto_tree *ti_audio_tree;
1104 proto_tree *ti_sample_tree;
1107 guint channels_per_frame = 0;
1108 guint bit_depth = 0;
1109 guint sample_width = 0;
1113 const gint *fields[] = {
1114 &hf_1722_aaf_mrfield,
1115 &hf_1722_aaf_tvfield,
1118 const gint *fields_pcm[] = {
1119 &hf_1722_aaf_sparse_timestamp,
1120 &hf_1722_aaf_evtfield,
1124 ti = proto_tree_add_item(tree, proto_1722_aaf, tvb, 0, -1, ENC_NA);
1125 ti_aaf_tree = proto_item_add_subtree(ti, ett_1722_aaf);
1127 proto_tree_add_bitmask_list(ti_aaf_tree, tvb, offset, 1, fields, ENC_NA);
1129 proto_tree_add_item(ti_aaf_tree, hf_1722_aaf_seqnum, tvb, offset, 1, ENC_BIG_ENDIAN);
1131 proto_tree_add_item(ti_aaf_tree, hf_1722_aaf_tufield, tvb, offset, 1, ENC_BIG_ENDIAN);
1133 proto_tree_add_item(ti_aaf_tree, hf_1722_aaf_stream_id, tvb, offset, 8, ENC_BIG_ENDIAN);
1135 proto_tree_add_item(ti_aaf_tree, hf_1722_aaf_avtp_timestamp, tvb, offset, 4, ENC_BIG_ENDIAN);
1138 ti_format = proto_tree_add_item_ret_uint(ti_aaf_tree, hf_1722_aaf_format, tvb, offset, 1, ENC_BIG_ENDIAN, &format);
1142 case IEEE_1722_AAF_FORMAT_USER:
1144 case IEEE_1722_AAF_FORMAT_FLOAT_32_BIT:
1147 case IEEE_1722_AAF_FORMAT_INT_32_BIT:
1150 case IEEE_1722_AAF_FORMAT_INT_24_BIT:
1153 case IEEE_1722_AAF_FORMAT_INT_16_BIT:
1156 case IEEE_1722_AAF_FORMAT_AES3_32_BIT:
1163 if (format < IEEE_1722_AAF_FORMAT_AES3_32_BIT)
1165 proto_tree_add_item(ti_aaf_tree, hf_1722_aaf_nominal_sample_rate, tvb, offset, 2, ENC_BIG_ENDIAN);
1166 ti_channels_per_frame = proto_tree_add_item_ret_uint(ti_aaf_tree, hf_1722_aaf_channels_per_frame, tvb, offset, 2, ENC_BIG_ENDIAN, &channels_per_frame);
1167 if (channels_per_frame == 0)
1169 expert_add_info(pinfo, ti_channels_per_frame, &ei_aaf_channels_per_frame);
1174 ti = proto_tree_add_item_ret_uint(ti_aaf_tree, hf_1722_aaf_bit_depth, tvb, offset, 1, ENC_BIG_ENDIAN, &bit_depth);
1175 if ((bit_depth == 0) || (bit_depth > sample_width))
1177 expert_add_info(pinfo, ti, &ei_aaf_incorrect_bit_depth);
1180 proto_tree_add_item_ret_uint(ti_aaf_tree, hf_1722_aaf_stream_data_length, tvb, offset, 2, ENC_BIG_ENDIAN, &datalen);
1183 proto_tree_add_bitmask_list(ti_aaf_tree, tvb, offset, 1, fields_pcm, ENC_BIG_ENDIAN);
1186 /* Make the Audio sample tree. */
1187 ti = proto_tree_add_item(ti_aaf_tree, hf_1722_aaf_data, tvb, offset, datalen, ENC_NA);
1188 ti_audio_tree = proto_item_add_subtree(ti, ett_1722_aaf_audio);
1190 if (sample_width == 0)
1192 expert_add_info(pinfo, ti, &ei_aaf_sample_width);
1196 /* Loop through all samples and add them to the audio tree. */
1197 for (j = 0; j < ((datalen * 8) / (channels_per_frame * sample_width)); j++)
1199 ti_sample_tree = proto_tree_add_subtree_format(ti_audio_tree, tvb, offset, 1,
1200 ett_1722_aaf_sample, NULL, "Sample Chunk %d", j);
1201 for (i = 0; i < channels_per_frame; i++)
1203 ti = proto_tree_add_item(ti_sample_tree, hf_1722_aaf_sample, tvb, offset, sample_width / 8, ENC_NA);
1204 proto_item_prepend_text(ti, "Channel: %d ", i);
1205 offset += (sample_width / 8);
1211 else if (format == IEEE_1722_AAF_FORMAT_AES3_32_BIT)
1213 expert_add_info(pinfo, ti_format, &ei_aaf_aes3_format);
1217 expert_add_info(pinfo, ti_format, &ei_aaf_reserved_format);
1219 return tvb_captured_length(tvb);
1222 void proto_register_1722_aaf (void)
1224 static hf_register_info hf[] =
1226 { &hf_1722_aaf_mrfield,
1227 { "Media Clock Restart", "aaf.mrfield",
1228 FT_BOOLEAN, 8, NULL, IEEE_1722_MR_MASK, NULL, HFILL }
1230 { &hf_1722_aaf_tvfield,
1231 { "Source Timestamp Valid", "aaf.tvfield",
1232 FT_BOOLEAN, 8, NULL, IEEE_1722_TV_MASK, NULL, HFILL }
1234 { &hf_1722_aaf_seqnum,
1235 { "Sequence Number", "aaf.seqnum",
1236 FT_UINT8, BASE_DEC, NULL, IEEE_1722_SEQ_NUM_MASK, NULL, HFILL }
1238 { &hf_1722_aaf_tufield,
1239 { "Timestamp Uncertain", "aaf.tufield",
1240 FT_BOOLEAN, 8, NULL, IEEE_1722_TU_MASK, NULL, HFILL }
1242 { &hf_1722_aaf_stream_id,
1243 { "Stream ID", "aaf.stream_id",
1244 FT_UINT64, BASE_HEX, NULL, IEEE_1722_STREAM_ID_MASK, NULL, HFILL }
1246 { &hf_1722_aaf_avtp_timestamp,
1247 { "AVTP Timestamp", "aaf.avtp_timestamp",
1248 FT_UINT32, BASE_DEC, NULL, IEEE_1722_TIMESTAMP_MASK, NULL, HFILL }
1250 { &hf_1722_aaf_format,
1251 { "Format", "aaf.format_info",
1252 FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(aaf_format_range_rvals), IEEE_1722_FORMAT_MASK, NULL, HFILL }
1254 { &hf_1722_aaf_nominal_sample_rate,
1255 { "Nominal Sample Rate", "aaf.nominal_sample_rate",
1256 FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(aaf_nominal_sample_rate_range_rvals), IEEE_1722_NOM_SAMPLE_RATE_MASK, NULL, HFILL }
1258 { &hf_1722_aaf_channels_per_frame,
1259 { "Channels per Frame", "aaf.channels_per_frame",
1260 FT_UINT16, BASE_DEC, NULL, IEEE_1722_CHANNEL_PER_FRAME_MASK, NULL, HFILL }
1262 { &hf_1722_aaf_bit_depth,
1263 { "Bit Depth", "aaf.bit_depth",
1264 FT_UINT8, BASE_DEC, NULL, IEEE_1722_BIT_DEPTH_MASK, NULL, HFILL }
1266 { &hf_1722_aaf_stream_data_length,
1267 { "Stream Data Length", "aaf.stream_data_len",
1268 FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, IEEE_1722_STREAM_DATA_LENGTH_MASK, NULL, HFILL }
1270 { &hf_1722_aaf_sparse_timestamp,
1271 { "Sparse Timestamp Mode", "aaf.sparse_timestamp",
1272 FT_UINT8, BASE_DEC, VALS(aaf_sparse_timestamp_vals), IEEE_1722_SP_MASK, NULL, HFILL }
1274 { &hf_1722_aaf_evtfield,
1275 { "EVT", "aaf.evtfield",
1276 FT_UINT8, BASE_HEX, NULL, IEEE_1722_EVT_MASK, NULL, HFILL }
1278 { &hf_1722_aaf_data,
1279 { "Audio Data", "aaf.data",
1280 FT_BYTES, BASE_NONE, NULL, IEEE_1722_DATA_MASK, NULL, HFILL }
1282 { &hf_1722_aaf_sample,
1283 { "Sample Data", "aaf.data.sample",
1284 FT_BYTES, BASE_NONE, NULL, IEEE_1722_SAMPLE_MASK, NULL, HFILL }
1288 static ei_register_info ei[] = {
1289 { &ei_aaf_sample_width, { "aaf.expert.sample_width_zero", PI_PROTOCOL, PI_WARN, "Sample_width of 0 can`t be dissected", EXPFILL }},
1290 { &ei_aaf_reserved_format, { "aaf.expert.reserved_format", PI_PROTOCOL, PI_WARN, "Incorrect format, can`t be dissected", EXPFILL }},
1291 { &ei_aaf_aes3_format, { "aaf.expert.aes3_format", PI_PROTOCOL, PI_WARN, "AES3 format is currently not supported", EXPFILL }},
1292 { &ei_aaf_channels_per_frame, { "aaf.expert.channels_per_frame_zero", PI_PROTOCOL, PI_WARN, "Channels_per_frame value shall not be 0", EXPFILL }},
1293 { &ei_aaf_incorrect_bit_depth, { "aaf.expert.incorrect_bit_depth", PI_PROTOCOL, PI_WARN, "Incorrect bit_depth value", EXPFILL }}
1296 static gint *ett[] =
1299 &ett_1722_aaf_audio,
1300 &ett_1722_aaf_sample,
1303 expert_module_t *expert_1722_aaf;
1305 /* Register the protocol name and description */
1306 proto_1722_aaf = proto_register_protocol("AVTP Audio Format", "AAF", "aaf");
1308 /* Required function calls to register the header fields and subtrees used */
1309 proto_register_field_array(proto_1722_aaf, hf, array_length(hf));
1310 proto_register_subtree_array(ett, array_length(ett));
1312 expert_1722_aaf = expert_register_protocol(proto_1722_aaf);
1313 expert_register_field_array(expert_1722_aaf, ei, array_length(ei));
1316 void proto_reg_handoff_1722_aaf(void)
1318 dissector_handle_t avb1722_aaf_handle;
1320 avb1722_aaf_handle = create_dissector_handle(dissect_1722_aaf, proto_1722_aaf);
1321 dissector_add_uint("ieee1722.subtype", IEEE_1722_SUBTYPE_AAF, avb1722_aaf_handle);
1324 /**************************************************************************************************/
1325 /* 1722 CVF dissector implementation */
1327 /**************************************************************************************************/
1328 static int dissect_1722_cvf (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1331 proto_tree *ti_cvf_tree;
1333 guint format_subtype = 0;
1334 proto_tree *ti_format;
1336 const gint *fields[] = {
1337 &hf_1722_cvf_mrfield,
1338 &hf_1722_cvf_tvfield,
1341 const gint *fields_cvf[] = {
1342 &hf_1722_cvf_marker_bit,
1343 &hf_1722_cvf_evtfield,
1347 const gint *fields_h264[] = {
1348 &hf_1722_cvf_h264_forbidden_bit,
1349 &hf_1722_cvf_h264_nri,
1350 &hf_1722_cvf_h264_nal_type,
1354 ti = proto_tree_add_item(tree, proto_1722_cvf, tvb, 0, -1, ENC_NA);
1355 ti_cvf_tree = proto_item_add_subtree(ti, ett_1722_cvf);
1357 proto_tree_add_bitmask_list(ti_cvf_tree, tvb, offset, 1, fields, ENC_NA);
1359 proto_tree_add_item(ti_cvf_tree, hf_1722_cvf_seqnum, tvb, offset, 1, ENC_BIG_ENDIAN);
1361 proto_tree_add_item(ti_cvf_tree, hf_1722_cvf_tufield, tvb, offset, 1, ENC_BIG_ENDIAN);
1363 proto_tree_add_item(ti_cvf_tree, hf_1722_cvf_stream_id, tvb, offset, 8, ENC_BIG_ENDIAN);
1365 proto_tree_add_item(ti_cvf_tree, hf_1722_cvf_avtp_timestamp, tvb, offset, 4, ENC_BIG_ENDIAN);
1367 proto_tree_add_item(ti_cvf_tree, hf_1722_cvf_format, tvb, offset, 1, ENC_BIG_ENDIAN);
1369 ti_format = proto_tree_add_item_ret_uint(ti_cvf_tree, hf_1722_cvf_format_subtype, tvb, offset, 1, ENC_BIG_ENDIAN, &format_subtype);
1371 proto_tree_add_item(ti_cvf_tree, hf_1722_cvf_stream_data_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1373 proto_tree_add_bitmask_list(ti_cvf_tree, tvb, offset, 1, fields_cvf, ENC_BIG_ENDIAN);
1376 switch(format_subtype) {
1377 case IEEE_1722_CVF_FORMAT_SUBTYPE_MJPEG:
1378 proto_tree_add_item(ti_cvf_tree, hf_1722_cvf_mjpeg_ts, tvb, offset, 1, ENC_BIG_ENDIAN);
1380 proto_tree_add_item(ti_cvf_tree, hf_1722_cvf_mjpeg_fragment_offset, tvb, offset, 3, ENC_BIG_ENDIAN);
1382 proto_tree_add_item(ti_cvf_tree, hf_1722_cvf_mjpeg_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1384 proto_tree_add_item(ti_cvf_tree, hf_1722_cvf_mjpeg_q, tvb, offset, 1, ENC_BIG_ENDIAN);
1386 proto_tree_add_item(ti_cvf_tree, hf_1722_cvf_mjpeg_width, tvb, offset, 1, ENC_BIG_ENDIAN);
1388 proto_tree_add_item(ti_cvf_tree, hf_1722_cvf_mjpeg_height, tvb, offset, 1, ENC_BIG_ENDIAN);
1391 case IEEE_1722_CVF_FORMAT_SUBTYPE_H264:
1392 proto_tree_add_item(ti_cvf_tree, hf_1722_cvf_h264_timestamp, tvb, offset, 4, ENC_BIG_ENDIAN);
1394 proto_tree_add_bitmask_list(ti_cvf_tree, tvb, offset, 1, fields_h264, ENC_BIG_ENDIAN);
1397 case IEEE_1722_CVF_FORMAT_SUBTYPE_JPEG2000:
1398 expert_add_info(pinfo, ti_format, &ei_cvf_jpeg2000_format);
1402 expert_add_info(pinfo, ti_format, &ei_cvf_reserved_format);
1405 return tvb_captured_length(tvb);
1408 void proto_register_1722_cvf (void)
1410 static hf_register_info hf[] =
1412 { &hf_1722_cvf_mrfield,
1413 { "Media Clock Restart", "cvf.mrfield",
1414 FT_BOOLEAN, 8, NULL, IEEE_1722_MR_MASK, NULL, HFILL }
1416 { &hf_1722_cvf_tvfield,
1417 { "Source Timestamp Valid", "cvf.tvfield",
1418 FT_BOOLEAN, 8, NULL, IEEE_1722_TV_MASK, NULL, HFILL }
1420 { &hf_1722_cvf_seqnum,
1421 { "Sequence Number", "cvf.seqnum",
1422 FT_UINT8, BASE_DEC, NULL, IEEE_1722_SEQ_NUM_MASK, NULL, HFILL }
1424 { &hf_1722_cvf_tufield,
1425 { "Timestamp Uncertain", "cvf.tufield",
1426 FT_BOOLEAN, 8, NULL, IEEE_1722_TU_MASK, NULL, HFILL }
1428 { &hf_1722_cvf_stream_id,
1429 { "Stream ID", "cvf.stream_id",
1430 FT_UINT64, BASE_HEX, NULL, IEEE_1722_STREAM_ID_MASK, NULL, HFILL }
1432 { &hf_1722_cvf_avtp_timestamp,
1433 { "AVTP Timestamp", "cvf.avtp_timestamp",
1434 FT_UINT32, BASE_DEC, NULL, IEEE_1722_TIMESTAMP_MASK, NULL, HFILL }
1436 { &hf_1722_cvf_format,
1437 { "Format", "cvf.format",
1438 FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(cvf_format_range_rvals), IEEE_1722_FORMAT_MASK, NULL, HFILL }
1440 { &hf_1722_cvf_format_subtype,
1441 { "CVF Format Subtype", "cvf.format_subtype",
1442 FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(cvf_format_subtype_range_rvals), IEEE_1722_FORMAT_SUBTYPE_MASK, NULL, HFILL }
1444 { &hf_1722_cvf_stream_data_length,
1445 { "Stream Data Length", "cvf.stream_data_len",
1446 FT_UINT16, BASE_DEC | BASE_UNIT_STRING, &units_byte_bytes, IEEE_1722_STREAM_DATA_LENGTH_MASK, NULL, HFILL }
1448 { &hf_1722_cvf_marker_bit,
1449 { "Marker Bit", "cvf.marker_bit",
1450 FT_BOOLEAN, 8, TFS(&tfs_marker_bit_set_not_set), IEEE_1722_MARKER_BIT_MASK, NULL, HFILL }
1452 { &hf_1722_cvf_evtfield,
1453 { "EVT", "cvf.evtfield",
1454 FT_UINT8, BASE_HEX, NULL, IEEE_1722_EVT_MASK, NULL, HFILL }
1456 { &hf_1722_cvf_h264_timestamp,
1457 { "H264 Timestamp", "cvf.h264_timestamp",
1458 FT_UINT32, BASE_DEC, NULL, IEEE_1722_CVF_H264_TIMESTAMP_MASK, NULL, HFILL }
1460 { &hf_1722_cvf_h264_forbidden_bit,
1461 { "H264 Forbidden Bit", "cvf.h264_f_bit",
1462 FT_BOOLEAN, 8, NULL, IEEE_1722_CVF_H264_FORBIDDEN_MASK, NULL, HFILL }
1464 { &hf_1722_cvf_h264_nri,
1465 { "H264 NRI", "cvf.h264_nri",
1466 FT_UINT8, BASE_HEX, NULL, IEEE_1722_CVF_H264_NRI_MASK, NULL, HFILL }
1468 { &hf_1722_cvf_h264_nal_type,
1469 { "H264 NAL Type", "cvf.h264_nal_type",
1470 FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(cvf_h264_nal_type_range_rvals), IEEE_1722_CVF_H264_NAL_TYPE_MASK, NULL, HFILL }
1472 { &hf_1722_cvf_mjpeg_ts,
1473 { "MJPEG Type Specific", "cvf.mjpeg_type_specific",
1474 FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(cvf_mjpeg_ts_range_rvals), IEEE_1722_CVF_MJPEG_TS_MASK, NULL, HFILL }
1476 { &hf_1722_cvf_mjpeg_fragment_offset,
1477 { "MJPEG Fragment Offset", "cvf.mjpeg_fragment_offset",
1478 FT_UINT24, BASE_DEC, NULL, IEEE_1722_CVF_MJPEG_FRAGMENT_OFFSET_MASK, NULL, HFILL }
1480 { &hf_1722_cvf_mjpeg_type,
1481 { "MJPEG Type", "cvf.mjpeg_type",
1482 FT_UINT8, BASE_DEC, NULL, IEEE_1722_CVF_MJPEG_TYPE_MASK, NULL, HFILL }
1484 { &hf_1722_cvf_mjpeg_q,
1485 { "MJPEG Q", "cvf.mjpeg_q",
1486 FT_UINT8, BASE_DEC, NULL, IEEE_1722_CVF_MJPEG_Q_MASK, NULL, HFILL }
1488 { &hf_1722_cvf_mjpeg_width,
1489 { "MJPEG Width", "cvf.mjpeg_width",
1490 FT_UINT8, BASE_DEC, NULL, IEEE_1722_CVF_MJPEG_WIDTH_MASK, NULL, HFILL }
1492 { &hf_1722_cvf_mjpeg_height,
1493 { "MJPEG Height", "cvf.mjpeg_height",
1494 FT_UINT8, BASE_DEC, NULL, IEEE_1722_CVF_MJPEG_HEIGHT_MASK, NULL, HFILL }
1499 static ei_register_info ei[] = {
1500 { &ei_cvf_jpeg2000_format, { "cvf.expert.jpeg2000_video", PI_PROTOCOL, PI_WARN, "JPEG2000 format is currently not supported", EXPFILL }},
1501 { &ei_cvf_reserved_format, { "cvf.expert.reserved_format", PI_PROTOCOL, PI_WARN, "Incorrect format, can`t be dissected", EXPFILL }}
1504 static gint *ett[] =
1509 expert_module_t *expert_1722_cvf;
1511 /* Register the protocol name and description */
1512 proto_1722_cvf = proto_register_protocol("AVTP Compressed Video Format", "CVF", "cvf");
1514 /* Required function calls to register the header fields and subtrees used */
1515 proto_register_field_array(proto_1722_cvf, hf, array_length(hf));
1516 proto_register_subtree_array(ett, array_length(ett));
1518 expert_1722_cvf = expert_register_protocol(proto_1722_cvf);
1519 expert_register_field_array(expert_1722_cvf, ei, array_length(ei));
1523 void proto_reg_handoff_1722_cvf(void)
1525 dissector_handle_t avb1722_cvf_handle;
1527 avb1722_cvf_handle = create_dissector_handle(dissect_1722_cvf, proto_1722_cvf);
1528 dissector_add_uint("ieee1722.subtype", IEEE_1722_SUBTYPE_CVF, avb1722_cvf_handle);
1531 /**************************************************************************************************/
1532 /* 1722 CRF dissector implementation */
1534 /**************************************************************************************************/
1535 static int dissect_1722_crf (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1538 proto_tree *ti_crf_tree;
1539 proto_tree *timestamp_tree;
1543 const gint *fields[] = {
1544 &hf_1722_crf_mrfield,
1545 &hf_1722_crf_fsfield,
1546 &hf_1722_crf_tufield,
1549 const gint *pull_frequency[] = {
1551 &hf_1722_crf_base_frequency,
1555 ti = proto_tree_add_item(tree, proto_1722_crf, tvb, 0, -1, ENC_NA);
1556 ti_crf_tree = proto_item_add_subtree(ti, ett_1722_crf);
1558 proto_tree_add_bitmask_list(ti_crf_tree, tvb, offset, 1, fields, ENC_NA);
1560 proto_tree_add_item(ti_crf_tree, hf_1722_crf_seqnum, tvb, offset, 1, ENC_BIG_ENDIAN);
1562 proto_tree_add_item(ti_crf_tree, hf_1722_crf_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1564 proto_tree_add_item(ti_crf_tree, hf_1722_crf_stream_id, tvb, offset, 8, ENC_BIG_ENDIAN);
1566 proto_tree_add_bitmask_list(ti_crf_tree, tvb, offset, 4, pull_frequency, ENC_NA);
1568 proto_tree_add_item_ret_uint(ti_crf_tree, hf_1722_crf_data_length, tvb, offset, 2, ENC_BIG_ENDIAN, &datalen);
1570 proto_tree_add_item(ti_crf_tree, hf_1722_crf_timestamp_interval, tvb, offset, 2, ENC_BIG_ENDIAN);
1573 /* Make the Timestamp tree. */
1574 ti = proto_tree_add_item(ti_crf_tree, hf_1722_crf_timestamp_data, tvb, offset, datalen, ENC_NA);
1575 timestamp_tree = proto_item_add_subtree(ti, ett_1722_crf_timestamp);
1579 expert_add_info(pinfo, ti, &ei_crf_datalen);
1583 /* Loop through all timestamps and add them to the timestamp tree. */
1584 for (j = 0; j < (datalen / IEEE_1722_CRF_TIMESTAMP_SIZE); j++)
1586 ti = proto_tree_add_item(timestamp_tree, hf_1722_crf_timestamp, tvb, offset, IEEE_1722_CRF_TIMESTAMP_SIZE, ENC_BIG_ENDIAN);
1587 proto_item_prepend_text(ti, "Timestamp %d ", j);
1588 offset += IEEE_1722_CRF_TIMESTAMP_SIZE;
1592 return tvb_captured_length(tvb);
1595 void proto_register_1722_crf(void)
1597 static hf_register_info hf[] =
1599 { &hf_1722_crf_mrfield,
1600 { "Media Clock Restart", "crf.mrfield",
1601 FT_BOOLEAN, 8, NULL, IEEE_1722_MR_MASK, NULL, HFILL }
1603 { &hf_1722_crf_fsfield,
1604 { "Frame Sync", "crf.fsfield",
1605 FT_BOOLEAN, 8, NULL, IEEE_1722_FS_MASK, NULL, HFILL }
1607 { &hf_1722_crf_tufield,
1608 { "Timestamp Uncertain", "crf.tufield",
1609 FT_BOOLEAN, 8, NULL, IEEE_1722_TU_MASK, NULL, HFILL }
1611 { &hf_1722_crf_seqnum,
1612 { "Sequence Number", "crf.seqnum",
1613 FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL }
1615 { &hf_1722_crf_type,
1616 { "Type", "crf.type",
1617 FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(crf_type_range_rvals), 0x00, NULL, HFILL }
1619 { &hf_1722_crf_stream_id,
1620 { "Stream ID", "crf.stream_id",
1621 FT_UINT64, BASE_HEX, NULL, 0x00, NULL, HFILL }
1623 { &hf_1722_crf_pull,
1624 { "Pull", "crf.pull",
1625 FT_UINT32, BASE_HEX | BASE_RANGE_STRING, RVALS(crf_pull_range_rvals), IEEE_1722_PULL_MASK, NULL, HFILL }
1627 { &hf_1722_crf_base_frequency,
1628 { "Base Frequency", "crf.base_frequency",
1629 FT_UINT32, BASE_DEC, NULL, IEEE_1722_BASE_FREQUENCY_MASK, NULL, HFILL }
1631 { &hf_1722_crf_data_length,
1632 { "Data Length", "crf.data_len",
1633 FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x00, NULL, HFILL }
1635 { &hf_1722_crf_timestamp_interval,
1636 { "Timestamp Interval", "crf.timestamp_interval",
1637 FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL }
1639 { &hf_1722_crf_timestamp_data,
1640 { "Timestamp Data", "crf.timestamp_data",
1641 FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL }
1643 { &hf_1722_crf_timestamp,
1644 { "Data", "crf.timestamp",
1645 FT_UINT64, BASE_HEX, NULL, 0x00, NULL, HFILL }
1649 static ei_register_info ei[] = {
1650 { &ei_crf_datalen, { "crf.expert.crf_datalen", PI_PROTOCOL, PI_WARN, "The CRF data length must be multiple of 8", EXPFILL }}
1653 static gint *ett[] =
1656 &ett_1722_crf_timestamp
1659 expert_module_t *expert_1722_crf;
1661 /* Register the protocol name and description */
1662 proto_1722_crf = proto_register_protocol("Clock Reference Format", "CRF", "crf");
1664 /* Required function calls to register the header fields and subtrees used */
1665 proto_register_field_array(proto_1722_crf, hf, array_length(hf));
1666 proto_register_subtree_array(ett, array_length(ett));
1667 expert_1722_crf = expert_register_protocol(proto_1722_crf);
1668 expert_register_field_array(expert_1722_crf, ei, array_length(ei));
1671 void proto_reg_handoff_1722_crf(void)
1673 dissector_handle_t avb1722_crf_handle;
1675 avb1722_crf_handle = create_dissector_handle(dissect_1722_crf, proto_1722_crf);
1676 dissector_add_uint("ieee1722.subtype", IEEE_1722_SUBTYPE_CRF, avb1722_crf_handle);
1680 * Editor modelines - http://www.wireshark.org/tools/modelines.html
1685 * indent-tabs-mode: nil
1688 * vi: set shiftwidth=4 tabstop=8 expandtab:
1689 * :indentSize=4:tabSize=8:noTabs=true: