2012-03-26 14:08:39 +00:00
|
|
|
/* packet-dvb-tot.c
|
|
|
|
* Routines for DVB (ETSI EN 300 468) Time Offset Table (TOT) dissection
|
|
|
|
* Copyright 2012, Guy Martin <gmsoft@tuxicoman.be>
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2013-04-17 01:36:07 +00:00
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
2012-03-26 14:08:39 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2012-03-26 14:08:39 +00:00
|
|
|
|
|
|
|
#include <epan/packet.h>
|
2014-12-20 21:23:59 +00:00
|
|
|
#include "packet-mpeg-sect.h"
|
2012-03-26 14:08:39 +00:00
|
|
|
|
|
|
|
#include "packet-mpeg-descriptor.h"
|
|
|
|
|
2013-03-16 16:25:41 +00:00
|
|
|
void proto_register_dvb_tot(void);
|
|
|
|
void proto_reg_handoff_dvb_tot(void);
|
|
|
|
|
2012-03-26 14:08:39 +00:00
|
|
|
static int proto_dvb_tot = -1;
|
|
|
|
static int hf_dvb_tot_utc_time = -1;
|
|
|
|
static int hf_dvb_tot_reserved = -1;
|
|
|
|
static int hf_dvb_tot_descriptors_loop_length = -1;
|
|
|
|
|
|
|
|
static gint ett_dvb_tot = -1;
|
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
#define DVB_TOT_RESERVED_MASK 0xF000
|
|
|
|
#define DVB_TOT_DESCRIPTORS_LOOP_LENGTH_MASK 0x0FFF
|
2012-03-26 14:08:39 +00:00
|
|
|
|
2015-11-15 13:00:10 +00:00
|
|
|
static int
|
|
|
|
dissect_dvb_tot(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
2012-03-26 14:08:39 +00:00
|
|
|
{
|
2013-03-14 14:42:12 +00:00
|
|
|
guint offset = 0;
|
2013-04-02 19:00:09 +00:00
|
|
|
guint descriptor_len;
|
2012-03-26 14:08:39 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *dvb_tot_tree;
|
2012-03-26 14:08:39 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
nstime_t utc_time;
|
2012-03-26 14:08:39 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, "Time Offset Table (TOT)");
|
2012-03-26 14:08:39 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_dvb_tot, tvb, offset, -1, ENC_NA);
|
|
|
|
dvb_tot_tree = proto_item_add_subtree(ti, ett_dvb_tot);
|
2012-03-26 14:08:39 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
offset += packet_mpeg_sect_header(tvb, offset, dvb_tot_tree, NULL, NULL);
|
2012-03-26 14:08:39 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &utc_time) < 0) {
|
2014-08-04 01:10:24 +00:00
|
|
|
proto_tree_add_time_format_value(dvb_tot_tree, hf_dvb_tot_utc_time, tvb, offset, 5, &utc_time, "Unparseable time");
|
2013-03-14 14:42:12 +00:00
|
|
|
} else {
|
2013-09-29 16:40:01 +00:00
|
|
|
proto_tree_add_time(dvb_tot_tree, hf_dvb_tot_utc_time, tvb, offset, 5, &utc_time);
|
2013-03-14 14:42:12 +00:00
|
|
|
}
|
2012-03-26 14:08:39 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
offset += 5;
|
2012-03-26 14:08:39 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
descriptor_len = tvb_get_ntohs(tvb, offset) & DVB_TOT_DESCRIPTORS_LOOP_LENGTH_MASK;
|
|
|
|
proto_tree_add_item(dvb_tot_tree, hf_dvb_tot_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(dvb_tot_tree, hf_dvb_tot_descriptors_loop_length, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2012-03-26 14:08:39 +00:00
|
|
|
|
2013-04-02 19:00:09 +00:00
|
|
|
offset += proto_mpeg_descriptor_loop_dissect(tvb, offset, descriptor_len, dvb_tot_tree);
|
2012-03-26 14:08:39 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
offset += packet_mpeg_sect_crc(tvb, pinfo, dvb_tot_tree, 0, offset);
|
|
|
|
proto_item_set_len(ti, offset);
|
2015-11-15 13:00:10 +00:00
|
|
|
return tvb_captured_length(tvb);
|
2012-03-26 14:08:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_dvb_tot(void)
|
|
|
|
{
|
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
static hf_register_info hf[] = {
|
2012-03-26 14:08:39 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ &hf_dvb_tot_utc_time, {
|
|
|
|
"UTC Time", "dvb_tot.utc_time",
|
|
|
|
FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL
|
|
|
|
} },
|
2012-03-26 14:08:39 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ &hf_dvb_tot_reserved, {
|
|
|
|
"Reserved", "dvb_tot.reserved",
|
|
|
|
FT_UINT16, BASE_HEX, NULL, DVB_TOT_RESERVED_MASK, NULL, HFILL
|
|
|
|
} },
|
2012-03-26 14:08:39 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ &hf_dvb_tot_descriptors_loop_length, {
|
|
|
|
"Descriptors Loop Length", "dvb_tot.descr_loop_len",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, DVB_TOT_DESCRIPTORS_LOOP_LENGTH_MASK, NULL, HFILL
|
|
|
|
} }
|
|
|
|
};
|
2012-03-26 14:08:39 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_dvb_tot
|
|
|
|
};
|
2012-03-26 14:08:39 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
proto_dvb_tot = proto_register_protocol("DVB Time Offset Table", "DVB TOT", "dvb_tot");
|
2012-03-26 14:08:39 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
proto_register_field_array(proto_dvb_tot, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2012-03-26 14:08:39 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void proto_reg_handoff_dvb_tot(void)
|
|
|
|
{
|
2013-03-14 14:42:12 +00:00
|
|
|
dissector_handle_t dvb_tot_handle;
|
2012-03-26 14:08:39 +00:00
|
|
|
|
2015-12-09 03:49:44 +00:00
|
|
|
dvb_tot_handle = create_dissector_handle(dissect_dvb_tot, proto_dvb_tot);
|
2012-03-26 14:08:39 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
dissector_add_uint("mpeg_sect.tid", DVB_TOT_TID, dvb_tot_handle);
|
2012-03-26 14:08:39 +00:00
|
|
|
}
|
2012-09-03 18:50:21 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 4
|
2013-03-14 14:42:12 +00:00
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
2012-09-03 18:50:21 +00:00
|
|
|
* End:
|
|
|
|
*
|
2013-03-14 14:42:12 +00:00
|
|
|
* vi: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
2012-09-03 18:50:21 +00:00
|
|
|
*/
|