HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / dissectors / packet-dvb-tdt.c
blob62e52cd2bc1f0283b68d658bd436d8f6c5527776
1 /* packet-dvb-tdt.c
2 * Routines for DVB (ETSI EN 300 468) Time and Date Table (TDT) dissection
3 * Copyright 2012, Guy Martin <gmsoft@tuxicoman.be>
5 * $Id$
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.
26 #include "config.h"
28 #include <glib.h>
30 #include <epan/packet.h>
31 #include <epan/dissectors/packet-mpeg-sect.h>
33 void proto_register_dvb_tdt(void);
34 void proto_reg_handoff_dvb_tdt(void);
36 static int proto_dvb_tdt = -1;
37 static int hf_dvb_tdt_utc_time = -1;
39 static gint ett_dvb_tdt = -1;
41 #define DVB_TDT_TID 0x70
43 static void
44 dissect_dvb_tdt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
47 guint offset = 0;
49 proto_item *ti;
50 proto_tree *dvb_tdt_tree;
52 nstime_t utc_time;
54 col_set_str(pinfo->cinfo, COL_INFO, "Time and Date Table (TDT)");
56 ti = proto_tree_add_item(tree, proto_dvb_tdt, tvb, offset, -1, ENC_NA);
57 dvb_tdt_tree = proto_item_add_subtree(ti, ett_dvb_tdt);
59 offset += packet_mpeg_sect_header(tvb, offset, dvb_tdt_tree, NULL, NULL);
61 if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &utc_time) < 0) {
62 proto_tree_add_text(dvb_tdt_tree, tvb, offset, 5, "Unparseable time");
63 } else {
64 proto_tree_add_time(dvb_tdt_tree, hf_dvb_tdt_utc_time, tvb, offset, 5, &utc_time);
66 offset += 5;
68 proto_item_set_len(ti, offset);
72 void
73 proto_register_dvb_tdt(void)
76 static hf_register_info hf[] = {
78 { &hf_dvb_tdt_utc_time, {
79 "UTC Time", "dvb_tdt.utc_time",
80 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL
81 } }
84 static gint *ett[] = {
85 &ett_dvb_tdt
88 proto_dvb_tdt = proto_register_protocol("DVB Time and Date Table", "DVB TDT", "dvb_tdt");
90 proto_register_field_array(proto_dvb_tdt, hf, array_length(hf));
91 proto_register_subtree_array(ett, array_length(ett));
96 void proto_reg_handoff_dvb_tdt(void)
98 dissector_handle_t dvb_tdt_handle;
100 dvb_tdt_handle = create_dissector_handle(dissect_dvb_tdt, proto_dvb_tdt);
102 dissector_add_uint("mpeg_sect.tid", DVB_TDT_TID, dvb_tdt_handle);
106 * Editor modelines - http://www.wireshark.org/tools/modelines.html
108 * Local variables:
109 * c-basic-offset: 4
110 * tab-width: 8
111 * indent-tabs-mode: nil
112 * End:
114 * vi: set shiftwidth=4 tabstop=8 expandtab:
115 * :indentSize=4:tabSize=8:noTabs=true: