2012-03-25 01:49:23 +00:00
|
|
|
/* packet-mpeg-sdt.c
|
|
|
|
* Routines for DVB (ETSI EN 300 468) Servide Description Table (SDT) dissection
|
|
|
|
* Copyright 2012, Guy Martin <gmsoft@tuxicoman.be>
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-12 11:23:27 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2012-03-25 01:49:23 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2012-03-25 01:49:23 +00:00
|
|
|
|
|
|
|
#include <epan/packet.h>
|
2014-12-20 21:23:59 +00:00
|
|
|
#include "packet-mpeg-sect.h"
|
2012-03-25 01:49:23 +00:00
|
|
|
#include "packet-mpeg-descriptor.h"
|
|
|
|
|
2013-03-16 16:25:41 +00:00
|
|
|
void proto_register_dvb_sdt(void);
|
|
|
|
void proto_reg_handoff_dvb_sdt(void);
|
|
|
|
|
2012-03-25 01:49:23 +00:00
|
|
|
static int proto_dvb_sdt = -1;
|
|
|
|
static int hf_dvb_sdt_transport_stream_id = -1;
|
|
|
|
static int hf_dvb_sdt_reserved1 = -1;
|
|
|
|
static int hf_dvb_sdt_version_number = -1;
|
|
|
|
static int hf_dvb_sdt_current_next_indicator = -1;
|
|
|
|
static int hf_dvb_sdt_section_number = -1;
|
|
|
|
static int hf_dvb_sdt_last_section_number = -1;
|
|
|
|
|
|
|
|
static int hf_dvb_sdt_original_network_id = -1;
|
|
|
|
static int hf_dvb_sdt_reserved2 = -1;
|
|
|
|
|
|
|
|
static int hf_dvb_sdt_service_id = -1;
|
|
|
|
static int hf_dvb_sdt_reserved3 = -1;
|
|
|
|
static int hf_dvb_sdt_eit_schedule_flag = -1;
|
|
|
|
static int hf_dvb_sdt_eit_present_following_flag = -1;
|
|
|
|
static int hf_dvb_sdt_running_status = -1;
|
|
|
|
static int hf_dvb_sdt_free_ca_mode = -1;
|
|
|
|
static int hf_dvb_sdt_descriptors_loop_length = -1;
|
|
|
|
|
|
|
|
static gint ett_dvb_sdt = -1;
|
|
|
|
static gint ett_dvb_sdt_service = -1;
|
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
#define DVB_SDT_RESERVED1_MASK 0xC0
|
|
|
|
#define DVB_SDT_VERSION_NUMBER_MASK 0x3E
|
|
|
|
#define DVB_SDT_CURRENT_NEXT_INDICATOR_MASK 0x01
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
#define DVB_SDT_RESERVED3_MASK 0xFC
|
|
|
|
#define DVB_SDT_EIT_SCHEDULE_FLAG_MASK 0x02
|
|
|
|
#define DVB_SDT_EIT_PRESENT_FOLLOWING_FLAG_MASK 0x01
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
#define DVB_SDT_RUNNING_STATUS_MASK 0xE000
|
|
|
|
#define DVB_SDT_FREE_CA_MODE_MASK 0x1000
|
|
|
|
#define DVB_SDT_DESCRIPTORS_LOOP_LENGTH_MASK 0x0FFF
|
2012-03-25 01:49:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
static const value_string dvb_sdt_cur_next_vals[] = {
|
2013-03-14 14:42:12 +00:00
|
|
|
{ 0, "Not yet applicable" },
|
|
|
|
{ 1, "Currently applicable" },
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ 0, NULL }
|
2012-03-25 01:49:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string dvb_sdt_running_status_vals[] = {
|
2013-03-14 14:42:12 +00:00
|
|
|
{ 0, "Undefined" },
|
|
|
|
{ 1, "Not Running" },
|
|
|
|
{ 2, "Starts in a few seconds" },
|
|
|
|
{ 3, "Pausing" },
|
|
|
|
{ 4, "Running" },
|
|
|
|
{ 5, "Service off-air" },
|
|
|
|
|
|
|
|
{ 0, NULL }
|
2012-03-25 01:49:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string dvb_sdt_free_ca_mode_vals[] = {
|
2013-03-14 14:42:12 +00:00
|
|
|
{ 0, "Not Scrambled" },
|
|
|
|
{ 1, "One or more component scrambled" },
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ 0, NULL }
|
2012-03-25 01:49:23 +00:00
|
|
|
};
|
|
|
|
|
2015-11-15 13:00:10 +00:00
|
|
|
static int
|
|
|
|
dissect_dvb_sdt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
2012-03-25 01:49:23 +00:00
|
|
|
{
|
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
guint offset = 0, length = 0;
|
2013-03-30 10:41:37 +00:00
|
|
|
guint descriptor_len;
|
2013-03-14 14:42:12 +00:00
|
|
|
guint16 svc_id;
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *dvb_sdt_tree;
|
|
|
|
proto_tree *dvb_sdt_service_tree;
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
/* The TVB should start right after the section_length in the Section packet */
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, "Service Description Table (SDT)");
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_dvb_sdt, tvb, offset, -1, ENC_NA);
|
|
|
|
dvb_sdt_tree = proto_item_add_subtree(ti, ett_dvb_sdt);
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
offset += packet_mpeg_sect_header(tvb, offset, dvb_sdt_tree, &length, NULL);
|
|
|
|
length -= 4;
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_transport_stream_id, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_version_number, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_current_next_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_original_network_id, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_reserved2, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
2012-03-25 01:49:23 +00:00
|
|
|
|
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
if (offset >= length)
|
2015-11-15 13:00:10 +00:00
|
|
|
return offset;
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
/* Parse all the services */
|
|
|
|
while (offset < length) {
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
svc_id = tvb_get_ntohs(tvb, offset);
|
2014-06-25 03:24:14 +00:00
|
|
|
dvb_sdt_service_tree = proto_tree_add_subtree_format(dvb_sdt_tree, tvb, offset, 5,
|
|
|
|
ett_dvb_sdt_service, NULL, "Service 0x%04hx", svc_id);
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_service_id, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_reserved3, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_eit_schedule_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_eit_present_following_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_running_status, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_free_ca_mode, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_descriptors_loop_length, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
descriptor_len = tvb_get_ntohs(tvb, offset) & DVB_SDT_DESCRIPTORS_LOOP_LENGTH_MASK;
|
|
|
|
offset += 2;
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-30 10:41:37 +00:00
|
|
|
offset += proto_mpeg_descriptor_loop_dissect(tvb, offset, descriptor_len, dvb_sdt_service_tree);
|
2013-03-14 14:42:12 +00:00
|
|
|
}
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
offset += packet_mpeg_sect_crc(tvb, pinfo, dvb_sdt_tree, 0, offset);
|
|
|
|
proto_item_set_len(ti, offset);
|
2015-11-15 13:00:10 +00:00
|
|
|
return tvb_captured_length(tvb);
|
2012-03-25 01:49:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_dvb_sdt(void)
|
|
|
|
{
|
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
static hf_register_info hf[] = {
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ &hf_dvb_sdt_transport_stream_id, {
|
|
|
|
"Transport Stream ID", "dvb_sdt.tsid",
|
|
|
|
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
|
|
|
|
} },
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ &hf_dvb_sdt_reserved1, {
|
|
|
|
"Reserved", "dvb_sdt.reserved1",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, DVB_SDT_RESERVED1_MASK, NULL, HFILL
|
|
|
|
} },
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ &hf_dvb_sdt_version_number, {
|
|
|
|
"Version Number", "dvb_sdt.version",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, DVB_SDT_VERSION_NUMBER_MASK, NULL, HFILL
|
|
|
|
} },
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ &hf_dvb_sdt_current_next_indicator, {
|
|
|
|
"Current/Next Indicator", "dvb_sdt.cur_next_ind",
|
|
|
|
FT_UINT8, BASE_DEC, VALS(dvb_sdt_cur_next_vals), DVB_SDT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
|
|
|
|
} },
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ &hf_dvb_sdt_section_number, {
|
|
|
|
"Section Number", "dvb_sdt.sect_num",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
|
|
|
|
} },
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ &hf_dvb_sdt_last_section_number, {
|
|
|
|
"Last Section Number", "dvb_sdt.last_sect_num",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
|
|
|
|
} },
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ &hf_dvb_sdt_original_network_id, {
|
|
|
|
"Original Network ID", "dvb_sdt.original_nid",
|
|
|
|
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
|
|
|
|
} },
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ &hf_dvb_sdt_reserved2, {
|
|
|
|
"Reserved", "dvb_sdt.reserved2",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
|
|
|
|
} },
|
2012-03-25 01:49:23 +00:00
|
|
|
|
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ &hf_dvb_sdt_service_id, {
|
|
|
|
"Service ID", "dvb_sdt.svc.id",
|
|
|
|
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
|
|
|
|
} },
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ &hf_dvb_sdt_reserved3, {
|
|
|
|
"Reserved", "dvb_sdt.svc.reserved",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, DVB_SDT_RESERVED3_MASK, NULL, HFILL
|
|
|
|
} },
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ &hf_dvb_sdt_eit_schedule_flag, {
|
|
|
|
"EIT Schedule Flag", "dvb_sdt.svc.eit_schedule_flag",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, DVB_SDT_EIT_SCHEDULE_FLAG_MASK, NULL, HFILL
|
|
|
|
} },
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ &hf_dvb_sdt_eit_present_following_flag, {
|
|
|
|
"EIT Present Following Flag", "dvb_sdt.svc.eit_present_following_flag",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, DVB_SDT_EIT_PRESENT_FOLLOWING_FLAG_MASK, NULL, HFILL
|
|
|
|
} },
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ &hf_dvb_sdt_running_status, {
|
|
|
|
"Running Status", "dvb_sdt.svc.running_status",
|
|
|
|
FT_UINT16, BASE_HEX, VALS(dvb_sdt_running_status_vals), DVB_SDT_RUNNING_STATUS_MASK, NULL, HFILL
|
|
|
|
} },
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ &hf_dvb_sdt_free_ca_mode, {
|
|
|
|
"Free CA Mode", "dvb_sdt.svc.free_ca_mode",
|
|
|
|
FT_UINT16, BASE_HEX, VALS(dvb_sdt_free_ca_mode_vals), DVB_SDT_FREE_CA_MODE_MASK, NULL, HFILL
|
|
|
|
} },
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
{ &hf_dvb_sdt_descriptors_loop_length, {
|
|
|
|
"Descriptors Loop Length", "dvb_sdt.svc.descr_loop_len",
|
|
|
|
FT_UINT16, BASE_HEX, NULL, DVB_SDT_DESCRIPTORS_LOOP_LENGTH_MASK, NULL, HFILL
|
|
|
|
} }
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
};
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_dvb_sdt,
|
|
|
|
&ett_dvb_sdt_service
|
|
|
|
};
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
proto_dvb_sdt = proto_register_protocol("DVB Service Description Table", "DVB SDT", "dvb_sdt");
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2013-03-14 14:42:12 +00:00
|
|
|
proto_register_field_array(proto_dvb_sdt, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2012-03-25 01:49:23 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void proto_reg_handoff_dvb_sdt(void)
|
|
|
|
{
|
2013-03-14 14:42:12 +00:00
|
|
|
dissector_handle_t dvb_sdt_handle;
|
2012-03-25 01:49:23 +00:00
|
|
|
|
2015-12-09 03:49:44 +00:00
|
|
|
dvb_sdt_handle = create_dissector_handle(dissect_dvb_sdt, proto_dvb_sdt);
|
2013-03-14 14:42:12 +00:00
|
|
|
dissector_add_uint("mpeg_sect.tid", DVB_SDT_TID_ACTUAL, dvb_sdt_handle);
|
|
|
|
dissector_add_uint("mpeg_sect.tid", DVB_SDT_TID_OTHER, dvb_sdt_handle);
|
2012-03-25 01:49:23 +00:00
|
|
|
}
|
2012-09-03 18:50:21 +00:00
|
|
|
|
2013-03-14 14:42:12 +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
|
|
|
*/
|