2 * Routines for DVB (ETSI EN 300 468) Time Offset Table (TOT) dissection
3 * Copyright 2012, Guy Martin <gmsoft@tuxicoman.be>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
14 #include <epan/packet.h>
15 #include "packet-mpeg-sect.h"
17 #include "packet-mpeg-descriptor.h"
19 void proto_register_dvb_tot(void);
20 void proto_reg_handoff_dvb_tot(void);
22 static dissector_handle_t dvb_tot_handle
;
24 static int proto_dvb_tot
;
25 static int hf_dvb_tot_utc_time
;
26 static int hf_dvb_tot_reserved
;
27 static int hf_dvb_tot_descriptors_loop_length
;
29 static int ett_dvb_tot
;
31 #define DVB_TOT_RESERVED_MASK 0xF000
32 #define DVB_TOT_DESCRIPTORS_LOOP_LENGTH_MASK 0x0FFF
35 dissect_dvb_tot(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
38 unsigned descriptor_len
;
41 proto_tree
*dvb_tot_tree
;
45 col_set_str(pinfo
->cinfo
, COL_INFO
, "Time Offset Table (TOT)");
47 ti
= proto_tree_add_item(tree
, proto_dvb_tot
, tvb
, offset
, -1, ENC_NA
);
48 dvb_tot_tree
= proto_item_add_subtree(ti
, ett_dvb_tot
);
50 offset
+= packet_mpeg_sect_header(tvb
, offset
, dvb_tot_tree
, NULL
, NULL
);
52 if (packet_mpeg_sect_mjd_to_utc_time(tvb
, offset
, &utc_time
) < 0) {
53 proto_tree_add_time_format_value(dvb_tot_tree
, hf_dvb_tot_utc_time
, tvb
, offset
, 5, &utc_time
, "Unparseable time");
55 proto_tree_add_time(dvb_tot_tree
, hf_dvb_tot_utc_time
, tvb
, offset
, 5, &utc_time
);
60 descriptor_len
= tvb_get_ntohs(tvb
, offset
) & DVB_TOT_DESCRIPTORS_LOOP_LENGTH_MASK
;
61 proto_tree_add_item(dvb_tot_tree
, hf_dvb_tot_reserved
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
62 proto_tree_add_item(dvb_tot_tree
, hf_dvb_tot_descriptors_loop_length
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
65 offset
+= proto_mpeg_descriptor_loop_dissect(tvb
, offset
, descriptor_len
, dvb_tot_tree
);
67 offset
+= packet_mpeg_sect_crc(tvb
, pinfo
, dvb_tot_tree
, 0, offset
);
68 proto_item_set_len(ti
, offset
);
69 return tvb_captured_length(tvb
);
74 proto_register_dvb_tot(void)
77 static hf_register_info hf
[] = {
79 { &hf_dvb_tot_utc_time
, {
80 "UTC Time", "dvb_tot.utc_time",
81 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_UTC
, NULL
, 0, NULL
, HFILL
84 { &hf_dvb_tot_reserved
, {
85 "Reserved", "dvb_tot.reserved",
86 FT_UINT16
, BASE_HEX
, NULL
, DVB_TOT_RESERVED_MASK
, NULL
, HFILL
89 { &hf_dvb_tot_descriptors_loop_length
, {
90 "Descriptors Loop Length", "dvb_tot.descr_loop_len",
91 FT_UINT16
, BASE_DEC
, NULL
, DVB_TOT_DESCRIPTORS_LOOP_LENGTH_MASK
, NULL
, HFILL
99 proto_dvb_tot
= proto_register_protocol("DVB Time Offset Table", "DVB TOT", "dvb_tot");
101 proto_register_field_array(proto_dvb_tot
, hf
, array_length(hf
));
102 proto_register_subtree_array(ett
, array_length(ett
));
104 dvb_tot_handle
= register_dissector("dvb_tot", dissect_dvb_tot
, proto_dvb_tot
);
108 void proto_reg_handoff_dvb_tot(void)
110 dissector_add_uint("mpeg_sect.tid", DVB_TOT_TID
, dvb_tot_handle
);
114 * Editor modelines - https://www.wireshark.org/tools/modelines.html
119 * indent-tabs-mode: nil
122 * vi: set shiftwidth=4 tabstop=8 expandtab:
123 * :indentSize=4:tabSize=8:noTabs=true: