2 * Routines for DVB (ETSI EN 300 468) Time Offset Table (TOT) dissection
3 * Copyright 2012, Guy Martin <gmsoft@tuxicoman.be>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 #include <epan/packet.h>
31 #include <epan/dissectors/packet-mpeg-sect.h>
33 #include "packet-mpeg-descriptor.h"
35 void proto_register_dvb_tot(void);
36 void proto_reg_handoff_dvb_tot(void);
38 static int proto_dvb_tot
= -1;
39 static int hf_dvb_tot_utc_time
= -1;
40 static int hf_dvb_tot_reserved
= -1;
41 static int hf_dvb_tot_descriptors_loop_length
= -1;
43 static gint ett_dvb_tot
= -1;
45 #define DVB_TOT_TID 0x73
47 #define DVB_TOT_RESERVED_MASK 0xF000
48 #define DVB_TOT_DESCRIPTORS_LOOP_LENGTH_MASK 0x0FFF
51 dissect_dvb_tot(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
58 proto_tree
*dvb_tot_tree
;
62 col_set_str(pinfo
->cinfo
, COL_INFO
, "Time Offset Table (TOT)");
64 ti
= proto_tree_add_item(tree
, proto_dvb_tot
, tvb
, offset
, -1, ENC_NA
);
65 dvb_tot_tree
= proto_item_add_subtree(ti
, ett_dvb_tot
);
67 offset
+= packet_mpeg_sect_header(tvb
, offset
, dvb_tot_tree
, NULL
, NULL
);
69 if (packet_mpeg_sect_mjd_to_utc_time(tvb
, offset
, &utc_time
) < 0) {
70 proto_tree_add_text(dvb_tot_tree
, tvb
, offset
, 5, "UTC Time : Unparseable time");
72 proto_tree_add_time(dvb_tot_tree
, hf_dvb_tot_utc_time
, tvb
, offset
, 5, &utc_time
);
77 descriptor_len
= tvb_get_ntohs(tvb
, offset
) & DVB_TOT_DESCRIPTORS_LOOP_LENGTH_MASK
;
78 proto_tree_add_item(dvb_tot_tree
, hf_dvb_tot_reserved
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
79 proto_tree_add_item(dvb_tot_tree
, hf_dvb_tot_descriptors_loop_length
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
82 offset
+= proto_mpeg_descriptor_loop_dissect(tvb
, offset
, descriptor_len
, dvb_tot_tree
);
84 offset
+= packet_mpeg_sect_crc(tvb
, pinfo
, dvb_tot_tree
, 0, offset
);
85 proto_item_set_len(ti
, offset
);
90 proto_register_dvb_tot(void)
93 static hf_register_info hf
[] = {
95 { &hf_dvb_tot_utc_time
, {
96 "UTC Time", "dvb_tot.utc_time",
97 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_UTC
, NULL
, 0, NULL
, HFILL
100 { &hf_dvb_tot_reserved
, {
101 "Reserved", "dvb_tot.reserved",
102 FT_UINT16
, BASE_HEX
, NULL
, DVB_TOT_RESERVED_MASK
, NULL
, HFILL
105 { &hf_dvb_tot_descriptors_loop_length
, {
106 "Descriptors Loop Length", "dvb_tot.descr_loop_len",
107 FT_UINT16
, BASE_DEC
, NULL
, DVB_TOT_DESCRIPTORS_LOOP_LENGTH_MASK
, NULL
, HFILL
111 static gint
*ett
[] = {
115 proto_dvb_tot
= proto_register_protocol("DVB Time Offset Table", "DVB TOT", "dvb_tot");
117 proto_register_field_array(proto_dvb_tot
, hf
, array_length(hf
));
118 proto_register_subtree_array(ett
, array_length(ett
));
123 void proto_reg_handoff_dvb_tot(void)
125 dissector_handle_t dvb_tot_handle
;
127 dvb_tot_handle
= create_dissector_handle(dissect_dvb_tot
, proto_dvb_tot
);
129 dissector_add_uint("mpeg_sect.tid", DVB_TOT_TID
, dvb_tot_handle
);
133 * Editor modelines - http://www.wireshark.org/tools/modelines.html
138 * indent-tabs-mode: nil
141 * vi: set shiftwidth=4 tabstop=8 expandtab:
142 * :indentSize=4:tabSize=8:noTabs=true: