aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss@ulticom.com>2012-03-26 14:08:39 +0000
committerJeff Morriss <jeff.morriss@ulticom.com>2012-03-26 14:08:39 +0000
commitc4acc5ceccf88aff1c7dae824df8bfbf3f64c776 (patch)
tree256594a3fb2d22aa92a580600add2a965abac489 /epan
parent4204d39e76629c378048dd2fbe5136ab1f8a7c60 (diff)
From Guy Martin via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6999 :
This patch adds support for the DVB Time Offset Table and the related descriptor. It also contains the Stuffing Descriptor as an added bonus. svn path=/trunk/; revision=41766
Diffstat (limited to 'epan')
-rw-r--r--epan/CMakeLists.txt3
-rw-r--r--epan/dissectors/Makefile.common1
-rw-r--r--epan/dissectors/packet-dvb-tdt.c3
-rw-r--r--epan/dissectors/packet-dvb-tot.c134
-rw-r--r--epan/dissectors/packet-mpeg-descriptor.c120
5 files changed, 255 insertions, 6 deletions
diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt
index 1e17fa470e..9348b312de 100644
--- a/epan/CMakeLists.txt
+++ b/epan/CMakeLists.txt
@@ -409,7 +409,7 @@ set(DISSECTOR_SRC
dissectors/packet-cimetrics.c
dissectors/packet-cip.c
dissectors/packet-cipmotion.c
- dissectors/packet-cipsafety.c
+ dissectors/packet-cipsafety.c
dissectors/packet-cisco-erspan.c
dissectors/packet-cisco-oui.c
dissectors/packet-cisco-sm.c
@@ -537,6 +537,7 @@ set(DISSECTOR_SRC
dissectors/packet-dvb-nit.c
dissectors/packet-dvb-sdt.c
dissectors/packet-dvb-tdt.c
+ dissectors/packet-dvb-tot.c
dissectors/packet-dvbci.c
dissectors/packet-dvmrp.c
dissectors/packet-e100.c
diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common
index 7f59a40b3c..f46ac5a871 100644
--- a/epan/dissectors/Makefile.common
+++ b/epan/dissectors/Makefile.common
@@ -455,6 +455,7 @@ DISSECTOR_SRC = \
packet-dvb-nit.c \
packet-dvb-sdt.c \
packet-dvb-tdt.c \
+ packet-dvb-tot.c \
packet-dvbci.c \
packet-dvmrp.c \
packet-e100.c \
diff --git a/epan/dissectors/packet-dvb-tdt.c b/epan/dissectors/packet-dvb-tdt.c
index 7c2cf36aee..cb05c59392 100644
--- a/epan/dissectors/packet-dvb-tdt.c
+++ b/epan/dissectors/packet-dvb-tdt.c
@@ -64,7 +64,8 @@ dissect_dvb_tdt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &utc_time) < 0) {
proto_tree_add_text(dvb_tdt_tree, tvb, offset, 5, "Unparseable time");
} else {
- proto_tree_add_time_format(dvb_tdt_tree, hf_dvb_tdt_utc_time, tvb, offset, 5, &utc_time, "UTC Time : %s UTC", abs_time_to_str(&utc_time, ABSOLUTE_TIME_UTC, FALSE));
+ proto_tree_add_time_format(dvb_tdt_tree, hf_dvb_tdt_utc_time, tvb, offset, 5, &utc_time,
+ "UTC Time : %s UTC", abs_time_to_str(&utc_time, ABSOLUTE_TIME_UTC, FALSE));
}
}
diff --git a/epan/dissectors/packet-dvb-tot.c b/epan/dissectors/packet-dvb-tot.c
new file mode 100644
index 0000000000..8b2905c66e
--- /dev/null
+++ b/epan/dissectors/packet-dvb-tot.c
@@ -0,0 +1,134 @@
+/* packet-dvb-tot.c
+ * Routines for DVB (ETSI EN 300 468) Time Offset Table (TOT) dissection
+ * Copyright 2012, Guy Martin <gmsoft@tuxicoman.be>
+ *
+ * $Id$
+ *
+ * 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
+ * the Free Software Foundation; tother version 2 of the License, or
+ * (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.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <glib.h>
+
+#include <epan/packet.h>
+#include <epan/dissectors/packet-mpeg-sect.h>
+
+#include "packet-mpeg-descriptor.h"
+
+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;
+
+#define DVB_TOT_TID 0x73
+
+#define DVB_TOT_RESERVED_MASK 0xF000
+#define DVB_TOT_DESCRIPTORS_LOOP_LENGTH_MASK 0x0FFF
+
+static void
+dissect_dvb_tot(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+
+ guint offset = 0, descriptor_len = 0, descriptor_end = 0;
+
+ proto_item *ti = NULL;
+ proto_tree *dvb_tot_tree = NULL;
+
+ nstime_t utc_time;
+
+ col_clear(pinfo->cinfo, COL_INFO);
+ col_set_str(pinfo->cinfo, COL_INFO, "Time Offset Table (TOT)");
+
+ if (!tree)
+ return;
+
+ 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);
+
+ offset += packet_mpeg_sect_header(tvb, offset, dvb_tot_tree, NULL, NULL);
+
+ if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &utc_time) < 0) {
+ proto_tree_add_text(dvb_tot_tree, tvb, offset, 5, "UTC Time : Unparseable time");
+ } else {
+ proto_tree_add_time_format(dvb_tot_tree, hf_dvb_tot_utc_time, tvb, offset, 5, &utc_time,
+ "UTC Time : %s UTC", abs_time_to_str(&utc_time, ABSOLUTE_TIME_UTC, FALSE));
+ }
+
+ offset += 5;
+
+ 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;
+
+ descriptor_end = offset + descriptor_len;
+ while (offset < descriptor_end)
+ offset += proto_mpeg_descriptor_dissect(tvb, offset, dvb_tot_tree);
+
+ packet_mpeg_sect_crc(tvb, pinfo, dvb_tot_tree, 0, offset);
+}
+
+
+void
+proto_register_dvb_tot(void)
+{
+
+ static hf_register_info hf[] = {
+
+ { &hf_dvb_tot_utc_time, {
+ "UTC Time", "dvb_tot.utc_time",
+ FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL
+ } },
+
+ { &hf_dvb_tot_reserved, {
+ "Reserved", "dvb_tot.reserved",
+ FT_UINT16, BASE_HEX, NULL, DVB_TOT_RESERVED_MASK, NULL, HFILL
+ } },
+
+ { &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
+ } }
+ };
+
+ static gint *ett[] = {
+ &ett_dvb_tot
+ };
+
+ proto_dvb_tot = proto_register_protocol("DVB Time Offset Table", "DVB TOT", "dvb_tot");
+
+ proto_register_field_array(proto_dvb_tot, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+
+}
+
+
+void proto_reg_handoff_dvb_tot(void)
+{
+ dissector_handle_t dvb_tot_handle;
+
+ dvb_tot_handle = create_dissector_handle(dissect_dvb_tot, proto_dvb_tot);
+
+ dissector_add_uint("mpeg_sect.tid", DVB_TOT_TID, dvb_tot_handle);
+}
diff --git a/epan/dissectors/packet-mpeg-descriptor.c b/epan/dissectors/packet-mpeg-descriptor.c
index 67ac3f0f41..01314cc1e9 100644
--- a/epan/dissectors/packet-mpeg-descriptor.c
+++ b/epan/dissectors/packet-mpeg-descriptor.c
@@ -622,6 +622,15 @@ proto_mpeg_descriptor_dissect_service_list(tvbuff_t *tvb, guint offset, guint8 l
}
}
+/* 0x42 Stuffing Descriptor */
+static int hf_mpeg_descr_stuffing = -1;
+
+static void
+proto_mpeg_descriptor_stuffing(tvbuff_t *tvb, guint offset, guint8 len, proto_tree *tree)
+{
+ proto_tree_add_item(tree, hf_mpeg_descr_stuffing, tvb, offset, len, ENC_NA);
+}
+
/* 0x43 Satellite Delivery System Descriptor */
static int hf_mpeg_descr_satellite_delivery_frequency = -1;
static int hf_mpeg_descr_satellite_delivery_orbital_position = -1;
@@ -1575,6 +1584,64 @@ proto_mpeg_descriptor_dissect_teletext(tvbuff_t *tvb, guint offset, guint8 len,
}
}
+/* 0x58 Local Time Offset Descriptor */
+static int hf_mpeg_descr_local_time_offset_country_code = -1;
+static int hf_mpeg_descr_local_time_offset_region_id = -1;
+static int hf_mpeg_descr_local_time_offset_reserved = -1;
+static int hf_mpeg_descr_local_time_offset_polarity = -1;
+static int hf_mpeg_descr_local_time_offset_offset = -1;
+static int hf_mpeg_descr_local_time_offset_time_of_change = -1;
+static int hf_mpeg_descr_local_time_offset_next_time_offset = -1;
+
+#define MPEG_DESCR_LOCAL_TIME_OFFSET_COUNTRY_REGION_ID_MASK 0xFC
+#define MPEG_DESCR_LOCAL_TIME_OFFSET_RESERVED_MASK 0x02
+#define MPEG_DESCR_LOCAL_TIME_OFFSET_POLARITY 0x01
+
+static const value_string mpeg_descr_local_time_offset_polarity_vals[] = {
+ { 0x0, "Positive (local time ahead of UTC)" },
+ { 0x1, "Negative (local time behind UTC)" },
+
+ { 0x0, NULL }
+};
+
+static void
+proto_mpeg_descriptor_dissect_local_time_offset(tvbuff_t *tvb, guint offset, guint8 len, proto_tree *tree)
+{
+ guint end = offset + len;
+ guint16 time_offset = 0;
+ nstime_t time_of_change;
+
+ while (offset < end) {
+ proto_tree_add_item(tree, hf_mpeg_descr_local_time_offset_country_code, tvb, offset, 3, ENC_ASCII|ENC_NA);
+ offset += 3;
+
+ proto_tree_add_item(tree, hf_mpeg_descr_local_time_offset_region_id, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_mpeg_descr_local_time_offset_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_mpeg_descr_local_time_offset_polarity, tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset++;
+
+ time_offset = tvb_get_ntohs(tvb, offset);
+ proto_tree_add_string_format_value(tree, hf_mpeg_descr_local_time_offset_offset, tvb, offset, 2, "Local Time Offset", "%02u:%02u",
+ MPEG_SECT_BCD44_TO_DEC(time_offset >> 8),
+ MPEG_SECT_BCD44_TO_DEC(time_offset));
+ offset += 2;
+
+
+ if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &time_of_change) < 0) {
+ proto_tree_add_text(tree, tvb, offset, 5, "Time of Change : Unparseable time");
+ } else {
+ proto_tree_add_time_format(tree, hf_mpeg_descr_local_time_offset_time_of_change, tvb, offset, 5, &time_of_change, "Time of Change : %s UTC", abs_time_to_str(&time_of_change, ABSOLUTE_TIME_UTC, FALSE));
+ }
+ offset += 5;
+
+ time_offset = tvb_get_ntohs(tvb, offset);
+ proto_tree_add_string_format_value(tree, hf_mpeg_descr_local_time_offset_next_time_offset, tvb, offset, 2, "Next Time Offset", "%02u:%02u",
+ MPEG_SECT_BCD44_TO_DEC(time_offset >> 8),
+ MPEG_SECT_BCD44_TO_DEC(time_offset));
+ offset += 2;
+ }
+}
+
/* 0x59 Subtitling Descriptor */
static int hf_mpeg_descr_subtitling_lang_code = -1;
static int hf_mpeg_descr_subtitling_type = -1;
@@ -2087,7 +2154,7 @@ static const value_string mpeg_descr_extension_tag_extension_vals[] = {
{ 0x0A, "Target Region Name Descriptor" },
{ 0x0B, "Service Relocated Descriptor" },
- { 0x0, NULL },
+ { 0x0, NULL }
};
static void
@@ -2327,6 +2394,9 @@ proto_mpeg_descriptor_dissect(tvbuff_t *tvb, guint offset, proto_tree *tree)
case 0x41: /* Service List Descriptor */
proto_mpeg_descriptor_dissect_service_list(tvb, offset, len, descriptor_tree);
break;
+ case 0x42: /* Stuffing Descriptor */
+ proto_mpeg_descriptor_stuffing(tvb, offset, len, descriptor_tree);
+ break;
case 0x43: /* Satellite Delivery System Descriptor */
proto_mpeg_descriptor_dissect_satellite_delivery(tvb, offset, descriptor_tree);
break;
@@ -2366,6 +2436,9 @@ proto_mpeg_descriptor_dissect(tvbuff_t *tvb, guint offset, proto_tree *tree)
case 0x56: /* Teletext Descriptor */
proto_mpeg_descriptor_dissect_teletext(tvb, offset, len, descriptor_tree);
break;
+ case 0x58: /* Local Time Offset Descriptor */
+ proto_mpeg_descriptor_dissect_local_time_offset(tvb, offset, len, descriptor_tree);
+ break;
case 0x59: /* Subtitling Descriptor */
proto_mpeg_descriptor_dissect_subtitling(tvb, offset, len, descriptor_tree);
break;
@@ -2705,7 +2778,6 @@ proto_register_mpeg_descriptor(void)
FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
} },
-
/* 0x28 AVC Video Descriptor */
{ &hf_mpeg_descr_avc_vid_profile_idc, {
"Profile IDC", "mpeg_descr.avc_vid.profile_idc",
@@ -2769,6 +2841,12 @@ proto_register_mpeg_descriptor(void)
FT_UINT8, BASE_HEX, VALS(mpeg_descr_service_type_vals), 0, NULL, HFILL
} },
+ /* 0x42 Stuffing Descriptor */
+ { &hf_mpeg_descr_stuffing, {
+ "Stuffing", "mpeg_descr.stuffing",
+ FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
+ } },
+
/* 0x43 Satellite Delivery System Descriptor */
{ &hf_mpeg_descr_satellite_delivery_frequency, {
"Frequency", "mpeg_descr.sat_delivery.freq",
@@ -2979,7 +3057,6 @@ proto_register_mpeg_descriptor(void)
FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
} },
-
/* 0x4D Short Event Descriptor */
{ &hf_mpeg_descr_short_event_lang_code, {
"Language Code", "mpeg_descr.short_evt.lang_code",
@@ -3147,7 +3224,6 @@ proto_register_mpeg_descriptor(void)
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
-
/* 0x55 Parental Rating Descriptor */
{ &hf_mpeg_descr_parental_rating_country_code, {
"Country Code", "mpeg_descr.parental_rating.country_code",
@@ -3159,6 +3235,42 @@ proto_register_mpeg_descriptor(void)
FT_UINT8, BASE_HEX, VALS(mpeg_descr_parental_rating_vals), 0, NULL, HFILL
} },
+ /* 0x58 Local Time Offset Descriptor */
+ { &hf_mpeg_descr_local_time_offset_country_code, {
+ "Country Code", "mpeg_descr.local_time_offset.country_code",
+ FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
+ } },
+
+ { &hf_mpeg_descr_local_time_offset_region_id, {
+ "Region ID", "mpeg_descr.local_time_offset.region_id",
+ FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LOCAL_TIME_OFFSET_COUNTRY_REGION_ID_MASK, NULL, HFILL
+ } },
+
+ { &hf_mpeg_descr_local_time_offset_reserved, {
+ "Reserved", "mpeg_descr.local_time_offset.reserved",
+ FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LOCAL_TIME_OFFSET_RESERVED_MASK, NULL, HFILL
+ } },
+
+ { &hf_mpeg_descr_local_time_offset_polarity, {
+ "Time Offset Polarity", "mpeg_descr.local_time_offset.polarity",
+ FT_UINT8, BASE_HEX, VALS(mpeg_descr_local_time_offset_polarity_vals), MPEG_DESCR_LOCAL_TIME_OFFSET_POLARITY, NULL, HFILL
+ } },
+
+ { &hf_mpeg_descr_local_time_offset_offset, {
+ "Time Offset", "mpeg_descr.local_time_offset.offset",
+ FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
+ } },
+
+ { &hf_mpeg_descr_local_time_offset_time_of_change, {
+ "Time of Change", "mpeg_descr.local_time_offset.time_of_change",
+ FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL
+ } },
+
+ { &hf_mpeg_descr_local_time_offset_next_time_offset, {
+ "Next Time Offset", "mpeg_descr.local_time_offset.next_time_offset",
+ FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
+ } },
+
/* 0x59 Subtitling Descriptor */
{ &hf_mpeg_descr_subtitling_lang_code, {
"Language Code", "mpeg_descr.subtitling.lang_code",