Hi,
It was only compiled with gcc version 3.3.3 and mvc++ version 6
More information on ULE can be found here: http://www.ietf.org/html.charters/ipdvb-charter.html
A small manual on the dissector can be found here: http://student.cosy.sbg.ac.at/~lfindeis/
The source code is published under GPL.
regards, Lutz Findeisen
diff -ruN ethereal-0.10.7/1 ethereal-0.10.7_mpeg2_recent/1
--- ethereal-0.10.7/1 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/1 2004-12-02 16:07:03.126397549 +0100
@@ -0,0 +1,5 @@
+../mpeg2_descriptors.c: In function `dvb_descr_assoc_tag_print':
+../mpeg2_descriptors.c:696: warning: comparison is always true due to limited range of data type
+../mpeg2_descriptors.c:700: warning: implicit declaration of function `ntohs'
+../mpeg2_psi.c: In function `dvb_pat_prog_print':
+../mpeg2_psi.c:210: warning: implicit declaration of function `ntohs'
diff -ruN ethereal-0.10.7/dvb_incs/avpes_hdr.h ethereal-0.10.7_mpeg2_recent/dvb_incs/avpes_hdr.h
--- ethereal-0.10.7/dvb_incs/avpes_hdr.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/dvb_incs/avpes_hdr.h 2004-12-02 16:14:18.333885658 +0100
@@ -0,0 +1,237 @@
+/* avpes_hdr.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING <wolfi@xxxxxxxxxxxxxx>
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __DVB_AVPES_HDR_H__
+#define __DVB_AVPES_HDR_H__
+
+#include <glib.h>
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#elif __BYTE_ORDER == __BIG_ENDIAN
+#else
+#error "Please specify the byte order!"
+#endif
+
+#define SyncWord 0x4156
+
+#ifdef __GNUC__
+#define attr_pack __attribute__((packed))
+#elif defined(_WIN32)
+#define attr_pack
+#pragma pack(push,p,1)
+#else
+#error "Compiler not supported"
+#endif
+typedef struct _dvb_avpes_hdr {
+
+ guint8 SyncWord_hi;
+ guint8 SyncWord_lo;
+
+ guint8 StreamID;
+ guint8 Counter;
+ guint8 Reserved;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+ guint8 PreBytes :2;
+ guint8 PostBytes :2;
+ guint8 PTS_Flag :1;
+ guint8 ReservedFlags :3;
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+ guint8 ReservedFlags :3;
+ guint8 PTS_Flag :1;
+ guint8 PostBytes :2;
+ guint8 PreBytes :2;
+
+#else
+#error "Please specify the byte order!"
+#endif
+
+ guint8 Length_hi;
+ guint8 Length_lo;
+
+} dvb_avpes_hdr_t attr_pack;
+
+
+/**
+ * Get the SyncWord value from the AVPES header.
+ *
+ * @param p pointer to dvb_avpes_hdr_t.
+ */
+#define AVPES_GET_SYNCWORD(p) \
+ ((((p)->SyncWord_hi) << 8) | ((p)->SyncWord_lo))
+
+
+/**
+ * Set the SyncWord value in a AVPES header.
+ *
+ * @param p pointer to dvb_ts_hdr_t.
+ * @param v SyncWord
+ */
+#define AVPES_SET_SYNCWORD(p,v) \
+do { \
+ (p)->SyncWord_lo = ((guint8)(((guint16)(v)) & 0x00FF)); \
+ (p)->SyncWord_hi = ((guint8)((((guint16)(v)) & 0xFF00) >> 8)); \
+} while (0)
+
+
+
+/**
+ * StreamIDs
+ */
+#define AVPES_VIDEO_STREAM_ID 0x01
+#define AVPES_MAIN_AUDIO_STREAM_ID 0x02
+
+
+
+/**
+ * Get the length of the AVPES payload.
+ *
+ * @param p pointer to dvb_avpes_hdr_t.
+ */
+#define AVPES_GET_LENGTH(p) \
+ ((((p)->Length_hi) << 8) | ((p)->Length_lo))
+
+
+/**
+ * Set the length of the payload in a AVPES header.
+ *
+ * @param p pointer to dvb_ts_hdr_t.
+ * @param v length
+ */
+#define AVPES_SET_LENGTH(p,v) \
+do { \
+ (p)->Length_lo = ((guint8)(((guint16)(v)) & 0x00FF)); \
+ (p)->Length_hi = ((guint8)((((guint16)(v)) & 0xFF00) >> 8)); \
+} while (0)
+
+
+#define MAX_VID_PAYLOADLENGTH 0x17f8
+#define MAX_AUD_PAYLOADLENGTH 0x07f8
+
+typedef struct _dvb_avpes_PTS {
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+ /*guint8 pts_31_30 :2;
+
+ guint8 pts_29_15_lo :7;
+ guint8 pts_29_15_hi :8;
+
+ guint8 pts_14_0_lo :7;
+
+ guint8 pts_14_0_hi :8;
+ */
+
+ guint8 pts_29_15_hi_6 :6;
+ guint8 pts_31_30 :2;
+
+ guint8 pts_29_15_mid_6 :6;
+ guint8 pts_29_15_mid_2 :2;
+
+ guint8 pts_14_0_hi_7 :7;
+ guint8 pts_29_15_lo_1 :1;
+
+ guint8 pts_14_0_lo_7 :7;
+ guint8 pts_14_0_mid_1 :1;
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+ guint8 pts_31_30 :2;
+ guint8 pts_29_15_hi_6 :6;
+
+ guint8 pts_29_15_mid_2 :2;
+ guint8 pts_29_15_mid_6 :6;
+
+ guint8 pts_29_15_lo_1 :1;
+ guint8 pts_14_0_hi_7 :7;
+
+ guint8 pts_14_0_mid_1 :1;
+ guint8 pts_14_0_lo_7 :7;
+
+#else
+#error "Please specify the byte order!"
+#endif
+
+} dvb_avpes_PTS_t attr_pack;
+#ifdef _WIN32
+#pragma pack(pop,p,1)
+#endif
+
+
+
+/**
+ * Get the PTS 29 15 timestamp.
+ *
+ * @param pt pointer to _dvb_avpes_PTS
+ */
+#define AVPES_GET_PTS_2915(pt) \
+ ((((pt)->pts_29_15_hi_6) << 9) | (((pt)->pts_29_15_mid_2) << 7) | (((pt)->pts_29_15_mid_6) << 1) | ((pt)->pts_29_15_lo_1))
+
+/**
+ * Get the PTS 14 0 timestamp.
+ *
+ * @param pt pointer to _dvb_avpes_PTS
+ */
+#define AVPES_GET_PTS_140(pt) \
+ ((((pt)->pts_14_0_hi_7) << 8) | (((pt)->pts_14_0_mid_1) << 7) | ((pt)->pts_14_0_lo_7))
+
+
+
+
+/**
+ * Set the PTS_2915 timestamp.
+ *
+ * @param pt pointer to _dvb_avpes_PTS.
+ * @param v value
+ */
+#define AVPES_SET_PTS_2915(pt, v) \
+do { \
+ (pt)->pts_29_15_lo_1 = ((guint8)(((guint16)(v)) & 0x0001)); \
+ (pt)->pts_29_15_mid_6 = ((guint8)((((guint16)(v)) & 0x007E) >> 1)); \
+ (pt)->pts_29_15_mid_2 = ((guint8)((((guint16)(v)) & 0x0180) >> 7)); \
+ (pt)->pts_29_15_hi_6 = ((guint8)((((guint16)(v)) & 0x7E00) >> 9)); \
+} while (0)
+
+
+/**
+ * Set the PTS_140 timestamp.
+ *
+ * @param pt pointer to _dvb_avpes_PTS
+ * @param v value
+ */
+#define AVPES_SET_PTS_140(pt, v) \
+do { \
+ (pt)->pts_14_0_lo_7 = ((guint8)(((guint16)(v)) & 0x007F)); \
+ (pt)->pts_14_0_mid_1 = ((guint8)((((guint16)(v)) & 0x0080) >> 7)); \
+ (pt)->pts_14_0_hi_7 = ((guint8)((((guint16)(v)) & 0x7F00) >> 8)); \
+} while (0)
+
+
+
+#endif /* __DVB_AVPES_HDR_H__ */
diff -ruN ethereal-0.10.7/dvb_incs/descriptors.h ethereal-0.10.7_mpeg2_recent/dvb_incs/descriptors.h
--- ethereal-0.10.7/dvb_incs/descriptors.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/dvb_incs/descriptors.h 2004-12-02 16:14:18.344884003 +0100
@@ -0,0 +1,1004 @@
+/* descriptors.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING <wolfi@xxxxxxxxxxxxxx>
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __DESCRIPTORS_H__
+#define __DESCRIPTORS_H__
+
+#include <glib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * DVB Stream Content values:
+ */
+#define DVB_STREAM_CONTENT_VIDEO 0x01
+#define DVB_STREAM_CONTENT_AUDIO 0x02
+#define DVB_STREAM_CONTENT_TELETEXT 0x03
+
+/**
+ * DVB Component Type values:
+ */
+#define DVB_COMP_TYPE_V_4_3 0x01 // video 4:3 aspect ratio
+#define DVB_COMP_TYPE_V_16_9_PV 0x02 // video 16:9 aspect ratio with pan vectors
+#define DVB_COMP_TYPE_v_19_9 0x03 // video 16:9 aspect ratio without pan vectors
+// 0x04 - 0xFF: Reserved for future use
+
+#define DVB_COMP_TYPE_A_MONO1 0x01 // audio: single mono channel
+#define DVB_COMP_TYPE_A_MONO2 0x02 // audio: dual mono channel
+#define DVB_COMP_TYPE_A_STEREO 0x03 // audio: stereo
+#define DVB_COMP_TYPE_A_MULTI 0x04 // audio: multilungual multichannel
+#define DVB_COMP_TYPE_A_SURROUND 0x05 // audio: surround
+// 0x06 - 0x3F: Reserved
+#define DVB_COMP_TYPE_A_VIMPAIRED 0x40 // audio: for visually impaired
+#define DVB_COMP_TYPE_A_AIMAPIRED 0x41 // audio: for the hard of hearing
+// 0x42 - 0xAF: Reserved for future use
+// 0xB0 - 0xFE: User defined
+// 0xFF: Reserved for future use
+
+#define DVB_COMP_TYPE_T_EBU_TTST 0x01 // EBU Teletext subtitles
+#define DVB_COMP_TYPE_T_AEBU_TT 0x02 // Associated EBU Teletext
+// 0x03 - 0x0F: Reserved for future use
+#define DVB_COMP_TYPE_T_DVB_ST 0x10 // DVB Subtitles (normal) with no monitor aspect ratio criticality
+#define DVB_COMP_TYPE_T_DVB_ST_4_3 0x11 // DVB Subtitles (normal) for display on 4:3 aspect ratio monitor
+#define DVB_COMP_TYPE_T_DVB_ST_16_9 0x12 // DVB Subtitles (normal) for display on 16:9 aspect ratio monitor
+#define DVB_COMP_TYPE_T_DVB_ST_221_1 0x13 // DVB Subtitles (normal) for display on 2.21:1 aspect ration monitor
+// 0x14 - 0x1F: Reserved for future use
+#define DVB_COMP_TYPE_T_DVB_HH_ST 0x10 // DVB Subtitles (hard of hearing) with no monitor aspect ratio criticality
+#define DVB_COMP_TYPE_T_DVB_HH_ST_4_3 0x11 // DVB Subtitles (hard of hearing) for display on 4:3 aspect ratio monitor
+#define DVB_COMP_TYPE_T_DVB_HH_ST_16_9 0x12 // DVB Subtitles (hard of hearing) for display on 16:9 aspect ratio monitor
+#define DVB_COMP_TYPE_T_DVB_HH_ST_221_1 0x13 // DVB Subtitles (hard of hearing) for display on 2.21:1 aspect ration monitor
+
+
+/**
+ * Generic DVB descriptor type.
+ * All DVB descriptors share this generic information
+ * in the first two bytes.
+ */
+#ifdef __GNUC__
+#define attr_pack __attribute__((packed))
+#elif defined(_WIN32)
+#define attr_pack
+#pragma pack(push,p,1)
+#else
+#error "Compiler not supported"
+#endif
+typedef struct _dvb_descr_gen {
+
+ guint8 descriptor_tag;
+ guint8 descriptor_length;
+
+ // descriptor data
+
+} dvb_descr_gen_t attr_pack;
+
+
+/**
+ * Values for descriptor_tag:
+ */
+#define DVB_DESCR_TAG_VIDEO_STREAM 0x02 // PMT
+#define DVB_DESCR_TAG_AUDIO_STREAM 0x03 // PMT
+#define DVB_DESCR_TAG_HIERARCHY 0x04 // PMT
+#define DVB_DESCR_TAG_REGISTRATION 0x05 // PMT
+#define DVB_DESCR_TAG_DATA_STREAM_ALIGN 0x06 // PMT
+#define DVB_DESCR_TAG_TARGET_BG_GRID 0x07 // PMT
+#define DVB_DESCR_TAG_VIDEO_WINDOW 0x08 // PMT
+#define DVB_DESCR_TAG_CA 0x09 // PMT
+#define DVB_DESCR_TAG_ISO_639_LANG 0x0A // PMT
+#define DVB_DESCR_TAG_SYSTEM_CLOCK 0x0B // PMT
+#define DVB_DESCR_TAG_MPX_BUF_UTIL 0x0C // PMT
+#define DVB_DESCR_TAG_COPYRIGHT 0x0D // PMT
+#define DVB_DESCR_TAG_MAX_BITRATE 0x0E // PMT
+#define DVB_DESCR_TAG_PRIVATE_DATA 0x0F // PMT
+#define DVB_DESCR_TAG_SMOOTHING_BUF 0x10 // PMT
+#define DVB_DESCR_TAG_SDT 0x11 // PMT
+#define DVB_DESCR_TAG_IBP 0x12 // PMT
+
+#define DVB_DESCR_TAG_CAROUSEL_ID 0x13 // PMT, DSM-CC
+#define DVB_DESCR_TAG_ASSOC_TAG 0x14
+#define DVB_DESCR_TAG_DEFERRED_ASSOC 0x15
+
+#define DVB_DESCR_TAG_NETWORK_NAME 0x40 // NIT
+#define DVB_DESCR_TAG_SERVICE_LIST 0x41 // NIT
+#define DVB_DESCR_TAG_STUFFING 0x42 // NIT, SDT
+#define DVB_DESCR_TAG_SAT_DELIV_SYS 0x43 // NIT
+#define DVB_DESCR_TAG_CABLE_DELIV_SYS 0x44 // NIT
+#define DVB_DESCR_TAG_VBI_DATA 0x45 // PMT
+#define DVB_DESCR_TAG_VBI_TELETEXT 0x46 // PMT
+#define DVB_DESCR_TAG_BOUQUET_NAME 0x47 // SDT
+#define DVB_DESCR_TAG_SERVICE 0x48 // SDT
+#define DVB_DESCR_TAG_COUNTRY_AVAIL 0x49 // SDT
+#define DVB_DESCR_TAG_LINKAGE 0x4A // NIT, SDT
+#define DVB_DESCR_TAG_NVOD_REFERENCE 0x4B // SDT
+#define DVB_DESCR_TAG_TIME_SHIFTED 0x4C // SDT
+#define DVB_DESCR_TAG_SHORT_EVENT 0x4D // EIT, SIT
+#define DVB_DESCR_TAG_EXTENDED_EVENT 0x4E // EIT, SIT
+#define DVB_DESCR_TAG_TSHIFT_EVENT 0x4F // EIT, SIT
+#define DVB_DESCR_TAG_COMPONENT 0x50 // EIT, SIT
+#define DVB_DESCR_TAG_MOSAIC 0x51 // PMT, SDT
+#define DVB_DESCR_TAG_STREAM_ID 0x52 // PMT
+#define DVB_DESCR_TAG_CA_ID 0x53 // SDT
+#define DVB_DESCR_TAG_CONTENT 0x54 // EIT, SIT
+#define DVB_DESCR_TAG_PARENTAL_RATING 0X55 // EIT, SIT
+#define DVB_DESCR_TAG_TELETEXT 0x56 // PMT
+#define DVB_DESCR_TAG_TELEPHONE 0x57 // SDT
+#define DVB_DESCR_TAG_LOC_TIME_OFF 0x58 // TOT
+#define DVB_DESCR_TAG_SUBTITLING 0x59 // PMT
+#define DVB_DESCR_TAG_TERR_DELIV_SYS 0x5A // NIT
+#define DVB_DESCR_TAG_MULING_NET_NAME 0x5B // NIT
+#define DVB_DESCR_TAG_MULING_BOU_NAME 0x5C // BAT
+#define DVB_DESCR_TAG_MULING_SERV_NAME 0x5D // SDT
+#define DVB_DESCR_TAG_MULING_COMP 0x5E // EIT, SIT
+#define DVB_DESCR_TAG_PRIV_DATA_SPEC 0x5F // PMT, NIT, SDT
+#define DVB_DESCR_TAG_SERVICE_MOVE 0x60 // PMT
+#define DVB_DESCR_TAG_FREQ_LIST 0x62 // NIT
+#define DVB_DESCR_TAG_DATA_BROADCAST 0x64 // SDT
+#define DVB_DESCR_TAG_CA_SYSTEM 0x65 // PMT
+#define DVB_DESCR_TAG_DATA_BROADCAST_ID 0x66 // PMT
+#define DVB_DESCR_TAG_PDC 0x69 // EIT
+#define DVB_DESCR_TAG_AC3 0x6A // PMT
+#define DVB_DESCR_TAG_APP_SIG 0x6F // PMT
+
+
+/**
+ * Values for descriptor_tag for MHP descriptors.
+ * They are most likely encounteren in AIT's and the descriptor loops of DII messages.
+ */
+#define DVB_DESCR_MHP_APP 0x00
+#define DVB_DESCR_MHP_APPNAME 0x01
+#define DVB_DESCR_MHP_TRPROT 0x02
+#define DVB_DESCR_MHP_DVBJAPP 0x03
+#define DVB_DESCR_MHP_DVBJAPPLOC 0x04
+#define DVB_DESCR_MHP_APPICON 0x0B
+#define DVB_DESCR_MHP_LABEL 0x70
+#define DVB_DESCR_MHP_CACHEPRI 0x71
+#define DVB_DESCR_DSMCC_COMPRESSED 0x09
+
+
+/**
+ * Video Stream Descriptor
+ */
+typedef struct _dvb_descr_video_stream {
+
+ dvb_descr_gen_t gen_descr;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 still_picture_flag :1;
+ guint8 constrained_parameter_flag :1;
+ guint8 MPEG_1_only_flag :1;
+ guint8 frame_rate_code :4; // defined in H.262
+ guint8 multiple_frame_rate_flag :1;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 multiple_frame_rate_flag :1;
+ guint8 frame_rate_code :4; // defined in H.262
+ guint8 MPEG_1_only_flag :1;
+ guint8 constrained_parameter_flag :1;
+ guint8 still_picture_flag :1;
+#else
+#error "Please specify the byte order!"
+#endif
+ // if MPEG_1_only_flag == 1
+ // dvb_descr_vs_mpeg1
+} dvb_descr_video_stream_t attr_pack;
+
+typedef struct _dvb_descr_vs_mpeg1 {
+ guint8 profile_and_level_indication;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 reserved :5;
+ guint8 frame_rate_extension_flag :1;
+ guint8 chroma_format :2;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 chroma_format :2;
+ guint8 frame_rate_extension_flag :1;
+ guint8 reserved :5;
+#else
+#error "Please specify the byte order!"
+#endif
+
+} dvb_descr_vs_mpeg1_t attr_pack;
+
+
+/**
+ * Audio Stream Descriptor.
+ */
+typedef struct _dvb_descr_audio_stream {
+
+ dvb_descr_gen_t gen_descr;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 reserved :3;
+ guint8 variable_rate_audio_indicator :1;
+ guint8 layer :2;
+ guint8 ID :1;
+ guint8 free_format_flag :1;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 free_format_flag :1;
+ guint8 ID :1;
+ guint8 layer :2;
+ guint8 variable_rate_audio_indicator :1;
+ guint8 reserved :3;
+#else
+#error "Please specify the byte order!"
+#endif
+
+} dvb_descr_audio_stream_t attr_pack;
+
+
+/**
+ * The DVB Mosaic Descriptor.
+ */
+typedef struct _dvb_descr_mosaic {
+
+ dvb_descr_gen_t gen_descr;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 number_of_vertical_elementary_cells :3;
+ guint8 reserved_future_use :1;
+ guint8 number_of_horizontal_elementary_cells :3;
+ guint8 mosaic_entry_point :1;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 mosaic_entry_point :1;
+ guint8 number_of_horizontal_elementary_cells :3;
+ guint8 reserved_future_use :1;
+ guint8 number_of_vertical_elementary_cells :3;
+#else
+#error "Please specify the byte order!"
+#endif
+
+ // Cell description...
+
+} dvb_descr_mosaic_t attr_pack;
+
+
+/**
+ * The DVB Stream ID Descriptor.
+ */
+typedef struct _dvb_descr_stream_id {
+
+ dvb_descr_gen_t gen_descr;
+
+ guint8 component_tag;
+
+} dvb_descr_stream_id_t attr_pack;
+
+/**
+ * The DVB PDC Descriptor
+ * This one contains the program deliverey control
+ */
+
+typedef struct _pil {
+ dvb_descr_gen_t gen_descr;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint day_hi :4;
+ guint reserved :4;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint reserved :4;
+ guint day_hi :4;
+#else
+#error "Please specify the byte order!"
+#endif
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint hour_hi :3;
+ guint month :4;
+ guint day_lo :1;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint day_lo :1;
+ guint month :4;
+ guint hour_hi :3;
+#else
+#error "Please specify the byte order!"
+#endif
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint minute :6;
+ guint hour_lo :2;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint hour_lo :2;
+ guint minute :6;
+#else
+#error "Please specify the byte order!"
+#endif
+} pil_t attr_pack;
+
+/**
+ * The DVB Teletext Descriptor.
+ * This one contains an array of teletext_entry blocks.
+ */
+typedef struct _dvb_descr_teletext_entry {
+
+ guint8 ISO_639_language_code_hi;
+ guint8 ISO_639_language_code_med;
+ guint8 ISO_639_language_code_lo;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 teletext_magazine_number :3;
+ guint8 teletext_type :5;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 teletext_type :5;
+ guint8 teletext_magazine_number :3;
+#else
+#error "Please specify the byte order!"
+#endif
+ guint8 teletext_page_number;
+
+} dvb_descr_teletext_entry_t attr_pack;
+
+/**
+ * Get DVB Teletext Descriptor's langauge code (24 bits) number.
+ * @param t pointer to dvb_descr_teletext_entry_t.
+ */
+#define DVB_GET_TT_LANG_CODE(t) \
+ (((t)->ISO_639_language_code_hi << 16) | ((t)->ISO_639_language_code_med << 8) | ((t)->ISO_639_language_code_lo))
+
+/**
+ * Set DVB Teletext Descriptor's languate code (24 bits) number.
+ * @param t pointer to dvb_descr_teletext_entry_t.
+ * @param lc language code (int, 24 bits signigicant).
+ */
+#define DVB_SET_TT_LANG_CODE(t,lc) \
+do { \
+ (t)->ISO_639_language_code_hi = (((guint32)(lc)) & 0x00FF0000) >> 16; \
+ (t)->ISO_639_language_code_med = (((guint32)(lc)) & 0x0000FF00) >> 8; \
+ (t)->ISO_639_language_code_lo = (((guint32)(lc)) & 0x000000FF); \
+} while (0)
+
+
+typedef struct _dvb_descr_teletext {
+
+ dvb_descr_gen_t gen_descr;
+
+ // dvb_descr_teletext_entry_t[N]
+
+} dvb_descr_teletext_t attr_pack;
+
+/**
+ * Values for dvb_descr_teletext_entry_t's teletext_type field:
+ */
+#define DVB_TELETEXT_TYPE_INITIAL 0x01
+#define DVB_TELETEXT_TYPE_SUBTITLE 0x02
+#define DVB_TELETEXT_TYPE_INFO 0x03
+#define DVB_TELETEXT_TYPE_SCHEDULE 0x04
+#define DVB_TELETEXT_TYPE_IMPAIRED 0x05
+
+
+/**
+ * The DVB Subtitling Descriptor.
+ * Contains an array of dvb_descr_subtitling_entry's.
+ */
+typedef struct _dvb_descr_subtitling_entry {
+
+ guint8 ISO_639_language_code_hi;
+ guint8 ISO_639_language_code_med;
+ guint8 ISO_639_language_code_lo;
+
+ guint8 subtitling_type;
+ guint8 composition_page_id_hi;
+ guint8 composition_page_id_lo;
+ guint8 ancillary_page_id_hi;
+ guint8 ancillary_page_id_lo;
+
+} dvb_descr_subtitling_entry_t attr_pack;
+
+/**
+ * Get DVB Teletext Descriptor's langauge code (24 bits) number.
+ * @param t pointer to dvb_descr_teletext_entry_t.
+ */
+#define DVB_GET_ST_LANG_CODE(t) \
+ (((t)->ISO_639_language_code_hi << 16) | ((t)->ISO_639_language_code_med << 8) | ((t)->ISO_639_language_code_lo))
+
+/**
+ * Set DVB Teletext Descriptor's languate code (24 bits) number.
+ * @param t pointer to dvb_descr_teletext_entry_t.
+ * @param lc language code (int, 24 bits signigicant).
+ */
+#define DVB_SET_ST_LANG_CODE(t,lc) \
+do { \
+ (t)->ISO_639_language_code_hi = (((guint32)(lc)) & 0x00FF0000) >> 16; \
+ (t)->ISO_639_language_code_med = (((guint32)(lc)) & 0x0000FF00) >> 8; \
+ (t)->ISO_639_language_code_lo = (((guint32)(lc)) & 0x000000FF); \
+} while (0)
+
+#define DVB_GET_ST_COMPOS_PAGE(s) \
+ (((s)->composition_page_id_hi << 8) | (s)->composition_page_id_lo)
+
+#define DVB_SET_ST_COMPOS_PAGE(s,cp) \
+do { \
+ (s)->composition_page_id_hi = (((guint16)(cp)) & 0xFF00) >> 8; \
+ (s)->composition_page_id_lo = (((guint16)(cp)) & 0x00FF); \
+} while (0)
+
+#define DVB_GET_ST_ANCILL_PAGE(s) \
+ (((s)->ancillary_page_id_hi << 8) | (s)->ancillary_page_id_lo)
+
+#define DVB_SET_ST_ANCILL_PAGE(s,cp) \
+do { \
+ (s)->ancillary_page_id_hi = (((guint16)(cp)) & 0xFF00) >> 8; \
+ (s)->ancillary_page_id_lo = (((guint16)(cp)) & 0x00FF); \
+} while (0)
+
+typedef struct _dvb_descr_subtitling {
+
+ dvb_descr_gen_t gen_descr;
+
+ // dvb_descr_subtitling_entry_t[N]
+
+} dvb_descr_subtitling_t attr_pack;
+
+
+/**
+ * The DVB Private Data Descriptor.
+ */
+typedef struct _dvb_descr_private_data {
+
+ dvb_descr_gen_t gen_descr;
+
+ guint32 private_data_specifier;
+
+} dvb_descr_private_data_t attr_pack;
+
+#define DVB_GET_DESCR_PRIV_DATA(t) \
+ g_ntohl( (t)->private_data_specifier )
+
+#define DVB_SET_DESCR_PRIV_DATA(t,d) \
+ (t)->private_data_specifier = htonl( (guint32)(d) )
+
+
+/**
+ * The DVB Service Move Descriptor.
+ */
+typedef struct _dvb_descr_service_move {
+
+ dvb_descr_gen_t gen_descr;
+
+ guint16 new_original_network_id;
+ guint16 new_transport_stream_id;
+ guint16 new_service_id;
+
+} dvb_descr_service_move_t attr_pack;
+
+#define DVB_GET_DESCR_SERVICE_MOVE_NID(t) \
+ g_ntohs( (t)->new_original_network_id )
+
+#define DVB_SET_DESCR_SERVICE_MODE_NID(t,d) \
+ (t)->new_original_network_id = htons( (guint16)(d) )
+
+#define DVB_GET_DESCR_SERVICE_MOVE_TSID(t) \
+ g_ntohs( (t)->new_transport_stream_id )
+
+#define DVB_SET_DESCR_SERVICE_MODE_TSID(t,d) \
+ (t)->new_transport_stream_id = htons( (guint16)(d) )
+
+#define DVB_GET_DESCR_SERVICE_MOVE_SID(t) \
+ g_ntohs( (t)->new_service_id )
+
+#define DVB_SET_DESCR_SERVICE_MODE_SID(t,d) \
+ (t)->new_service_id = htons( (guint16)(d) )
+
+
+/**
+ * The DVB CA System Descriptor.
+ */
+typedef struct _dvb_descr_ca_system {
+
+ dvb_descr_gen_t gen_descr;
+
+ // CA_system_id[N] described in ETR162
+
+} dvb_descr_ca_system_t attr_pack;
+
+/**
+ * The CA Identifier Descriptor.
+ */
+typedef struct _dvb_descr_ca_id {
+
+ dvb_descr_gen_t gen_descr;
+
+ // guint16 CA_id[N] described in ETR162
+
+} dvb_descr_ca_id_t attr_pack;
+
+#define DVB_GET_DESCR_CA_ID(t) \
+ ((t)[0] << 8 | (t)[1])
+
+#define DVB_SET_DESCR_CA_ID(t,i) \
+do { \
+ (t)[0] = (((guint16)(i)) & 0xFF00) >> 8; \
+ (t)[1] = (((guint16)(i)) & 0x00FF); \
+} while (0)
+
+
+/**
+ * The DVB Data Broadcast ID Descriptor.
+ */
+typedef struct _dvb_descr_data_broadcast_id {
+
+ dvb_descr_gen_t gen_descr;
+
+ guint16 data_broadcast_id; // defined in ETR162
+
+ // selector_byte[N]
+
+} dvb_descr_data_broadcast_id_t attr_pack;
+
+
+/**
+ * Data Broadcast Descriptor.
+ */
+typedef struct _dvb_descr_data_broadcast {
+
+ dvb_descr_gen_t gen_descr;
+
+ guint8 data_broadcast_id_hi;
+ guint8 data_broadcast_id_lo;
+
+ guint8 component_tag;
+ guint8 selector_length;
+
+ // selector_byte[N]
+
+ // dvb_descr_data_broadcast_ext
+
+ // text_char[N]
+
+} dvb_descr_data_broadcast_t attr_pack;
+
+#define DVB_GET_DESCR_DBC_ID(t) \
+ (((t)->data_broadcast_id_hi << 8) | (t)->data_broadcast_id_lo)
+
+#define DVB_SET_DESCR_DBC_ID(t,i) \
+do { \
+ (t)->data_broadcast_id_hi = (((guint16)(i)) & 0xFF00) >> 8; \
+ (t)->data_broadcast_id_lo = (((guint16)(i)) & 0x00FF); \
+} while (0)
+
+#define DVB_DBC_ID_DATA_PIPE 0x0001
+#define DVB_DBC_ID_ASYNC_DATA_STREAM 0x0002
+#define DVB_DBC_ID_SYNC_DATA_STREAM 0x0003
+#define DVB_DBC_ID_SYNCED_DATA_STREAM 0x0004
+#define DVB_DBC_ID_MPE 0x0005
+#define DVB_DBC_ID_DATA_CAROUSEL 0x0006
+#define DVB_DBC_ID_OBJECT_CAROUSEL 0x0007
+#define DVB_DBC_ID_ATM_STREAMS 0x0008
+#define DVB_DBC_ID_HIGHER_PROTO 0x0009
+
+#define DVB_DBC_ID_MHP_CAROUSEL 0x00F0
+#define DVB_DBC_ID_MHP_MPE 0x00F1
+
+
+typedef struct _dvb_descr_data_broadcast_ext {
+
+ guint8 ISO_639_language_code_0;
+ guint8 ISO_639_language_code_1;
+ guint8 ISO_639_language_code_2;
+
+ guint8 text_length;
+
+} dvb_descr_data_broadcast_ext_t attr_pack;
+
+
+// Selector of data_broadcast descriptor for data_broadcast_id == 0x0005
+typedef struct _dvb_mpe_info {
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 reserved :3;
+ guint8 alignment_indicator :1;
+ guint8 mac_ip_map_flag :1;
+ guint8 mac_addr_range :3;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 mac_addr_range :3;
+ guint8 mac_ip_map_flag :1;
+ guint8 alignment_indicator :1;
+ guint8 reserved :3;
+#else
+#error "Please specify the byte order!"
+#endif
+
+ guint8 max_sec_per_dg;
+
+} dvb_mpe_info_t attr_pack;
+
+
+#define DVB_GET_DESCR_DBC_ISO_639(t,s) \
+do { \
+ (s)[0] = (t)->ISO_639_language_code_0; \
+ (s)[1] = (t)->ISO_639_language_code_1; \
+ (s)[2] = (t)->ISO_639_language_code_2; \
+} while (0)
+
+#define DVB_SET_DESCR_DBC_ISO_639(t,s) \
+do { \
+ (t)->ISO_639_language_code_0 = (s)[0]; \
+ (t)->ISO_639_language_code_1 = (s)[1]; \
+ (t)->ISO_639_language_code_2 = (s)[2]; \
+} while (0)
+
+
+/**
+ * Network Name Descriptor
+ */
+typedef struct _dvb_descr_network_name {
+
+ dvb_descr_gen_t gen_descr;
+
+ // char[N]
+
+} dvb_descr_network_name_t attr_pack;
+
+
+/**
+ * Service List descriptor entry
+ */
+typedef struct _dvb_service_list_entry {
+
+ guint8 service_id_hi;
+ guint8 service_id_lo;
+ guint8 service_type;
+
+} dvb_service_list_entry_t attr_pack;
+
+
+#define DVB_GET_SVC_LIST_ENTRY_ID(t) \
+ (((t)->service_id_hi << 8) | ((t)->service_id_lo))
+
+#define DVB_SET_SVC_LIST_ENTRY_ID(t,d) \
+do { \
+ (t)->service_id_hi = (((guint16)(d)) & 0xFF00) >> 8; \
+ (t)->service_id_lo = ((guint16)(d)) & 0x00FF; \
+} while (0)
+
+
+/**
+ * Service List Descriptor
+ */
+typedef struct _dvb_descr_service_list {
+
+ dvb_descr_gen_t gen_descr;
+
+ // dvb_service_list_entry_t[N]
+
+} dvb_descr_service_list_t attr_pack;
+
+
+/**
+ * Values for dvb_service_list_entry_t's service_type.
+ */
+#define DVB_SVC_TYP_DIGI_TV 0x01
+#define DVB_SVC_TYP_DIGI_RD_SOUND 0x02
+#define DVB_SVC_TYP_TELETEXT 0x03
+#define DVB_SVC_TYP_NVOD_REF 0x04
+#define DVB_SVC_TYP_NVOD_TSHF 0x05
+#define DVB_SVC_TYP_MOSAIC 0x06
+#define DVB_SVC_TYP_PAL_CODED 0x07
+#define DVB_SVC_TYP_SECAM_CODED 0x08
+#define DVB_SVC_TYP_D_D2_MAC 0x09
+#define DVB_SVC_TYP_FM_RADIO 0x0A
+#define DVB_SVC_TYP_NTSC_CODED 0x0B
+#define DVB_SVC_TYP_DATA_BROADCAST 0x0C
+/* 0x0D - 0x7F reserved for future use */
+/* 0x80 - 0xFE user defined */
+/* 0xFF reserved for future use */
+
+
+/**
+ * Service Descriptor.
+ */
+typedef struct _dvb_descr_service {
+
+ dvb_descr_gen_t gen_descr;
+
+ guint8 service_type;
+ guint8 service_provider_name_length;
+ // char service_provider_name[N]
+ // guint8 service_name_length
+ // char service_name[N1]
+
+} dvb_descr_service_t attr_pack;
+
+
+/**
+ * Stuffing Descriptor
+ */
+typedef struct _dvb_descr_stuffing {
+
+ dvb_descr_gen_t gen_descr;
+
+ // stuffing_byte[N]
+
+} dvb_descr_stuffing_t attr_pack;
+
+
+/**
+ * Values for Satellite Delivery System Descriptor.
+ */
+#define DVB_OUTER_FEC_NONE 0x1
+#define DVB_OUTER_FEC_RS 0x2
+
+#define DVB_INNER_FEC_1_2 0x1
+#define DVB_INNER_FEC_2_3 0x2
+#define DVB_INNER_FEC_3_4 0x3
+#define DVB_INNER_FEC_5_6 0x4
+#define DVB_INNER_FEC_7_8 0x5
+#define DVB_INNER_FEC_NONE 0xF
+
+#define DVB_CABLE_MOD_16_QAM 0x01
+#define DVB_CABLE_MOD_32_QAM 0x02
+#define DVB_CABLE_MOD_64_QAM 0x03
+#define DVB_CABLE_MOD_128_QAM 0x04
+#define DVB_CABLE_MOD_256_QAM 0x05
+
+#define DVB_SATELLITE_MOD_QPSK 0x01
+
+#define DVB_POLARIZATION_LIN_HORZ 0
+#define DVB_POLARIZATION_LIN_VERT 1
+#define DVB_POLARIZATION_CIRC_LT 2
+#define DVB_POLARIZATION_CIRC_RT 3
+
+#define DVB_WEST_EAST_WEST 0
+#define DVB_WEST_EAST_EAST 1
+
+
+/**
+ * Satellite Delivery System Descriptor
+ */
+typedef struct _dvb_descr_satellite_del_sys {
+
+ dvb_descr_gen_t gen_descr;
+
+ guint8 frequency_0;
+ guint8 frequency_1;
+ guint8 frequency_2;
+ guint8 frequency_3;
+
+ guint8 orbital_position_hi;
+ guint8 orbital_position_lo;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 modulation :5;
+ guint8 polarization :2;
+ guint8 west_east_flag :1;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 west_east_flag :1;
+ guint8 polarization :2;
+ guint8 modulation :5;
+#else
+#error "Please specify the byte order!"
+#endif
+ guint8 symbol_rate_0;
+ guint8 symbol_rate_1;
+ guint8 symbol_rate_2;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 FEC_inner :4;
+ guint8 symbol_rate_3 :4;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 symbol_rate_3 :4;
+ guint8 FEC_inner :4;
+#else
+#error "Please specify the byte order!"
+#endif
+} dvb_descr_satellite_del_sys_t attr_pack;
+
+
+#define DVB_GET_SAT_DEL_SYS_FREQ(t) \
+ (((t)->frequency_0 << 24) | ((t)->frequency_1 << 16) | ((t)->frequency_2 << 8) | (t)->frequency_3)
+
+#define DVB_SET_SAT_DEL_SYS_FREQ(t,d) \
+do { \
+ (t)->frequency_0 = (((guint32)(d)) & 0xFF000000) >> 24; \
+ (t)->frequency_1 = (((guint32)(d)) & 0x00FF0000) >> 16; \
+ (t)->frequency_2 = (((guint32)(d)) & 0x0000FF00) >> 8; \
+ (t)->frequency_3 = (((guint32)(d)) & 0x000000FF); \
+} while (0)
+
+
+#define DVB_GET_SAT_DEL_SYS_ORB(t) \
+ (((t)->orbital_position_hi << 8) | (t)->orbital_position_lo)
+
+#define DVB_SET_SAT_DEL_SYS_ORB(t,d) \
+do { \
+ (t)->orbital_position_hi = (((guint16)(d)) & 0xFF00) >> 8; \
+ (t)->orbital_position_lo = (((guint16)(d)) & 0x00FF); \
+} while (0)
+
+
+#define DVB_GET_SAT_DEL_SYS_SYMBOL(t) \
+ (((t)->symbol_rate_0 << 20) | ((t)->symbol_rate_1 << 12) | ((t)->symbol_rate_2 << 4) | ((t)->symbol_rate_3))
+
+#define DVB_SET_SAT_DEL_SYS_SYMBOL(t,s) \
+do { \
+ (t)->symbol_rate_0 = (((guint32)(s)) & 0x0FF00000) >> 20; \
+ (t)->symbol_rate_1 = (((guint32)(s)) & 0x000FF000) >> 12; \
+ (t)->symbol_rate_2 = (((guint32)(s)) & 0x00000FF0) >> 4; \
+ (t)->symbol_rate_3 = (((guint32)(s)) & 0x0000000F); \
+} while (0)
+
+
+/**
+ * Cable Delivery System Descriptor
+ */
+typedef struct _dvb_descr_cable_del_sys {
+
+ dvb_descr_gen_t gen_descr;
+
+ guint32 frequency;
+ guint8 reserved_0;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 FEC_outer :4;
+ guint8 reserved_1 :4;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 reserved_1 :4;
+ guint8 FEC_outer :4;
+#else
+#error "Please specify the byte order!"
+#endif
+ guint8 modulation;
+ guint8 symbol_rate_0;
+ guint8 symbol_rate_1;
+ guint8 symbol_rate_2;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 FEC_inner :4;
+ guint8 symbol_rate_3 :4;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 symbol_rate_3 :4;
+ guint8 FEC_inner :4;
+#else
+#error "Please specify the byte order!"
+#endif
+} dvb_descr_cable_del_sys_t attr_pack;
+
+
+#define DVB_GET_CABLE_DEL_SYS_FREQ(t) \
+ g_ntohl( (t)->frequency )
+
+#define DVB_SET_CABLE_DEL_SYS_FREQ(t,d) \
+ (t)->frequency = htonl( (guint32)(d) )
+
+#define DVB_GET_CABLE_DEL_SYS_RESERVED(t) \
+ (((t)->reserved_0 << 4) | ((t)->reserved_1))
+
+#define DVB_SET_CABLE_DEL_SYS_RESERVED(t,s) \
+do { \
+ (t)->reserved_0 = (((guint16)(s)) & 0x0FF0) >> 4; \
+ (t)->reserved_1 = (((guint16)(s)) & 0x000F); \
+} while (0)
+
+#define DVB_GET_CABLE_DEL_SYS_SYMBOL(t) \
+ (((t)->symbol_rate_0 << 20) | ((t)->symbol_rate_1 << 12) | ((t)->symbol_rate_2 << 4) | ((t)->symbol_rate_3))
+
+#define DVB_SET_CABLE_DEL_SYS_SYMBOL(t,s) \
+do { \
+ (t)->symbol_rate_0 = (((guint32)(s)) & 0x0FF00000) >> 20; \
+ (t)->symbol_rate_1 = (((guint32)(s)) & 0x000FF000) >> 12; \
+ (t)->symbol_rate_2 = (((guint32)(s)) & 0x00000FF0) >> 4; \
+ (t)->symbol_rate_3 = (((guint32)(s)) & 0x0000000F); \
+} while (0)
+
+
+#define DVB_LINKAGE_TYPE_RESSERVED 0x00
+#define DVB_LINKAGE_TYPE_INFO 0x01
+#define DVB_LINKAGE_TYPE_EPG 0x02
+#define DVB_LINKAGE_TYPE_CA_REPLACE 0x03
+#define DVB_LINKAGE_TYPE_BOUQUET_SI 0x04
+#define DVB_LINKAGE_TYPE_SVC_REPLACE 0x05
+#define DVB_LINKAGE_TYPE_DATA_BROADCAST 0x06
+
+
+/**
+ * Linkage Descriptor
+ */
+typedef struct _dvb_descr_linkage {
+
+ dvb_descr_gen_t gen_descr;
+
+ guint16 transport_stream_id __attribute((packed));
+ guint16 original_network_id __attribute((packed));
+ guint16 service_id __attribute((packed));
+ guint8 linkage_type __attribute((packed));
+
+ // private_data_byte[N]
+
+} dvb_descr_linkage_t attr_pack;
+
+
+#define DVB_GET_LINKAGE_TS_ID(t) \
+ g_ntohs( (t)->transport_stream_id )
+
+#define DVB_SET_LINKAGE_TS_ID(t,d) \
+ (t)->transport_stream_id = htons( (guint16)(d) )
+
+#define DVB_GET_LINKAGE_NETW_ID(t) \
+ g_ntohs( (t)->original_network_id )
+
+#define DVB_SET_LINKAGE_NETW_ID(t,d) \
+ (t)->original_network_id = htons( (guint16)(d) )
+
+#define DVB_GET_LINKAGE_SVC_ID(t) \
+ g_ntohs( (t)->service_id )
+
+#define DVB_SET_LINKAGE_SVC_ID(t,d) \
+ (t)->service_id = htons( (guint16)(d) )
+
+
+typedef struct _dvb_descr_carousel_id {
+
+ dvb_descr_gen_t gen_descr;
+
+ guint32 carousel_id attr_pack;
+ guint8 format_id attr_pack;
+
+ // if (format_id == 1)
+ // format_specifier()
+
+ // private_data_byte[N]
+
+} dvb_descr_carousel_id_t attr_pack;
+
+
+typedef struct _dvb_descr_app_sig {
+
+ dvb_descr_gen_t gen_descr;
+
+ // dvb_appsig_entry_t[]
+
+} dvb_descr_app_sig_t attr_pack;
+
+typedef struct _dvb_appsig_entry {
+ guint16 app_type attr_pack;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 ait_ver :5 attr_pack;
+ guint8 reserved :3 attr_pack;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 reserved :3 attr_pack;
+ guint8 ait_ver :5 attr_pack;
+#else
+#error "Please specify the byte order!"
+#endif
+
+} dvb_appsig_entry_t attr_pack;
+
+
+typedef struct _dvb_descr_assoctag
+{
+ dvb_descr_gen_t gen_descr attr_pack;
+
+ guint16 assoc_tag attr_pack;
+ guint16 use attr_pack;
+ guint8 selector_len attr_pack;
+
+ // guint8 selector_bytes[selector_len];
+ // guint8 private_data_bytes[]
+} dvb_descr_assoctag_t attr_pack;
+#ifdef _WIN32
+#pragma pack(pop,p,1)
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* __DESCRIPTORS_H__ */
diff -ruN ethereal-0.10.7/dvb_incs/dvb_types.h ethereal-0.10.7_mpeg2_recent/dvb_incs/dvb_types.h
--- ethereal-0.10.7/dvb_incs/dvb_types.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/dvb_incs/dvb_types.h 2004-12-02 16:14:18.346883702 +0100
@@ -0,0 +1,14 @@
+/* $Id: dvb_types.h,v 1.2 2000/02/11 10:33:53 pmm Exp $ */
+
+#ifndef __DVB_TYPES_H__
+#define __DVB_TYPES_H__
+
+typedef unsigned int uint8 __attribute__(( __mode__( __QI__ ) ));
+typedef unsigned int uint16 __attribute__(( __mode__( __HI__ ) ));
+typedef unsigned int uint32 __attribute__(( __mode__( __SI__ ) ));
+
+typedef uint16 dvb_pid_t;
+typedef uint16 dvb_sid_t;
+typedef uint8 dvb_table_t;
+
+#endif /* __DVB_TYPES_H__ */
diff -ruN ethereal-0.10.7/dvb_incs/pes_hdr.h ethereal-0.10.7_mpeg2_recent/dvb_incs/pes_hdr.h
--- ethereal-0.10.7/dvb_incs/pes_hdr.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/dvb_incs/pes_hdr.h 2004-12-02 16:14:18.496861135 +0100
@@ -0,0 +1,662 @@
+/* pes_hdr.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING <wolfi@xxxxxxxxxxxxxx>
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#ifndef __DVB_PES_HDR_H__
+#define __DVB_PES_HDR_H__
+
+#include <glib.h>
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#elif __BYTE_ORDER == __BIG_ENDIAN
+#else
+#error "Please specify the byte order!"
+#endif
+
+#define PACKET_START_CODE_PREFIX 0x000001
+#ifdef __GNUC__
+#define attr_pack __attribute__((packed))
+#elif defined(_WIN32)
+#define attr_pack
+#pragma pack(push,p,1)
+#else
+#error "Compiler not supported"
+#endif
+typedef struct _dvb_pes_hdr {
+
+ guint8 packet_start_code_prefix_hi;
+ guint8 packet_start_code_prefix_mid;
+ guint8 packet_start_code_prefix_lo;
+
+ guint8 stream_id;
+ guint8 pes_packet_length_hi;
+ guint8 pes_packet_length_lo;
+
+} dvb_pes_hdr_t attr_pack;
+
+/**
+ * Get the PES packet start code prefix
+ *
+ * @param p pointer to dvb_pes_hdr_t.
+ */
+#define DVB_GET_PACKET_START_CODE_PREFIX(p) \
+((((p)->packet_start_code_prefix_hi) << 16) | (((p)->packet_start_code_prefix_mid) << 8) | (p)->packet_start_code_prefix_lo)
+
+/**
+ * Get the PES packet length value
+ *
+ * @param p pointer to dvb_pes_hdr_t.
+ */
+#define DVB_GET_PES_LEN(p) \
+ ((((p)->pes_packet_length_hi) << 8) | ((p)->pes_packet_length_lo))
+
+typedef struct _pes_flags {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+ guint8 original_or_copy :1;
+ guint8 copyright :1;
+ guint8 data_alignment_indicator :1;
+ guint8 pes_priority :1;
+ guint8 pes_scrambling_control :2;
+ guint8 pes_start_code_prefix :2; // must be 0x02 (10b)
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+ guint8 pes_start_code_prefix :2; // must be 0x02 (10b)
+ guint8 pes_scrambling_control :2;
+ guint8 pes_priority :1;
+ guint8 data_alignment_indicator :1;
+ guint8 copyright :1;
+ guint8 original_or_copy :1;
+
+#else
+#error "Please specify the byte order!"
+#endif
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+ guint8 pes_extension_flag :1;
+ guint8 pes_crc_flag :1;
+ guint8 additional_copy_info_flag :1;
+ guint8 dsm_trick_mode_flag :1;
+ guint8 es_rate_flag :1;
+ guint8 escr_flag :1;
+ guint8 pts_dts_flag :2;
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+ guint8 pts_dts_flag :2;
+ guint8 escr_flag :1;
+ guint8 es_rate_flag :1;
+ guint8 dsm_trick_mode_flag :1;
+ guint8 additional_copy_info_flag :1;
+ guint8 pes_crc_flag :1;
+ guint8 pes_extension_flag :1;
+
+#else
+#error "Please specify the byte order!"
+#endif
+
+ guint8 pes_header_data_length :8;
+
+} pes_flags_t attr_pack;
+
+
+
+typedef struct _pts_dts_flag_2 {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+ guint8 marker_bit1 :1;
+ guint8 pts_32_30 :3;
+ guint8 pts_start_code_prefix :4; // must be 0010b
+
+ guint8 pts_29_15_hi :8;
+
+ guint8 marker_bit2 :1;
+ guint8 pts_29_15_lo :7;
+
+ guint8 pts_14_0_hi :8;
+
+ guint8 marker_bit3 :1;
+ guint8 pts_14_0_lo :7;
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+ guint8 pts_start_code_prefix :4; // must be 0010b
+ guint8 pts_32_30 :3;
+ guint8 marker_bit1 :1;
+
+ guint8 pts_29_15_hi :8;
+
+ guint8 pts_29_15_lo :7;
+ guint8 marker_bit2 :1;
+
+ guint8 pts_14_0_hi :8;
+
+ guint8 pts_14_0_lo :7;
+ guint8 marker_bit3 :1;
+
+#else
+#error "Please specify the byte order!"
+#endif
+
+} pts_dts_flag2_t attr_pack;
+
+/**
+ * Get the PTS value.
+ *
+ * @param pt pointer to pts_dts_flag2_t or pts_dts_flag3_t
+ */
+#define DVB_GET_PTS(pt) \
+ ((unsigned long long)(((pt)->pts_32_30 << 30) | ((pt)->pts_29_15_hi << 22) | ((pt)->pts_29_15_lo << 15) | \
+ ((pt)->pts_14_0_hi << 7) | (pt)->pts_14_0_lo))
+
+/**
+ * Get the PTS 29 15 timestamp.
+ *
+ * @param pt pointer to pts_dts_flag2_t.
+ */
+#define DVB_GET_PTS_2915(pt) \
+((((pt)->pts_29_15_hi) << 7) | ((pt)->pts_29_15_lo))
+
+/**
+ * Get the PTS 14 0 timestamp.
+ *
+ * @param pt pointer to pts_dts_flag2_t.
+ */
+#define DVB_GET_PTS_140(pt) \
+((((pt)->pts_14_0_hi) << 7) | ((pt)->pts_14_0_lo))
+
+
+ /**
+ * Set the PTS_2915 value in a pes flag field.
+ *
+ * @param pt pointer to _pts_dts_flag_2.
+ * @param v value
+ */
+#define DVB_SET_PTS_2915(pt, v) \
+do { \
+ (pt)->pts_29_15_lo = ((guint8)(((guint16)(v)) & 0x00FF)); \
+ (pt)->pts_29_15_hi = ((guint8)((((guint16)(v)) & 0xFF00) >> 8)); \
+} while (0)
+
+
+/**
+ * Set the PTS_140 value in a pes flag field.
+ *
+ * @param pt pointer to _pts_dts_flag_2
+ * @param v value
+ */
+#define DVB_SET_PTS_140(pt, v) \
+do { \
+ (pt)->pts_14_0_lo = ((guint8)(((guint16)(v)) & 0x00FF)); \
+ (pt)->pts_14_0_hi = ((guint8)((((guint16)(v)) & 0xFF00) >> 8)); \
+} while (0)
+
+
+typedef struct _pts_dts_flag_3 {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+ guint8 marker_bit1 :1;
+ guint8 pts_32_30 :3;
+ guint8 pts_start_code_prefix :4; // must be 0010b
+
+ guint8 pts_29_15_hi :8;
+
+ guint8 marker_bit2 :1;
+ guint8 pts_29_15_lo :7;
+
+ guint8 pts_14_0_hi :8;
+
+ guint8 marker_bit3 :1;
+ guint8 pts_14_0_lo :7;
+
+ guint8 marker_bit4 :1;
+ guint8 dts_32_30 :3;
+ guint8 dts_start_code_prefix :4; // must be 0001b
+
+ guint8 dts_29_15_hi :8;
+
+ guint8 marker_bit5 :1;
+ guint8 dts_29_15_lo :7;
+
+ guint8 dts_14_0_hi :8;
+
+ guint8 marker_bit6 :1;
+ guint8 dts_14_0_lo :7;
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+ guint8 pts_start_code_prefix :4; // must be 0011b
+ guint8 pts_32_30 :3;
+ guint8 marker_bit1 :1;
+
+ guint8 pts_29_15_hi :8;
+
+ guint8 pts_29_15_lo :7;
+ guint8 marker_bit2 :1;
+
+ guint8 pts_14_0_hi :8;
+
+ guint8 pts_14_0_lo :7;
+ guint8 marker_bit3 :1;
+
+ guint8 dts_start_code_prefix :4; // must be 0001b
+ guint8 dts_32_30 :3;
+ guint8 marker_bit4 :1;
+
+ guint8 dts_29_15_hi :8;
+
+ guint8 dts_29_15_lo :7;
+ guint8 marker_bit5 :1;
+
+ guint8 dts_14_0_hi :8;
+
+ guint8 dts_14_0_lo :7;
+ guint8 marker_bit6 :1;
+
+#else
+#error "Please specify the byte order!"
+#endif
+
+} pts_dts_flag3_t attr_pack;
+
+
+/**
+ * Get the DTS value.
+ *
+ * @param pt pointer to pts_dts_flag3_t
+ */
+#define DVB_GET_DTS(pt) \
+ ((unsigned long long)(((pt)->dts_32_30 << 30) | ((pt)->dts_29_15_hi << 22) | ((pt)->dts_29_15_lo << 15) | \
+ ((pt)->dts_14_0_hi << 7) | (pt)->dts_14_0_lo))
+
+/**
+ * Get the PTS 29 15 timestamp.
+ *
+ * @param pt pointer to pts_dts_flag2_t.
+ */
+#define DVB_GET_DTS_2915(pt) \
+((((pt)->dts_29_15_hi) << 7) | ((pt)->dts_29_15_lo))
+
+/**
+ * Get the PTS 14 0 timestamp.
+ *
+ * @param pt pointer to pts_dts_flag2_t.
+ */
+#define DVB_GET_DTS_140(pt) \
+((((pt)->dts_14_0_hi) << 7) | ((pt)->dts_14_0_lo))
+
+
+typedef struct _escr_flag {
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+ guint8 marker_bit1 :1;
+ guint8 escr_base_29_15_hi :2;
+ guint8 escr_base_32_30 :3;
+ guint8 escr_reserved :2;
+
+ guint8 escr_base_29_15_mid :8;
+
+ guint8 escr_base_14_0_hi :2;
+ guint8 marker_bit2 :1;
+ guint8 escr_base_29_15_lo :5;
+
+ guint8 escr_base_14_0_mid :8;
+
+ guint8 escr_extension_hi :2;
+ guint8 marker_bit3 :1;
+ guint8 escr_base_14_0_lo :5;
+
+ guint8 marker_bit4 :1;
+ guint8 escr_extension_lo :7;
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+ guint8 escr_reserved :2;
+ guint8 escr_base_32_30 :3;
+ guint8 marker_bit1 :1;
+ guint8 escr_base_29_15_hi :2;
+
+ guint8 escr_base_29_15_mid :8;
+
+ guint8 escr_base_29_15_lo :5;
+ guint8 marker_bit2 :1;
+ guint8 escr_base_14_0_hi :2;
+
+ guint8 escr_base_14_0_mid :8;
+
+ guint8 escr_base_14_0_lo :5;
+ guint8 marker_bit3 :1;
+ guint8 escr_extension_hi :2;
+
+ guint8 escr_extension_lo :7;
+ guint8 marker_bit4 :1;
+
+#else
+#error "Please specify the byte order!"
+#endif
+
+} escr_flag_t attr_pack;
+
+#define DVB_GET_ESCR_BASE(e) \
+ ((unsigned long long)(((e)->escr_base_32_30 << 30) | ((e)->escr_base_29_15_hi << 28) | ((e)->escr_base_29_15_mid << 20) | ((e)->escr_base_29_15_lo << 15) | ((e)->escr_base_14_0_hi << 13) | ((e)->escr_base_14_0_mid << 5) | (e)->escr_base_14_0_lo))
+
+#define DVB_GET_ESCR_EXT(e) \
+ ((unsigned short)(((e)->escr_extension_hi << 7) | (e)->escr_extension_lo))
+
+#define DVB_GET_ESCR(e) \
+ ((unsigned long long)((DVB_GET_ESCR_BASE(e) * 300) + DVB_GET_ESCR_EXT(e)))
+
+
+typedef struct _es_rate_flag {
+ // the elementary stream rate is a 22 bit unsigned int in units of 50 bytes/sec
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+ guint8 es_rate_hi :7;
+ guint8 marker_bit1 :1;
+
+ guint8 es_rate_mid :8;
+
+ guint8 marker_bit2 :1;
+ guint8 es_rate_lo :7;
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+ guint8 marker_bit1 :1;
+ guint8 es_rate_hi :7;
+
+ guint8 es_rate_mid :8;
+
+ guint8 es_rate_lo :7;
+ guint8 marker_bit2 :1;
+
+#else
+#error "Please specify the byte order!"
+#endif
+
+} es_rate_flag_t attr_pack;
+
+#define DVB_GET_ES_RATE(e) \
+ ((unsigned long)(((e)->es_rate_hi << 15) | ((e)->es_rate_mid << 7) | (e)->es_rate_lo))
+
+typedef struct _dsm_trick_mode_flag {
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+ union _mode {
+ struct _fast_forward {
+ guint8 frequency_truncation :2;
+ guint8 intra_slice_refresh :1;
+ guint8 field_id :2;
+ } fast_forward;
+
+ struct _slow_motion {
+ guint8 rep_cntrl :5;
+ } slow_motion;
+
+ struct _freeze_frame {
+ guint8 reserved :3;
+ guint8 field_id :2;
+ } freeze_frame;
+
+ struct _fast_reverse {
+ guint8 frequency_truncation :2;
+ guint8 intra_slice_refresh :1;
+ guint8 field_id :2;
+ } fast_reverse;
+
+ struct _slow_reverse {
+ guint8 rep_cntrl :5;
+ } slow_reverse;
+ } mode;
+ guint8 trick_mode_control :3;
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+ guint8 trick_mode_control :3;
+ union _mode {
+ struct _fast_forward {
+ guint8 field_id :2;
+ guint8 intra_slice_refresh :1;
+ guint8 frequency_truncation :2;
+ } fast_forward;
+
+ struct _slow_motion {
+ uint rep_cntrl :5;
+ } slow_motion;
+
+ struct _freeze_frame {
+ guint8 field_id :2;
+ guint8 reserved :3;
+ } freeze_frame;
+
+ struct _fast_reverse {
+ guint8 field_id :2;
+ guint8 intra_slice_refresh :1;
+ guint8 frequency_truncation :2;
+ } fast_reverse;
+
+ struct _slow_reverse {
+ guint8 rep_cntrl :5;
+ } slow_reverse;
+ } mode;
+
+#else
+#error "Please specify the byte order!"
+#endif
+
+} dsm_trick_mode_flag_t attr_pack;
+
+#define TRICK_MODE_FFWD 0x0 // fast forward
+#define TRICK_MODE_SLMOT 0x1 // slow motion
+#define TRICK_MODE_FRZFR 0x2 // freeze frame
+#define TRICK_MODE_FREV 0x3 // fast reverse
+#define TRICK_MODE_SLREV 0x4 // slow reverse
+
+
+typedef struct _additional_copy_info_flag {
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+ guint8 additional_copy_info : 7;
+ guint8 marker_bit : 1;
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+ guint8 marker_bit : 1;
+ guint8 additional_copy_info : 7;
+
+#else
+#error "Please specify the byte order!"
+#endif
+
+} additional_copy_info_flag_t attr_pack;
+
+
+typedef struct _pes_crc_flag {
+
+ guint8 previous_pes_packet_crc_hi :8;
+ guint8 previous_pes_packet_crc_lo :8;
+
+} pes_crc_flag_t attr_pack;
+
+#define DVB_GET_PES_CRC(c) \
+ (((c)->previous_pes_packet_crc_hi << 8) | (c)->previous_pes_packet_crc_lo)
+
+
+typedef struct _pes_extension_flag {
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+ guint8 pes_extension_flag2 :1;
+ guint8 reserved0 :3;
+ guint8 pstd_buffer_flag :1;
+ guint8 program_packet_sequence_counter_flag :1;
+ guint8 pack_header_field_flag :1;
+ guint8 pes_private_data_flag :1;
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+ guint8 pes_private_data_flag :1;
+ guint8 pack_header_field_flag :1;
+ guint8 program_packet_sequence_counter_flag :1;
+ guint8 pstd_buffer_flag :1;
+ guint8 reserved0 :3;
+ guint8 pes_extension_flag2 :1;
+
+#else
+#error "Please specify the byte order!"
+#endif
+
+} pes_extension_flag_t attr_pack;
+
+
+// if pes_private_data_flag == 1
+// guint8 pes_private_data[16]
+
+
+// if pes_pack_header_field_flag == 1
+//
+typedef struct _pes_pack_hdr_field_flag {
+
+ guint8 pack_field_length;
+ // guint8 pack_header[pack_field_length];
+
+} pes_pack_hdr_field_flag_t attr_pack;
+
+
+// if program_packet_sequence_counter_flag == 1
+//
+typedef struct _program_packet_sequence_counter_flag {
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+
+ guint8 program_packet_squence_counter :7;
+ guint8 marker_bit1 :1;
+
+ guint8 original_stuff_length :6;
+ guint8 mpeg1_mpeg2_identifier :1;
+ guint8 marker_bit2 :1;
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+ guint8 marker_bit1 :1;
+ guint8 program_packet_squence_counter :7;
+
+ guint8 marker_bit2 :1;
+ guint8 mpeg1_mpeg2_identifier :1;
+ guint8 original_stuff_length :6;
+
+#else
+#error "Please specify the byte order!"
+#endif
+
+} program_packet_sequence_counter_flag_t attr_pack;
+
+
+// if psdt_buffer_flag == 1
+//
+typedef struct _pstd_buffer_flag {
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+ guint8 pstd_buffer_size_hi :5;
+ guint8 pstd_buffer_scale :1;
+ guint8 reserved0 :2; // must be 01b
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+ guint8 reserved0 :2; // must be 01b
+ guint8 pstd_buffer_scale :1;
+ guint8 pstd_buffer_size_hi :5;
+
+#else
+#error "Please specify the byte order!"
+#endif
+
+ guint8 pstd_buffer_size_lo :8;
+
+} pstd_buffer_flag_t attr_pack;
+
+#define GET_PSTD_BUFFER_SIZE(p) (((p)->pstd_buffer_size_hi << 8) | (p)->pstd_buffer_size_lo)
+
+
+// if pes_extension_flag2 == 1
+//
+typedef struct _pes_extension_flag2 {
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+ guint8 pes_extension_field_length :7;
+ guint8 marker_bit :1;
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+ guint8 marker_bit :1;
+ guint8 pes_extension_field_length :7;
+
+#else
+#error "Please specify the byte order!"
+#endif
+
+ // guint8 pes_extension_field_data[pes_extension_field_length];
+
+} pes_extension_flag2_t attr_pack;
+#ifdef _WIN32
+#pragma pack(pop,p,1)
+#endif
+
+#define STREAM_PROGRAM_END 0xB9 // PS END: 000001B9
+#define STREAM_PACK 0xBA
+#define STREAM_SYS_HDR 0xBB
+#define STREAM_PROGRAM_MAP 0xBC
+#define STREAM_PRIVATE_1 0xBD
+#define STREAM_PADDING 0xBE
+#define STREAM_PRIVATE_2 0xBF
+#define STREAM_AUDIO_START 0xC0 // C0..DF: 110X XXXX
+#define STREAM_AUDIO_END 0xDF
+#define STREAM_VIDEO_START 0xE0 // E0..EF: 1110 XXXX
+#define STREAM_VIDEO_END 0xEF
+#define STREAM_ECM 0xF0
+#define STREAM_EMM 0xF1
+#define STREAM_DSMCC 0xF2
+#define STREAM_ITU_A 0xF4
+#define STREAM_ITU_B 0xF5
+#define STREAM_ITU_C 0xF6
+#define STREAM_ITU_D 0xF7
+#define STREAM_ITU_E 0xF8
+#define STREAM_ANCILLARY 0xF9
+#define STREAM_RESERVED_START 0xFA
+#define STREAM_RESERVED_END 0xFE
+#define STREAM_PROGRAM_DIR 0xFF
+
+#define STREAM_AUDIO_MASK 0xE0
+#define STREAM_AUDIO_NR 0xC0
+#define STREAM_VIDEO_MASK 0xF0
+#define STREAM_VIDEO_NR 0xE0
+
+
+#endif /* __DVB_PES_HDR_H__ */
diff -ruN ethereal-0.10.7/dvb_incs/ps_hdr.h ethereal-0.10.7_mpeg2_recent/dvb_incs/ps_hdr.h
--- ethereal-0.10.7/dvb_incs/ps_hdr.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/dvb_incs/ps_hdr.h 2004-12-02 16:14:18.498860834 +0100
@@ -0,0 +1,289 @@
+/* avpes_hdr.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING <wolfi@xxxxxxxxxxxxxx>
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __DVB_PS_HDR_H__
+#define __DVB_PS_HDR_H__
+
+#include "dvb_types.h"
+
+/*
+ * MPEG2 program stream, as defined by ISO-13818-1 (H.222.0), table 2-31:
+ *
+ * MPEG2_program_stream() {
+ * do {
+ * pack()
+ * } while (nextbits() == pack_start_code)
+ * MPEG_program_end_code
+ * }
+ *
+ *
+ * Program stream pack (table 2-32):
+ *
+ * pack() {
+ * pack_header()
+ * while (nextbits() == packet_start_code_prefix) {
+ * PES_packet()
+ * }
+ * }
+ */
+
+#define MPEG_PROGRAM_END_CODE 0x000001B9
+
+/*
+ * Generic program stream (PES, PACK) header:
+ * Use stream_id to find out what you've actually got.
+ */
+typedef struct _dvb_ps_hdr {
+ guint8 start_code_1;
+ guint8 start_code_2;
+ guint8 start_code_3;
+ guint8 stream_id;
+} dvb_ps_hdr_t;
+
+#define GET_PS_START_CODE(p) \
+ (((p)->start_code_1 << 16) | ((p)->start_code_2 << 8) | (p)->start_code_3)
+
+#ifdef __GNUC__
+#define attr_pack __attribute__((packed))
+#elif defined(_WIN32)
+#define attr_pack
+#pragma pack(push,p,1)
+#else
+#error "Compiler not supported"
+#endif
+typedef struct _dvb_pack_hdr {
+
+ guint8 pack_start_code_1;
+ guint8 pack_start_code_2;
+ guint8 pack_start_code_3;
+ guint8 pack_start_code_4;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+ guint8 system_clock_reference_base_2915_1 :2;
+ guint8 marker_bit0 :1; // 1b
+ guint8 system_clock_reference_base_3230 :3;
+ guint8 reserved0 :2; // 01b
+
+ guint8 system_clock_reference_base_2915_2;
+
+ guint8 system_clock_reference_base_140_1 :2;
+ guint8 marker_bit1 :1; // 1b
+ guint8 system_clock_reference_base_2915_3 :5;
+
+ guint8 system_clock_reference_base_140_2;
+
+ guint8 system_clock_reference_extension_1 :2;
+ guint8 marker_bit2 :1; // 1b
+ guint8 system_clock_reference_base_140_3 :5;
+
+ guint8 marker_bit3 :1; // 1b
+ guint8 system_clock_reference_extension_2 :7;
+
+ guint8 program_mux_rate_1; // measured in 50 B/s
+ guint8 program_mux_rate_2;
+
+ guint8 marker_bit5 :1; // 1b
+ guint8 marker_bit4 :1; // 1b
+ guint8 program_mux_rate_3 :6;
+
+ guint8 pack_stuffing_length :3;
+ guint8 reserved1 :5;
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+ guint8 reserved0 :2; // 01b
+ guint8 system_clock_reference_base_3230 :3;
+ guint8 marker_bit0 :1; // 1b
+ guint8 system_clock_reference_base_2915_1 :2;
+
+ guint8 system_clock_reference_base_2915_2;
+
+ guint8 system_clock_reference_base_2915_3 :5;
+ guint8 marker_bit1 :1; // 1b
+ guint8 system_clock_reference_base_140_1 :2;
+
+ guint8 system_clock_reference_base_140_2;
+
+ guint8 system_clock_reference_base_140_3 :5;
+ guint8 marker_bit2 :1; // 1b
+ guint8 system_clock_reference_extension_1 :2;
+
+ guint8 system_clock_reference_extension_2 :7;
+ guint8 marker_bit3 :1; // 1b
+
+ guint8 program_mux_rate_1; // measured in 50 B/s
+ guint8 program_mux_rate_2;
+
+ guint8 program_mux_rate_3 :6;
+ guint8 marker_bit4 :1; // 1b
+ guint8 marker_bit5 :1; // 1b
+
+ guint8 reserved1 :5;
+ guint8 pack_stuffing_length :3;
+
+#else
+#error "Please specify the byte order!"
+#endif
+
+ // guint8 pack_stuffing_byte[pack_stuffing_length]; // all bytes 0xFF
+
+} dvb_pack_hdr_t attr_pack;
+
+#define PACK_START_CODE 0x000001BA
+
+#define GET_PACK_START_CODE(p) \
+ (((p)->pack_start_code_1 << 24) | ((p)->pack_start_code_2 << 16) | ((p)->pack_start_code_3 << 8) | (p)->pack_start_code_4)
+
+#define GET_PACK_SCR_BASE(p) \
+ ((unsigned long long)(((p)->system_clock_reference_base_3230 << 30) | ((p)->system_clock_reference_base_2915_1 << 28) | \
+ ((p)->system_clock_reference_base_2915_2 << 20) | ((p)->system_clock_reference_base_2915_3 << 15) | \
+ ((p)->system_clock_reference_base_140_1 << 13) | ((p)->system_clock_reference_base_140_2 << 5) | \
+ (p)->system_clock_reference_base_140_3))
+
+#define GET_PACK_SCR_EXT(p) \
+ ((unsigned short)(((p)->system_clock_reference_extension_1 << 7) | (p)->system_clock_reference_extension_2))
+
+#define GET_PACK_SCR(p) \
+ ((unsigned long long)((GET_PACK_SCR_BASE(p) * 300) + GET_PACK_SCR_EXT(p)))
+
+#define GET_PACK_PROGRAM_MUX_RATE(p) \
+ ((unsigned long)(((p)->program_mux_rate_1 << 14) | ((p)->program_mux_rate_2 << 6) | (p)->program_mux_rate_3))
+
+
+typedef struct _dvb_ps_system_hdr {
+
+ guint8 system_header_start_code_1;
+ guint8 system_header_start_code_2;
+ guint8 system_header_start_code_3;
+ guint8 system_header_start_code_4;
+
+ guint8 system_header_length_1;
+ guint8 system_header_length_2;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+ guint8 rate_bound_1 :7;
+ guint8 marker_bit1 :1; // 1b
+
+ guint8 rate_bound_2;
+
+ guint8 marker_bit2 :1; // 1b
+ guint8 rate_bound_3 :7;
+
+ guint8 CSPS_flag :1;
+ guint8 fixed_flag :1;
+ guint8 audio_bound :6;
+
+ guint8 video_bound :5;
+ guint8 marker_bit3 :1; // 1b
+ guint8 system_video_lock_flag :1;
+ guint8 system_audio_lock_flag :1;
+
+ guint8 reserved_bits :7; // 111 1111b
+ guint8 packet_rate_restriction_flag :1;
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+ guint8 marker_bit1 :1; // 1b
+ guint8 rate_bound_1 :7;
+
+ guint8 rate_bound_2;
+
+ guint8 rate_bound_3 :7;
+ guint8 marker_bit2 :1; // 1b
+
+ guint8 audio_bound :6;
+ guint8 fixed_flag :1;
+ guint8 CSPS_flag :1;
+
+ guint8 system_audio_lock_flag :1;
+ guint8 system_video_lock_flag :1;
+ guint8 marker_bit3 :1; // 1b
+ guint8 video_bound :5;
+
+ guint8 packet_rate_restriction_flag :1;
+ guint8 reserved_bits :7; // 111 1111b
+
+#else
+#error "Please specify the byte order!"
+#endif
+
+ /*
+ * while (nextbits() == '1') {
+ * streadm_id :8
+ * '11'
+ * P-STD_buffer_bound_scale :1
+ * P-STD_buffer_size_bound :13
+ * }
+ */
+
+} dvb_ps_system_hdr_t attr_pack;
+
+#define SYSTEM_HEADER_STREAM_ID 0xBB
+#define SYSTEM_HEADER_START_CODE 0x000001BB
+
+#define GET_SYS_HDR_START_CODE(p) \
+ (((p)->system_header_start_code_1 << 24) | ((p)->system_header_start_code_2 << 16) | \
+ ((p)->system_header_start_code_3 << 8) | (p)->system_header_start_code_4)
+
+#define GET_SYS_HDR_LEN(p) \
+ (((p)->system_header_length_1 << 8) | (p)->system_header_length_2)
+
+#define GET_SYS_HDR_RATE_BOUND(p) \
+ ((unsigned long)(((p)->rate_bound_1 << 15) | ((p)->rate_bound_2 << 7) | (p)->rate_bound_3))
+
+
+typedef struct _dvb_system_hdr_2 {
+
+ guint8 stream_id;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+ guint8 PSTD_buffer_size_bound_1 :5;
+ guint8 PSTD_buffer_bound_scale :1;
+ guint8 reserved1 :2; // 11b
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+ guint8 reserved1 :2; // 11b
+ guint8 PSTD_buffer_bound_scale :1;
+ guint8 PSTD_buffer_size_bound_1 :5;
+
+#else
+#error "Please specify the byte order!"
+#endif
+
+ guint8 PSTD_buffer_size_bound_2;
+
+} dvb_system_hdr_2_t attr_pack;
+#ifdef _WIN32
+#pragma pack(pop,p,1)
+#endif
+
+#define GET_SYS_HDR_PSTD_BUF_SIZE_BOUND(p) \
+ (((p)->PSTD_buffer_size_bound_1 << 8) | (p)->PSTD_buffer_size_bound_2)
+
+#endif /* __DVB_PS_HDR_H__ */
diff -ruN ethereal-0.10.7/dvb_incs/sect_cat.h ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_cat.h
--- ethereal-0.10.7/dvb_incs/sect_cat.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_cat.h 2004-12-02 16:14:18.547853462 +0100
@@ -0,0 +1,53 @@
+/* sect_cat.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING <wolfi@xxxxxxxxxxxxxx>
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __SECT_CAT_H__
+#define __SECT_CAT_H__
+
+#include <glib.h>
+#include "sect_gen.h"
+
+#ifdef __GNUC__
+#define attr_pack __attribute__((packed))
+#elif defined(_WIN32)
+#define attr_pack
+#pragma pack(push,p,1)
+#else
+#error "Complier not supported"
+#endif
+typedef struct _dvb_sect_cat {
+
+ dvb_sect_gen_t gen_hdr;
+
+ // descriptor[N];
+
+ // dvb_CRC32_t;
+
+} dvb_sect_cat_t attr_pack;
+#ifdef _WIN32
+#pragma pack(pop,p,1)
+#endif
+
+#endif /* __SECT_CAT_H__ */
diff -ruN ethereal-0.10.7/dvb_incs/sect_eit.h ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_eit.h
--- ethereal-0.10.7/dvb_incs/sect_eit.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_eit.h 2004-12-02 16:14:18.549853161 +0100
@@ -0,0 +1,149 @@
+/* sect_eit.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING <wolfi@xxxxxxxxxxxxxx>
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#ifndef __SECT_EIT_H__
+#define __SECT_EIT_H__
+
+#include <glib.h>
+#include "sect_gen.h"
+
+#ifdef __GNUC__
+#define attr_pack __attribute__((packed))
+#elif defined(_WIN32)
+#define attr_pack
+#pragma pack(push,p,1)
+#else
+#error "Compiler not supported"
+#endif
+typedef struct _dvb_sect_eit {
+
+ dvb_sect_gen_t gen_hdr;
+
+ guint8 transport_stream_id_hi;
+ guint8 transport_stream_id_lo;
+ guint8 original_network_id_hi;
+ guint8 original_network_id_lo;
+
+ guint8 segment_last_section_number;
+ guint8 last_table_id;
+
+ // dvb_sect_eit_entry_t[N];
+
+ // dvb_CRC32_t;
+
+} dvb_sect_eit_t attr_pack;
+
+
+#define DVB_GET_EIT_TS_ID(t) \
+ (((t)->transport_stream_id_hi << 8) | (t)->transport_stream_id_lo)
+
+#define DVB_SET_EIT_TS_ID(t,i) \
+do { \
+ (t)->transport_stream_id_hi = (((guint16)(i)) & 0xFF00) >> 8; \
+ (t)->transport_stream_id_lo = (((guint16)(i)) & 0x00FF); \
+} while (0)
+
+#define DVB_GET_EIT_ONET_ID(t) \
+ (((t)->original_network_id_hi << 8) | (t)->original_network_id_lo)
+
+#define DVB_SET_EIT_ONET_ID(t,i) \
+do { \
+ (t)->original_network_id_hi = (((guint16)(i)) & 0xFF00) >> 8; \
+ (t)->original_network_id_lo = (((guint16)(i)) & 0x00FF); \
+} while (0)
+
+
+typedef struct _dvb_sect_eit_entry {
+
+ guint8 event_id_hi;
+ guint8 event_id_lo;
+
+ guint8 start_time_0;
+ guint8 start_time_1;
+ guint8 start_time_2;
+ guint8 start_time_3;
+ guint8 start_time_4;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 descriptor_loop_length_hi :4;
+ guint8 free_CA_mode :1;
+ guint8 running_status :3;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 running_status :3;
+ guint8 free_CA_mode :1;
+ guint8 descriptor_loop_length_hi :4;
+#else
+#error "Please specify the byte order!"
+#endif
+
+ guint8 descriptor_loop_length_lo;
+
+ // descriptor[N]
+
+} dvb_sect_eit_entry_t attr_pack;
+#ifdef _WIN32
+#pragma pack(pop,p,1)
+#endif
+
+#define DVB_GET_EIT_EVENT_ID(t) \
+ (((t)->event_id_hi << 8) | (t)->event_id_lo)
+
+#define DVB_SET_EIT_EVENT_ID(t,i) \
+do { \
+ (t)->event_id_hi = (((guint16)(i)) & 0xFF00) >> 8; \
+ (t)->event_id_lo = (((guint16)(i)) & 0x00FF); \
+} while (0)
+
+
+#define DVB_GET_EIT_START_MJD( t ) \
+ (((t)->start_time_0 << 8) | (t)->start_time_1)
+
+#define DVB_SET_EIT_START_MJD( t, s ) \
+do { \
+ (t)->start_time_0 = (((guint16)(s)) & 0xFF00) >> 8; \
+ (t)->start_time_1 = (((guint16)(s)) & 0x00FF); \
+} while (0)
+
+#define DVB_GET_EIT_START_UTC( t ) \
+ (((t)->start_time_2 << 16) | ((t)->start_time_3 << 8) || (t)->start_time_4)
+
+#define DVB_SET_EIT_START_UTC( t, s ) \
+do { \
+ (t)->start_time_2 = (((guint32)(s)) & 0x00FF0000) >> 16; \
+ (t)->start_time_3 = (((guint32)(s)) & 0x0000FF00) >> 8; \
+ (t)->start_time_4 = (((guint32)(s)) & 0x000000FF); \
+} while (0)
+
+
+#define DVB_GET_EIT_DL_LEN(t) \
+ (((t)->descriptor_loop_length_hi << 8) | (t)->descriptor_loop_length_lo)
+
+#define DVB_SET_EIT_DL_LEN(t,i) \
+do { \
+ (t)->descriptor_loop_length_hi = (((guint16)(i)) & 0x0F00) >> 8; \
+ (t)->descriptor_loop_length_lo = (((guint16)(i)) & 0x00FF); \
+} while (0)
+
+
+#endif /* __SECT_EIT_H__ */
diff -ruN ethereal-0.10.7/dvb_incs/sect_gen.h ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_gen.h
--- ethereal-0.10.7/dvb_incs/sect_gen.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_gen.h 2004-12-02 16:14:18.590846993 +0100
@@ -0,0 +1,180 @@
+/* sect_gen.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING <wolfi@xxxxxxxxxxxxxx>
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <glib.h>
+
+#ifndef __SECT_GEN_H__
+#define __SECT_GEN_H__
+
+#ifdef __GNUC__
+#define attr_pack __attribute__((packed))
+#elif defined(_WIN32)
+#define attr_pack
+#pragma pack(push,p,1)
+#else
+#error "Compiler not supported"
+#endif
+typedef struct _dvb_sect_gen {
+
+ guint8 table_id;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 section_length_hi :4;
+ guint8 reserved0 :2;
+ guint8 private_indicator :1;
+ guint8 section_syntax_indicator :1;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 section_syntax_indicator :1;
+ guint8 private_indicator :1; // always 0
+ guint8 reserved0 :2;
+ guint8 section_length_hi :4;
+#else
+#error "Please specify the byte order!"
+#endif
+
+ guint8 section_length_lo;
+
+ guint8 id_hi; // Meaning depends on specific table type
+ guint8 id_lo;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 current_next_indicator :1;
+ guint8 version_number :5;
+ guint8 reserved1 :2;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 reserved1 :2;
+ guint8 version_number :5;
+ guint8 current_next_indicator :1;
+#else
+#error "Please specify the byte order!"
+#endif
+
+ guint8 section_number;
+ guint8 last_section_number;
+
+} dvb_sect_gen_t attr_pack;
+#ifdef _WIN32
+#pragma pack(pop,p,1)
+#endif
+typedef guint32 dvb_CRC32_t;
+
+
+/**
+ * @param ps pointer to dvb_gen_secthdr_t.
+ */
+#define DVB_GET_SECTION_LENGTH(ps) \
+ ((((ps)->section_length_hi) << 8) | (ps)->section_length_lo)
+
+/**
+ * @param ps pointer to dvb_gen_secthdr_t.
+ * @param l length to set in section header.
+ */
+#define DVB_SET_SECTION_LENGTH(ps,l) \
+do { \
+ (ps)->section_length_lo = ((guint8)(((uint16)(l)) & 0x00FF)); \
+ (ps)->section_length_hi = ((guint8)((((uint16)(l)) & 0x0F00) >> 8)); \
+} while (0)
+
+/**
+ * @param ps pointer to dvb_gen_secthdr_t.
+ */
+#define DVB_GET_SECTION_ID(ps) \
+ (((ps)->id_hi << 8) | (ps)->id_lo)
+
+/**
+ * @param ps pointer to dvb_gen_secthdr_t.
+ * @param id id to set in section header.
+ */
+#define DVB_SET_SECTION_ID(ps,id) \
+do { \
+ (ps)->id_lo = ((guint8)(((uint16)(id)) & 0x00FF)); \
+ (ps)->id_hi = ((guint8)((((uint16)(id)) & 0xFF00) >> 8)); \
+} while (0)
+
+
+/**
+ * Table ID's
+ */
+#define DVB_TABLE_ID_PAT 0x00
+#define DVB_TABLE_ID_CAT 0x01
+#define DVB_TABLE_ID_PMT 0x02
+#define DVB_TABLE_ID_TSDT 0x03
+/* 0x04 - 0x39 reserved */
+#define DVB_TABLE_ID_DSMCC_MPE 0x3A
+#define DVB_TABLE_ID_DSMCC_UN 0x3B
+#define DVB_TABLE_ID_DSMCC_DDB 0x3C
+#define DVB_TABLE_ID_DSMCC_SD 0x3D
+#define DVB_TABLE_ID_DSMCC_PRIV 0x3E
+/* 0x3F ISO/IEC 13818-6 reserved */
+#define DVB_TABLE_ID_NIT_ACT 0x40
+#define DVB_TABLE_ID_NIT_OTH 0x41
+#define DVB_TABLE_ID_SDT_ACT 0x42
+/* 0x43 - 0x45 reserved */
+#define DVB_TABLE_ID_SDT_OTH 0x46
+/* 0x43 - 0x49 reserved */
+#define DVB_TABLE_ID_BAT 0x4A
+/* 0x4B - 0x4D reserved */
+#define DVB_TABLE_ID_EIT_ACT_PF 0x4E
+#define DVB_TABLE_ID_EIT_OTH_PF 0x4F
+/* 0x50 - 0x5F EIT_ACT_SCHEDULE */
+/* 0x60 - 0x6F EIT_OTH_SCHEDULE */
+#define DVB_TABLE_ID_TDT 0x70
+#define DVB_TABLE_ID_RST 0x71
+#define DVB_TABLE_ID_ST 0x72
+#define DVB_TABLE_ID_TOT 0x73
+#define DVB_TABLE_ID_AIT 0x74
+/* 0x75 - 0x7D reserved */
+#define DVB_TABLE_ID_DIT 0x7E
+#define DVB_TABLE_ID_SIT 0x7F
+/* User-Defined: SkyPlex Signalling Channel: */
+#define DVB_TABLE_ID_SSC 0x80
+/* User-Defined: EMBRACE Ethernet in Sections: */
+#define DVB_TABLE_ID_ETH 0x88
+/* 0x80 - 0xFE user defined */
+/* 0xFF reserved */
+
+
+/**
+ * Table PIDs
+ */
+#define DVB_TABLE_PID_PAT 0x0000
+#define DVB_TABLE_PID_NIT 0x0010
+#define DVB_TABLE_PID_SDT 0x0011
+#define DVB_TABLE_PID_TDT 0x0014
+#define DVB_TABLE_PID_EIT_ACT_PF 0x0012
+
+
+/**
+ * Recommended table refresh interval (in milliseconds)
+ */
+#define DVB_TABLE_INTV_PAT 400
+#define DVB_TABLE_INTV_PMT 400
+#define DVB_TABLE_INTV_NIT 9900
+#define DVB_TABLE_INTV_SDT_ACT 1900
+#define DVB_TABLE_INTV_TDT 29900
+#define DVB_TABLE_INTV_EIT_ACT_PF 1900
+
+
+#endif /* __SECT_GEN_H__ */
diff -ruN ethereal-0.10.7/dvb_incs/sect_mpe.h ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_mpe.h
--- ethereal-0.10.7/dvb_incs/sect_mpe.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_mpe.h 2004-12-02 16:14:18.591846843 +0100
@@ -0,0 +1,111 @@
+/* sect_mpe.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING <wolfi@xxxxxxxxxxxxxx>
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __SECT_MPE_H__
+#define __SECT_MPE_H__
+
+#include <glib.h>
+
+/*
+ * datagramm_section as defined in
+ * ETSI EN 301 192 V1.2.1 (1999-06), table 3.
+ */
+#ifdef __GNUC__
+#define attr_pack __attribute__((packed))
+#elif defined(_WIN32)
+#define attr_pack
+#pragma pack(push,p,1)
+#else
+#error "Complier not supported"
+#endif
+typedef struct _dvb_sect_mpe3e {
+
+ guint8 table_id;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 section_length_hi :4;
+ guint8 reserved0 :2;
+ guint8 private_indicator :1;
+ guint8 section_syntax_indicator :1;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 section_syntax_indicator :1;
+ guint8 private_indicator :1;
+ guint8 reserved0 :2;
+ guint8 section_length_hi :4;
+#else
+#error "Please specify the byte order!"
+#endif
+
+ guint8 section_length_lo;
+
+ guchar MAC_hi[2];
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 current_next_indicator :1;
+ guint8 LLC_SNAP_flag :1;
+ guint8 address_scrambling_control :2;
+ guint8 payload_scrambling_control :2;
+ guint8 reserved1 :2;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 reserved1 :2;
+ guint8 payload_scrambling_control :2;
+ guint8 address_scrambling_control :2;
+ guint8 LLC_SNAP_flag :1;
+ guint8 current_next_indicator :1;
+#else
+#error "Please specify the byte order!"
+#endif
+
+ guint8 section_number;
+ guint8 last_section_number;
+
+ guchar MAC_lo[4];
+
+ // if (LLC_SNAP_flag == 1)
+ // LLC_SNAP()
+ // else
+ // IP datagram byte[N1]
+
+ // if (section_number == last_section_number)
+ // stuffing_byte[N2]
+
+ // if (section_syntax_indicator == '0')
+ // checksum
+ // else
+ // CRC_32
+
+} dvb_sect_mpe3e_t attr_pack;
+#ifdef _WIN32
+#pragma pack(pop,p,1)
+#endif
+
+
+/**
+ * @param ps pointer to dvb_gen_secthdr_t.
+ */
+#define DVB_GET_SECTION_LENGTH(ps) \
+ ((((ps)->section_length_hi) << 8) | (ps)->section_length_lo)
+
+#endif /* __SECT_MPE_H__ */
diff -ruN ethereal-0.10.7/dvb_incs/sect_nit.h ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_nit.h
--- ethereal-0.10.7/dvb_incs/sect_nit.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_nit.h 2004-12-02 16:14:18.656837064 +0100
@@ -0,0 +1,160 @@
+/* sect_nit.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING <wolfi@xxxxxxxxxxxxxx>
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#ifndef __SECT_NIT_H__
+#define __SECT_NIT_H__
+
+#include <glib.h>
+#include "sect_gen.h"
+
+#ifdef __GNUC__
+#define attr_pack __attribute__((packed))
+#elif defined(_WIN32)
+#define attr_pack
+#pragma pack(push,p,1)
+#else
+#error "Complier not supported"
+#endif
+typedef struct _dvb_sect_nit {
+
+ dvb_sect_gen_t gen_hdr attr_pack;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 network_descriptors_length_hi :4;
+ guint8 reserved_future_use :4;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 reserved_future_use :4;
+ guint8 network_descriptors_length_hi :4;
+#else
+#error "Please specify the byte order!"
+#endif
+
+ guint8 network_descriptors_length_lo;
+
+ // netowrk descriptor[N]
+
+ // reserved
+ // > dvb_sect_nit_ext_t (see below)
+ // loop_length
+
+ // TS descriptors[N1]
+
+ // dvb_CRC32_t;
+
+} dvb_sect_nit_t attr_pack;
+
+
+#define DVB_GET_NIT_NETDESC_LEN(p) \
+ (((p)->network_descriptors_length_hi << 8) | (p)->network_descriptors_length_lo)
+
+#define DVB_SET_NIT_NETDESC_LEN(p,l) \
+do { \
+ (p)->network_descriptors_length_lo = ((guint8)(((guint16)(l)) & 0x00FF)); \
+ (p)->network_descriptors_length_hi = ((guint8)((((guint16)(l)) & 0x0F00) >> 8)); \
+} while (0)
+
+
+typedef struct _dvb_sect_nit_ext {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 transport_stream_loop_length_hi :4;
+ guint8 reserved_future_use :4;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 reserved_future_use :4;
+ guint8 transport_stream_loop_length_hi :4;
+#else
+#error "Please specify the byte order!"
+#endif
+
+ guint8 transport_stream_loop_length_lo;
+
+} dvb_sect_nit_ext_t attr_pack;
+
+
+#define DVB_GET_NIT_TSL_LEN(p) \
+ (((p)->transport_stream_loop_length_hi << 8) | (p)->transport_stream_loop_length_lo)
+
+#define DVB_SET_NIT_TSL_LEN(p,l) \
+do { \
+ (p)->transport_stream_loop_length_lo = ((guint8)(((guint16)(l)) & 0x00FF)); \
+ (p)->transport_stream_loop_length_hi = ((guint8)((((guint16)(l)) & 0x0F00) >> 8)); \
+} while (0)
+
+
+
+typedef struct _dvb_sect_nit_entry {
+
+ guint8 transport_stream_id_hi;
+ guint8 transport_stream_id_lo;
+
+ guint8 original_network_id_hi;
+ guint8 original_network_id_lo;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 transport_descriptors_length_hi :4;
+ guint8 reserved_future_use :4;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 reserved_future_use :4;
+ guint8 transport_descriptors_length_hi :4;
+#else
+#error "Please specify the byte order!"
+#endif
+ guint8 transport_descriptors_length_lo;
+
+} dvb_sect_nit_entry_t attr_pack;
+#ifdef _WIN32
+#pragma pack(pop,p,1)
+#endif
+
+#define DVB_GET_NIT_TS_ID(p) \
+ ((((p)->transport_stream_id_hi) << 8) | (p)->transport_stream_id_lo)
+
+#define DVB_SET_NIT_TS_ID(p,i) \
+do { \
+ (p)->transport_stream_id_hi = (((guint16)(i)) & 0xFF00) >> 8; \
+ (p)->transport_stream_id_lo = (((guint16)(i)) & 0x00FF); \
+} while (0)
+
+
+#define DVB_GET_NIT_ONET_ID(p) \
+ ((((p)->original_network_id_hi) << 8) | (p)->original_network_id_lo)
+
+#define DVB_SET_NIT_ONET_ID(p,i) \
+do { \
+ (p)->original_network_id_hi = (((guint16)(i)) & 0xFF00) >> 8; \
+ (p)->original_network_id_lo = (((guint16)(i)) & 0x00FF); \
+} while (0)
+
+
+#define DVB_GET_NIT_TSDESC_LEN(p) \
+ (((p)->transport_descriptors_length_hi << 8) | (p)->transport_descriptors_length_lo)
+
+#define DVB_SET_NIT_TSDESC_LEN(p,l) \
+do { \
+ (p)->transport_descriptors_length_lo = ((guint8)(((guint16)(l)) & 0x00FF)); \
+ (p)->transport_descriptors_length_hi = ((guint8)((((guint16)(l)) & 0x0F00) >> 8)); \
+} while (0)
+
+
+
+#endif /* __SECT_PMT_H__ */
diff -ruN ethereal-0.10.7/dvb_incs/sect_pat.h ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_pat.h
--- ethereal-0.10.7/dvb_incs/sect_pat.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_pat.h 2004-12-02 16:14:18.658836763 +0100
@@ -0,0 +1,129 @@
+/* sect_pat.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING <wolfi@xxxxxxxxxxxxxx>
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#ifndef __SECT_PAT_H__
+#define __SECT_PAT_H__
+
+#include <glib.h>
+#include "sect_gen.h"
+
+#ifdef __GNUC__
+#define attr_pack __attribute__((packed))
+#elif defined(_WIN32)
+#define attr_pack
+#pragma pack(push,p,1)
+#else
+#error "Complier not supported"
+#endif
+typedef struct _dvb_sect_pat {
+
+ dvb_sect_gen_t gen_hdr;
+
+ // dvb_sect_pat_program_t[N];
+
+ // dvb_CRC32_t;
+
+} dvb_sect_pat_t attr_pack;
+
+
+typedef struct _dvb_sect_pat_program {
+
+ guint16 program_number;
+
+ union _u {
+ struct _network_PID {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 network_PID_hi :5;
+ guint8 reserved0 :3;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 reserved0 :3;
+ guint8 network_PID_hi :5;
+#else
+#error "Please specify the byte order!"
+#endif
+ guint8 network_PID_lo;
+ } network_PID;
+ struct _program_map_PID {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 program_map_PID_hi :5;
+ guint8 reserved0 :3;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 reserved0 :3;
+ guint8 program_map_PID_hi :5;
+#else
+#error "Please specify the byte order!"
+#endif
+ guint8 program_map_PID_lo;
+ } program_map_PID;
+ } u;
+} dvb_sect_pat_program_t attr_pack;
+#ifdef _WIN32
+#pragma pack(pop,p1)
+#endif
+
+/**
+ * @param p pointer to dvb_sect_pat_t.
+ *
+ * @note 9 because section length is the length of the remainder
+ * of the section starting with the first byte after the
+ * section length field, but including the CRC32.
+ */
+#define DVB_GET_PAT_PROG_COUNT(p) \
+ ((((((p)->gen_hdr.section_length_hi) << 8) | (p)->gen_hdr.section_length_lo) - 9) >> 2)
+
+
+/**
+ * @param ps pointer to dvb_gen_secthdr_t.
+ */
+#define DVB_GET_PAT_PROGNR(pp) \
+ (guint16)g_ntohs( (pp)->program_number )
+
+/**
+ * @param ps pointer to dvb_gen_secthdr_t.
+ * @param id id to set in section header.
+ */
+#define DVB_SET_PAT_PROGNR(pp,pnr) \
+ (pp)->program_number = htons( ((guint16)(pnr)) )
+
+
+/**
+ * @param S type of PAT Program Info (PMT or NIT)
+ * @param ps pointer to dvb_sect_pat_program_t.
+ */
+#define DVB_GET_PAT_PROG_PID(S,ps) \
+ ((((ps)->u.S.S ## _hi) << 8) | (ps)->u.S.S ## _lo)
+
+/**
+ * @param S type of PAT Program Info (PMT or NIT)
+ * @param ps pointer to dvb_sect_pat_program_t.
+ * @param l PID to set.
+ */
+#define DVB_SET_PAT_PROG_PID(S,ps,l) \
+do { \
+ (ps)->u.S.S ## _lo = ((guint8)(((guint16)(l)) & 0x00FF)); \
+ (ps)->u.S.S ## _hi = ((guint8)((((guint16)(l)) & 0x1F00) >> 8)); \
+} while (0)
+
+
+#endif /* __SECT_PAT_H__ */
diff -ruN ethereal-0.10.7/dvb_incs/sect_pmt.h ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_pmt.h
--- ethereal-0.10.7/dvb_incs/sect_pmt.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_pmt.h 2004-12-02 16:14:18.699830595 +0100
@@ -0,0 +1,165 @@
+/* sect_pmt.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING <wolfi@xxxxxxxxxxxxxx>
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#ifndef __SECT_PMT_H__
+#define __SECT_PMT_H__
+
+#include <glib.h>
+#include "sect_gen.h"
+
+#ifdef __GNUC__
+#define attr_pack __attribute__((packed))
+#elif defined(_WIN32)
+#define attr_pack
+#pragma pack(push,p,1)
+#else
+#error "Complier not supported"
+#endif
+typedef struct _dvb_sect_pmt {
+
+ dvb_sect_gen_t gen_hdr attr_pack;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 PCR_PID_hi :5;
+ guint8 reserved0 :3;
+ guint8 PCR_PID_lo;
+ guint8 program_info_length_hi :4;
+ guint8 reserved1 :4;
+ guint8 program_info_length_lo;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 reserved0 :3;
+ guint8 PCR_PID_hi :5;
+ guint8 PCR_PID_lo;
+ guint8 reserved1 :4;
+ guint8 program_info_length_hi :4;
+ guint8 program_info_length_lo;
+#else
+#error "Please specify the byte order!"
+#endif
+
+ // descriptor[N]
+ // PMT entries[N1] + ES_descr[N]
+
+ // dvb_CRC32_t;
+
+} dvb_sect_pmt_t attr_pack;
+
+
+#define DVB_GET_PMT_PCRPID(p) \
+(((p)->PCR_PID_hi << 8) | (p)->PCR_PID_lo)
+
+#define DVB_SET_PMT_PCRPID(p,pid) \
+do { \
+ (p)->PCR_PID_lo = ((guint8)(((guint16)(pid)) & 0x00FF)); \
+ (p)->PCR_PID_hi = ((guint8)((((guint16)(pid)) & 0x1F00) >> 8)); \
+} while (0)
+
+
+#define DVB_GET_PROGINFO_LENGTH(p) \
+ ((((p)->program_info_length_hi) << 8) | (p)->program_info_length_lo)
+
+#define DVB_SET_PROGINFO_LENGTH(p,l) \
+do { \
+ (p)->program_info_length_lo = ((guint8)(((guint16)(l)) & 0x00FF)); \
+ (p)->program_info_length_hi = ((guint8)((((guint16)(l)) & 0x0F00) >> 8)); \
+} while (0)
+
+
+typedef struct _dvb_sect_pmt_entry {
+
+ guint8 stream_type;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 elementary_PID_hi :5;
+ guint8 reserved0 :3;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 reserved0 :3;
+ guint8 elementary_PID_hi :5;
+#else
+#error "Please specify the byte order!"
+#endif
+
+ guint8 elementary_PID_lo;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 ES_info_length_hi :4;
+ guint8 reserved1 :4;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 reserved1 :4;
+ guint8 ES_info_length_hi :4;
+#else
+#error "Please specify the byte order!"
+#endif
+
+ guint8 ES_info_length_lo;
+
+ // ES Descriptors[N2]
+
+} dvb_sect_pmt_entry_t attr_pack;
+#ifdef _WIN32
+#pragma pack(pop,p,1)
+#endif
+
+#define DVB_GET_SECT_PMT_EPID(p) \
+ ((((p)->elementary_PID_hi) << 8) | (p)->elementary_PID_lo)
+
+#define DVB_SET_SECT_PMT_EPID(p,ep) \
+do { \
+ (p)->elementary_PID_hi = (((guint16)(ep)) & 0x1F00) >> 8; \
+ (p)->elementary_PID_lo = (((guint16)(ep)) & 0x00FF); \
+} while (0)
+
+#define DVB_GET_SECT_PMT_ESINFO_LEN(p) \
+ ((((p)->ES_info_length_hi) << 8) | (p)->ES_info_length_lo)
+
+#define DVB_SET_SECT_PMT_ESINFO_LEN(p,l) \
+do { \
+ (p)->ES_info_length_hi = (((guint16)(l)) & 0x0F00) >> 8; \
+ (p)->ES_info_length_lo = (((guint16)(l)) & 0x00FF); \
+} while (0)
+
+
+/**
+ * Values for dvb_sect_pmt_entry_t's stream_type:
+ */
+#define DVB_PMT_STREAM_IEC_11172_VIDEO 0x01
+#define DVB_PMT_STREAM_IEC_13818_2_VIDEO 0x02
+#define DVB_PMT_STREAM_IEC_11172_AUDIO 0x03
+#define DVB_PMT_STREAM_IEC_13818_3_AUDIO 0x04
+#define DVB_PMT_STREAM_IEC_13818_1_PRIVATE 0x05
+#define DVB_PMT_STREAM_IEC_13818_1_PES 0x06
+#define DVB_PMT_STREAM_IEC_13522_MHEG 0x07
+#define DVB_PMT_STREAM_IEC_13818_1_DSMCC 0x08
+#define DVB_PMT_STREAM_ITUT_H222_1 0x09
+#define DVB_PMT_STREAM_IEC_13818_6_A 0x0A
+#define DVB_PMT_STREAM_IEC_13818_6_B 0x0B
+#define DVB_PMT_STREAM_IEC_13818_6_C 0x0C
+#define DVB_PMT_STREAM_IEC_13818_6_D 0x0D
+#define DVB_PMT_STREAM_IEC_13818_1_AUX 0x0E
+// 0x0F - 0x7F: Reserved
+// 0x80 - 0xFF: User defined
+
+
+
+#endif /* __SECT_PMT_H__ */
diff -ruN ethereal-0.10.7/dvb_incs/sect_sdt.h ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_sdt.h
--- ethereal-0.10.7/dvb_incs/sect_sdt.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_sdt.h 2004-12-02 16:14:18.747823373 +0100
@@ -0,0 +1,121 @@
+/* sect_sdt.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING <wolfi@xxxxxxxxxxxxxx>
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#ifndef __SECT_SDT_H__
+#define __SECT_SDT_H__
+
+#include <glib.h>
+#include "sect_gen.h"
+
+#ifdef __GNUC__
+#define attr_pack __attribute__((packed))
+#elif defined(_WIN32)
+#define attr_pack
+#pragma pack(push,p,1)
+#else
+#error "Complier not supported"
+#endif
+typedef struct _dvb_sect_sdt {
+
+ dvb_sect_gen_t gen_hdr;
+
+ guint8 original_network_id_hi;
+ guint8 original_network_id_lo;
+
+ guint8 reserved_future_use;
+
+ // dvb_sect_sdt_entry_t[N];
+
+ // dvb_CRC32_t;
+
+} dvb_sect_sdt_t attr_pack;
+
+#define DVB_GET_SDT_ONET_ID(t) \
+ (((t)->original_network_id_hi << 8) | (t)->original_network_id_lo)
+
+#define DVB_SET_SDT_ONET_ID(t,i) \
+do { \
+ (t)->original_network_id_hi = (((guint16)(i)) & 0xFF00) >> 8; \
+ (t)->original_network_id_lo = (((guint16)(i)) & 0x00FF); \
+} while (0)
+
+
+typedef struct _dvb_sect_sdt_entry {
+
+ guint8 service_id_hi;
+ guint8 service_id_lo;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 EIT_present_following_flag :1;
+ guint8 EIT_schedule_flag :1;
+ guint8 reserved_future_use :6;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 reserved_future_use :6;
+ guint8 EIT_schedule_flag :1;
+ guint8 EIT_present_following_flag :1;
+#else
+#error "Please specify the byte order!"
+#endif
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 descriptor_loop_length_hi :4;
+ guint8 free_CA_mode :1;
+ guint8 running_status :3;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 running_status :3;
+ guint8 free_CA_mode :1;
+ guint8 descriptor_loop_length_hi :4;
+#else
+#error "Please specify the byte order!"
+#endif
+ guint8 descriptor_loop_length_lo;
+
+ // descriptor[N]
+
+} dvb_sect_sdt_entry_t attr_pack;
+#ifdef _WIN32
+#pragma pack(pop,p,1)
+#endif
+
+#define DVB_GET_SDT_SERVICE_ID(t) \
+ (((t)->service_id_hi << 8) | (t)->service_id_lo)
+
+#define DVB_SET_SDT_SERVICE_ID(t,i) \
+do { \
+ (t)->service_id_hi = (((guint16)(i)) & 0xFF00) >> 8; \
+ (t)->service_id_lo = (((guint16)(i)) & 0x00FF); \
+} while (0)
+
+
+#define DVB_GET_SDT_DL_LEN(t) \
+ (((t)->descriptor_loop_length_hi << 8) | (t)->descriptor_loop_length_lo)
+
+#define DVB_SET_SDT_DL_LEN(t,i) \
+do { \
+ (t)->descriptor_loop_length_hi = (((guint16)(i)) & 0x0F00) >> 8; \
+ (t)->descriptor_loop_length_lo = (((guint16)(i)) & 0x00FF); \
+} while (0)
+
+
+#endif /* __SECT_SDT_H__ */
diff -ruN ethereal-0.10.7/dvb_incs/sect_ssc.h ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_ssc.h
--- ethereal-0.10.7/dvb_incs/sect_ssc.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_ssc.h 2004-12-02 16:14:18.788817205 +0100
@@ -0,0 +1,117 @@
+/* sect_ssc.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING <wolfi@xxxxxxxxxxxxxx>
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#ifndef __SECT_SSC_H__
+#define __SECT_SSC_H__
+
+#include <glib.h>
+
+
+#define DVB_SECT_SSC_VERSION 0x11
+
+#ifdef __GNUC__
+#define attr_pack __attribute__((packed))
+#elif defined(_WIN32)
+#define attr_pack
+#pragma pack(push,p,1)
+#else
+#error "Complier not supported"
+#endif
+typedef struct _dvb_sect_ssc {
+
+ guint8 table_id;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 section_length_hi :4;
+ guint8 reserved0 :2;
+ guint8 authority_indicator :1;
+ guint8 section_syntax_indicator :1; // always 0
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 section_syntax_indicator :1; // always 0
+ guint8 authority_indicator :1;
+ guint8 reserved0 :2;
+ guint8 section_length_hi :4;
+#else
+#error "Please specify the byte order!"
+#endif
+
+ guint8 section_length_lo;
+
+ guint8 station_id_32_0;
+ guint8 station_id_32_1;
+ guint8 station_id_32_2;
+ guint8 station_id_32_3;
+
+ guint8 option_field_length;
+
+ // for (i=0;i<option_field_length;i++) {
+ // guint8 option_field_data
+ // }
+ // scmp_packet_data()
+ // dvb_CRC32_t
+
+} dvb_sect_ssc_t attr_pack;
+#ifdef _WIN32
+#pragma pack(pop,p,1)
+#endif
+
+/**
+ * @param ps pointer to dvb_sect_ssc_t
+ */
+#define DVB_GET_SSC_SECTION_LENGTH(ps) \
+ ((((ps)->section_length_hi) << 8) | (ps)->section_length_lo)
+
+/**
+ * @param ps pointer to dvb_sect_ssc_t.
+ * @param l length to set in section header.
+ */
+#define DVB_SET_SSC_SECTION_LENGTH(ps,l) \
+do { \
+ (ps)->section_length_lo = ((guint8)(((guint16)(l)) & 0x00FF)); \
+ (ps)->section_length_hi = ((guint8)((((guint16)(l)) & 0x0F00) >> 8)); \
+} while (0)
+
+
+/**
+ * @param ps pointer to dvb_sect_ssc_t
+ */
+#define DVB_GET_SSC_STATION_ID_32(ps) \
+ ((((ps)->station_id_32_0) << 24) | (((ps)->station_id_32_1) << 16) | \
+ (((ps)->station_id_32_2) << 8) | (ps)->station_id_32_3)
+
+
+/**
+ * @param ps pointer to dvb_sect_ssc_t.
+ * @param l station id.
+ */
+#define DVB_SET_SSC_STATION_ID_32(ps,l) \
+do { \
+ (ps)->station_id_32_3 = ((guint8)(((guint32)(l)) & 0x000000FF)); \
+ (ps)->station_id_32_2 = ((guint8)((((guint32)(l)) & 0x0000FF00) >> 8)); \
+ (ps)->station_id_32_1 = ((guint8)((((guint32)(l)) & 0x00FF0000) >> 16)); \
+ (ps)->station_id_32_0 = ((guint8)((((guint32)(l)) & 0xFF000000) >> 24)); \
+} while (0)
+
+
+#endif /* __SECT_SSC_H__ */
diff -ruN ethereal-0.10.7/dvb_incs/sect_tdt.h ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_tdt.h
--- ethereal-0.10.7/dvb_incs/sect_tdt.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/dvb_incs/sect_tdt.h 2004-12-02 16:14:18.790816904 +0100
@@ -0,0 +1,92 @@
+/* sect_tdt.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING <wolfi@xxxxxxxxxxxxxx>
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#ifndef __SECT_TDT_H__
+#define __SECT_TDT_H__
+
+#include <glib.h>
+
+#ifdef __GNUC__
+#define attr_pack __attribute__((packed))
+#elif defined(_WIN32)
+#define attr_pack
+#pragma pack(push,p,1)
+#else
+#error "Complier not supported"
+#endif
+typedef struct _dvb_sect_tdt {
+
+ guint8 table_id;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 section_length_hi: 4;
+ guint8 reserved: 2;
+ guint8 reserved_future_use: 1;
+ guint8 section_syntax_indicator: 1;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 section_syntax_indicator: 1;
+ guint8 reserved_future_use: 1;
+ guint8 reserved: 2;
+ guint8 section_length_hi: 4;
+#else
+#error "Please specify the byte order!"
+#endif
+
+ guint8 section_length_lo;
+
+ guint8 UTC_time_0;
+ guint8 UTC_time_1;
+ guint8 UTC_time_2;
+ guint8 UTC_time_3;
+ guint8 UTC_time_4;
+
+ // NOTE: The TDT section has no checksum and the
+ // section_syntax_indicator must be set to '0'.
+
+} dvb_sect_tdt_t attr_pack;
+#ifdef _WIN32
+#pragma pack(pop,p,1)
+#endif
+
+#define DVB_GET_TDT_MJD( t ) \
+ (((t)->UTC_time_0 << 8) | (t)->UTC_time_1)
+
+#define DVB_SET_TDT_MJD( t, s ) \
+do { \
+ (t)->UTC_time_0 = (((guint16)(s)) & 0xFF00) >> 8; \
+ (t)->UTC_time_1 = (((guint16)(s)) & 0x00FF); \
+} while (0)
+
+#define DVB_GET_TDT_UTC( t ) \
+ (((t)->UTC_time_2 << 16) | ((t)->UTC_time_3 << 8) | (t)->UTC_time_4)
+
+#define DVB_SET_TDT_UTC( t, s ) \
+do { \
+ (t)->UTC_time_2 = (((guint32)(s)) & 0x00FF0000) >> 16; \
+ (t)->UTC_time_3 = (((guint32)(s)) & 0x0000FF00) >> 8; \
+ (t)->UTC_time_4 = (((guint32)(s)) & 0x000000FF); \
+} while (0)
+
+
+#endif /* __SECT_TDT_H__ */
diff -ruN ethereal-0.10.7/dvb_incs/ts_hdr.h ethereal-0.10.7_mpeg2_recent/dvb_incs/ts_hdr.h
--- ethereal-0.10.7/dvb_incs/ts_hdr.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/dvb_incs/ts_hdr.h 2004-12-02 16:14:18.831810736 +0100
@@ -0,0 +1,266 @@
+/* ts_hdr.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING <wolfi@xxxxxxxxxxxxxx>
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#ifndef __DVB_TS_HDR_H__
+#define __DVB_TS_HDR_H__
+
+#include <glib.h>
+
+#ifdef __GNUC__
+#define attr_pack __attribute__((packed))
+#elif defined(_WIN32)
+#define attr_pack
+#pragma pack(push,p,1)
+#else
+#error "Complier not supported"
+#endif
+typedef struct _dvb_ts_hdr {
+
+ guint8 sync_byte; // 0x47
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 PID_hi :5;
+ guint8 transport_priority :1;
+ guint8 payload_unit_start_indicator :1;
+ guint8 transport_error_indicator :1;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 transport_error_indicator :1;
+ guint8 payload_unit_start_indicator :1;
+ guint8 transport_priority :1;
+ guint8 PID_hi :5;
+#else
+#error "Please specify the byte order!"
+#endif
+
+ guint8 PID_lo;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 continuity_counter :4;
+ guint8 adaptation_field_control :2;
+ guint8 transport_scrambling_control :2;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 transport_scrambling_control :2;
+ guint8 adaptation_field_control :2;
+ guint8 continuity_counter :4;
+#else
+#error "Please specify the byte order!"
+#endif
+
+} dvb_ts_hdr_t attr_pack;
+
+#define TS_LEN 188
+#define TS_HDR_LEN sizeof(dvb_ts_hdr_t) // 4 bytes
+#define TS_DATA_LEN 188 - TS_HDR_LEN // 184 bytes
+
+#define TS_SYNC_BYTE 0x47
+
+
+/**
+ * Maximum PID number.
+ */
+#define DVB_MAX_PID 0x1FFF
+
+
+/**
+ * Get the PID value from the TS header.
+ *
+ * @param ts pointer to dvb_ts_hdr_t.
+ */
+#define DVB_GET_TS_PID(t) \
+((((t)->PID_hi) << 8) | ((t)->PID_lo))
+
+/**
+ * Set the PID value in a TS header.
+ *
+ * @param ts pointer to dvb_ts_hdr_t.
+ * @param p PID
+ */
+#define DVB_SET_TS_PID(ts,p) \
+do { \
+ (ts)->PID_lo = ((guint8)(((guint16)(p)) & 0x00FF)); \
+ (ts)->PID_hi = ((guint8)((((guint16)(p)) & 0x1F00) >> 8)); \
+} while (0)
+
+
+/**
+ * Scrambling Control values.
+ */
+#define TS_SCV_NOT_SCRAMBLED 0x00
+#define TS_SCV_USER_DEFINED_01 0x01
+#define TS_SCV_USER_DEFINED_10 0x02
+#define TS_SCV_USER_DEFINED_11 0x03
+
+/**
+ * Adaptation Field Control values.
+ */
+#define TS_ADP_RESERVED 0x00
+#define TS_ADP_PAYLOAD_ONLY 0x01
+#define TS_ADP_ADAPTFIELD_ONLY 0x02
+#define TS_ADP_BOTH 0x03
+
+
+/**
+ * Fixed-size part of Adaptation Field.
+ */
+typedef struct _dvb_ts_adaptation_field {
+
+ guint8 adaptation_field_length;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 adaptation_field_extension_flag :1;
+ guint8 transport_private_data_flag :1;
+ guint8 splicing_point_flag :1;
+ guint8 OPCR_flag :1;
+ guint8 PCR_flag :1;
+ guint8 elementary_stream_priority_indicator :1;
+ guint8 random_access_indicator :1;
+ guint8 discontinuity_indicator :1;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 discontinuity_indicator :1;
+ guint8 random_access_indicator :1;
+ guint8 elementary_stream_priority_indicator :1;
+ guint8 PCR_flag :1;
+ guint8 OPCR_flag :1;
+ guint8 splicing_point_flag :1;
+ guint8 transport_private_data_flag :1;
+ guint8 adaptation_field_extension_flag :1;
+#else
+#error "Please specify the byte order!"
+#endif
+
+} dvb_ts_adaptation_field_t attr_pack;
+
+#define TS_AF_HDR_LEN sizeof(dvb_ts_adaptation_field_t)
+
+
+typedef struct _dvb_ts_pcr {
+
+ guint8 program_clock_reference_base_1;
+ guint8 program_clock_reference_base_2;
+ guint8 program_clock_reference_base_3;
+ guint8 program_clock_reference_base_4;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+ guint8 program_clock_reference_extension_1 :1;
+ guint8 reserved0 :6;
+ guint8 program_clock_reference_base_5 :1;
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+ guint8 program_clock_reference_base_5 :1;
+ guint8 reserved0 :6;
+ guint8 program_clock_reference_extension_1 :1;
+
+#else
+#error "Please specify the byte order!"
+#endif
+
+ guint8 program_clock_reference_extension_2;
+
+} dvb_ts_pcr_t attr_pack;
+
+#define TS_PCR_LEN sizeof(dvb_ts_pcr_t)
+
+/**
+ * Get the PCR base value as number from a PCR or OPCR struct.
+ *
+ * @param ph pointer to dvb_ts_pcr_t or dvb_ts_opcr_t
+ * @return the pcr base, an unsigned long long
+ */
+#define TS_GET_PCR_BASE(ph) \
+ (((ph)->program_clock_reference_base_1 << 25) | ((ph)->program_clock_reference_base_2 << 17) | \
+ ((ph)->program_clock_reference_base_3 << 9) | ((ph)->program_clock_reference_base_4 << 1) | \
+ (ph)->program_clock_reference_base_5)
+
+/**
+ * Get the PCR extension value as number from a PCR or OPCR struct.
+ *
+ * @param ph pointer to dvb_ts_pcr_t or dvb_ts_opcr_t
+ * @return the pcr extension, an unsigned short
+ */
+#define TS_GET_PCR_EXT(ph) \
+ ((ph->program_clock_reference_extension_1 << 8) | ph->program_clock_reference_extension_2 )
+
+/**
+ * Get the complete PCR value as number from a PCR or OPCR struct.
+ *
+ * @param ph pointer to dvb_ts_pcr_t or dvb_ts_opcr_t
+ * @return the pcr, an unsigned long long, in units of 27 MHz
+ */
+#define TS_GET_PCR(ph) \
+ ((TS_GET_PCR_BASE(ph) * 300) + TS_GET_PCR_EXT(ph))
+
+static inline unsigned long long ts_pcr2uint64( dvb_ts_pcr_t *ph )
+{
+ unsigned long long pcr = 0LL;
+ unsigned short pcr_ext = 0;
+
+ pcr = ph->program_clock_reference_base_1;
+ pcr = pcr << 8 | ph->program_clock_reference_base_2;
+ pcr = pcr << 8 | ph->program_clock_reference_base_3;
+ pcr = pcr << 8 | ph->program_clock_reference_base_4;
+ pcr = pcr << 1 | ph->program_clock_reference_base_5;
+ pcr *= 300;
+
+ pcr_ext = ph->program_clock_reference_extension_1;
+ pcr_ext = pcr_ext << 8 | ph->program_clock_reference_extension_2;
+
+ pcr += pcr_ext;
+
+ return pcr;
+}
+
+
+/**
+ * Convert pcr value to microseconds (µs).
+ *
+ * @param p pcr value (unsigned long long)
+ * @return µs value corresponding to the given pcr.
+ */
+#define TS_PCR_2_US(p) ((p) / 27)
+
+
+typedef struct _dvb_ts_pcr dvb_ts_opcr_t; /* same structure as pcr */
+
+
+/**
+ * Complete TS cell: 188 bytes long.
+ */
+struct _dvb_ts_cell {
+ dvb_ts_hdr_t tsc_header;
+ union {
+ unsigned char tsc_bytes[184];
+ struct _with_af {
+ dvb_ts_adaptation_field_t tsc_af;
+ unsigned char tsc_af_bytes[184-sizeof(dvb_ts_adaptation_field_t)];
+ } with_af;
+ } tsc_payload;
+} attr_pack;
+
+typedef struct _dvb_ts_cell dvb_ts_cell_t;
+#ifdef _WIN32
+#pragma pack(pop,p,1)
+#endif
+#endif /* __DVB_TS_HDR_H__ */
diff -ruN ethereal-0.10.7/epan/column.c ethereal-0.10.7_mpeg2_recent/epan/column.c
--- ethereal-0.10.7/epan/column.c 2004-10-21 00:34:36.000000000 +0200
+++ ethereal-0.10.7_mpeg2_recent/epan/column.c 2004-12-02 16:14:18.901800205 +0100
@@ -1,7 +1,7 @@
/* column.c
* Routines for handling column preferences
*
- * $Id: column.c 12131 2004-09-29 02:54:22Z guy $
+ * $Id: column.c,v 1.48 2004/07/05 09:29:04 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@xxxxxxxxxxxx>
@@ -40,8 +40,8 @@
#endif
#include <epan/timestamp.h>
-#include <epan/prefs.h>
-#include <epan/column.h>
+#include "prefs.h"
+#include "column.h"
#include <epan/packet.h>
/* Given a format number (as defined in packet.h), returns its equivalent
@@ -53,7 +53,7 @@
"%rd", "%ud", "%hd", "%rhd", "%uhd", "%nd", "%rnd",
"%und", "%S", "%rS", "%uS", "%D", "%rD", "%uD", "%p",
"%i", "%L", "%B", "%XO", "%XR", "%I", "%c", "%Xs",
- "%Xd", "%V", "%x", "%e" };
+ "%Xd", "%V", "%x", "%e", "%q" };
if (fmt < 0 || fmt > NUM_COL_FMTS)
return NULL;
@@ -107,6 +107,7 @@
"VSAN",
"IEEE 802.11 TX rate",
"IEEE 802.11 RSSI",
+ "PID",
};
gchar *
@@ -195,6 +196,9 @@
case COL_RSSI:
fmt_list[COL_RSSI] = TRUE;
break;
+ case COL_PID:
+ fmt_list[COL_PID] = TRUE;
+ break;
default:
break;
}
@@ -297,6 +301,9 @@
case COL_RSSI:
return "100";
break;
+ case COL_PID:
+ return "00000000";
+ break;
default: /* COL_INFO */
return "Source port: kerberos-master Destination port: kerberos-master";
break;
@@ -434,6 +441,9 @@
case 'e':
return COL_RSSI;
break;
+ case 'q':
+ return COL_PID;
+ break;
}
cptr++;
}
diff -ruN ethereal-0.10.7/epan/column_info.h ethereal-0.10.7_mpeg2_recent/epan/column_info.h
--- ethereal-0.10.7/epan/column_info.h 2004-10-21 00:35:03.000000000 +0200
+++ ethereal-0.10.7_mpeg2_recent/epan/column_info.h 2004-12-02 16:14:18.955792081 +0100
@@ -1,7 +1,7 @@
/* column.h
* Definitions for column structures and routines
*
- * $Id: column_info.h 11400 2004-07-18 00:24:25Z guy $
+ * $Id: column_info.h,v 1.13 2004/07/05 09:29:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@xxxxxxxxxxxx>
@@ -95,10 +95,8 @@
COL_VSAN, /* VSAN - Cisco MDS-specific */
COL_TX_RATE, /* IEEE 802.11 - TX rate in Mbps */
COL_RSSI, /* IEEE 802.11 - received signal strength */
+ COL_PID, /* MPEG2 Packet Identifier */
NUM_COL_FMTS /* Should always be last */
};
#endif /* __COLUMN_INFO_H__ */
-
-
-
diff -ruN ethereal-0.10.7/epan/dissectors/dvb_crc32_table.h ethereal-0.10.7_mpeg2_recent/epan/dissectors/dvb_crc32_table.h
--- ethereal-0.10.7/epan/dissectors/dvb_crc32_table.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/epan/dissectors/dvb_crc32_table.h 2004-12-02 16:14:18.996785912 +0100
@@ -0,0 +1,76 @@
+/* DVB CRC32 Calculation table for generator polynomial 0x04c11db7. */
+/* automatically generated by sec_crc_table, don't edit! */
+
+#ifndef __DVB_CRC32_TABLE_H__
+#define __DVB_CRC32_TABLE_H__
+
+unsigned int dvb_crc_table[256] =
+{
+ 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9,
+ 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005,
+ 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
+ 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd,
+ 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9,
+ 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,
+ 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011,
+ 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd,
+ 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
+ 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5,
+ 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81,
+ 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d,
+ 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49,
+ 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95,
+ 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,
+ 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d,
+ 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae,
+ 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072,
+ 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16,
+ 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca,
+ 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde,
+ 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02,
+ 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066,
+ 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
+ 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e,
+ 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692,
+ 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6,
+ 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a,
+ 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e,
+ 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,
+ 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686,
+ 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a,
+ 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637,
+ 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb,
+ 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f,
+ 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53,
+ 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47,
+ 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b,
+ 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
+ 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623,
+ 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7,
+ 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b,
+ 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f,
+ 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3,
+ 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,
+ 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b,
+ 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f,
+ 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3,
+ 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640,
+ 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c,
+ 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8,
+ 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24,
+ 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30,
+ 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
+ 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088,
+ 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654,
+ 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0,
+ 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c,
+ 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18,
+ 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,
+ 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0,
+ 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c,
+ 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,
+ 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4
+};
+
+#endif /* __DVB_CRC32_TABLE_H__ */
+
diff -ruN ethereal-0.10.7/epan/dissectors/Makefile.common ethereal-0.10.7_mpeg2_recent/epan/dissectors/Makefile.common
--- ethereal-0.10.7/epan/dissectors/Makefile.common 2004-10-21 00:34:43.000000000 +0200
+++ ethereal-0.10.7_mpeg2_recent/epan/dissectors/Makefile.common 2004-12-02 16:14:18.998785612 +0100
@@ -529,7 +529,11 @@
packet-yppasswd.c \
packet-ypserv.c \
packet-ypxfr.c \
- packet-zebra.c
+ packet-zebra.c \
+ packet-section.c \
+ packet-mpeg2.c \
+ packet-table_print.c \
+ packet-ule.c
# corresponding headers
DISSECTOR_INCLUDES = \
diff -ruN ethereal-0.10.7/epan/dissectors/packet-mpeg2.c ethereal-0.10.7_mpeg2_recent/epan/dissectors/packet-mpeg2.c
--- ethereal-0.10.7/epan/dissectors/packet-mpeg2.c 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/epan/dissectors/packet-mpeg2.c 2004-12-02 16:14:19.100770266 +0100
@@ -0,0 +1,525 @@
+/* packet-mpeg2.c
+ * Routines for MPEG2 TS dissection
+ *
+ * Copyright 2003, Lutz FINDEISEN <lfindeis@xxxxxxxxxxxxxx>
+ *
+ * Project partially sponsored by ESA projectnr.: JR/UOS/17471/03/NL/ND
+ * "Standardisation Support of enhanced IEFTF IP Encapsulation Tecniques"
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <epan/packet.h>
+
+#include "prefs.h"
+#include "reassemble.h"
+#ifdef NEED_SNPRINTF_H
+# include "snprintf.h"
+#endif
+
+
+
+/*DVB dump includes*/
+#include "dvb_incs/ts_hdr.h"
+#include "dvb_incs/sect_gen.h"
+#include "dvb_incs/pes_hdr.h"
+
+
+#define ULE_END_INDICATOR 0xFFFF
+
+/**
+ * Used to export variables und WIN32
+ */
+#ifdef __GNUC__
+#define EXPORT_VAR
+#elif defined(_WIN32)
+#define EXPORT_VAR __declspec(dllexport)
+#endif
+
+/* Initialize the protocol and registered fields */
+static int proto_mpeg2 = -1;
+
+
+/* The Transport Stream header fields*/
+static int hf_mpeg2_sync_byte = -1;
+static int hf_mpeg2_transport_error_indicator = -1;
+static int hf_mpeg2_PUSI = -1;
+static int hf_mpeg2_tranport_priority = -1;
+static int hf_mpeg2_PID = -1;
+static int hf_mpeg2_transport_scrambling_control = -1;
+static int hf_mpeg2_adaption_field_cotrol = -1;
+static int hf_mpeg2_continuity_counter = -1;
+static int hf_mpeg2_pointer_field = -1;
+
+/* The Adaptationfield Header Fields*/
+static int hf_mpeg2_adaptation_field_length = -1;
+static int hf_mpeg2_adaptation_field_extension_flag = -1;
+static int hf_mpeg2_transport_private_data_flag = -1;
+static int hf_mpeg2_splicing_point_flag = -1;
+static int hf_mpeg2_OPCR_flag = -1;
+static int hf_mpeg2_PCR_flag = -1;
+static int hf_mpeg2_elementary_stream_priority_indicator = -1;
+static int hf_mpeg2_random_access_indicator = -1;
+static int hf_mpeg2_discontinuity_indicator = -1;
+
+
+/* Initialize the subtree pointers */
+static gint ett_mpeg2 = -1;
+static gint ett_sndu = -1;
+
+/* Dissector Handles */
+static dissector_handle_t data_handle;
+static dissector_handle_t section_handle;
+static dissector_handle_t ule_handle;
+/**
+ * Structure that holds the information to perform reassembly with the Ethereal reas. engine
+ * This structure is needed because there is the possibility that more than one section are to be reassembled at the same so a
+ * dynamic list is created with this struct that holds the reassemble information for every PID that has to be reassembled
+ */
+typedef struct reas_info{
+ /** PID packet identifier */
+ guint16 PID;
+ /** frame used to key to identify the datagram in the hash table */
+ guint32 frame;
+ /** defr_off offset into the defragmented packet */
+ guint defr_off;
+ /** rest bytes left to reassemble */
+ guint rest;
+ /** slen length of the complete datagram */
+ guint16 slen;
+ } reas_info_t;
+/****************************************************************
+ * declarations needed for Section reassembly
+ ****************************************************************/
+ guint16 sect_PID = 0x2fff; /* initialize with a invalid PID */
+ guint16 help_PID, display_PID; /* Holds the complete PID */
+ guint16 slen = 0; /* Sectionlength */
+ guint offset = 0; /* Offset into the TS-Cell */
+ guint32 frag_len;
+ guint32 frame_nr = 0;
+
+
+
+
+ EXPORT_VAR gboolean do_ule = FALSE; /* False if no ULE packet */
+ EXPORT_VAR GSList *PID_list=NULL; /* List containing all the PID that carry ULE SNDUs */
+
+ GSList *section_PID_list = NULL; /* List that PID of all section currently in reassembly state */
+ reas_info_t *reas, *recvr_inf =NULL, *actual_inf = NULL;
+
+ /*needed by the reassembly-engine */
+ fragment_data *mpeg2_head;
+ static GHashTable *mpeg2_fragment_table = NULL;
+ static GHashTable *mpeg2_reassembled_table = NULL;
+ tvbuff_t *next_tvb= NULL;
+
+/**
+ * Function that initiates everything needed for reassembly
+ */
+
+
+static void mpeg2_reassamble(void)
+{
+ fragment_table_init(&mpeg2_fragment_table);
+ reassembled_table_init(&mpeg2_reassembled_table);
+ sect_PID = 0x2fff;
+ offset = 0;
+ slen = 0;
+ frag_len = 0;
+ frame_nr = 0;
+ actual_inf = NULL;
+ recvr_inf = NULL;
+ section_PID_list = NULL;
+}
+static void mpeg2_reassemble_sndus(tvbuff_t *tvb, packet_info *pinfo, guint offset,guint8 pf, proto_tree *tree);
+
+/* Code to actually dissect the packets */
+static void
+dissect_mpeg2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ dvb_ts_hdr_t *tsh; /* TS Header*/
+ dvb_sect_gen_t *secth; /* minimal Section Header including sectionlength*/
+ dvb_pes_hdr_t *pesh; /* PES Header to check section or PES */
+ dvb_ts_adaptation_field_t *adapt; /* TS adaption field header */
+ guchar *dword ;
+ proto_item *ti = NULL;
+ proto_tree *mpeg2_tree, *adap_tree;
+ gboolean no_reas = FALSE, init_val = do_ule;
+ guint32 frag_len_mem = 0;
+ GSList *head = NULL;
+ guint16 pf = 0;
+
+
+/* Make entries in Protocol column and Info column on summary display */
+ if (check_col(pinfo->cinfo, COL_PROTOCOL))
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPEG2");
+
+
+
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_add_str(pinfo->cinfo, COL_INFO, "MPEG2 Transport Stream");
+
+
+ dword = (guchar *)tvb_get_ptr(tvb, 0, 4);
+ tsh = (dvb_ts_hdr_t *)dword;
+
+ if (check_col(pinfo->cinfo, COL_PID))
+ col_add_fstr(pinfo->cinfo, COL_PID,"0x%4x",DVB_GET_TS_PID(tsh));
+ if(tsh->payload_unit_start_indicator == 1)
+ {
+ if (check_col(pinfo->cinfo, COL_INFO))
+ {
+ col_set_str(pinfo->cinfo, COL_INFO, "PUSI");
+ }
+ }
+
+/**************************************************************************************
+ * Setting up Protocoltree for TS-Header analysation
+ *************************************************************************************/
+
+ if (tree)
+ {
+
+
+ ti = proto_tree_add_item( tree, proto_mpeg2, tvb, 0, -1, FALSE);
+ mpeg2_tree = proto_item_add_subtree(ti, ett_mpeg2);
+ proto_tree_add_uint(mpeg2_tree, hf_mpeg2_sync_byte, tvb, 0, 1, tsh->sync_byte);
+ proto_tree_add_uint(mpeg2_tree, hf_mpeg2_transport_error_indicator, tvb,1, 1, tsh->transport_error_indicator);
+ proto_tree_add_uint(mpeg2_tree, hf_mpeg2_PUSI, tvb, 1, 1, tsh->payload_unit_start_indicator);
+ proto_tree_add_uint(mpeg2_tree, hf_mpeg2_tranport_priority, tvb, 1, 1, tsh->transport_priority);
+ proto_tree_add_uint(mpeg2_tree, hf_mpeg2_PID, tvb, 1, 2, DVB_GET_TS_PID(tsh));
+ proto_tree_add_uint(mpeg2_tree, hf_mpeg2_transport_scrambling_control, tvb, 3, 1, tsh->transport_scrambling_control);
+ ti = proto_tree_add_uint(mpeg2_tree, hf_mpeg2_adaption_field_cotrol, tvb, 3, 1, tsh->adaptation_field_control);
+ proto_tree_add_uint(mpeg2_tree, hf_mpeg2_continuity_counter, tvb, 3, 1, tsh->continuity_counter);
+ }
+
+/**************************************************************************************
+ * Display the Adaptation field if present
+ **************************************************************************************/
+ offset = TS_HDR_LEN;
+
+ if(tree){
+ if(tsh->adaptation_field_control > 1)
+ {
+ dword = (guchar *)tvb_get_ptr(tvb, offset, sizeof(dvb_ts_adaptation_field_t));
+ adapt = (dvb_ts_adaptation_field_t *)dword;
+ adap_tree = proto_item_add_subtree(ti, ett_mpeg2);
+ proto_tree_add_uint(adap_tree, hf_mpeg2_adaptation_field_length, tvb,offset , 1, adapt->adaptation_field_length);
+ proto_tree_add_uint(adap_tree, hf_mpeg2_adaptation_field_extension_flag, tvb,offset+1 , 1, adapt->adaptation_field_extension_flag);
+ proto_tree_add_uint(adap_tree, hf_mpeg2_transport_private_data_flag, tvb, offset+1 , 1, adapt->transport_private_data_flag);
+ proto_tree_add_uint(adap_tree, hf_mpeg2_splicing_point_flag , tvb, offset+1 , 1, adapt->splicing_point_flag);
+ proto_tree_add_uint(adap_tree, hf_mpeg2_OPCR_flag , tvb, offset+1 , 1, adapt->OPCR_flag);
+ proto_tree_add_uint(adap_tree, hf_mpeg2_PCR_flag , tvb, offset+1 , 1, adapt->PCR_flag);
+ proto_tree_add_uint(adap_tree, hf_mpeg2_elementary_stream_priority_indicator, tvb, offset+1 ,1, adapt->elementary_stream_priority_indicator);
+ proto_tree_add_uint(adap_tree, hf_mpeg2_random_access_indicator, tvb, offset+1 , 1, adapt->random_access_indicator);
+ proto_tree_add_uint(adap_tree, hf_mpeg2_discontinuity_indicator, tvb, offset+1 , 1, adapt->discontinuity_indicator);
+ offset += 1 + adapt->adaptation_field_length; /* set the offset with the right offset for a possible reassembly */
+ }
+
+ if(tsh->payload_unit_start_indicator == 1)
+ proto_tree_add_uint(mpeg2_tree, hf_mpeg2_pointer_field, tvb,offset,1, pf = tvb_get_guint8(tvb, offset));
+ }
+/**************************************************************************************
+ * Sectionreassembling starts here
+ *************************************************************************************/
+ if(!actual_inf) /*initiate struct */
+ {
+ actual_inf = g_malloc(sizeof(reas_info_t));
+ actual_inf->rest = 0;
+ actual_inf->PID = 0xFFFF;
+ actual_inf->frame = 0;
+ }
+ help_PID = DVB_GET_TS_PID(tsh);
+ head = PID_list;
+ if(PID_list && do_ule)
+ do_ule = FALSE;
+ while(head != NULL)
+ {
+ if((guint)head->data == help_PID)
+ {
+ do_ule = TRUE; break; /* ULE in the packet */
+ }
+ head = g_slist_next(head);
+ }
+ if(tsh->payload_unit_start_indicator == 1)
+ {
+ if(!do_ule)
+ {
+ dword = (guchar *)tvb_get_ptr(tvb, offset,3);
+ pesh = (dvb_pes_hdr_t *)dword;
+ if(DVB_GET_PACKET_START_CODE_PREFIX(pesh)==1)
+ return;
+ offset += 1 + pf; /* TS_HDR_LEN + pointer_field + value of pointer */
+ dword = (guchar *)tvb_get_ptr(tvb, offset, 3);
+ secth = (dvb_sect_gen_t *)dword;
+ /* section header including section_length */
+ frag_len = TS_LEN - offset;
+ if( (slen = DVB_GET_SECTION_LENGTH(secth) + 3) <= TS_LEN-3)
+ {
+ next_tvb = tvb_new_subset(tvb, offset, slen, slen);
+ call_dissector(section_handle, next_tvb, pinfo, tree);
+ no_reas = TRUE;
+ }
+ else
+ {
+ if(actual_inf->rest > 0)
+ {
+ reas = g_malloc(sizeof(reas_info_t));
+ if(actual_inf)
+ {
+ memcpy(reas,actual_inf, sizeof(reas_info_t));
+ section_PID_list = g_slist_append(section_PID_list, (gpointer)reas);
+ }
+ }
+ actual_inf->slen = DVB_GET_SECTION_LENGTH(secth) + 3;
+ actual_inf->frame = pinfo->fd->num;
+ actual_inf->PID = help_PID;
+ actual_inf->defr_off = 0;
+ mpeg2_head = fragment_add_check(tvb, offset, pinfo,actual_inf->frame, mpeg2_fragment_table, mpeg2_reassembled_table, actual_inf->defr_off, frag_len, TRUE );
+ fragment_set_tot_len(pinfo, actual_inf->frame, mpeg2_fragment_table, actual_inf->slen);
+ actual_inf->rest = actual_inf->slen - frag_len;
+ actual_inf->defr_off = frag_len;
+ if(mpeg2_head != NULL)
+ {
+ /* create a new tvbuffer and handle over to the section dissector */
+ next_tvb =tvb_new_real_data(mpeg2_head->data, mpeg2_head->datalen, mpeg2_head->datalen);
+ tvb_set_child_real_data_tvbuff(tvb, next_tvb);
+ add_new_data_source(pinfo, next_tvb, "Reassembled Section");
+ call_dissector(section_handle, next_tvb, pinfo, tree);
+ }
+
+
+ }
+ }
+ else
+ {
+
+ mpeg2_reassemble_sndus(tvb, pinfo, (offset+1),tvb_get_guint8(tvb, offset), tree);
+ actual_inf->PID = DVB_GET_TS_PID(tsh);
+
+ if((mpeg2_head != NULL) && (actual_inf->frame == pinfo->fd->num))
+ {
+ /* create a new tvbuffer and handle over to the ULE dissector */
+ next_tvb =tvb_new_real_data(mpeg2_head->data, mpeg2_head->datalen, mpeg2_head->datalen);
+ tvb_set_child_real_data_tvbuff(tvb, next_tvb);
+ add_new_data_source(pinfo, next_tvb, "Reassembled ULE SNDU");
+ call_dissector(ule_handle, next_tvb, pinfo, tree);
+
+ }
+
+ }
+
+
+ }
+ head = section_PID_list;
+ /* Search the list if on this PID is something to reassemble */
+ while(head != NULL)
+ {
+ if(((reas_info_t *)(head->data))->PID == help_PID)
+ {
+ recvr_inf = actual_inf;
+ actual_inf = (reas_info_t *)(head->data);
+ break;
+ }
+ head = g_slist_next(head);
+ }
+
+ if((help_PID == actual_inf->PID) && (actual_inf->frame != pinfo->fd->num))
+ {
+ offset = TS_HDR_LEN; /* without pointerfield */
+ if(!do_ule)
+ {
+ if((actual_inf->slen - actual_inf->defr_off) > 183)
+ frag_len = TS_LEN - offset; /* calculate the fragment length */
+ else
+ frag_len = actual_inf->slen - actual_inf->defr_off; /* The last fragment length is calculated separatly */
+ mpeg2_head = fragment_add_check(tvb, offset, pinfo, actual_inf->frame , mpeg2_fragment_table, mpeg2_reassembled_table, actual_inf->defr_off, frag_len, TRUE);
+ actual_inf->defr_off += frag_len; actual_inf->rest -= frag_len;
+ if(recvr_inf)
+ {
+ actual_inf = recvr_inf; /*recover the old info */
+ recvr_inf = NULL;
+ }
+ if(head)
+ {
+ if(((reas_info_t *)(head->data))->rest == 0)
+ section_PID_list = g_slist_remove(section_PID_list, head->data); /* reassembly is finished and entry is removed from the list */
+ }
+
+
+ }
+ else
+ {
+ if(frag_len > 184) /* frag_len holds the rest of the SNDU */
+ {
+ frag_len_mem = frag_len -184; /* rest of SNDU will be stored in frag_len_mem */
+ frag_len = 184;
+ }
+ mpeg2_head = fragment_add_check(tvb, offset, pinfo, actual_inf->frame , mpeg2_fragment_table, mpeg2_reassembled_table, actual_inf->defr_off, frag_len, TRUE);
+ actual_inf->defr_off += frag_len; frag_len = frag_len_mem; /* write back stored value to frag_len */
+
+ }
+
+ }
+
+
+ do_ule = init_val; /* reset do_ule to initial value */
+ }
+
+/* Register the protocol with Ethereal */
+
+/* this format is require because a script is used to build the C function
+ that calls all the protocol registration.
+*/
+
+void
+proto_register_mpeg2(void)
+{
+ /* Setup list of header fields See Section 1.6.1 for details*/
+ static hf_register_info hf[] = {
+ { &hf_mpeg2_sync_byte,
+ { "sync byte", "mpeg2.sync_byte", FT_UINT8, BASE_HEX, NULL, 0x0, "used for syncronistion value 0x47", HFILL } },
+ { &hf_mpeg2_transport_error_indicator,
+ { "transport error indicator", "mpeg2.transport_error_indicator", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_mpeg2_PUSI,
+ {"payload Unit Start Indicator", "mpeg2.PUSI", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_mpeg2_tranport_priority,
+ {"transport priority", "mpeg2.transport_priority", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_mpeg2_PID,
+ {"packet identifier (PID)", "mpeg2.PID", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL } },
+ { &hf_mpeg2_transport_scrambling_control,
+ {"transport scrambling control", "mpeg2.transport_scrambling_control", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL } },
+ { &hf_mpeg2_adaption_field_cotrol,
+ {"adaptation field control", "mpeg2.adaptation_field_control", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL } },
+ { &hf_mpeg2_continuity_counter,
+ {"continuity Counter", "mpeg2.continuity_counter", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL } },
+ { &hf_mpeg2_adaptation_field_length,
+ {"adaptation field length", "mpeg2.adaptaion_field_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_mpeg2_adaptation_field_extension_flag,
+ {"adaptation field extension length", "mpeg2.adatation_field_extension_flag", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_mpeg2_transport_private_data_flag,
+ {"transport field extension flag", "mpeg2.transport_private_data_flag", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_mpeg2_splicing_point_flag,
+ {"splicing point flag", "mpeg2.splicing_point_falg", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_mpeg2_OPCR_flag,
+ {"OPCR flag", "mpeg2.OPCR_flag", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_mpeg2_PCR_flag,
+ {"PCR flag", "mpeg2.PCR_flag", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_mpeg2_elementary_stream_priority_indicator,
+ {"elemetnary stream priority indicator", "mpeg2.elementary_stream_priority_indicator", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_mpeg2_random_access_indicator,
+ {"radom access indicator", "mpeg2.access_indicator", FT_UINT8, BASE_DEC, NULL,0x0, " ", HFILL } },
+ { &hf_mpeg2_discontinuity_indicator,
+ {"discontinuity indicator", "mpeg2.discontinuity_indicator", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL, } },
+ { &hf_mpeg2_pointer_field,
+ { "pointer field", "mpeg2.pointer_field", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } }
+ };
+
+ /*Setup proto col subtree array */
+ static gint *ett[] = {
+ &ett_mpeg2, };
+
+ /* Register the protocol name and description*/
+ proto_mpeg2 = proto_register_protocol("MPEG-2 ISO 13818","MPEG2", "mpeg2");
+
+ /* Required function calls to register the header fields and subtrees used */
+ proto_register_field_array(proto_mpeg2, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+ register_init_routine(mpeg2_reassamble);
+ }
+
+
+
+void
+proto_reg_handoff_mpeg2(void)
+{
+ dissector_handle_t mpeg2_handle;
+ data_handle = find_dissector("data");
+ mpeg2_handle = find_dissector("mpeg2");
+ section_handle = find_dissector("section");
+ ule_handle = find_dissector("ule");
+ mpeg2_handle = create_dissector_handle(dissect_mpeg2, proto_mpeg2);
+ dissector_add("wtap_encap",WTAP_FILE_MPEG2, mpeg2_handle);
+ }
+/**
+ * Function that handles the reasemble of ULE SNDUs
+ *
+ * @param tvb testy virtualizable buffer
+ * @param pinfo packet info
+ * @param offset byteoffset into TS packet
+ * @param tree protocol tree to construct tree in middle pane (here needed for reasembly engine)
+ */
+
+static void mpeg2_reassemble_sndus(tvbuff_t *tvb, packet_info *pinfo, guint offset,guint8 pf, proto_tree *tree)
+ {
+ guchar *dword;
+ guint16 sndulen = 0, rest_tvb = TS_LEN - (TS_HDR_LEN +1);
+ guint16 end_ind; gboolean more_sndus = TRUE;
+
+ /* loop through a TS packet and reasemble SNDU or handle off to ULE dissector */
+
+ while(more_sndus)
+ {
+ dword = (guchar *)tvb_get_ptr(tvb, offset,2);
+ sndulen = (((dword[0] & 0x7f) << 8) | dword[1]) +4;
+ end_ind = (dword[0] <<8) | dword[1]; /* ULE Endindicator */
+
+ if(pf > 0)
+ {
+ /* Add this piece with length = pf to the fragment table with id = actual_inf->frame this part belongs to a earlier TS packet */
+ mpeg2_head = fragment_add_check(tvb, 5, pinfo, actual_inf->frame, mpeg2_fragment_table, mpeg2_reassembled_table, actual_inf->defr_off, pf, TRUE );
+ offset += pf; rest_tvb -=pf; pf = 0;
+ }
+ else
+ {
+ if(end_ind == ULE_END_INDICATOR)
+ return; /* finished */
+ if(sndulen <= rest_tvb) /* no reasembly is necessary */
+ {
+ if((sndulen == 182) || (sndulen == 183)) /* special cases in ULE */
+ {
+ next_tvb = tvb_new_subset(tvb, offset, sndulen, sndulen);
+ call_dissector(ule_handle, next_tvb, pinfo, tree);
+ return;
+ }
+ next_tvb = tvb_new_subset(tvb, offset, sndulen, sndulen);
+ call_dissector(ule_handle, next_tvb, pinfo, tree);
+ offset += sndulen; rest_tvb -= sndulen;
+ }
+ else
+ { /* reassembly necessary */
+ frag_len = rest_tvb; actual_inf->frame = pinfo->fd->num; actual_inf->defr_off = 0;
+ mpeg2_head = fragment_add_check(tvb, offset, pinfo, actual_inf->frame, mpeg2_fragment_table, mpeg2_reassembled_table, actual_inf->defr_off, frag_len, TRUE );
+ fragment_set_tot_len(pinfo, actual_inf->frame, mpeg2_fragment_table, sndulen); /* Set total length, needed by the reassembly engine */
+ actual_inf->defr_off = frag_len; frag_len = sndulen - rest_tvb; more_sndus = FALSE;
+ //return;
+ }
+ }
+ }
+ return;
+}
diff -ruN ethereal-0.10.7/epan/dissectors/packet-section.c ethereal-0.10.7_mpeg2_recent/epan/dissectors/packet-section.c
--- ethereal-0.10.7/epan/dissectors/packet-section.c 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/epan/dissectors/packet-section.c 2004-12-02 16:14:19.102769965 +0100
@@ -0,0 +1,211 @@
+/* packet-section.c
+ * Routines for MPEG2 Transport stream section dissection
+ *
+ * Copyright 2004, Lutz FINDEISEN lfindeis@xxxxxxxxxxxxxx
+ *
+ * Project partially sponsored by ESA projectnr.: JR/UOS/17471/03/NL/ND
+ * "Standardisation Support of enhanced IEFTF IP Encapsulation Tecniques"
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#include <glib.h>
+
+#ifdef NEED_SNPRINTF_H
+# include "snprintf.h"
+#endif
+
+#include <epan/packet.h>
+
+#include "mpeg2_convenience_routines.h"
+
+/*DVB dump includes*/
+#include "dvb_incs/ts_hdr.h"
+#include "dvb_incs/sect_gen.h"
+#include "dvb_crc32_table.h"
+
+
+/* Initialize the protocol and registered fields */
+static int proto_section = -1;
+static int hf_section_table_id = -1;
+static int hf_section_length = -1;
+static int hf_reserved0 = -1;
+static int hf_private_indicator = -1;
+static int hf_section_syntax_indicator = -1;
+static int hf_id = -1;
+static int hf_current_next_indicator = -1;
+static int hf_version_number = -1;
+static int hf_reserved1 = -1;
+static int hf_section_number = -1;
+static int hf_last_section_number = -1;
+static int hf_CRC32 = -1;
+
+/* Initialize the subtree pointers */
+static gint ett_section = -1;
+
+static dissector_handle_t table_print_handle;
+
+dvb_CRC32_t dvb_crc32_calc( const unsigned char *sectbuf, unsigned int size )
+{
+ dvb_CRC32_t crc32 = 0xffffffff;
+ guint i = 0;
+
+ for (i = 0; i < size; i++)
+ crc32 = (crc32 << 8) ^ dvb_crc_table[(((crc32 >> 24) ^ sectbuf[i]) & 0xff)];
+
+ return crc32;
+}
+
+
+/* Code to actually dissect the packets */
+static void
+dissect_section(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+
+ const guchar *data;
+ dvb_sect_gen_t *secth = NULL; /* minimal Section Header including sectionlength*/
+/* Set up structures needed to add the protocol subtree and manage it */
+ proto_item *ti = NULL;
+ proto_tree *section_tree;
+ guint sec_len = 0;
+ guint len = 4096; /* Max section size */
+ dvb_CRC32_t sec_crc32 = 0, calc_crc32 = 0;
+
+/* Make entries in Protocol column and Info column on summary display */
+
+if (tree)
+ {
+ data = tvb_get_ptr(tvb,0,sizeof(secth));
+ secth = (dvb_sect_gen_t *)data;
+ ti = proto_tree_add_item(tree, proto_section, tvb, 0, -1, FALSE);
+ section_tree = proto_item_add_subtree(ti, ett_section);
+ ti = proto_tree_add_uint(section_tree, hf_section_table_id, tvb, 0, 1, secth->table_id);
+ proto_item_append_text(ti, " (%s)",dvb_table_id_str(secth->table_id));
+ if(secth->section_syntax_indicator == 1)
+ {
+ proto_tree_add_uint(section_tree, hf_section_syntax_indicator, tvb,1 ,1 , secth->section_syntax_indicator);
+ proto_tree_add_uint(section_tree, hf_private_indicator, tvb, 1, 1, secth->private_indicator);
+ proto_tree_add_uint(section_tree, hf_reserved0, tvb, 1, 1, secth->reserved0);
+ proto_tree_add_uint(section_tree, hf_section_length, tvb, 1, 2, sec_len = (guint)DVB_GET_SECTION_LENGTH(secth));
+ proto_tree_add_uint(section_tree, hf_id, tvb, 3,2, DVB_GET_SECTION_ID(secth));
+ proto_tree_add_uint(section_tree, hf_reserved1, tvb, 5, 1, secth->reserved1);
+ proto_tree_add_uint(section_tree, hf_version_number, tvb, 5, 1, secth->version_number);
+ proto_tree_add_uint(section_tree, hf_current_next_indicator, tvb, 5, 1, secth->current_next_indicator);
+ proto_tree_add_uint(section_tree, hf_section_number, tvb, 6,1, secth->section_number);
+ proto_tree_add_uint(section_tree, hf_last_section_number, tvb, 7, 1, secth->last_section_number);
+ }
+ else
+ {
+ proto_tree_add_uint(section_tree, hf_section_syntax_indicator, tvb, 1,1, secth->section_syntax_indicator);
+ proto_tree_add_uint(section_tree, hf_private_indicator, tvb, 1,1, secth->private_indicator);
+ proto_tree_add_uint(section_tree, hf_section_length, tvb, 1,2, sec_len = (guint)DVB_GET_SECTION_LENGTH(secth));
+ }
+ if((sec_len > 0) && (sec_len <= len))
+ {
+ if(secth->section_syntax_indicator)
+ {
+ /* Print the CRC32: section_length + 3 bytes fixed header - 4 bytes CRC32. */
+ data = tvb_get_ptr(tvb, 0, sec_len);
+ sec_crc32 = g_ntohl( (dvb_CRC32_t)*((dvb_CRC32_t *) (data + sec_len + 3 -4)) );
+ calc_crc32 = dvb_crc32_calc( data, sec_len +3 - 4);
+ ti = proto_tree_add_uint(section_tree, hf_CRC32, tvb, (tvb_length(tvb) - 4), 4, sec_crc32);
+ proto_item_append_text(ti, ", verification: %s (0x%08x) ", (sec_crc32 == calc_crc32) ? "OK" : "FAILED!" , calc_crc32);
+ }
+ }
+ call_dissector(table_print_handle, tvb, pinfo, tree);
+ }
+
+/* If this protocol has a sub-dissector call it here, see section 1.8 */
+}
+
+
+/* Register the protocol with Ethereal */
+
+/* this format is require because a script is used to build the C function
+ that calls all the protocol registration.
+*/
+
+void
+proto_register_section(void)
+{
+
+/* Setup list of header fields See Section 1.6.1 for details*/
+ static hf_register_info hf[] = {
+ { &hf_section_table_id,
+ { "table id", "section.table_id", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL } },
+ { &hf_section_length,
+ { "sction length", "section.section_length", FT_UINT16, BASE_DEC, NULL, 0x0, " ", HFILL, } },
+ { &hf_section_syntax_indicator,
+ { "section syntax indicator", "section.section_syntax_indicator", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_private_indicator,
+ { "private indicator", "section.private_indicator", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_reserved0,
+ { "reserved0", "section.reserved0", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL } },
+ { &hf_current_next_indicator,
+ { "current next indicator", "section.crurrent_next_indicator", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_reserved1,
+ { "reserved1", "section.reserved1", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL } },
+ { &hf_section_number,
+ { "section number", "section.section_number", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_id,
+ { "table id extension", "section.id", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL } },
+ { &hf_last_section_number,
+ { "last section number", "section.last_section_number", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL, } },
+ { &hf_version_number,
+ { "version number", "section.version_number", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL, } },
+ { &hf_CRC32,
+ { "CRC32", "section.CRC32", FT_UINT32, BASE_HEX, NULL, 0x0, " ", HFILL, } }
+ };
+
+/* Setup protocol subtree array */
+ static gint *ett[] = {
+ &ett_section,
+ };
+
+/* Register the protocol name and description */
+ proto_section = proto_register_protocol("MPEG2 Section",
+ "section", "section");
+
+/* Required function calls to register the header fields and subtrees used */
+ proto_register_field_array(proto_section, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+ register_dissector("section", dissect_section, proto_section);
+}
+
+
+/* If this dissector uses sub-dissector registration add a registration routine.
+ This format is required because a script is used to find these routines and
+ create the code that calls these routines.
+*/
+void
+proto_reg_handoff_section(void)
+{
+ table_print_handle = find_dissector("table_print");
+}
diff -ruN ethereal-0.10.7/epan/dissectors/packet-table_print.c ethereal-0.10.7_mpeg2_recent/epan/dissectors/packet-table_print.c
--- ethereal-0.10.7/epan/dissectors/packet-table_print.c 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/epan/dissectors/packet-table_print.c 2004-12-02 16:14:19.155761992 +0100
@@ -0,0 +1,715 @@
+ /* packet-table_print.c
+ * Routines for MPEG2 Section Table printers
+ *
+ * Copyright 2004, Lutz FINDEISEN lfindeis@xxxxxxxxxxxxxx
+ *
+ * Project partially sponsored by ESA projectnr.: JR/UOS/17471/03/NL/ND
+ * "Standardisation Support of enhanced IEFTF IP Encapsulation Tecniques"
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <glib.h>
+
+#ifdef NEED_SNPRINTF_H
+# include "snprintf.h"
+#endif
+
+#include <epan/packet.h>
+#include <reassemble.h>
+
+#include <mpeg2_convenience_routines.h>
+#include <mpeg2_psi.h>
+
+/*DVB dump includes*/
+#include "dvb_incs/sect_gen.h"
+
+/* include the header fields*/
+#include <mpeg2_hf.h>
+
+typedef void (*dvb_table_print_t) (guint8 *tblbuf, proto_tree *tree, tvbuff_t *tvb);
+
+dvb_table_print_t table_printer[255];
+/**
+ * Init the array of function pointers
+ */
+static void table_init()
+{
+ table_printer[DVB_TABLE_ID_PAT] = dvb_pat_print;
+ table_printer[DVB_TABLE_ID_PMT] = dvb_pmt_print;
+ table_printer[DVB_TABLE_ID_DSMCC_PRIV] = dvb_mpe3e_print;
+ table_printer[DVB_TABLE_ID_NIT_ACT] = dvb_nit_print;
+ table_printer[DVB_TABLE_ID_NIT_OTH] = dvb_nit_print;
+ table_printer[DVB_TABLE_ID_SDT_ACT] = dvb_sdt_print;
+ table_printer[DVB_TABLE_ID_SDT_OTH] = dvb_sdt_print;
+
+}
+
+
+
+
+/* Initialize the subtree pointers */
+ gint ett_table_print = -1;
+
+
+dissector_handle_t ip_handle, llc_handle;
+
+tvbuff_t *next_tvb;
+proto_item *ti = NULL;
+proto_tree *table_tree = NULL;
+packet_info *pinfo_mem = NULL;
+
+/* offset into the tvb */
+guint16 tvb_offset = 0;
+
+/* Code to actually dissect the packets */
+static void
+dissect_print_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ //proto_item *ti = NULL;
+ guint8 *data = NULL;
+ dvb_sect_gen_t *secth = NULL; /* minimal Section Header including sectionlength*/
+ /* Set up structures needed to add the protocol subtree and manage it */
+
+
+
+
+
+
+ if (tree)
+ {
+ table_init();
+ pinfo_mem = pinfo; /* unclean but usefull */
+ data = (guint8 *)tvb_get_ptr(tvb,0,tvb_length(tvb));
+ secth = (dvb_sect_gen_t *)data;
+ if(secth->section_syntax_indicator == 1)
+ tvb_offset = sizeof(dvb_sect_gen_t);
+ else
+ tvb_offset = sizeof(dvb_sect_gen_t) - 5;
+ ti = proto_tree_add_item(tree, proto_table_print, tvb, 0, -1, FALSE);
+ table_tree = proto_item_add_subtree(ti, ett_table_print);
+ if(table_printer[secth->table_id])
+ table_printer[secth->table_id](data, table_tree, tvb);
+ }
+
+/* If this protocol has a sub-dissector call it here, see section 1.8 */
+}
+
+
+/* Register the protocol with Ethereal */
+
+/* this format is require because a script is used to build the C function
+ that calls all the protocol registration.
+*/
+
+void
+proto_register_table_print(void)
+{
+
+/* Setup list of header fields See Section 1.6.1 for details*/
+ static hf_register_info hf[] = {
+ { &hf_service_nr,
+ { "service", "table_print.service_nr", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_network_PID,
+ { "network PID ", "table_print.network_PID", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL } },
+ { &hf_reserved,
+ { "reserverd", "table_print.reserved", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_program_map_PID,
+ { "program map PID", "table_print.program_map_PID", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_program_number,
+ { "program number", "table_print.program_number", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_reserved_future_use,
+ { "reserved future use", "table_print.reserved_future_use", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_network_descriptors_length,
+ { "network descriptor length", "table_print.network_descriptor_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_transport_stream_loop_length,
+ { "transport stream loop length", "table_print.transport_stream_loop_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_tsid,
+ { "tsid", "table_print.tsid", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_onid,
+ { "onid", "table_print.onid", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_TS_descriptor_length,
+ { "TS descriptor length", "table_print.TS_descriptor_length", FT_UINT16, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_Transport_Stream_Descriptions,
+ { "transport stream Descriptions", "table_print.Transport_Stream_Descriptions", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_Network_Descriptors,
+ { "network descriptors", "table_print.Network_Descriptors", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_reserved1,
+ { "reserved1", "table_print.reserved1", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_payload_scrambling_control,
+ { "payload scrambling control", "table_print.payload_scrambling_control", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_LLC_SNAP_flag,
+ { "LLC SNAP flag", "table_print.LLC_SNAP_flag", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_address_scrambling_control,
+ { "address scrambling control", "table_print.adress_scrambling_control", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_MAC_address,
+ { "MAC address", "table_print.MAC_adress", FT_ETHER, BASE_NONE, NULL , 0x0, " ", HFILL} },
+ { &hf_LLC_SNAP,
+ { "LLC SNAP", "table_print.LLC_SNAP", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_PCR_PID,
+ { "PCR PID", "table_print.PCR_PID", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_program_info_length,
+ { "program info length", "table_print.program_info_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_program_info_descriptors,
+ { "program info descriptors", "table_print.program_info_descriptors", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_EPID,
+ { "PID", "table_print.EPID", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_ES_info_length,
+ { "ES info length", "table_print.ES_info_length", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_Elementary_stream_descriptions,
+ { "elementary stream descriptions", "table_print.Elementary_stream_descriptons", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_multiple_frame_rate_flag,
+ { "multiple frame rate flag", "table_print.multiple_frame_rate_flag", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_constraint_parameter_flag,
+ { "constrained parameter flag", "table_print.constrained_parameter_flag", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_MPEG_1_only_flag,
+ {"MPEG1 only flag", "table_print.MPEG_1_only_flag", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_still_picture_flag,
+ {"still picture flag", "table_print.still_picture_flag", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_sprofile_and_level_indication,
+ {"sprofile and level indication", "table_print.sprofile_and_level_indication", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_frame_rate_extension_flag,
+ {"frame rate extension flag", "table_print.frame_rate_extension_flag", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_chroma_format,
+ { "chroma format", "table_print.chroma_format", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_frame_rate_code,
+ {"frame rate code", "table_print.frame_rate_code", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_stream_type,
+ {"stream type", "table_print.stream_type", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_constrained_parameter_flag,
+ {"constrained parameter flag", "table_print.constrained_parameter_flag", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_carousel_id,
+ { "carousel id", "table_print.carousel_id", FT_UINT32, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_format_id,
+ { "format id", "table_print.format_id", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_private_data,
+ { "private data", "table_print.private_data", FT_NONE, BASE_NONE, NULL,0x0, " ",HFILL} },
+ { &hf_component_id,
+ { "component id", "table_print.component_id", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_descriptor_tag,
+ { "descriptor tag", "table_print.descriptor_tag", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_original_network_PID,
+ { "original network PID", "table_print.original_network_PID", FT_UINT16, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_SDT_Entry_loop,
+ { "SDT Entry loop", "table_print.SDT_Entry_loop", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_reserved_future_use0,
+ { "reserverd future use", "table_print.reserverd_future_use0", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_service_id,
+ { "service id", "table_print.service_id", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_running_status,
+ { "running status", "table_print.running_status", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_EIT_schedule_flag,
+ { "EIT schedule flag", "table_print.EIT_schedule_flag", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_free_CA_mode,
+ { "free CA mode", "table_print.free_CA_mode", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_EIT_present_following_flag,
+ { "EIT present following flag", "table_print.EIT_present_following_flag", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_descriptor_loop_length,
+ { "descriptor loop length", "table_print.descriptor_loop_length", FT_UINT16, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_reserved_future_use1,
+ { "reserved future use", "table_print.reserved_future_use1", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_Descriptors,
+ { "descriptors", "table_print.Descriptors", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_protocol_discriminator,
+ { "protocol discriminator", "table_print.protocol_discriminator", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_dsmcc_type,
+ { "dsmcc type", "table_print.dsmcc_type", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_message_id,
+ { "message id", "table_print.message_id", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_transaction_id,
+ { "transaction id", "table_print.transaction_id", FT_UINT32, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_reserved_dsmcc,
+ { "reserved", "table_print.reserverd_dsmcc", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_adaptation_length,
+ { "adaptation length", "table_print.adaptation_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_message_length,
+ { "message length", "table_print.message_length", FT_UINT16, BASE_DEC, NULL,0x0, " ", HFILL} },
+ { &hf_dsmcc_adapt_field,
+ { "adaptation field", "table_print.dsmcc_adapt_field", FT_NONE, BASE_NONE,NULL, 0x0, " ", HFILL} },
+ { &hf_message,
+ { "message", "table_print.message", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_free_format_flag,
+ { "free format flag", "table_print.free_format_flag", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_id,
+ { "id", "table_print.id", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_layer,
+ { "layer", "table_print.layer", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_variable_rate_audio_indicator,
+ { "variable rate audio indicator", "table_print.variable_rate_audio_indicator", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_network_name,
+ { "network name", "table_print.network_name", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_service_type,
+ { "service type", "table_print.service_type", FT_UINT8,BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_frequency,
+ { "frequency", "table_print.frequency", FT_UINT32, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_modulation,
+ { "modulation", "table_print.modulation", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_orbital_position,
+ { "orbital position", "table_print.orbital_position", FT_UINT16, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_symbol_rate,
+ { "symbol rate", "table_print.symbol_rate", FT_UINT32, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_west_east_flag,
+ { "west east flag", "table_print.west_east_flag", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_FEC_inner,
+ { "FEC inner", "table_print.FEC_inner", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_polarization,
+ { "polarization", "table_print.polarization", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_FEC_outer,
+ { "FEC outer", "table_print.FEC_outer", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_frequency_terr,
+ { "frequency [10Hz]", "table_print.frequency_terr", FT_UINT32, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_bandwitdth,
+ { "bandwidth", "table_print.bandwidth", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_constellation,
+ { "constellation", "table_print.constellation", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_hirachy,
+ { "hirachy", "table_print.hirachy", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_code_rate_HP,
+ { "code rate HP", "table_print.code_rate_HP", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_code_rate_LP,
+ { "code rate LP", "table_print.code_rate_LP", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_quard_internal,
+ { "quard internal", "table_print.quard_internal", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_transmission_mode,
+ { "transmission mode", "table_print.transmission_mode", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_other_freq,
+ { "other frequencies used", "table_print.other_freq", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_service_provider_name,
+ { "service provider name", "table_print.service_provider_name", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_service_name,
+ { "service name", "table_print.service_name", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_data_broadcast_id,
+ { "data broadcast id", "table_printer.data_broadcast_id", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_component_tag,
+ { "component tag", "table_print.component_tag", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_selector_length,
+ { "selector length", "table_print.selector_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_selector,
+ { "selector", "table_print.selector", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_ISO_639_language_code,
+ {"ISO639 language code", "table_print.ISO639_language_code", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_text_length,
+ {"text length", "table_print.text_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ",HFILL} },
+ { &hf_textstr,
+ { "text", "table_print.textstr", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_text,
+ { "text", "table_print.text", FT_UINT8, BASE_DEC, NULL,0x0, " ", HFILL} },
+ { &hf_MAC_address_range,
+ { "MAC address range", "table_print.MAC_adress_range", FT_UINT8, BASE_DEC, NULL, 0x0," ",HFILL} },
+ { &hf_MAC_IP_mapping_flag,
+ { "MAC IP mapping flag", "table_print.MAC_IP_mapping_flag", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_alignment_indicator,
+ { "alignemnt indicator", "table_print.alignemnt_indicator", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_section_per_datagram,
+ { "max section per datagram", "table_print.section_per_datagram", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_carousel_type_id,
+ { "carousel type id", "table_print.carousel_type_id", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_timeout_DSI,
+ { "timeout DSI", "table_print.timeout_DSI", FT_UINT32, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_timeout_DII,
+ { "timeout DII", "table_print.timeout_DII", FT_UINT32, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_leak_rate,
+ { "leak rate", "table_print.leak_rate", FT_UINT32, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_language_code,
+ { "language code", "table_print.language_code", FT_STRING, BASE_DEC, NULL, 0x0," ", HFILL} },
+ { &hf_object_name,
+ { "object name: len", "table_print.object_name", FT_UINT8, BASE_DEC, NULL, 0x0," ", HFILL} },
+ { &hf_linkage_type,
+ { "linkage type", "table_print.linkage_type", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_private_data_byte,
+ { "private data byte(s)", "table_print.private_data_byte", FT_NONE, BASE_NONE, NULL, 0x0," ", HFILL} },
+ { &hf_application_type,
+ { "application type", "table_print.application_type", FT_UINT16, BASE_HEX, NULL, 0x0," ", HFILL} },
+ { &hf_ait_version,
+ { "ait version", "table_print.ait_version", FT_UINT8, BASE_HEX, NULL, 0x0," ", HFILL } },
+ { &hf_association_tag,
+ { "association tag", "table_print.association_tag", FT_UINT16, BASE_HEX, NULL, 0x0, " ",HFILL } },
+ { &hf_timeout,
+ { "timeout", "table_print.timeout", FT_UINT32, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_use,
+ { "use", "table_print.use", FT_UINT16, BASE_HEX, NULL, 0x0, " ",HFILL} },
+ { &hf_event_text,
+ { "event text len", "table_print.event_text", FT_UINT8, BASE_DEC, NULL, 0x0," ", HFILL} },
+ { &hf_event_name,
+ { "event name len", "table_print.event_name", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_descriptor_number,
+ { "descriptor number", "table_print.descriptor_number", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_last_descr_number,
+ { "last descriptor number", "table_print.last_descr_number", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_length_of_items,
+ { "length of items", "table_print.length_of_items", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_item_descr_len,
+ { "item descriptor length", "table_print.item_descriptor_len", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_reference_service_id,
+ { "reference service id", "table_print.reference_service_id", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_reference_event_id,
+ { "reference event id", "table_print.reference_event_id", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_Flags,
+ { "flags", "table_print.Flags", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_comp_type,
+ { "comp type", "table_print.comp_type", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_bsid,
+ { "bsid", "table_print.bsid", FT_NONE, BASE_NONE, NULL, 0x0, " " ,HFILL} },
+ { &hf_mainid,
+ { "mainid", "table_print.mainid", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_asvc,
+ { "asvc", "table_print.asvc", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_component_type,
+ { "component type", "table_print.component_type", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_bs_id,
+ { "bs_id", "table_print.bs_id", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_main_id,
+ { "main id", "table_print.main_id", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_asvc_value,
+ { "asvc", "table_print.asvc_value", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_additional_info,
+ { "additional info", "table_print.additional_info", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_application_profiles,
+ { "application profile: len", "table_print.application_profiles", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_application_profile,
+ { "application profile", "table_print.application_profile", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_service_bound_flag,
+ { "service bound flag", "table_print.table_bound_flag", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_visibility,
+ { "visibility", "table_print.visibility", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_application_priority,
+ { "application priority", "table_print.application_priority", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_transport_protocol_lables,
+ { "transport protocol labels", "table_print.transport_protocol_labels", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_application_name,
+ { "application name", "table_print.application_name", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_protocol_id,
+ { "protocol id", "table_print.protocol_id", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_protocol_label,
+ { "protocol label", "table_print.protocol_label", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_len,
+ { "len", "table_print.len", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_base_directory,
+ { "base directory: len", "table_print.base_directory", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_classpath_extension,
+ { "classpath extension: len", "table_print.classpath_extension", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_initial_class,
+ { "initial class", "table_print.initial_class", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_label,
+ { "label", "table_print.label", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_priority_value,
+ { "priority value", "table_print.priority_value", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_transparency_value,
+ { "transparancy value", "table_print.transparancy_value", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_common_descriptor_length,
+ { "common descriptor length", "table_print.common_descriptor_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_common_descriptors,
+ { "common descriptors", "table_print.common_descriptors", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_Application_loop_length,
+ { "Application loop length", "table_print.Application_loop_length", FT_UINT16, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_organization_id,
+ { "organization id", "table_print.organization_id", FT_UINT32, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_application_id,
+ { "application id", "table_print.application_id", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_application_control_code,
+ { "application control code", "table_print.application_control_code", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_application_descriptor_len,
+ { "application descriptor length", "table_print.application_descriptor_len", FT_UINT16, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_Application_descriptor,
+ { "application descriptors", "table_print.table_descriptor", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_DAY,
+ { "day (MJD)", "table_print.DAY", FT_UINT16, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_UNIX_time,
+ { "UNIX time", "table_print.UNIX_time", FT_UINT16, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_transport_stream_id,
+ { "transport stream id", "table_print.transport_stream_id", FT_UINT16, BASE_HEX, NULL, 0x0, " ",HFILL} },
+ { &hf_original_network_id,
+ { "original network id", "table_print.original_network_id", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_segment_last_section_number,
+ { "segment last section number", "table_print.segment_last_section_number", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_last_label_id,
+ { "last label id", "table_print.last_label_id", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_event_loop,
+ { "event", "table_print.event_loop", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_duration,
+ { "duration", "table_print.duration", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL } },
+ { &hf_start_time,
+ { "start time", "table_print.start_time", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_event_id,
+ { "event id", "table_print.event_id", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL } },
+ { &hf_CA_system_id,
+ { "CA system id", "table_print.CA_system_id", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_content_nibble_level1,
+ { "content nibble level1", "table_print.content_nibble_level1", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_content_nibble_level2,
+ { "content nibble level2", "table_print.content_nibble_level2", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_user_nibble,
+ { "user nibble", "table_print.user_nibble", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_country_code,
+ { "country code", "table_print", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_rating,
+ { "rating", "table_print.rating", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_foreign_availability,
+ { "foreign availability", "table_print.foreign_availability", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_connection_type,
+ { "connection type", "table_print.connection_type", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_country_prefix_length,
+ { "country prefix length", "table_print.country_prefix_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_international_area_code_length,
+ { "international area code length", "table_print.international_area_code_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_operator_code_length,
+ { "operator code length", "table_print.operator_code_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_national_area_code_length,
+ { "national area code length", "table_print.national_area_code_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_core_number_length,
+ { "core number length", "table_print.core_number_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_info_msg,
+ { "***INFO MSG***", "table_print.err_msg", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_download_id,
+ { "download id", "table_print.download_id", FT_UINT32, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_block_sz,
+ { "block size", "table_print.block_sz", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_window_sz,
+ { "window size", "table_print.window_sz", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_ack_period,
+ { "ack period", "table_print.ack_period", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_tc_dl_window,
+ { "tc dl window","table_print.tc_dl_window", FT_UINT32, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_tc_dl_scenario,
+ { "tc dl scenario", "table_print.tc_dl_window", FT_UINT32, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_compability_descr_length,
+ { "compabilitiy descr length", "table_print.compabilitiy_descr_length", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_compability_descr,
+ { "compabilitiy descriptor", "table_print.compabilitiy_descr", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_number_of_modules,
+ { "number of modules", "table_print.number_of_modules", FT_UINT16, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_module,
+ { "module", "table_print.module", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_module_id,
+ { "module id", "table_print.module_id", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_module_sz,
+ { "module size", "table_print.module_sz", FT_UINT32, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_module_info,
+ { "module info", "table_print.module_info", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_module_timeout,
+ { "module timeout", "table_print.module_timeout", FT_UINT32, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_block_timeout,
+ { "block timeout", "table_print.block_timeout", FT_UINT32, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_min_block_time,
+ { "min. block time", "table_print.min_block_time", FT_UINT32, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_taps_count,
+ { "download taps count", "table_print.taps_count", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_usr_info_len,
+ { "user info length", "table_print.usr_info_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_private_data_length,
+ { "private data length", "table_print.private_data_length", FT_UINT16, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_module_version,
+ { "module version", "table_print.module_version", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_module_info_length,
+ { "module info length", "table_print.module_info_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_tap,
+ { "tap", "table_print.tap", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL } },
+ { &hf_selector_type,
+ { "selector type", "table_print.selector_type", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL } },
+ { &hf_tap_id,
+ { "id", "table_print.tap_id", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL } },
+ { &hf_tap_use,
+ { "use", "table_print.use", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL } },
+ { &hf_server_id,
+ { "server id", "table_print.server_id", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL } },
+ { &hf_service_gateway_info,
+ { "service gateway info", "table_print.service_gateway_info", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL } },
+ { &hf_download_taps_count,
+ { "download taps count", "table_print.download_taps_count", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_service_context_list_count,
+ { "service context list count", "table_print.service_context_list_count", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_IOP_IOR,
+ { "IOP::IOR", "table_print.IOP_IOR", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_type_id_len,
+ { "type id len", "table_print.type_id_len", FT_UINT32, BASE_HEX, NULL, 0x0, " ", HFILL } },
+ { &hf_alignment_gap,
+ { "alignment gap", "table_print.alignemnt_gap", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_tagged_profiles_count,
+ { "tagged profiles count", "table_print.tagged_profiles_count", FT_UINT32, BASE_DEC,NULL, 0x0, " ", HFILL} },
+ { &hf_IOP_IOR_id,
+ { "id", "table_print.IOP_IOR_id", FT_UINT32, BASE_HEX,NULL, 0x0, " ", HFILL} },
+ { &hf_profile_id_tag,
+ { "profile id tag", "table_print.profile_id_tag", FT_UINT32, BASE_HEX,NULL, 0x0, " ", HFILL} },
+ { &hf_profile_data_len,
+ { "progile data len", "table_print.profile_data_len", FT_UINT32, BASE_DEC, NULL,0x0, " ", HFILL} },
+ { &hf_byte_order,
+ { "byte order", "table_print.byte_order", FT_UINT8, BASE_HEX,NULL, 0x0, " ", HFILL} },
+ { &hf_lite_components_count,
+ { "lite components count", "table_print.lite_components_counts", FT_UINT8, BASE_DEC,NULL, 0x0, " ", HFILL} },
+ { &hf_component_data_len,
+ { "component data len", "table_print.component_data_len", FT_UINT8, BASE_DEC, NULL,0x0, " ", HFILL } },
+ { &hf_version,
+ { "version", "table_print.version", FT_STRING, BASE_NONE, NULL,0x0, " ", HFILL} },
+ { &hf_object_key_len,
+ { "object key len", "table_print.object_key_len", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_service_context_id,
+ { "service context id", "table_print.service_context_id", FT_UINT32, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_data_len,
+ { "data len", "table_print.data_len", FT_UINT16, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_download_data_block,
+ { "download data block", "table_print.download_data_block", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_block_number,
+ { "block number", "table_print.block_number", FT_UINT16, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_BIOP_message,
+ { "BIOP message", "table_print.BIOP_message", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_magic,
+ { "magic", "table_print.magic", FT_UINT32, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_BIOP_version,
+ { "BIOP version", "table_print.BIOP_version", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_message_type,
+ { "message type", "table_print.message_type", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_message_size,
+ { "message size", "table_print.message_size", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_object_key,
+ { "object key len", "table_print.object_key", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_object_kind_len,
+ { "object kind len", "table_print.object_kind_len", FT_UINT32, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_object_kind,
+ { "object kind", "table_print.object_kind", FT_UINT32, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_object_info_len,
+ { "object info len", "table_print.object_info_len", FT_UINT16, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_content_size,
+ { "content size", "table_print.content_size", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_message_body_len,
+ { "message body len", "table_print.message_body_len", FT_UINT32, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_content_length,
+ { "content length", "table_print.content_length", FT_UINT32, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_bindings_count,
+ { "bindings count", "table_print.bindings_count", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_binding,
+ { "Binding", "table_print.binding", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_binding_type,
+ { "binding type", "table_print.binding_type", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_end_binding,
+ { "end binding", "table_print.end_binding", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_name_components_count,
+ { "name components count", "table_print.name_components_count", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_kind_len,
+ { "kind len", "table_print.kind_len", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_BIOP_id,
+ { "id len", "table_print.BIOP_id", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_stream_content,
+ { "stream content", "table_print.stream_content", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_programme_identification_label,
+ { "programme identifaction label", "table_print.programme_identification_label", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_teletext_type,
+ { "teletext type", "table_print.teletext_type", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_teletext_magazine_number,
+ { "teletext magazine number", "table_print.teletext_magazine_number", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_teletext_page_number,
+ { "teletext page number", "table_print.teletext_page_number", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_data_service_id,
+ { "data service id", "table_print.data_service_id", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_data_service_descriptor_length,
+ { "data service descriptor length", "table_print.data_service_descriptor_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_field_parity,
+ { "field parity", "table_print.field_parity", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_line_offset,
+ { "line offset", "table_print.line_offset", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_audo_type,
+ { "audio type", "table_print.audio_type", FT_UINT8, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_leak_valid_flag,
+ { "leak valid rate", "table_print.leak_valid_rate", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_format_identifier,
+ { "format identifier", "table_print.format_identifier", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_additional_identification_info,
+ { "additional identifaction info", "table_print.additional_identification_info", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_country_availability_flag,
+ { "country availability flag", "table_print.country_availability_flag", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_priv_data_spec,
+ { "private data specifier", "table_print.private_data_spec", FT_UINT32, BASE_HEX, NULL, 0x0, " ", HFILL } },
+ { &hf_coding_type,
+ { "coding type", "table_print.coding_typw", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_centre_frequency,
+ { "centre frequency", "table_print.centre_frequency", FT_UINT32, BASE_HEX, NULL, 0x0, " ", HFILL } },
+ { &hf_country_region_id,
+ { "country region id (time zone)", "table_print.country_region", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_local_time_offset_polarity,
+ { "local time offset polarity", "table_print.local_time_offset_polarity", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_time_of_change,
+ { "time of change", "table_print.time_of_change", FT_NONE, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_local_time_offset,
+ { "local time offset", "table_print.local_time_offset", FT_UINT16, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_next_time_offset,
+ { "next time offset", "table_print.next_time_offset", FT_UINT16, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_mosaic_entry_point,
+ { "mosaic entry point", "table_print.mosaic_entry_point", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_nohec,
+ { "nr. of hor. elem. cells", "table_print.nohec", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_novec,
+ { "nr. of ver. elem. cells", "table_print.novec", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_log_cell_pres_nfo,
+ { "logical cell presentation info", "table_print.log_cell_pres_nfo", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_el_cell_fl,
+ { "elem. cell field length", "table_print.el_cell_fl", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_el_cell_id,
+ { "elem. cell id", "table_print.el_cell_id", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_log_cell_id,
+ { "logical cell id", "table_print.log_cell_id", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_bouquet_name_length,
+ { "bouquet name length", "table_print.bouquet_name_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_network_name_length,
+ { "network name length", "table_print.network_name_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_service_provider_name_length,
+ { "service provider name length", "table_print.service_provider_name_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_service_name_length,
+ { "service name length", "table_print.service_name_length", FT_UINT8, BASE_DEC, NULL, 0x0, " ", HFILL} },
+ { &hf_CA_PID,
+ { "CA PID", "table_print.CA_PID", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} }
+ };
+
+
+
+/* Setup protocol subtree array */
+ static gint *ett[] = {
+ &ett_table_print
+ };
+
+
+/* Register the protocol name and description */
+ proto_table_print = proto_register_protocol("MPEG2 table printer",
+ "table", "MPEG2_table_printer");
+
+/* Required function calls to register the header fields and subtrees used */
+ proto_register_field_array(proto_table_print, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+ register_dissector("table_print", dissect_print_table, proto_table_print);
+ }
+
+
+/* If this dissector uses sub-dissector registration add a registration routine.
+ This format is requpacket-table_print.cired because a script is used to find these routines and
+ create the code that calls these routines.
+*/
+void
+proto_reg_handoff_print_table(void)
+{
+ ip_handle = find_dissector("ip");
+ llc_handle = find_dissector("llc");
+}
diff -ruN ethereal-0.10.7/epan/dissectors/packet-ule.c ethereal-0.10.7_mpeg2_recent/epan/dissectors/packet-ule.c
--- ethereal-0.10.7/epan/dissectors/packet-ule.c 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/epan/dissectors/packet-ule.c 2004-12-02 16:14:19.197755673 +0100
@@ -0,0 +1,171 @@
+/* packet-ule.c
+ * Routines for ULE SNDU dissection
+ * Copyright 200, Lutz Findeisen <lfindeis@xxxxxxxxxxxxxx>
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <glib.h>
+
+#ifdef NEED_SNPRINTF_H
+# include "snprintf.h"
+#endif
+//#include "dvb_crc32_table.h"
+#include <epan/packet.h>
+
+typedef guint32 dvb_CRC32_t;
+
+/* IF PROTO exposes code to other dissectors, then it must be exported
+ in a header file. If not, a header file is not needed at all. */
+
+
+/* Initialize the protocol and registered fields */
+static int proto_ule = -1;
+static int hf_ule_D = -1;
+static int hf_ule_length = -1;
+static int hf_ule_protocol_type = -1;
+static int hf_ule_MAC_address_flag = -1;
+static int hf_ule_MAC_address = -1;
+static int hf_ule_CRC32 = -1;
+
+/* Initialize the subtree pointers */
+static gint ett_ule = -1;
+tvbuff_t *next_tvb;
+extern dvb_CRC32_t dvb_crc32_calc( const unsigned char *sectbuf, unsigned int size );
+
+static dissector_handle_t ip_handle, ipv6_handle, ether_handle, mpls_handle;
+
+/* Code to actually dissect the packets */
+static void
+dissect_ule(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+
+/* Set up structures needed to add the protocol subtree and manage it */
+ proto_item *ti;
+ proto_tree *ule_tree;
+ guint8 offset = 0;
+ guchar *ulebuf, MAC_full[6];
+ guint16 len = 0, ule_type;
+ gulong ule_crc32 = 0L, calc_crc32 = 0L;
+
+
+
+ if (tree) {
+
+
+ ti = proto_tree_add_item(tree, proto_ule, tvb, 0, -1, FALSE);
+
+ ule_tree = proto_item_add_subtree(ti, ett_ule);
+ ulebuf = (guchar *)tvb_get_ptr(tvb,0,3);
+ len = (((ulebuf[0] & 0x7f) << 8) | (ulebuf[1]));
+ proto_tree_add_uint(ule_tree, hf_ule_length, tvb, 0,2,len);
+ proto_tree_add_uint(ule_tree, hf_ule_protocol_type, tvb, 2,2, ule_type = ((ulebuf[2] << 8) | ulebuf[3]));
+ proto_tree_add_string(ule_tree, hf_ule_MAC_address_flag,tvb, 0, 1, (ulebuf[0] & 0x80) ? "absent (D-bit: 1)": "present (D-bit: 0)");
+ if (! (ulebuf[0] & 0x80)) {
+ // MAC address is present, if D-bit is _not_ set.
+ gint i;
+ for(i = 0; i < 6; i++)
+ MAC_full[i] = ulebuf[4+i];
+ proto_tree_add_ether(ule_tree, hf_ule_MAC_address, tvb,4,6 , MAC_full);
+ }
+ next_tvb = tvb_new_subset(tvb, 4, len, len);
+ switch(ule_type)
+ {
+ case 0x0800: call_dissector(ip_handle, next_tvb, pinfo, ule_tree); break;
+ case 0x86DD: call_dissector(ipv6_handle, next_tvb, pinfo,ule_tree); break;
+ case 0x8847: call_dissector(mpls_handle, next_tvb, pinfo, ule_tree); break;
+ case 0x0001: call_dissector(ether_handle, next_tvb,pinfo, ule_tree); break;
+ default: break;
+ }
+
+ proto_tree_add_uint(ule_tree, hf_ule_D, tvb, offset,0 , FALSE);
+ ulebuf = (guchar *)tvb_get_ptr(tvb,0, tvb_length(tvb));
+ ule_crc32 = g_ntohl( *((gulong *)(ulebuf + len + 4 - 4)) );
+ calc_crc32 = dvb_crc32_calc( ulebuf, len + 4 - 4 );
+ ti = proto_tree_add_uint(ule_tree, hf_ule_CRC32, tvb, (tvb_length(tvb) - 4), 4, ule_crc32);
+ proto_item_append_text(ti, ", verifiction: %s (0x%08x) ", (ule_crc32 == calc_crc32) ? "OK" : "FAILED!" , calc_crc32);
+
+
+
+
+
+
+ }
+
+/* If this protocol has a sub-dissector call it here, see section 1.8 */
+}
+
+
+/* Register the protocol with Ethereal */
+
+/* this format is require because a script is used to build the C function
+ that calls all the protocol registration.
+*/
+
+void
+proto_register_ule(void)
+{
+
+/* Setup list of header fields See Section 1.6.1 for details*/
+ static hf_register_info hf[] = {
+ { &hf_ule_D,
+ { "Destination address present field","ule.ule_D", FT_UINT8, BASE_DEC, NULL, 0x0," ", HFILL } },
+ { &hf_ule_length,
+ { "SNDU length", "ule.ule_length", FT_UINT16, BASE_DEC, NULL, 0x0, " ", HFILL } },
+ { &hf_ule_CRC32,
+ { "ULE crc32", "ule.ule_crc32", FT_UINT32, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_ule_protocol_type,
+ { "ULE protocol type", "ule.ule_protocol_type", FT_UINT16, BASE_HEX, NULL, 0x0, " ", HFILL} },
+ { &hf_ule_MAC_address_flag,
+ { "ULE Dest MAC addr", "ule.ule_MAC_adress_flag", FT_STRING, BASE_NONE, NULL, 0x0, " ", HFILL} },
+ { &hf_ule_MAC_address,
+ { "MAC adress", "ule.ule_MAC_adress", FT_ETHER, BASE_NONE, NULL, 0x0, " ", HFILL} }
+ };
+
+/* Setup protocol subtree array */
+ static gint *ett[] = {
+ &ett_ule,
+ };
+
+/* Register the protocol name and description */
+ proto_ule = proto_register_protocol("Ultra light weight encapsulation", "MPEG2-ULE", "MPEG2-ULE");
+
+/* Required function calls to register the header fields and subtrees used */
+ proto_register_field_array(proto_ule, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+ register_dissector("ule", dissect_ule, proto_ule);
+}
+void
+proto_reg_handoff_ule(void)
+{
+ ip_handle = find_dissector("ip");
+ ipv6_handle = find_dissector("ipv6");
+ ether_handle = find_dissector("ether");
+ mpls_handle = find_dissector("mpls");
+}
diff -ruN ethereal-0.10.7/epan/Makefile.common ethereal-0.10.7_mpeg2_recent/epan/Makefile.common
--- ethereal-0.10.7/epan/Makefile.common 2004-10-21 00:35:04.000000000 +0200
+++ ethereal-0.10.7_mpeg2_recent/epan/Makefile.common 2004-12-02 16:14:19.198755523 +0100
@@ -136,5 +136,8 @@
../h225-persistentdata.c \
../ptvcursor.c \
../reassemble.c \
- ../xmlstub.c
+ ../xmlstub.c \
+ ../mpeg2_convenience_routines.c \
+ ../mpeg2_descriptors.c \
+ ../mpeg2_psi.c
diff -ruN ethereal-0.10.7/gtk/file_dlg.c ethereal-0.10.7_mpeg2_recent/gtk/file_dlg.c
--- ethereal-0.10.7/gtk/file_dlg.c 2004-10-21 00:34:29.000000000 +0200
+++ ethereal-0.10.7_mpeg2_recent/gtk/file_dlg.c 2004-12-02 16:18:55.221229119 +0100
@@ -58,7 +58,6 @@
#endif
#include "merge.h"
#include "util.h"
-
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -66,6 +65,16 @@
#ifdef HAVE_IO_H
#include <io.h> /* open/close on win32 */
#endif
+/**
+ * Imported from packet-mpeg2.c
+ */
+#ifdef __GNUC__
+#define IMPORT_VAR extern
+#elif defined(_WIN32)
+#define IMPORT_VAR __declspec(dllimport)
+#endif
+IMPORT_VAR gboolean do_ule;
+IMPORT_VAR GSList *PID_list;
static void file_open_ok_cb(GtkWidget *w, gpointer fs);
static void file_open_destroy_cb(GtkWidget *win, gpointer user_data);
@@ -79,6 +88,9 @@
static void file_color_export_ok_cb(GtkWidget *w, gpointer fs);
static void file_color_export_destroy_cb(GtkWidget *win, gpointer user_data);
static void set_file_type_list(GtkWidget *option_menu);
+static void set_do_ule(GtkWidget *w, gpointer user_data);
+static void entrytxt_to_str(GtkWidget *w, gpointer data);
+static void do_ule_te_syntax_check(GtkWidget *w);
#define E_FILE_M_RESOLVE_KEY "file_dlg_mac_resolve_key"
#define E_FILE_N_RESOLVE_KEY "file_dlg_network_resolve_key"
@@ -434,7 +446,8 @@
file_open_cmd(GtkWidget *w)
{
GtkWidget *main_hb, *main_vb, *filter_hbox, *filter_bt, *filter_te,
- *m_resolv_cb, *n_resolv_cb, *t_resolv_cb, *prev;
+ *m_resolv_cb, *n_resolv_cb, *t_resolv_cb, *prev, *do_ule_cb, *do_ule_te,
+ *do_ule_hbox, *do_ule_lbl;
#if GTK_MAJOR_VERSION < 2
GtkAccelGroup *accel_group;
#endif
@@ -564,6 +577,33 @@
E_FILE_T_RESOLVE_KEY, t_resolv_cb);
#endif
+ do_ule_cb = CHECK_BUTTON_NEW_WITH_MNEMONIC("Enable MPEG2 _ULE SNDU analyzation", accel_group);
+ do_ule_te = gtk_entry_new();
+ gtk_entry_set_editable(do_ule_te, FALSE);
+ SIGNAL_CONNECT(do_ule_te, "changed", do_ule_te_syntax_check, NULL);
+ gtk_box_pack_start(GTK_BOX(main_vb), do_ule_cb, FALSE, FALSE, 0);
+ do_ule = FALSE;
+ SIGNAL_CONNECT(do_ule_cb, "clicked", set_do_ule, do_ule_te);
+ gtk_widget_show(do_ule_cb);
+
+ do_ule_hbox = gtk_hbox_new(FALSE, 1);
+ gtk_container_border_width(GTK_CONTAINER(do_ule_hbox), 0);
+ gtk_box_pack_start(GTK_BOX(main_vb), do_ule_hbox, FALSE, FALSE, 0);
+ gtk_widget_show(do_ule_hbox);
+ do_ule_lbl = gtk_label_new("ULE PID:");
+
+
+#if !((GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2)
+ SIGNAL_CONNECT(GTK_FILE_SELECTION(file_open_w)->ok_button, "clicked", entrytxt_to_str,
+ do_ule_te);
+#endif
+
+ /*OBJECT_SET_DATA(filter_bt, E_FILT_TE_PTR_KEY, filter_te);*/
+ gtk_box_pack_start(GTK_BOX(do_ule_hbox), do_ule_lbl, TRUE, TRUE, 3);
+ gtk_box_pack_start(GTK_BOX(do_ule_hbox), do_ule_te, TRUE,TRUE, 3);
+ /*SIGNAL_CONNECT(filter_te, "changed", filter_te_syntax_check_cb, NULL);*/
+ gtk_widget_show(do_ule_lbl);
+ gtk_widget_show(do_ule_te);
SIGNAL_CONNECT(file_open_w, "destroy", file_open_destroy_cb, NULL);
@@ -582,6 +622,7 @@
OBJECT_GET_DATA(w, E_DFILTER_TE_KEY));
if (gtk_dialog_run(GTK_DIALOG(file_open_w)) == GTK_RESPONSE_ACCEPT)
{
+ entrytxt_to_str(NULL,do_ule_te);
file_open_ok_cb(file_open_w, file_open_w);
}
else window_destroy(file_open_w);
@@ -1811,3 +1852,50 @@
{
file_color_export_w = NULL;
}
+static void set_do_ule(GtkWidget *w, gpointer user_data)
+{
+ do_ule = do_ule ? FALSE : TRUE;
+ gtk_entry_set_editable(GTK_ENTRY(user_data), do_ule);
+}
+static void entrytxt_to_str(GtkWidget *w, gpointer data)
+{
+ gchar *entrytxt;
+ GSList *test_list = NULL;
+ long int_PID = 0;
+ entrytxt = (guchar *)gtk_entry_get_text(GTK_ENTRY(data));
+ if(*entrytxt == '\0')
+ return;
+ while(*entrytxt)
+ {
+ int_PID = strtoul(entrytxt, &entrytxt,0);
+ /* Because ULE will never come on PId = 0 there is no need to do error handling
+ if strtoul() returns 0 on an error just don't append the value to the GSList*/
+ if(int_PID != 0)
+ test_list = g_slist_append(test_list, GUINT_TO_POINTER(int_PID));
+ else
+ return;
+ }
+ PID_list = g_slist_copy(test_list);
+ return;
+}
+static void do_ule_te_syntax_check(GtkWidget *w)
+{
+ gchar *strval = (guchar *)gtk_entry_get_text(GTK_ENTRY(w));
+ long int_PID;
+ if (*strval == '\0')
+ colorize_filter_te_as_empty(w);
+ while(*strval)
+ {
+ int_PID = strtoul(strval, &strval,0);
+
+ if((int_PID != 0) && (int_PID < 0x1FFF))
+ colorize_filter_te_as_valid(w);
+ else
+ {
+ colorize_filter_te_as_invalid(w);
+ break;
+ }
+ }
+
+ return;
+}
diff -ruN ethereal-0.10.7/gtk/file_dlg.c.orig ethereal-0.10.7_mpeg2_recent/gtk/file_dlg.c.orig
--- ethereal-0.10.7/gtk/file_dlg.c.orig 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/gtk/file_dlg.c.orig 2004-10-21 00:34:29.000000000 +0200
@@ -0,0 +1,1813 @@
+/* file_dlg.c
+ * Dialog boxes for handling files
+ *
+ * $Id: file_dlg.c 12341 2004-10-18 15:14:13Z gerald $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <string.h>
+
+#include <gtk/gtk.h>
+
+#include "packet-range.h"
+#include <epan/filesystem.h>
+
+#include "globals.h"
+#include "gtkglobals.h"
+#include <epan/addr_resolv.h>
+#include "keys.h"
+#include "filter_dlg.h"
+#include "ui_util.h"
+#include "alert_box.h"
+#include "simple_dialog.h"
+#include "menu.h"
+#include "dlg_utils.h"
+#include "file_dlg.h"
+#include "main.h"
+#include "compat_macros.h"
+#include <epan/prefs.h>
+#include "recent.h"
+#include "color.h"
+#include "../ui_util.h"
+#include "color_filters.h"
+#include "gtk/color_dlg.h"
+#ifdef HAVE_LIBPCAP
+#include "capture_dlg.h"
+#include "range_utils.h"
+#endif
+#include "merge.h"
+#include "util.h"
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_IO_H
+#include <io.h> /* open/close on win32 */
+#endif
+
+static void file_open_ok_cb(GtkWidget *w, gpointer fs);
+static void file_open_destroy_cb(GtkWidget *win, gpointer user_data);
+static void file_merge_ok_cb(GtkWidget *w, gpointer fs);
+static void file_merge_destroy_cb(GtkWidget *win, gpointer user_data);
+static void select_file_type_cb(GtkWidget *w, gpointer data);
+static void file_save_as_ok_cb(GtkWidget *w, gpointer fs);
+static void file_save_as_destroy_cb(GtkWidget *win, gpointer user_data);
+static void file_color_import_ok_cb(GtkWidget *w, gpointer fs);
+static void file_color_import_destroy_cb(GtkWidget *win, gpointer user_data);
+static void file_color_export_ok_cb(GtkWidget *w, gpointer fs);
+static void file_color_export_destroy_cb(GtkWidget *win, gpointer user_data);
+static void set_file_type_list(GtkWidget *option_menu);
+
+#define E_FILE_M_RESOLVE_KEY "file_dlg_mac_resolve_key"
+#define E_FILE_N_RESOLVE_KEY "file_dlg_network_resolve_key"
+#define E_FILE_T_RESOLVE_KEY "file_dlg_transport_resolve_key"
+
+#define E_MERGE_PREPEND_KEY "merge_dlg_prepend_key"
+#define E_MERGE_CHRONO_KEY "merge_dlg_chrono_key"
+#define E_MERGE_APPEND_KEY "merge_dlg_append_key"
+
+#define ARGUMENT_CL "argument_cl"
+
+
+#define PREVIEW_TABLE_KEY "preview_table_key"
+#define PREVIEW_FILENAME_KEY "preview_filename_key"
+#define PREVIEW_FORMAT_KEY "preview_format_key"
+#define PREVIEW_SIZE_KEY "preview_size_key"
+#define PREVIEW_ELAPSED_KEY "preview_elapsed_key"
+#define PREVIEW_PACKETS_KEY "preview_packets_key"
+#define PREVIEW_FIRST_KEY "preview_first_key"
+
+
+/*
+ * Keep a static pointer to the current "Save Capture File As" window, if
+ * any, so that if somebody tries to do "File:Save" or "File:Save As"
+ * while there's already a "Save Capture File As" window up, we just pop
+ * up the existing one, rather than creating a new one.
+ */
+static GtkWidget *file_save_as_w;
+
+/* XXX - can we make these not be static? */
+static packet_range_t range;
+static gboolean color_marked;
+static int filetype;
+static GtkWidget *cfmark_cb;
+static GtkWidget *ft_om;
+static GtkWidget *range_tb;
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#define PREVIEW_STR_MAX 200
+
+static double
+secs_usecs( guint32 s, guint32 us)
+{
+ return (us / 1000000.0) + (double)s;
+}
+
+
+/* set a new filename for the preview widget */
+static wtap *
+preview_set_filename(GtkWidget *prev, const gchar *cf_name)
+{
+ GtkWidget *label;
+ wtap *wth;
+ int err = 0;
+ gchar *err_info;
+ struct stat cf_stat;
+ gchar string_buff[PREVIEW_STR_MAX];
+ guint64 filesize;
+
+
+ /* init preview labels */
+ label = OBJECT_GET_DATA(prev, PREVIEW_FILENAME_KEY);
+ gtk_label_set_text(GTK_LABEL(label), "-");
+ label = OBJECT_GET_DATA(prev, PREVIEW_FORMAT_KEY);
+ gtk_label_set_text(GTK_LABEL(label), "-");
+ label = OBJECT_GET_DATA(prev, PREVIEW_SIZE_KEY);
+ gtk_label_set_text(GTK_LABEL(label), "-");
+ label = OBJECT_GET_DATA(prev, PREVIEW_ELAPSED_KEY);
+ gtk_label_set_text(GTK_LABEL(label), "-");
+ label = OBJECT_GET_DATA(prev, PREVIEW_PACKETS_KEY);
+ gtk_label_set_text(GTK_LABEL(label), "-");
+ label = OBJECT_GET_DATA(prev, PREVIEW_FIRST_KEY);
+ gtk_label_set_text(GTK_LABEL(label), "-");
+
+ if(!cf_name) {
+ return FALSE;
+ }
+
+ label = OBJECT_GET_DATA(prev, PREVIEW_FILENAME_KEY);
+ gtk_label_set_text(GTK_LABEL(label), get_basename((char *)cf_name));
+
+ if (test_for_directory(cf_name) == EISDIR) {
+ label = OBJECT_GET_DATA(prev, PREVIEW_FORMAT_KEY);
+ gtk_label_set_text(GTK_LABEL(label), "directory");
+ return FALSE;
+ }
+
+ wth = wtap_open_offline(cf_name, &err, &err_info, TRUE);
+ if (wth == NULL) {
+ label = OBJECT_GET_DATA(prev, PREVIEW_FORMAT_KEY);
+ if(err == WTAP_ERR_FILE_UNKNOWN_FORMAT) {
+ gtk_label_set_text(GTK_LABEL(label), "unknown file format");
+ } else {
+ gtk_label_set_text(GTK_LABEL(label), "error opening file");
+ }
+ return FALSE;
+ }
+
+ /* Find the size of the file. */
+ if (fstat(wtap_fd(wth), &cf_stat) < 0) {
+ wtap_close(wth);
+ return FALSE;
+ }
+
+ /* size */
+ filesize = cf_stat.st_size;
+ g_snprintf(string_buff, PREVIEW_STR_MAX, "%" PRIu64 " bytes", filesize);
+ label = OBJECT_GET_DATA(prev, PREVIEW_SIZE_KEY);
+ gtk_label_set_text(GTK_LABEL(label), string_buff);
+
+ /* type */
+ g_snprintf(string_buff, PREVIEW_STR_MAX, "%s", wtap_file_type_string(wtap_file_type(wth)));
+ label = OBJECT_GET_DATA(prev, PREVIEW_FORMAT_KEY);
+ gtk_label_set_text(GTK_LABEL(label), string_buff);
+
+ return wth;
+}
+
+
+/* do a preview run on the currently selected capture file */
+static void
+preview_do(GtkWidget *prev, wtap *wth)
+{
+ GtkWidget *label;
+ unsigned int elapsed_time;
+ time_t time_preview;
+ time_t time_current;
+ int err = 0;
+ gchar *err_info;
+ long data_offset;
+ const struct wtap_pkthdr *phdr;
+ double start_time = 0; /* seconds, with msec resolution */
+ double stop_time = 0; /* seconds, with msec resolution */
+ double cur_time;
+ unsigned int packets = 0;
+ gboolean is_breaked = FALSE;
+ gchar string_buff[PREVIEW_STR_MAX];
+ time_t ti_time;
+ struct tm *ti_tm;
+
+
+ time(&time_preview);
+ while ( (wtap_read(wth, &err, &err_info, &data_offset)) ) {
+ phdr = wtap_phdr(wth);
+ cur_time = secs_usecs(phdr->ts.tv_sec, phdr->ts.tv_usec);
+ if(packets == 0) {
+ start_time = cur_time;
+ stop_time = cur_time;
+ }
+ if (cur_time < start_time) {
+ start_time = cur_time;
+ }
+ if (cur_time > stop_time){
+ stop_time = cur_time;
+ }
+
+ packets++;
+ if(packets%1000) {
+ /* do we have a timeout? */
+ time(&time_current);
+ if(time_current-time_preview >= (time_t) prefs.gui_fileopen_preview) {
+ is_breaked = TRUE;
+ break;
+ }
+ }
+ }
+
+ if(err != 0) {
+ g_snprintf(string_buff, PREVIEW_STR_MAX, "error after reading %u packets", packets);
+ label = OBJECT_GET_DATA(prev, PREVIEW_PACKETS_KEY);
+ gtk_label_set_text(GTK_LABEL(label), string_buff);
+ wtap_close(wth);
+ return;
+ }
+
+ /* packet count */
+ if(is_breaked) {
+ g_snprintf(string_buff, PREVIEW_STR_MAX, "more than %u packets (preview timeout)", packets);
+ } else {
+ g_snprintf(string_buff, PREVIEW_STR_MAX, "%u", packets);
+ }
+ label = OBJECT_GET_DATA(prev, PREVIEW_PACKETS_KEY);
+ gtk_label_set_text(GTK_LABEL(label), string_buff);
+
+ /* first packet */
+ ti_time = (long)start_time;
+ ti_tm = localtime( &ti_time );
+ g_snprintf(string_buff, PREVIEW_STR_MAX,
+ "%04d-%02d-%02d %02d:%02d:%02d",
+ ti_tm->tm_year + 1900,
+ ti_tm->tm_mon + 1,
+ ti_tm->tm_mday,
+ ti_tm->tm_hour,
+ ti_tm->tm_min,
+ ti_tm->tm_sec);
+ label = OBJECT_GET_DATA(prev, PREVIEW_FIRST_KEY);
+ gtk_label_set_text(GTK_LABEL(label), string_buff);
+
+ /* elapsed time */
+ elapsed_time = (unsigned int)(stop_time-start_time);
+ if(elapsed_time/86400) {
+ g_snprintf(string_buff, PREVIEW_STR_MAX, "%02u days %02u:%02u:%02u",
+ elapsed_time/86400, elapsed_time%86400/3600, elapsed_time%3600/60, elapsed_time%60);
+ } else {
+ g_snprintf(string_buff, PREVIEW_STR_MAX, "%02u:%02u:%02u",
+ elapsed_time%86400/3600, elapsed_time%3600/60, elapsed_time%60);
+ }
+ if(is_breaked) {
+ g_snprintf(string_buff, PREVIEW_STR_MAX, "unknown");
+ }
+ label = OBJECT_GET_DATA(prev, PREVIEW_ELAPSED_KEY);
+ gtk_label_set_text(GTK_LABEL(label), string_buff);
+
+ wtap_close(wth);
+}
+
+#if 0
+/* as the dialog layout will look very ugly when using the file chooser preview mechanism,
+ simply use the same layout as in GTK1 */
+/* (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2 */
+static void
+update_preview_cb (GtkFileChooser *file_chooser, gpointer data)
+{
+ GtkWidget *prev = GTK_WIDGET (data);
+ char *cf_name;
+ gboolean have_preview;
+
+ cf_name = gtk_file_chooser_get_preview_filename (file_chooser);
+
+ have_preview = preview_set_filename(prev, cf_name);
+
+ g_free (cf_name);
+
+ have_preview = TRUE;
+ gtk_file_chooser_set_preview_widget_active (file_chooser, have_preview);
+}
+#endif
+
+
+/* the filename text entry changed */
+static void
+file_open_entry_changed(GtkWidget *w _U_, gpointer file_sel)
+{
+ GtkWidget *prev = OBJECT_GET_DATA(file_sel, PREVIEW_TABLE_KEY);
+ const gchar* cf_name;
+ gboolean have_preview;
+ wtap *wth;
+
+ /* get the filename */
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ cf_name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(file_sel));
+#else
+ cf_name = gtk_file_selection_get_filename(GTK_FILE_SELECTION(file_sel));
+#endif
+
+ /* set the filename to the preview */
+ wth = preview_set_filename(prev, cf_name);
+ have_preview = (gboolean) wth;
+
+ /* make the preview widget sensitive */
+ gtk_widget_set_sensitive(prev, have_preview);
+
+ /* make the open/save/... dialog button sensitive */
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ gtk_dialog_set_response_sensitive(file_sel, GTK_RESPONSE_ACCEPT, have_preview);
+#else
+ gtk_widget_set_sensitive(GTK_FILE_SELECTION(file_sel)->ok_button, have_preview);
+#endif
+
+ /* do the actual preview */
+ if(have_preview)
+ preview_do(prev, wth);
+}
+
+
+/* copied from summary_dlg.c */
+static GtkWidget *
+add_string_to_table_sensitive(GtkWidget *list, guint *row, gchar *title, gchar *value, gboolean sensitive)
+{
+ GtkWidget *label;
+ gchar *indent;
+
+ if(strlen(value) != 0) {
+ indent = g_strdup_printf(" %s", title);
+ } else {
+ indent = g_strdup(title);
+ }
+ label = gtk_label_new(indent);
+ g_free(indent);
+ gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
+ gtk_widget_set_sensitive(label, sensitive);
+ gtk_table_attach_defaults(GTK_TABLE(list), label, 0, 1, *row, *row+1);
+
+ label = gtk_label_new(value);
+ gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
+ gtk_widget_set_sensitive(label, sensitive);
+ gtk_table_attach_defaults(GTK_TABLE(list), label, 1, 2, *row, *row+1);
+
+ *row = *row + 1;
+
+ return label;
+}
+
+static GtkWidget *
+add_string_to_table(GtkWidget *list, guint *row, gchar *title, gchar *value)
+{
+ return add_string_to_table_sensitive(list, row, title, value, TRUE);
+}
+
+
+
+static GtkWidget *
+preview_new(void)
+{
+ GtkWidget *table, *label;
+ guint row;
+
+ table = gtk_table_new(1, 2, FALSE);
+ gtk_table_set_col_spacings(GTK_TABLE(table), 6);
+ gtk_table_set_row_spacings(GTK_TABLE(table), 3);
+ row = 0;
+
+ label = add_string_to_table(table, &row, "Filename:", "-");
+ WIDGET_SET_SIZE(label, DEF_WIDTH/3, -1);
+ OBJECT_SET_DATA(table, PREVIEW_FILENAME_KEY, label);
+ label = add_string_to_table(table, &row, "Format:", "-");
+ OBJECT_SET_DATA(table, PREVIEW_FORMAT_KEY, label);
+ label = add_string_to_table(table, &row, "Size:", "-");
+ OBJECT_SET_DATA(table, PREVIEW_SIZE_KEY, label);
+ label = add_string_to_table(table, &row, "Packets:", "-");
+ OBJECT_SET_DATA(table, PREVIEW_PACKETS_KEY, label);
+ label = add_string_to_table(table, &row, "First Packet:", "-");
+ OBJECT_SET_DATA(table, PREVIEW_FIRST_KEY, label);
+ label = add_string_to_table(table, &row, "Elapsed time:", "-");
+ OBJECT_SET_DATA(table, PREVIEW_ELAPSED_KEY, label);
+
+ return table;
+}
+
+/*
+ * Keep a static pointer to the current "Open Capture File" window, if
+ * any, so that if somebody tries to do "File:Open" while there's already
+ * an "Open Capture File" window up, we just pop up the existing one,
+ * rather than creating a new one.
+ */
+static GtkWidget *file_open_w;
+
+/* Open a file */
+void
+file_open_cmd(GtkWidget *w)
+{
+ GtkWidget *main_hb, *main_vb, *filter_hbox, *filter_bt, *filter_te,
+ *m_resolv_cb, *n_resolv_cb, *t_resolv_cb, *prev;
+#if GTK_MAJOR_VERSION < 2
+ GtkAccelGroup *accel_group;
+#endif
+ /* No Apply button, and "OK" just sets our text widget, it doesn't
+ activate it (i.e., it doesn't cause us to try to open the file). */
+ static construct_args_t args = {
+ "Ethereal: Read Filter",
+ FALSE,
+ FALSE
+ };
+
+ if (file_open_w != NULL) {
+ /* There's already an "Open Capture File" dialog box; reactivate it. */
+ reactivate_window(file_open_w);
+ return;
+ }
+
+ file_open_w = file_selection_new("Ethereal: Open Capture File",
+ FILE_SELECTION_OPEN);
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ /* it's annoying, that the file chooser dialog is already shown here,
+ so we cannot use the correct gtk_window_set_default_size() to resize it */
+ WIDGET_SET_SIZE(GTK_WINDOW(file_open_w), DEF_WIDTH, DEF_HEIGHT);
+#else
+ gtk_window_set_default_size(GTK_WINDOW(file_open_w), DEF_WIDTH, DEF_HEIGHT);
+#endif
+
+#if GTK_MAJOR_VERSION < 2
+ /* Accelerator group for the accelerators (or, as they're called in
+ Windows and, I think, in Motif, "mnemonics"; Alt+<key> is a mnemonic,
+ Ctrl+<key> is an accelerator). */
+ accel_group = gtk_accel_group_new();
+ gtk_window_add_accel_group(GTK_WINDOW(file_open_w), accel_group);
+#endif
+
+ switch (prefs.gui_fileopen_style) {
+
+ case FO_STYLE_LAST_OPENED:
+ /* The user has specified that we should start out in the last directory
+ we looked in. If we've already opened a file, use its containing
+ directory, if we could determine it, as the directory, otherwise
+ use the "last opened" directory saved in the preferences file if
+ there was one. */
+ /* This is now the default behaviour in file_selection_new() */
+ break;
+
+ case FO_STYLE_SPECIFIED:
+ /* The user has specified that we should always start out in a
+ specified directory; if they've specified that directory,
+ start out by showing the files in that dir. */
+ if (prefs.gui_fileopen_dir[0] != '\0')
+ file_selection_set_current_folder(file_open_w, prefs.gui_fileopen_dir);
+ break;
+ }
+
+
+ main_hb = gtk_hbox_new(FALSE, 3);
+ file_selection_set_extra_widget(file_open_w, main_hb);
+ gtk_widget_show(main_hb);
+
+ /* Container for each row of widgets */
+ main_vb = gtk_vbox_new(FALSE, 3);
+ gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
+ gtk_box_pack_start(GTK_BOX(main_hb), main_vb, FALSE, FALSE, 0);
+ gtk_widget_show(main_vb);
+
+ /* filter row */
+ filter_hbox = gtk_hbox_new(FALSE, 1);
+ gtk_container_border_width(GTK_CONTAINER(filter_hbox), 0);
+ gtk_box_pack_start(GTK_BOX(main_vb), filter_hbox, FALSE, FALSE, 0);
+ gtk_widget_show(filter_hbox);
+
+ filter_bt = BUTTON_NEW_FROM_STOCK(ETHEREAL_STOCK_DISPLAY_FILTER_ENTRY);
+ SIGNAL_CONNECT(filter_bt, "clicked", display_filter_construct_cb, &args);
+ SIGNAL_CONNECT(filter_bt, "destroy", filter_button_destroy_cb, NULL);
+ gtk_box_pack_start(GTK_BOX(filter_hbox), filter_bt, FALSE, TRUE, 0);
+ gtk_widget_show(filter_bt);
+
+ filter_te = gtk_entry_new();
+ OBJECT_SET_DATA(filter_bt, E_FILT_TE_PTR_KEY, filter_te);
+ gtk_box_pack_start(GTK_BOX(filter_hbox), filter_te, TRUE, TRUE, 3);
+ SIGNAL_CONNECT(filter_te, "changed", filter_te_syntax_check_cb, NULL);
+ gtk_widget_show(filter_te);
+
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ OBJECT_SET_DATA(file_open_w, E_RFILTER_TE_KEY, filter_te);
+#else
+ OBJECT_SET_DATA(GTK_FILE_SELECTION(file_open_w)->ok_button,
+ E_RFILTER_TE_KEY, filter_te);
+#endif
+
+ /* resolve buttons */
+ m_resolv_cb = CHECK_BUTTON_NEW_WITH_MNEMONIC("Enable _MAC name resolution", accel_group);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_resolv_cb),
+ g_resolv_flags & RESOLV_MAC);
+ gtk_box_pack_start(GTK_BOX(main_vb), m_resolv_cb, FALSE, FALSE, 0);
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ OBJECT_SET_DATA(file_open_w,
+ E_FILE_M_RESOLVE_KEY, m_resolv_cb);
+#else
+ OBJECT_SET_DATA(GTK_FILE_SELECTION(file_open_w)->ok_button,
+ E_FILE_M_RESOLVE_KEY, m_resolv_cb);
+#endif
+ gtk_widget_show(m_resolv_cb);
+
+ n_resolv_cb = CHECK_BUTTON_NEW_WITH_MNEMONIC("Enable _network name resolution", accel_group);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(n_resolv_cb),
+ g_resolv_flags & RESOLV_NETWORK);
+ gtk_box_pack_start(GTK_BOX(main_vb), n_resolv_cb, FALSE, FALSE, 0);
+ gtk_widget_show(n_resolv_cb);
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ OBJECT_SET_DATA(file_open_w, E_FILE_N_RESOLVE_KEY, n_resolv_cb);
+#else
+ OBJECT_SET_DATA(GTK_FILE_SELECTION(file_open_w)->ok_button,
+ E_FILE_N_RESOLVE_KEY, n_resolv_cb);
+#endif
+
+ t_resolv_cb = CHECK_BUTTON_NEW_WITH_MNEMONIC("Enable _transport name resolution", accel_group);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(t_resolv_cb),
+ g_resolv_flags & RESOLV_TRANSPORT);
+ gtk_box_pack_start(GTK_BOX(main_vb), t_resolv_cb, FALSE, FALSE, 0);
+ gtk_widget_show(t_resolv_cb);
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ OBJECT_SET_DATA(file_open_w, E_FILE_T_RESOLVE_KEY, t_resolv_cb);
+#else
+ OBJECT_SET_DATA(GTK_FILE_SELECTION(file_open_w)->ok_button,
+ E_FILE_T_RESOLVE_KEY, t_resolv_cb);
+#endif
+
+
+ SIGNAL_CONNECT(file_open_w, "destroy", file_open_destroy_cb, NULL);
+
+ /* preview widget */
+ prev = preview_new();
+ OBJECT_SET_DATA(file_open_w, PREVIEW_TABLE_KEY, prev);
+ gtk_widget_show_all(prev);
+ gtk_box_pack_start(GTK_BOX(main_hb), prev, TRUE, TRUE, 0);
+
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ SIGNAL_CONNECT(GTK_FILE_CHOOSER(file_open_w), "selection-changed",
+ file_open_entry_changed, file_open_w);
+ file_open_entry_changed(file_open_w, file_open_w);
+
+ OBJECT_SET_DATA(file_open_w, E_DFILTER_TE_KEY,
+ OBJECT_GET_DATA(w, E_DFILTER_TE_KEY));
+ if (gtk_dialog_run(GTK_DIALOG(file_open_w)) == GTK_RESPONSE_ACCEPT)
+ {
+ file_open_ok_cb(file_open_w, file_open_w);
+ }
+ else window_destroy(file_open_w);
+#else
+ SIGNAL_CONNECT(GTK_FILE_SELECTION(file_open_w)->selection_entry, "changed",
+ file_open_entry_changed, file_open_w);
+
+ /* Connect the ok_button to file_open_ok_cb function and pass along a
+ pointer to the file selection box widget */
+ SIGNAL_CONNECT(GTK_FILE_SELECTION(file_open_w)->ok_button, "clicked",
+ file_open_ok_cb, file_open_w);
+
+ OBJECT_SET_DATA(GTK_FILE_SELECTION(file_open_w)->ok_button,
+ E_DFILTER_TE_KEY, OBJECT_GET_DATA(w, E_DFILTER_TE_KEY));
+
+ /* Connect the cancel_button to destroy the widget */
+ window_set_cancel_button(file_open_w,
+ GTK_FILE_SELECTION(file_open_w)->cancel_button, window_cancel_button_cb);
+
+ SIGNAL_CONNECT(file_open_w, "delete_event", window_delete_event_cb, NULL);
+
+ gtk_widget_show(file_open_w);
+ window_present(file_open_w);
+#endif
+}
+
+static void file_open_answered_cb(gpointer dialog _U_, gint btn, gpointer data _U_)
+{
+ switch(btn) {
+ case(ESD_BTN_SAVE):
+ /* save file first */
+ file_save_as_cmd(after_save_open_dialog, data);
+ break;
+ case(ESD_BTN_DONT_SAVE):
+ cf_close(&cfile);
+ file_open_cmd(data);
+ break;
+ case(ESD_BTN_CANCEL):
+ break;
+ default:
+ g_assert_not_reached();
+ }
+}
+
+void
+file_open_cmd_cb(GtkWidget *widget, gpointer data _U_) {
+ gpointer dialog;
+
+ if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
+ /* user didn't saved his current file, ask him */
+ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE_CANCEL,
+ PRIMARY_TEXT_START "Save capture file before opening a new one?" PRIMARY_TEXT_END "\n\n"
+ "If you open a new capture file without saving, your capture data will be discarded.");
+ simple_dialog_set_cb(dialog, file_open_answered_cb, widget);
+ } else {
+ /* unchanged file, just open a new one */
+ file_open_cmd(widget);
+ }
+}
+
+/* user pressed "open" button */
+static void
+file_open_ok_cb(GtkWidget *w, gpointer fs) {
+ gchar *cf_name, *rfilter, *s;
+ GtkWidget *filter_te, *m_resolv_cb, *n_resolv_cb, *t_resolv_cb;
+ dfilter_t *rfcode = NULL;
+ int err;
+
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ cf_name = g_strdup(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fs)));
+#else
+ cf_name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs)));
+#endif
+ filter_te = OBJECT_GET_DATA(w, E_RFILTER_TE_KEY);
+ rfilter = (gchar *)gtk_entry_get_text(GTK_ENTRY(filter_te));
+ if (!dfilter_compile(rfilter, &rfcode)) {
+ bad_dfilter_alert_box(rfilter);
+ g_free(cf_name);
+ return;
+ }
+
+ /* Perhaps the user specified a directory instead of a file.
+ Check whether they did. */
+ if (test_for_directory(cf_name) == EISDIR) {
+ /* It's a directory - set the file selection box to display that
+ directory, don't try to open the directory as a capture file. */
+ set_last_open_dir(cf_name);
+ g_free(cf_name);
+ file_selection_set_current_folder(fs, get_last_open_dir());
+ return;
+ }
+
+ /* Try to open the capture file. */
+ if ((err = cf_open(cf_name, FALSE, &cfile)) != 0) {
+ /* We couldn't open it; don't dismiss the open dialog box,
+ just leave it around so that the user can, after they
+ dismiss the alert box popped up for the open error,
+ try again. */
+ if (rfcode != NULL)
+ dfilter_free(rfcode);
+ g_free(cf_name);
+ return;
+ }
+
+ /* Attach the new read filter to "cf" ("cf_open()" succeeded, so
+ it closed the previous capture file, and thus destroyed any
+ previous read filter attached to "cf"). */
+ cfile.rfcode = rfcode;
+
+ /* Set the global resolving variable */
+ g_resolv_flags = prefs.name_resolve & RESOLV_CONCURRENT;
+ m_resolv_cb = OBJECT_GET_DATA(w, E_FILE_M_RESOLVE_KEY);
+ g_resolv_flags |= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (m_resolv_cb)) ? RESOLV_MAC : RESOLV_NONE;
+ n_resolv_cb = OBJECT_GET_DATA(w, E_FILE_N_RESOLVE_KEY);
+ g_resolv_flags |= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (n_resolv_cb)) ? RESOLV_NETWORK : RESOLV_NONE;
+ t_resolv_cb = OBJECT_GET_DATA(w, E_FILE_T_RESOLVE_KEY);
+ g_resolv_flags |= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (t_resolv_cb)) ? RESOLV_TRANSPORT : RESOLV_NONE;
+
+ /* We've crossed the Rubicon; get rid of the file selection box. */
+ window_destroy(GTK_WIDGET (fs));
+
+ switch (cf_read(&cfile)) {
+
+ case READ_SUCCESS:
+ case READ_ERROR:
+ /* Just because we got an error, that doesn't mean we were unable
+ to read any of the file; we handle what we could get from the
+ file. */
+ break;
+
+ case READ_ABORTED:
+ /* The user bailed out of re-reading the capture file; the
+ capture file has been closed - just free the capture file name
+ string and return (without changing the last containing
+ directory). */
+ g_free(cf_name);
+ return;
+ }
+
+ /* Save the name of the containing directory specified in the path name,
+ if any; we can write over cf_name, which is a good thing, given that
+ "get_dirname()" does write over its argument. */
+ s = get_dirname(cf_name);
+ set_last_open_dir(s);
+ gtk_widget_grab_focus(packet_list);
+
+ g_free(cf_name);
+}
+
+static void
+file_open_destroy_cb(GtkWidget *win _U_, gpointer user_data _U_)
+{
+ /* Note that we no longer have a "Open Capture File" dialog box. */
+ file_open_w = NULL;
+}
+
+/*
+ * Keep a static pointer to the current "Merge Capture File" window, if
+ * any, so that if somebody tries to do "File:Merge" while there's already
+ * an "Merge Capture File" window up, we just pop up the existing one,
+ * rather than creating a new one.
+ */
+static GtkWidget *file_merge_w;
+
+/* Merge existing with another file */
+void
+file_merge_cmd(GtkWidget *w)
+{
+ GtkWidget *main_hb, *main_vb, *ft_hb, *ft_lb, *filter_hbox,
+ *filter_bt, *filter_te, *prepend_rb, *chrono_rb,
+ *append_rb, *prev;
+#if GTK_MAJOR_VERSION < 2
+ GtkAccelGroup *accel_group;
+#endif
+ GtkTooltips *tooltips = gtk_tooltips_new();
+ /* No Apply button, and "OK" just sets our text widget, it doesn't
+ activate it (i.e., it doesn't cause us to try to open the file). */
+ static construct_args_t args = {
+ "Ethereal: Read Filter",
+ FALSE,
+ FALSE
+ };
+
+ if (file_merge_w != NULL) {
+ /* There's already an "Merge Capture File" dialog box; reactivate it. */
+ reactivate_window(file_merge_w);
+ return;
+ }
+
+ /* Default to saving all packets, in the file's current format. */
+ filetype = cfile.cd_t;
+
+ file_merge_w = file_selection_new("Ethereal: Merge with Capture File",
+ FILE_SELECTION_OPEN);
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ /* it's annoying, that the file chooser dialog is already shown here,
+ so we cannot use the correct gtk_window_set_default_size() to resize it */
+ WIDGET_SET_SIZE(GTK_WINDOW(file_merge_w), DEF_WIDTH, DEF_HEIGHT);
+#else
+ gtk_window_set_default_size(GTK_WINDOW(file_merge_w), DEF_WIDTH, DEF_HEIGHT);
+#endif
+
+#if GTK_MAJOR_VERSION < 2
+ /* Accelerator group for the accelerators (or, as they're called in
+ Windows and, I think, in Motif, "mnemonics"; Alt+<key> is a mnemonic,
+ Ctrl+<key> is an accelerator). */
+ accel_group = gtk_accel_group_new();
+ gtk_window_add_accel_group(GTK_WINDOW(file_merge_w), accel_group);
+#endif
+
+ switch (prefs.gui_fileopen_style) {
+
+ case FO_STYLE_LAST_OPENED:
+ /* The user has specified that we should start out in the last directory
+ we looked in. If we've already opened a file, use its containing
+ directory, if we could determine it, as the directory, otherwise
+ use the "last opened" directory saved in the preferences file if
+ there was one. */
+ /* This is now the default behaviour in file_selection_new() */
+ break;
+
+ case FO_STYLE_SPECIFIED:
+ /* The user has specified that we should always start out in a
+ specified directory; if they've specified that directory,
+ start out by showing the files in that dir. */
+ if (prefs.gui_fileopen_dir[0] != '\0')
+ file_selection_set_current_folder(file_merge_w, prefs.gui_fileopen_dir);
+ break;
+ }
+
+ main_hb = gtk_hbox_new(FALSE, 3);
+ file_selection_set_extra_widget(file_merge_w, main_hb);
+ gtk_widget_show(main_hb);
+
+ /* Container for each row of widgets */
+ main_vb = gtk_vbox_new(FALSE, 3);
+ gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
+ gtk_box_pack_start(GTK_BOX(main_hb), main_vb, FALSE, FALSE, 0);
+ gtk_widget_show(main_vb);
+
+ /* File type row */
+ range_tb = NULL;
+ ft_hb = gtk_hbox_new(FALSE, 3);
+ gtk_container_add(GTK_CONTAINER(main_vb), ft_hb);
+ gtk_widget_show(ft_hb);
+
+ ft_lb = gtk_label_new("Merged output file type:");
+ gtk_box_pack_start(GTK_BOX(ft_hb), ft_lb, FALSE, FALSE, 0);
+ gtk_widget_show(ft_lb);
+
+ ft_om = gtk_option_menu_new();
+
+ /* Generate the list of file types we can save. */
+ set_file_type_list(ft_om);
+ gtk_box_pack_start(GTK_BOX(ft_hb), ft_om, FALSE, FALSE, 0);
+ gtk_widget_show(ft_om);
+
+ filter_hbox = gtk_hbox_new(FALSE, 1);
+ gtk_container_border_width(GTK_CONTAINER(filter_hbox), 0);
+ gtk_box_pack_start(GTK_BOX(main_vb), filter_hbox, FALSE, FALSE, 0);
+ gtk_widget_show(filter_hbox);
+
+ filter_bt = BUTTON_NEW_FROM_STOCK(ETHEREAL_STOCK_DISPLAY_FILTER_ENTRY);
+ SIGNAL_CONNECT(filter_bt, "clicked", display_filter_construct_cb, &args);
+ SIGNAL_CONNECT(filter_bt, "destroy", filter_button_destroy_cb, NULL);
+ gtk_box_pack_start(GTK_BOX(filter_hbox), filter_bt, FALSE, TRUE, 0);
+ gtk_widget_show(filter_bt);
+
+ filter_te = gtk_entry_new();
+ OBJECT_SET_DATA(filter_bt, E_FILT_TE_PTR_KEY, filter_te);
+ gtk_box_pack_start(GTK_BOX(filter_hbox), filter_te, TRUE, TRUE, 3);
+ SIGNAL_CONNECT(filter_te, "changed", filter_te_syntax_check_cb, NULL);
+ gtk_widget_show(filter_te);
+
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ OBJECT_SET_DATA(file_merge_w, E_RFILTER_TE_KEY, filter_te);
+#else
+ OBJECT_SET_DATA(GTK_FILE_SELECTION(file_merge_w)->ok_button,
+ E_RFILTER_TE_KEY, filter_te);
+#endif
+
+ prepend_rb = RADIO_BUTTON_NEW_WITH_MNEMONIC(NULL, "Prepend packets to existing file", accel_group);
+ gtk_tooltips_set_tip(tooltips, prepend_rb,
+ "The resulting file contains the packets from the selected, followed by the packets from the currently loaded file,"
+ " the packet timestamps will be ignored.", NULL);
+ gtk_box_pack_start(GTK_BOX(main_vb), prepend_rb, FALSE, FALSE, 0);
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ OBJECT_SET_DATA(file_merge_w,
+ E_MERGE_PREPEND_KEY, prepend_rb);
+#else
+ OBJECT_SET_DATA(GTK_FILE_SELECTION(file_merge_w)->ok_button,
+ E_MERGE_PREPEND_KEY, prepend_rb);
+#endif
+ gtk_widget_show(prepend_rb);
+
+ chrono_rb = RADIO_BUTTON_NEW_WITH_MNEMONIC(prepend_rb, "Merge packets chronologically", accel_group);
+ gtk_tooltips_set_tip(tooltips, chrono_rb,
+ "The resulting file contains all the packets from the currently loaded and the selected file,"
+ " sorted by the packet timestamps.", NULL);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chrono_rb), TRUE);
+ gtk_box_pack_start(GTK_BOX(main_vb), chrono_rb, FALSE, FALSE, 0);
+ gtk_widget_show(chrono_rb);
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ OBJECT_SET_DATA(file_merge_w, E_MERGE_CHRONO_KEY, chrono_rb);
+#else
+ OBJECT_SET_DATA(GTK_FILE_SELECTION(file_merge_w)->ok_button,
+ E_MERGE_CHRONO_KEY, chrono_rb);
+#endif
+
+ append_rb = RADIO_BUTTON_NEW_WITH_MNEMONIC(prepend_rb, "Append packets to existing file", accel_group);
+ gtk_tooltips_set_tip(tooltips, append_rb,
+ "The resulting file contains the packets from the currently loaded, followed by the packets from the selected file,"
+ " the packet timestamps will be ignored.", NULL);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(append_rb),
+ g_resolv_flags & RESOLV_TRANSPORT);
+ gtk_box_pack_start(GTK_BOX(main_vb), append_rb, FALSE, FALSE, 0);
+ gtk_widget_show(append_rb);
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ OBJECT_SET_DATA(file_merge_w, E_MERGE_APPEND_KEY, append_rb);
+#else
+ OBJECT_SET_DATA(GTK_FILE_SELECTION(file_merge_w)->ok_button,
+ E_MERGE_APPEND_KEY, append_rb);
+#endif
+
+
+ SIGNAL_CONNECT(file_merge_w, "destroy", file_merge_destroy_cb, NULL);
+
+ /* preview widget */
+ prev = preview_new();
+ OBJECT_SET_DATA(file_merge_w, PREVIEW_TABLE_KEY, prev);
+ gtk_widget_show_all(prev);
+ gtk_box_pack_start(GTK_BOX(main_hb), prev, TRUE, TRUE, 0);
+
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ SIGNAL_CONNECT(GTK_FILE_CHOOSER(file_merge_w), "selection-changed",
+ file_open_entry_changed, file_merge_w);
+ file_open_entry_changed(file_merge_w, file_merge_w);
+
+ OBJECT_SET_DATA(file_merge_w, E_DFILTER_TE_KEY,
+ OBJECT_GET_DATA(w, E_DFILTER_TE_KEY));
+ if (gtk_dialog_run(GTK_DIALOG(file_merge_w)) == GTK_RESPONSE_ACCEPT)
+ {
+ file_merge_ok_cb(file_merge_w, file_merge_w);
+ }
+ else window_destroy(file_merge_w);
+#else
+ SIGNAL_CONNECT(GTK_FILE_SELECTION(file_merge_w)->selection_entry, "changed",
+ file_open_entry_changed, file_merge_w);
+
+ /* Connect the ok_button to file_merge_ok_cb function and pass along a
+ pointer to the file selection box widget */
+ SIGNAL_CONNECT(GTK_FILE_SELECTION(file_merge_w)->ok_button, "clicked",
+ file_merge_ok_cb, file_merge_w);
+
+ OBJECT_SET_DATA(GTK_FILE_SELECTION(file_merge_w)->ok_button,
+ E_DFILTER_TE_KEY, OBJECT_GET_DATA(w, E_DFILTER_TE_KEY));
+
+ /* Connect the cancel_button to destroy the widget */
+ window_set_cancel_button(file_merge_w,
+ GTK_FILE_SELECTION(file_merge_w)->cancel_button, window_cancel_button_cb);
+
+ SIGNAL_CONNECT(file_merge_w, "delete_event", window_delete_event_cb, NULL);
+
+ gtk_widget_show(file_merge_w);
+ window_present(file_merge_w);
+#endif
+}
+
+static void file_merge_answered_cb(gpointer dialog _U_, gint btn, gpointer data _U_)
+{
+ switch(btn) {
+ case(ESD_BTN_OK):
+ /* save file first */
+ file_save_as_cmd(after_save_merge_dialog, data);
+ break;
+ case(ESD_BTN_CANCEL):
+ break;
+ default:
+ g_assert_not_reached();
+ }
+}
+
+void
+file_merge_cmd_cb(GtkWidget *widget, gpointer data _U_) {
+ gpointer dialog;
+
+ if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
+ /* user didn't saved his current file, ask him */
+ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_OK_CANCEL,
+ PRIMARY_TEXT_START "Save the capture file before merging to another one?" PRIMARY_TEXT_END "\n\n"
+ "A temporary capture file cannot be merged.");
+ simple_dialog_set_cb(dialog, file_merge_answered_cb, widget);
+ } else {
+ /* unchanged file, just start to merge */
+ file_merge_cmd(widget);
+ }
+}
+
+
+static void
+file_merge_ok_cb(GtkWidget *w, gpointer fs) {
+ gchar *cf_name, *rfilter, *s;
+ GtkWidget *filter_te, *rb;
+ dfilter_t *rfcode = NULL;
+ int err;
+ gboolean merge_ok;
+ char *in_filenames[2];
+ int out_fd;
+ char tmpname[128+1];
+
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ cf_name = g_strdup(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fs)));
+#else
+ cf_name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs)));
+#endif
+ filter_te = OBJECT_GET_DATA(w, E_RFILTER_TE_KEY);
+ rfilter = (gchar *)gtk_entry_get_text(GTK_ENTRY(filter_te));
+ if (!dfilter_compile(rfilter, &rfcode)) {
+ bad_dfilter_alert_box(rfilter);
+ g_free(cf_name);
+ return;
+ }
+
+ /* Perhaps the user specified a directory instead of a file.
+ Check whether they did. */
+ if (test_for_directory(cf_name) == EISDIR) {
+ /* It's a directory - set the file selection box to display that
+ directory, don't try to open the directory as a capture file. */
+ set_last_open_dir(cf_name);
+ g_free(cf_name);
+ file_selection_set_current_folder(fs, get_last_open_dir());
+ return;
+ }
+
+ out_fd = create_tempfile(tmpname, sizeof tmpname, "ether");
+
+ /* merge or append the two files */
+ rb = OBJECT_GET_DATA(w, E_MERGE_CHRONO_KEY);
+ if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (rb))) {
+ /* chonological order */
+ in_filenames[0] = cfile.filename;
+ in_filenames[1] = cf_name;
+ merge_ok = merge_n_files(out_fd, 2, in_filenames, filetype, FALSE, &err);
+ } else {
+ rb = OBJECT_GET_DATA(w, E_MERGE_PREPEND_KEY);
+ if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (rb))) {
+ /* prepend file */
+ in_filenames[0] = cfile.filename;
+ in_filenames[1] = cf_name;
+ merge_ok = merge_n_files(out_fd, 2, in_filenames, filetype, TRUE, &err);
+ } else {
+ /* append file */
+ in_filenames[0] = cf_name;
+ in_filenames[1] = cfile.filename;
+ merge_ok = merge_n_files(out_fd, 2, in_filenames, filetype, TRUE, &err);
+ }
+ }
+
+ g_free(cf_name);
+
+ if(!merge_ok) {
+ /* merge failed */
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
+ "An error occurred while merging the files: %s.",
+ wtap_strerror(err));
+ close(out_fd);
+ if (rfcode != NULL)
+ dfilter_free(rfcode);
+ return;
+ }
+
+ cf_close(&cfile);
+
+ /* We've crossed the Rubicon; get rid of the file selection box. */
+ window_destroy(GTK_WIDGET (fs));
+
+ /* Try to open the merged capture file. */
+ if ((err = cf_open(tmpname, TRUE /* temporary file */, &cfile)) != 0) {
+ /* We couldn't open it; don't dismiss the open dialog box,
+ just leave it around so that the user can, after they
+ dismiss the alert box popped up for the open error,
+ try again. */
+ if (rfcode != NULL)
+ dfilter_free(rfcode);
+ return;
+ }
+
+ /* Attach the new read filter to "cf" ("cf_open()" succeeded, so
+ it closed the previous capture file, and thus destroyed any
+ previous read filter attached to "cf"). */
+ cfile.rfcode = rfcode;
+
+ switch (cf_read(&cfile)) {
+
+ case READ_SUCCESS:
+ case READ_ERROR:
+ /* Just because we got an error, that doesn't mean we were unable
+ to read any of the file; we handle what we could get from the
+ file. */
+ break;
+
+ case READ_ABORTED:
+ /* The user bailed out of re-reading the capture file; the
+ capture file has been closed - just free the capture file name
+ string and return (without changing the last containing
+ directory). */
+ return;
+ }
+
+ /* Save the name of the containing directory specified in the path name,
+ if any; we can write over cf_merged_name, which is a good thing, given that
+ "get_dirname()" does write over its argument. */
+ s = get_dirname(tmpname);
+ set_last_open_dir(s);
+ gtk_widget_grab_focus(packet_list);
+}
+
+static void
+file_merge_destroy_cb(GtkWidget *win _U_, gpointer user_data _U_)
+{
+ /* Note that we no longer have a "Merge Capture File" dialog box. */
+ file_merge_w = NULL;
+}
+
+
+void file_close_answered_cb(gpointer dialog _U_, gint btn, gpointer data _U_)
+{
+ switch(btn) {
+ case(ESD_BTN_SAVE):
+ /* save file first */
+ file_save_as_cmd(after_save_close_file, NULL);
+ break;
+ case(ESD_BTN_DONT_SAVE):
+ cf_close(&cfile);
+ break;
+ case(ESD_BTN_CANCEL):
+ break;
+ default:
+ g_assert_not_reached();
+ }
+}
+
+/* Close a file */
+void
+file_close_cmd_cb(GtkWidget *widget _U_, gpointer data _U_) {
+ gpointer dialog;
+
+ if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
+ /* user didn't saved his current file, ask him */
+ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE_CANCEL,
+ PRIMARY_TEXT_START "Save capture file before closing it?" PRIMARY_TEXT_END "\n\n"
+ "If you close without saving, your capture data will be discarded.");
+
+ simple_dialog_set_cb(dialog, file_close_answered_cb, NULL);
+ } else {
+ /* unchanged file, just close it */
+ cf_close(&cfile);
+ }
+}
+
+void
+file_save_cmd_cb(GtkWidget *w, gpointer data) {
+ /* If the file's already been saved, do nothing. */
+ if (cfile.user_saved)
+ return;
+
+ /* Do a "Save As". */
+ file_save_as_cmd_cb(w, data);
+}
+
+static gboolean
+can_save_with_wiretap(int ft)
+{
+ /* To save a file with Wiretap, Wiretap has to handle that format,
+ and its code to handle that format must be able to write a file
+ with this file's encapsulation type. */
+ return wtap_dump_can_open(ft) && wtap_dump_can_write_encap(ft, cfile.lnk_t);
+}
+
+
+/* Generate a list of the file types we can save this file as.
+
+ "filetype" is the type it has now.
+
+ "encap" is the encapsulation for its packets (which could be
+ "unknown" or "per-packet").
+
+ "filtered" is TRUE if we're to save only the packets that passed
+ the display filter (in which case we have to save it using Wiretap)
+ and FALSE if we're to save the entire file (in which case, if we're
+ saving it in the type it has already, we can just copy it).
+
+ The same applies for sel_curr, sel_all, sel_m_only, sel_m_range and sel_man_range
+*/
+static void
+set_file_type_list(GtkWidget *option_menu)
+{
+ GtkWidget *ft_menu, *ft_menu_item;
+ int ft;
+ guint index;
+ guint item_to_select;
+
+ /* Default to the first supported file type, if the file's current
+ type isn't supported. */
+ item_to_select = 0;
+
+ ft_menu = gtk_menu_new();
+
+ /* Check all file types. */
+ index = 0;
+ for (ft = 0; ft < WTAP_NUM_FILE_TYPES; ft++) {
+ if (!packet_range_process_all(&range) || ft != cfile.cd_t) {
+ /* not all unfiltered packets or a different file type. We have to use Wiretap. */
+ if (!can_save_with_wiretap(ft))
+ continue; /* We can't. */
+ }
+
+ /* OK, we can write it out in this type. */
+ ft_menu_item = gtk_menu_item_new_with_label(wtap_file_type_string(ft));
+ if (ft == filetype) {
+ /* Default to the same format as the file, if it's supported. */
+ item_to_select = index;
+ }
+ SIGNAL_CONNECT(ft_menu_item, "activate", select_file_type_cb,
+ GINT_TO_POINTER(ft));
+ gtk_menu_append(GTK_MENU(ft_menu), ft_menu_item);
+ gtk_widget_show(ft_menu_item);
+ index++;
+ }
+
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), ft_menu);
+ gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), item_to_select);
+}
+
+static void
+select_file_type_cb(GtkWidget *w _U_, gpointer data)
+{
+ int new_filetype = GPOINTER_TO_INT(data);
+
+ if (filetype != new_filetype) {
+ /* We can select only the filtered or marked packets to be saved if we can
+ use Wiretap to save the file. */
+ if (range_tb != NULL)
+ range_set_displayed_sensitive(range_tb, can_save_with_wiretap(new_filetype));
+ filetype = new_filetype;
+ file_set_save_marked_sensitive();
+ }
+}
+
+
+/*
+ * Set the "Save only marked packets" toggle button as appropriate for
+ * the current output file type and count of marked packets.
+ *
+ * Called when the "Save As..." dialog box is created and when either
+ * the file type or the marked count changes.
+ */
+void
+file_set_save_marked_sensitive(void)
+{
+ if (file_save_as_w == NULL) {
+ /* We don't currently have a "Save As..." dialog box up. */
+ return;
+ }
+
+ /* We can request that only the marked packets be saved only if we
+ can use Wiretap to save the file and if there *are* marked packets. */
+ if (can_save_with_wiretap(filetype) && cfile.marked_count > 0) {
+ range_set_marked_sensitive(range_tb, TRUE);
+ }
+ else {
+ /* Force the "Save only marked packets" toggle to "false", turn
+ off the flag it controls, and update the list of types we can
+ save the file as. */
+ range.process = range_process_all;
+ set_file_type_list(ft_om);
+ range_set_marked_sensitive(range_tb, FALSE);
+ }
+}
+
+
+action_after_save_e action_after_save_g;
+gpointer action_after_save_data_g;
+
+
+void
+file_save_as_cmd(action_after_save_e action_after_save, gpointer action_after_save_data)
+{
+ GtkWidget *main_vb, *ft_hb, *ft_lb, *range_fr;
+ GtkTooltips *tooltips;
+
+#if GTK_MAJOR_VERSION < 2
+ GtkAccelGroup *accel_group;
+#endif
+
+ if (file_save_as_w != NULL) {
+ /* There's already an "Save Capture File As" dialog box; reactivate it. */
+ reactivate_window(file_save_as_w);
+ return;
+ }
+
+ /* Default to saving all packets, in the file's current format. */
+ filetype = cfile.cd_t;
+
+ /* init the packet range */
+ packet_range_init(&range);
+
+ /* Enable tooltips */
+ tooltips = gtk_tooltips_new();
+
+ /* build the file selection */
+ file_save_as_w = file_selection_new ("Ethereal: Save Capture File As",
+ FILE_SELECTION_SAVE);
+
+ /* as the dialog might already be gone, when using this values, we cannot
+ * set data to the dialog object, but keep global values */
+ action_after_save_g = action_after_save;
+ action_after_save_data_g = action_after_save_data;
+
+#if GTK_MAJOR_VERSION < 2
+ accel_group = gtk_accel_group_new();
+ gtk_window_add_accel_group(GTK_WINDOW(file_save_as_w), accel_group);
+#endif
+
+ /* Container for each row of widgets */
+
+ main_vb = gtk_vbox_new(FALSE, 5);
+ gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
+ file_selection_set_extra_widget(file_save_as_w, main_vb);
+ gtk_widget_show(main_vb);
+
+ /*** Packet Range frame ***/
+ range_fr = gtk_frame_new("Packet Range");
+ gtk_box_pack_start(GTK_BOX(main_vb), range_fr, FALSE, FALSE, 0);
+ gtk_widget_show(range_fr);
+
+ /* range table */
+ range_tb = range_new(&range
+#if GTK_MAJOR_VERSION < 2
+ , accel_group
+#endif
+ );
+ gtk_container_add(GTK_CONTAINER(range_fr), range_tb);
+ gtk_widget_show(range_tb);
+
+ /* File type row */
+ ft_hb = gtk_hbox_new(FALSE, 3);
+ gtk_container_add(GTK_CONTAINER(main_vb), ft_hb);
+ gtk_widget_show(ft_hb);
+
+ ft_lb = gtk_label_new("File type:");
+ gtk_box_pack_start(GTK_BOX(ft_hb), ft_lb, FALSE, FALSE, 0);
+ gtk_widget_show(ft_lb);
+
+ ft_om = gtk_option_menu_new();
+
+ /* Generate the list of file types we can save. */
+ set_file_type_list(ft_om);
+ gtk_box_pack_start(GTK_BOX(ft_hb), ft_om, FALSE, FALSE, 0);
+ gtk_widget_show(ft_om);
+
+ /*
+ * Set the sensitivity of the "Save only marked packets" toggle
+ * button
+ *
+ * This has to be done after we create the file type menu option,
+ * as the routine that sets it also sets that menu.
+ */
+ file_set_save_marked_sensitive();
+
+ /* dynamic values in the range frame */
+ range_update_dynamics(range_tb);
+
+ SIGNAL_CONNECT(file_save_as_w, "destroy", file_save_as_destroy_cb, NULL);
+
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ if (gtk_dialog_run(GTK_DIALOG(file_save_as_w)) == GTK_RESPONSE_ACCEPT) {
+ file_save_as_ok_cb(file_save_as_w, file_save_as_w);
+ } else {
+ window_destroy(file_save_as_w);
+ }
+#else
+ /* Connect the ok_button to file_save_as_ok_cb function and pass along a
+ pointer to the file selection box widget */
+ SIGNAL_CONNECT(GTK_FILE_SELECTION (file_save_as_w)->ok_button, "clicked",
+ file_save_as_ok_cb, file_save_as_w);
+
+ window_set_cancel_button(file_save_as_w,
+ GTK_FILE_SELECTION(file_save_as_w)->cancel_button, window_cancel_button_cb);
+
+ SIGNAL_CONNECT(file_save_as_w, "delete_event", window_delete_event_cb, NULL);
+
+ gtk_widget_show(file_save_as_w);
+ window_present(file_save_as_w);
+#endif
+}
+
+void
+file_save_as_cmd_cb(GtkWidget *w _U_, gpointer data _U_)
+{
+ file_save_as_cmd(after_save_no_action, NULL);
+}
+
+static void
+file_save_as_ok_cb(GtkWidget *w _U_, gpointer fs) {
+ gchar *cf_name;
+ gchar *dirname;
+
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ cf_name = g_strdup(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fs)));
+#else
+ cf_name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs)));
+#endif
+
+ /* Perhaps the user specified a directory instead of a file.
+ Check whether they did. */
+ if (test_for_directory(cf_name) == EISDIR) {
+ /* It's a directory - set the file selection box to display that
+ directory, and leave the selection box displayed. */
+ set_last_open_dir(cf_name);
+ g_free(cf_name);
+ file_selection_set_current_folder(fs, get_last_open_dir());
+ return;
+ }
+
+ /* Check whether the range is valid. */
+ if (!range_check_validity(&range)) {
+ /* The range isn't valid; don't dismiss the open dialog box,
+ just leave it around so that the user can, after they
+ dismiss the alert box popped up for the error, try again. */
+ g_free(cf_name);
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ /* XXX - as we cannot start a new event loop (using gtk_dialog_run()),
+ * as this will prevent the user from closing the now existing error
+ * message, simply close the dialog (this is the best we can do here). */
+ if (file_save_as_w)
+ window_destroy(GTK_WIDGET (fs));
+#else
+ gtk_widget_show(GTK_WIDGET (fs));
+#endif
+ return;
+ }
+
+ /* don't show the dialog while saving */
+ gtk_widget_hide(GTK_WIDGET (fs));
+
+ /* Write out the packets (all, or only the ones from the current
+ range) to the file with the specified name. */
+ if (! cf_save(cf_name, &cfile, &range, filetype)) {
+ /* The write failed; don't dismiss the open dialog box,
+ just leave it around so that the user can, after they
+ dismiss the alert box popped up for the error, try again. */
+ g_free(cf_name);
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ /* XXX - as we cannot start a new event loop (using gtk_dialog_run()),
+ * as this will prevent the user from closing the now existing error
+ * message, simply close the dialog (this is the best we can do here). */
+ if (file_save_as_w)
+ window_destroy(GTK_WIDGET (fs));
+#else
+ gtk_widget_show(GTK_WIDGET (fs));
+#endif
+ return;
+ }
+
+ /* The write succeeded; get rid of the file selection box. */
+ /* cf_save might already closed our dialog! */
+ if (file_save_as_w)
+ window_destroy(GTK_WIDGET (fs));
+
+ /* Save the directory name for future file dialogs. */
+ dirname = get_dirname(cf_name); /* Overwrites cf_name */
+ set_last_open_dir(dirname);
+ g_free(cf_name);
+
+ /* we have finished saving, do we have pending things to do? */
+ switch(action_after_save_g) {
+ case(after_save_no_action):
+ break;
+ case(after_save_open_dialog):
+ file_open_cmd(action_after_save_data_g);
+ break;
+ case(after_save_open_recent_file):
+ menu_open_recent_file_cmd(action_after_save_data_g);
+ break;
+ case(after_save_open_dnd_file):
+ dnd_open_file_cmd(action_after_save_data_g);
+ break;
+ case(after_save_merge_dialog):
+ file_merge_cmd(action_after_save_data_g);
+ break;
+#ifdef HAVE_LIBPCAP
+ case(after_save_capture_dialog):
+ capture_prep();
+ break;
+#endif
+ case(after_save_close_file):
+ cf_close(&cfile);
+ break;
+ case(after_save_exit):
+ main_do_quit();
+ break;
+ default:
+ g_assert_not_reached();
+ }
+
+ action_after_save_g = after_save_no_action;
+}
+
+void
+file_save_as_destroy(void)
+{
+ if (file_save_as_w)
+ window_destroy(file_save_as_w);
+}
+
+static void
+file_save_as_destroy_cb(GtkWidget *win _U_, gpointer user_data _U_)
+{
+ /* Note that we no longer have a "Save Capture File As" dialog box. */
+ file_save_as_w = NULL;
+}
+
+/* Reload a file using the current read and display filters */
+void
+file_reload_cmd_cb(GtkWidget *w _U_, gpointer data _U_) {
+ cf_reload();
+}
+
+/******************** Color Filters *********************************/
+/*
+ * Keep a static pointer to the current "Color Export" window, if
+ * any, so that if somebody tries to do "Export"
+ * while there's already a "Color Export" window up, we just pop
+ * up the existing one, rather than creating a new one.
+ */
+static GtkWidget *file_color_import_w;
+
+/* sets the file path to the global color filter file.
+ WARNING: called by both the import and the export dialog.
+*/
+static void
+color_global_cb(GtkWidget *widget _U_, gpointer data)
+{
+ GtkWidget *fs_widget = data;
+ gchar *path;
+
+ /* decide what file to open (from dfilter code) */
+ path = get_datafile_path("colorfilters");
+
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ gtk_file_chooser_select_filename(GTK_FILE_CHOOSER(fs_widget), path);
+#else
+ file_selection_set_current_folder(fs_widget, path);
+#endif
+ g_free((gchar *)path);
+}
+
+/* Import color filters */
+void
+file_color_import_cmd_cb(GtkWidget *w _U_, gpointer data)
+{
+ GtkWidget *main_vb, *cfglobal_but;
+#if GTK_MAJOR_VERSION < 2
+ GtkAccelGroup *accel_group;
+#endif
+ /* No Apply button, and "OK" just sets our text widget, it doesn't
+ activate it (i.e., it doesn't cause us to try to open the file). */
+
+ if (file_color_import_w != NULL) {
+ /* There's already an "Import Color Filters" dialog box; reactivate it. */
+ reactivate_window(file_color_import_w);
+ return;
+ }
+
+ file_color_import_w = file_selection_new("Ethereal: Import Color Filters",
+ FILE_SELECTION_OPEN);
+
+#if GTK_MAJOR_VERSION < 2
+ /* Accelerator group for the accelerators (or, as they're called in
+ Windows and, I think, in Motif, "mnemonics"; Alt+<key> is a mnemonic,
+ Ctrl+<key> is an accelerator). */
+ accel_group = gtk_accel_group_new();
+ gtk_window_add_accel_group(GTK_WINDOW(file_color_import_w), accel_group);
+#endif
+
+ /* Container for each row of widgets */
+ main_vb = gtk_vbox_new(FALSE, 3);
+ gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
+ file_selection_set_extra_widget(file_color_import_w, main_vb);
+ gtk_widget_show(main_vb);
+
+
+ cfglobal_but = gtk_button_new_with_label("Global Color Filter File");
+ gtk_container_add(GTK_CONTAINER(main_vb), cfglobal_but);
+ SIGNAL_CONNECT(cfglobal_but, "clicked", color_global_cb, file_color_import_w);
+ gtk_widget_show(cfglobal_but);
+
+ SIGNAL_CONNECT(file_color_import_w, "destroy", file_color_import_destroy_cb, NULL);
+
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ OBJECT_SET_DATA(file_color_import_w, ARGUMENT_CL, data);
+
+ if (gtk_dialog_run(GTK_DIALOG(file_color_import_w)) == GTK_RESPONSE_ACCEPT)
+ {
+ file_color_import_ok_cb(file_color_import_w, file_color_import_w);
+ }
+ else window_destroy(file_color_import_w);
+#else
+ /* Connect the ok_button to file_open_ok_cb function and pass along a
+ pointer to the file selection box widget */
+ SIGNAL_CONNECT(GTK_FILE_SELECTION(file_color_import_w)->ok_button, "clicked",
+ file_color_import_ok_cb, file_color_import_w);
+
+ OBJECT_SET_DATA(GTK_FILE_SELECTION(file_color_import_w)->ok_button,
+ ARGUMENT_CL, data);
+
+ window_set_cancel_button(file_color_import_w,
+ GTK_FILE_SELECTION(file_color_import_w)->cancel_button, window_cancel_button_cb);
+
+ SIGNAL_CONNECT(file_color_import_w, "delete_event", window_delete_event_cb, NULL);
+
+
+ gtk_widget_show(file_color_import_w);
+ window_present(file_color_import_w);
+#endif
+}
+
+static void
+file_color_import_ok_cb(GtkWidget *w, gpointer fs) {
+ gchar *cf_name, *s;
+ gpointer argument;
+
+ argument = OBJECT_GET_DATA(w, ARGUMENT_CL); /* to be passed back into read_other_filters */
+
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ cf_name = g_strdup(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fs)));
+#else
+ cf_name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs)));
+#endif
+ /* Perhaps the user specified a directory instead of a file.
+ Check whether they did. */
+ if (test_for_directory(cf_name) == EISDIR) {
+ /* It's a directory - set the file selection box to display that
+ directory, don't try to open the directory as a capture file. */
+ set_last_open_dir(cf_name);
+ g_free(cf_name);
+ file_selection_set_current_folder(fs, get_last_open_dir());
+ return;
+ }
+
+ /* Try to open the capture file. */
+
+ if (!read_other_filters(cf_name, argument)) {
+ /* We couldn't open it; don't dismiss the open dialog box,
+ just leave it around so that the user can, after they
+ dismiss the alert box popped up for the open error,
+ try again. */
+ g_free(cf_name);
+ return;
+ }
+
+ /* We've crossed the Rubicon; get rid of the file selection box. */
+ window_destroy(GTK_WIDGET (fs));
+
+ /* Save the name of the containing directory specified in the path name,
+ if any; we can write over cf_name, which is a good thing, given that
+ "get_dirname()" does write over its argument. */
+ s = get_dirname(cf_name);
+ set_last_open_dir(s);
+ gtk_widget_grab_focus(packet_list);
+
+ g_free(cf_name);
+}
+
+static void
+file_color_import_destroy_cb(GtkWidget *win _U_, gpointer user_data _U_)
+{
+ /* Note that we no longer have a "Open Capture File" dialog box. */
+ file_color_import_w = NULL;
+}
+
+static GtkWidget *file_color_export_w;
+/*
+ * Set the "Export only marked filters" toggle button as appropriate for
+ * the current output file type and count of marked filters.
+ *
+ * Called when the "Export" dialog box is created and when the marked
+ * count changes.
+ */
+void
+color_set_export_marked_sensitive(GtkWidget * cfmark_cb)
+{
+ if (file_color_export_w == NULL) {
+ /* We don't currently have an "Export" dialog box up. */
+ return;
+ }
+
+ /* We can request that only the marked filters be saved only if
+ there *are* marked filters. */
+ if (color_marked_count() != 0)
+ gtk_widget_set_sensitive(cfmark_cb, TRUE);
+ else {
+ /* Force the "Export only marked filters" toggle to "false", turn
+ off the flag it controls. */
+ color_marked = FALSE;
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cfmark_cb), FALSE);
+ gtk_widget_set_sensitive(cfmark_cb, FALSE);
+ }
+}
+
+static void
+color_toggle_marked_cb(GtkWidget *widget, gpointer data _U_)
+{
+ color_marked = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (widget));
+}
+
+void
+file_color_export_cmd_cb(GtkWidget *w _U_, gpointer data _U_)
+{
+ GtkWidget *main_vb, *cfglobal_but;
+
+ if (file_color_export_w != NULL) {
+ /* There's already an "Color Filter Export" dialog box; reactivate it. */
+ reactivate_window(file_color_export_w);
+ return;
+ }
+
+ /* Default to saving all packets, in the file's current format. */
+ color_marked = FALSE;
+ filetype = cfile.cd_t;
+
+ file_color_export_w = file_selection_new("Ethereal: Export Color Filters",
+ FILE_SELECTION_SAVE);
+
+ /* Container for each row of widgets */
+ main_vb = gtk_vbox_new(FALSE, 3);
+ gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
+ file_selection_set_extra_widget(file_color_export_w, main_vb);
+ gtk_widget_show(main_vb);
+
+ cfmark_cb = gtk_check_button_new_with_label("Export only marked filters");
+ gtk_container_add(GTK_CONTAINER(main_vb), cfmark_cb);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cfmark_cb), FALSE);
+ SIGNAL_CONNECT(cfmark_cb, "toggled", color_toggle_marked_cb, NULL);
+ gtk_widget_show(cfmark_cb);
+ color_set_export_marked_sensitive(cfmark_cb);
+
+ cfglobal_but = gtk_button_new_with_label("Global Color Filter File");
+ gtk_container_add(GTK_CONTAINER(main_vb), cfglobal_but);
+ SIGNAL_CONNECT(cfglobal_but, "clicked", color_global_cb, file_color_export_w);
+ gtk_widget_show(cfglobal_but);
+
+ SIGNAL_CONNECT(file_color_export_w, "destroy", file_color_export_destroy_cb, NULL);
+
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ if (gtk_dialog_run(GTK_DIALOG(file_color_export_w)) == GTK_RESPONSE_ACCEPT)
+ {
+ file_color_export_ok_cb(file_color_export_w, file_color_export_w);
+ }
+ else window_destroy(file_color_export_w);
+#else
+ /* Connect the ok_button to file_export_ok_cb function and pass along a
+ pointer to the file selection box widget */
+ SIGNAL_CONNECT(GTK_FILE_SELECTION (file_color_export_w)->ok_button, "clicked",
+ file_color_export_ok_cb, file_color_export_w);
+
+ window_set_cancel_button(file_color_export_w,
+ GTK_FILE_SELECTION(file_color_export_w)->cancel_button, window_cancel_button_cb);
+
+ SIGNAL_CONNECT(file_color_export_w, "delete_event", window_delete_event_cb, NULL);
+
+
+ gtk_file_selection_set_filename(GTK_FILE_SELECTION(file_color_export_w), "");
+
+ gtk_widget_show(file_color_export_w);
+ window_present(file_color_export_w);
+#endif
+}
+
+static void
+file_color_export_ok_cb(GtkWidget *w _U_, gpointer fs) {
+ gchar *cf_name;
+ gchar *dirname;
+
+#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2
+ cf_name = g_strdup(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fs)));
+#else
+ cf_name = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs)));
+#endif
+
+ /* Perhaps the user specified a directory instead of a file.
+ Check whether they did. */
+ if (test_for_directory(cf_name) == EISDIR) {
+ /* It's a directory - set the file selection box to display that
+ directory, and leave the selection box displayed. */
+ set_last_open_dir(cf_name);
+ g_free(cf_name);
+ file_selection_set_current_folder(fs, get_last_open_dir());
+ return;
+ }
+
+ /* Write out the filters (all, or only the ones that are currently
+ displayed or marked) to the file with the specified name. */
+
+ if (!write_other_filters(cf_name, color_marked))
+ {
+ /* The write failed; don't dismiss the open dialog box,
+ just leave it around so that the user can, after they
+ dismiss the alert box popped up for the error, try again. */
+
+ g_free(cf_name);
+ return;
+ }
+
+ /* The write succeeded; get rid of the file selection box. */
+ window_destroy(GTK_WIDGET (fs));
+
+ /* Save the directory name for future file dialogs. */
+ dirname = get_dirname(cf_name); /* Overwrites cf_name */
+ set_last_open_dir(dirname);
+ g_free(cf_name);
+}
+
+static void
+file_color_export_destroy_cb(GtkWidget *win _U_, gpointer user_data _U_)
+{
+ file_color_export_w = NULL;
+}
diff -ruN ethereal-0.10.7/gtk/file_dlg.c.rej ethereal-0.10.7_mpeg2_recent/gtk/file_dlg.c.rej
--- ethereal-0.10.7/gtk/file_dlg.c.rej 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/gtk/file_dlg.c.rej 2004-12-02 16:14:19.419722274 +0100
@@ -0,0 +1,20 @@
+***************
+*** 78,84 ****
+ static void file_color_import_destroy_cb(GtkWidget *win, gpointer user_data);
+ static void file_color_export_ok_cb(GtkWidget *w, gpointer fs);
+ static void file_color_export_destroy_cb(GtkWidget *win, gpointer user_data);
+
+ #define E_FILE_M_RESOLVE_KEY "file_dlg_mac_resolve_key"
+ #define E_FILE_N_RESOLVE_KEY "file_dlg_network_resolve_key"
+ #define E_FILE_T_RESOLVE_KEY "file_dlg_transport_resolve_key"
+--- 87,96 ----
+ static void file_color_import_destroy_cb(GtkWidget *win, gpointer user_data);
+ static void file_color_export_ok_cb(GtkWidget *w, gpointer fs);
+ static void file_color_export_destroy_cb(GtkWidget *win, gpointer user_data);
++ static void set_do_ule(GtkWidget *w, gpointer user_data);
+
++ static void entrytxt_to_str(GtkWidget *w, gpointer data);
++ static void do_ule_te_syntax_check(GtkWidget *w);
+ #define E_FILE_M_RESOLVE_KEY "file_dlg_mac_resolve_key"
+ #define E_FILE_N_RESOLVE_KEY "file_dlg_network_resolve_key"
+ #define E_FILE_T_RESOLVE_KEY "file_dlg_transport_resolve_key"
diff -ruN ethereal-0.10.7/Makefile.common ethereal-0.10.7_mpeg2_recent/Makefile.common
--- ethereal-0.10.7/Makefile.common 2004-10-21 00:34:27.000000000 +0200
+++ ethereal-0.10.7_mpeg2_recent/Makefile.common 2004-12-02 16:14:19.502709787 +0100
@@ -51,7 +51,27 @@
sctpppids.h \
smb.h \
x264_prt_id.h \
- xmlstub.h
+ xmlstub.h \
+ mpeg2_convenience_routines.h \
+ mpeg2_descriptors.h \
+ mpeg2_hf.h \
+ mpeg2_psi.h \
+ epan/dissectors/dvb_crc32_table.h \
+ dvb_incs/ts_hdr.h \
+ dvb_incs/sect_gen.h \
+ dvb_incs/avpes_hdr.h \
+ dvb_incs/pes_hdr.h \
+ dvb_incs/sect_eit.h \
+ dvb_incs/sect_nit.h \
+ dvb_incs/sect_sdt.h \
+ dvb_incs/descriptors.h \
+ dvb_incs/ps_hdr.h \
+ dvb_incs/sect_pat.h \
+ dvb_incs/sect_ssc.h \
+ dvb_incs/sect_cat.h \
+ dvb_incs/sect_mpe.h \
+ dvb_incs/sect_pmt.h \
+ dvb_incs/sect_tdt.h
# "BUILT_SOURCES" are built before any "make all" or "make check" targets.
BUILT_SOURCES = \
diff -ruN ethereal-0.10.7/mpeg2_convenience_routines.c ethereal-0.10.7_mpeg2_recent/mpeg2_convenience_routines.c
--- ethereal-0.10.7/mpeg2_convenience_routines.c 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/mpeg2_convenience_routines.c 2004-12-02 16:14:19.591696398 +0100
@@ -0,0 +1,659 @@
+/* mpeg2_convenience_routines.c
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ *
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING wolfi@xxxxxxxxxxxxxx
+ * Lutz FINDEISEN lfindeis@xxxxxxxxxxxxxx
+ *
+ * Project partially sponsored by ESA projectnr.: JR/UOS/17471/03/NL/ND
+ * "Standardisation Support of enhanced IEFTF IP Encapsulation Tecniques"
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <string.h>
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+#ifdef NEED_SNPRINTF_H
+# include "snprintf.h"
+#endif
+
+#include <epan/packet.h>
+
+#include "dvb_incs/sect_gen.h"
+#include "dvb_incs/sect_gen.h"
+#include "dvb_incs/sect_pmt.h"
+#include "dvb_incs/sect_nit.h"
+#include "dvb_incs/sect_sdt.h"
+#include "dvb_incs/sect_mpe.h"
+#include "dvb_incs/descriptors.h"
+
+/*gboolean do_ule = FALSE;
+GSList *PID_list = NULL;*/
+
+gchar *dvb_table_id_str( guint8 tid )
+{
+ gchar *tstr = NULL;
+
+ switch (tid)
+ {
+ case DVB_TABLE_ID_PAT: tstr = "program association table"; break;
+ case DVB_TABLE_ID_CAT: tstr = "conditional access table"; break;
+ case DVB_TABLE_ID_PMT: tstr = "program map table"; break;
+ case DVB_TABLE_ID_TSDT: tstr = "transport stream description table"; break;
+
+ case DVB_TABLE_ID_NIT_ACT: tstr = "network information_table - actual network"; break;
+ case DVB_TABLE_ID_NIT_OTH: tstr = "network information_table - other network"; break;
+ case DVB_TABLE_ID_SDT_ACT: tstr = "service description_table - actual transport stream"; break;
+
+ case DVB_TABLE_ID_SDT_OTH: tstr = "service description table - other transport stream"; break;
+
+ case DVB_TABLE_ID_BAT: tstr = "bouquet association table"; break;
+
+ case DVB_TABLE_ID_EIT_ACT_PF: tstr = "event information_table - actual transport stream, present/following"; break;
+ case DVB_TABLE_ID_EIT_OTH_PF: tstr = "event information_table - other transport stream, present/following"; break;
+
+ case DVB_TABLE_ID_TDT: tstr = "time date table"; break;
+ case DVB_TABLE_ID_RST: tstr = "running status table"; break;
+ case DVB_TABLE_ID_ST: tstr = "stuffing table"; break;
+ case DVB_TABLE_ID_TOT: tstr = "time offset table"; break;
+
+ case DVB_TABLE_ID_DIT: tstr = "discontinuity information table"; break;
+ case DVB_TABLE_ID_SIT: tstr = "selection information table"; break;
+
+ case DVB_TABLE_ID_DSMCC_UN: tstr = "DSMCC User-Network message"; break;
+ case DVB_TABLE_ID_DSMCC_DDB: tstr = "DSMCC DownloadData message"; break;
+
+ case DVB_TABLE_ID_DSMCC_MPE: tstr = "DSMCC MPE encapsulated data"; break;
+ case DVB_TABLE_ID_DSMCC_PRIV: tstr = "DSMCC private_data"; break;
+
+ case DVB_TABLE_ID_AIT: tstr = "application information table"; break;
+
+ default: {
+ if (tid >= 0x50 && tid <= 0x5F)
+ tstr = "event information_table - actual transport stream, schedule";
+ else if (tid >= 0x60 && tid <= 0x6F)
+ tstr = "event information table - other transport stream, schedule";
+ else if (tid >= 0x80 && tid <= 0xFE)
+ tstr = "user defined";
+ else
+ tstr = "reserved";
+ break;
+ }
+ }
+ return tstr;
+}
+
+gchar *dvb_stream_type_str( guint8 stype )
+{
+ gchar *sstr = NULL;
+
+ switch (stype)
+ {
+ case 0x00: sstr = "ITU-T, ISO/IEC Reserved"; break;
+ case DVB_PMT_STREAM_IEC_11172_VIDEO: sstr = "ISO/IEC 11172 Video"; break;
+ case DVB_PMT_STREAM_IEC_13818_2_VIDEO: sstr = "ITU-T H.262, ISO/IEC 13818-2 Video"; break;
+ case DVB_PMT_STREAM_IEC_11172_AUDIO: sstr = "ISO/IEC 11172 Audio"; break;
+ case DVB_PMT_STREAM_IEC_13818_3_AUDIO: sstr = "ISO/IEC 13818-3 Audio"; break;
+ case DVB_PMT_STREAM_IEC_13818_1_PRIVATE: sstr = "ITU-T H.222.0, ISO/IEC 13818-1 Private Section"; break;
+ case DVB_PMT_STREAM_IEC_13818_1_PES: sstr = "ITU-T H.222.0, ISO/IEC 13818-1 PES Private"; break;
+ case DVB_PMT_STREAM_IEC_13522_MHEG: sstr = "ISO/IEC 13522 MHEG"; break;
+ case DVB_PMT_STREAM_IEC_13818_1_DSMCC: sstr = "ITU-T 222.0, ISO/IEC 13818-1 Annex A DSM CC"; break;
+ case DVB_PMT_STREAM_ITUT_H222_1: sstr = "ITU-T H.222.1"; break;
+ case DVB_PMT_STREAM_IEC_13818_6_A: sstr = "ISO/IEC 13818-6 type A"; break;
+ case DVB_PMT_STREAM_IEC_13818_6_B: sstr = "ISO/IEC 13818-6 type B"; break;
+ case DVB_PMT_STREAM_IEC_13818_6_C: sstr = "ISO/IEC 13818-6 type C"; break;
+ case DVB_PMT_STREAM_IEC_13818_6_D: sstr = "MPE Data Stream (ISO/IEC 13818-6 type D)"; break;
+ case DVB_PMT_STREAM_IEC_13818_1_AUX: sstr = "ISO/IEC 13818-1 Auxiliary"; break;
+ default: {
+ if (stype >= 0x0F && stype <= 0x7F)
+ sstr = "ITU-T H.222.0, ISO/IEC 13818-1 Reserved";
+ else if (stype >= 0x80)
+ sstr = "User Private";
+ }
+ }
+ return sstr;
+}
+
+gchar *dvb_descr_tag_str( guint8 dtag )
+{
+ gchar *dtstr = NULL;
+
+ switch (dtag)
+ {
+ case DVB_DESCR_TAG_VIDEO_STREAM: dtstr = "video_stream_descriptor"; break;
+ case DVB_DESCR_TAG_AUDIO_STREAM: dtstr = "audio_stream_descriptor"; break;
+ case DVB_DESCR_TAG_HIERARCHY: dtstr = "hierarchy_descriptor"; break;
+ case DVB_DESCR_TAG_REGISTRATION: dtstr = "registration_descriptor"; break;
+ case DVB_DESCR_TAG_DATA_STREAM_ALIGN: dtstr = "data_stream_alignment_descriptor"; break;
+ case DVB_DESCR_TAG_TARGET_BG_GRID: dtstr = "target_background_grid_descriptor"; break;
+ case DVB_DESCR_TAG_VIDEO_WINDOW: dtstr = "video_window_descriptor"; break;
+ case DVB_DESCR_TAG_CA: dtstr = "CA_descriptor"; break;
+ case DVB_DESCR_TAG_ISO_639_LANG: dtstr = "ISO_639_language_descriptor"; break;
+ case DVB_DESCR_TAG_SYSTEM_CLOCK: dtstr = "system_clock_descriptor"; break;
+ case DVB_DESCR_TAG_MPX_BUF_UTIL: dtstr = "multiplex_buffer_utilization_descriptor"; break;
+ case DVB_DESCR_TAG_COPYRIGHT: dtstr = "copyright_descriptor"; break;
+ case DVB_DESCR_TAG_MAX_BITRATE: dtstr = "maximum_bitarte_descriptor"; break;
+ case DVB_DESCR_TAG_PRIVATE_DATA: dtstr = "private_data_indicator_descriptor"; break;
+ case DVB_DESCR_TAG_SMOOTHING_BUF: dtstr = "smoothing_buffer_descriptor"; break;
+ case DVB_DESCR_TAG_SDT: dtstr = "SDT_descriptor"; break;
+ case DVB_DESCR_TAG_IBP: dtstr = "IBP_descriptor"; break;
+
+ case DVB_DESCR_TAG_CAROUSEL_ID: dtstr = "carousel_identifier_descriptor"; break;
+ case DVB_DESCR_TAG_ASSOC_TAG: dtstr = "association_tag_descriptor"; break;
+ case DVB_DESCR_TAG_DEFERRED_ASSOC: dtstr = "deferred_association_tags_descriptor"; break;
+
+ case DVB_DESCR_TAG_NETWORK_NAME: dtstr = "network_name_descriptor"; break;
+ case DVB_DESCR_TAG_SERVICE_LIST: dtstr = "service_list_descriptor"; break;
+ case DVB_DESCR_TAG_STUFFING: dtstr = "stuffing_descriptor"; break;
+ case DVB_DESCR_TAG_SAT_DELIV_SYS: dtstr = "satellite_delivery_system_descriptor"; break;
+ case DVB_DESCR_TAG_CABLE_DELIV_SYS: dtstr = "cable_delivery_system_descriptor"; break;
+ case DVB_DESCR_TAG_BOUQUET_NAME: dtstr = "bouquet_name_descriptor"; break;
+ case DVB_DESCR_TAG_SERVICE: dtstr = "service_descriptor"; break;
+ case DVB_DESCR_TAG_COUNTRY_AVAIL: dtstr = "country_availability_descriptor"; break;
+ case DVB_DESCR_TAG_LINKAGE: dtstr = "linkage_descriptor"; break;
+ case DVB_DESCR_TAG_NVOD_REFERENCE: dtstr = "NVOD_reference_descriptor"; break;
+ case DVB_DESCR_TAG_TIME_SHIFTED: dtstr = "time_shifted_service_descriptor"; break;
+ case DVB_DESCR_TAG_SHORT_EVENT: dtstr = "short_event_descriptor"; break;
+ case DVB_DESCR_TAG_EXTENDED_EVENT: dtstr = "extended_event_descriptor"; break;
+ case DVB_DESCR_TAG_TSHIFT_EVENT: dtstr = "time_shifted_event_descriptor"; break;
+ case DVB_DESCR_TAG_COMPONENT: dtstr = "component_descriptor"; break;
+ case DVB_DESCR_TAG_MOSAIC: dtstr = "mosaic_descriptor"; break;
+ case DVB_DESCR_TAG_STREAM_ID: dtstr = "stream_identifier_descriptor"; break;
+ case DVB_DESCR_TAG_CA_ID: dtstr = "CA_identifier_descriptor"; break;
+ case DVB_DESCR_TAG_TELETEXT: dtstr = "teletext_descriptor"; break;
+ case DVB_DESCR_TAG_TELEPHONE: dtstr = "telephone_descriptor"; break;
+ case DVB_DESCR_TAG_SUBTITLING: dtstr = "subtitling_descriptor"; break;
+ case DVB_DESCR_TAG_TERR_DELIV_SYS: dtstr = "terrestrial_delilvery_system_descriptor"; break;
+ case DVB_DESCR_TAG_MULING_NET_NAME: dtstr = "multilingual_network_name_descriptor"; break;
+ case DVB_DESCR_TAG_MULING_SERV_NAME: dtstr = "multilingual_service_name_descriptor"; break;
+ case DVB_DESCR_TAG_PRIV_DATA_SPEC: dtstr = "private_data_specifier_descriptor"; break;
+ case DVB_DESCR_TAG_SERVICE_MOVE: dtstr = "service_move_descriptor"; break;
+ case DVB_DESCR_TAG_FREQ_LIST: dtstr = "frequency_list_descriptor"; break;
+ case DVB_DESCR_TAG_DATA_BROADCAST: dtstr = "data_broadcast_descriptor"; break;
+ case DVB_DESCR_TAG_CA_SYSTEM: dtstr = "ca_system_descriptor"; break;
+ case DVB_DESCR_TAG_DATA_BROADCAST_ID: dtstr = "data_broadcast_id_descriptor"; break;
+ case DVB_DESCR_TAG_AC3: dtstr = "ac3_descriptor"; break;
+ case DVB_DESCR_TAG_APP_SIG: dtstr = "application_signalling_descriptor"; break;
+ case DVB_DESCR_TAG_CONTENT: dtstr = "content_descriptor"; break;
+ case DVB_DESCR_TAG_PDC: dtstr = "PDC_descriptor"; break;
+ case DVB_DESCR_TAG_VBI_DATA: dtstr = "VBI_data_descriptor"; break;
+ case DVB_DESCR_TAG_VBI_TELETEXT: dtstr = "VBI_Teletext_descriptor"; break;
+ case DVB_DESCR_TAG_LOC_TIME_OFF: dtstr = "local_time_offset_descriptor"; break;
+ case DVB_DESCR_TAG_MULING_BOU_NAME: dtstr = "multili_bouquet_name_descriptor"; break;
+ case DVB_DESCR_TAG_MULING_COMP: dtstr = "multilingual_component_descriptor"; break;
+
+ /* case DVB_DESCR_TAG_: dtstr = "_descriptor"; break;*/
+ default: {
+ if (dtag >= 0x67 && dtag <= 0x7F)
+ dtstr = "reserved for future use";
+ else if (dtag >= 0x80 && dtag <= 0xFE)
+ dtstr = "user defined";
+ else
+ dtstr = "forbidden";
+ }
+ }
+ return dtstr;
+}
+
+gchar *dvb_service_type_str( guint8 stype )
+{
+ gchar *sstr = NULL;
+
+ switch (stype)
+ {
+ case DVB_SVC_TYP_DIGI_TV: sstr = "digital television service"; break;
+ case DVB_SVC_TYP_DIGI_RD_SOUND: sstr = "digital radio sound service"; break;
+ case DVB_SVC_TYP_TELETEXT: sstr = "teletext service"; break;
+ case DVB_SVC_TYP_NVOD_REF: sstr = "NVOD reference service"; break;
+ case DVB_SVC_TYP_NVOD_TSHF: sstr = "NVOD time-shifted service"; break;
+ case DVB_SVC_TYP_MOSAIC: sstr = "mosaic service"; break;
+ case DVB_SVC_TYP_PAL_CODED: sstr = "PAL coded signal"; break;
+ case DVB_SVC_TYP_SECAM_CODED: sstr = "SECAM coded signal"; break;
+ case DVB_SVC_TYP_D_D2_MAC: sstr = "D/D2-MAC"; break;
+ case DVB_SVC_TYP_FM_RADIO: sstr = "FM Radio"; break;
+ case DVB_SVC_TYP_NTSC_CODED: sstr = "NTSC coded signal"; break;
+ case DVB_SVC_TYP_DATA_BROADCAST: sstr = "data broadcast service"; break;
+ default: {
+ if (stype == 0x00 || (stype >= 0x0D && stype <= 0x7F) || stype == 0xFF)
+ sstr = "reserved for future use";
+ else if (stype >= 0x80 && stype <= 0xFE)
+ sstr = "user defined";
+ }
+ }
+ return sstr;
+}
+
+gchar *dvb_content_str(gint nibble)
+{
+ gchar *cstr = NULL;
+
+ switch(nibble)
+ {
+ case 0x10: cstr = "movie/drama (general)"; break;
+ case 0x11: cstr = "detective/thriller"; break;
+ case 0x12: cstr = "adventure/western/war"; break;
+ case 0x13: cstr = "science fiction/fantasy/horror"; break;
+ case 0x14: cstr = "comedy"; break;
+ case 0x15: cstr = "soap/melodrama/folkloric"; break;
+ case 0x16: cstr = "romance"; break;
+ case 0x17: cstr = "serious/classical/religous/historical movie/drama"; break;
+ case 0x18: cstr = "adult movie/drama"; break;
+ case 0x20: cstr = "news/current affairs (general)"; break;
+ case 0x21: cstr = "news/weather report"; break;
+ case 0x22: cstr = "news magazine"; break;
+ case 0x23: cstr = "documentary"; break;
+ case 0x24: cstr = "discussion/interview/debate"; break;
+ case 0x2F: cstr = "user defined"; break;
+ case 0x30: cstr = "show/game show (general)"; break;
+ case 0x31: cstr = "game show/quiz/contest"; break;
+ case 0x32: cstr = "variety show"; break;
+ case 0x33: cstr = "talk show"; break;
+ case 0x3f: cstr = "user defined"; break;
+ case 0x40: cstr = "sports (general)"; break;
+ case 0x41: cstr = "special events (Olympic Games, World Cup, etc.)"; break;
+ case 0x42: cstr = "sports magazines"; break;
+ case 0x43: cstr = "football/soccer"; break;
+ case 0x44: cstr = "tennis/squash"; break;
+ case 0x45: cstr = "team sports (excluding football)";
+ case 0x46: cstr = "athletics"; break;
+ case 0x47: cstr = "motor sports"; break;
+ case 0x48: cstr = "water sports"; break;
+ case 0x49: cstr = "winter sports"; break;
+ case 0x4a: cstr = "equestrian"; break;
+ case 0x4b: cstr = "martial sports"; break;
+ case 0x4f: cstr = "user defined"; break;
+ case 0x50: cstr = "children's/youth programmes (general)"; break;
+ case 0x51: cstr = "pre-school children's programmes"; break;
+ case 0x52: cstr = "entertainment programmes 6 to 14"; break;
+ case 0x53: cstr = "entertainment programmes 10 to 16"; break;
+ case 0x54: cstr = "informational/educational/school programmes"; break;
+ case 0x55: cstr = "cartoons puppets"; break;
+ case 0x5f: cstr = "user defined"; break;
+ case 0x60: cstr = "music/ballet/dance (general)"; break;
+ case 0x61: cstr = "rock/pop"; break;
+ case 0x62: cstr = "serious music/classical music"; break;
+ case 0x63: cstr = "folk/traditional music"; break;
+ case 0x64: cstr = "jazz"; break;
+ case 0x65: cstr = "musical/opera"; break;
+ case 0x66: cstr = "ballet"; break;
+ case 0x6f: cstr = "user defined"; break;
+ case 0x70: cstr = "arts/culture (without music general)"; break;
+ case 0x71: cstr = "performing arts"; break;
+ case 0x72: cstr = "fine arts"; break;
+ case 0x73: cstr = "religion"; break;
+ case 0x74: cstr = "popular culture/traditional arts"; break;
+ case 0x75: cstr = "literature"; break;
+ case 0x76: cstr = "film/cinema"; break;
+ case 0x77: cstr = "experimental film/video"; break;
+ case 0x78: cstr = "broadcast/press"; break;
+ case 0x79: cstr = "new media"; break;
+ case 0x7a: cstr = "arts/culture magazines"; break;
+ case 0xfb: cstr = "fashion"; break;
+ case 0x7f: cstr = "user defined"; break;
+ case 0x80: cstr = "social/political issues/economics (general)"; break;
+ case 0x81: cstr = "magazines/reports/documentary"; break;
+ case 0x82: cstr = "economics/social advisory"; break;
+ case 0x83: cstr = "remarkable people"; break;
+ case 0x8f: cstr = "user defined"; break;
+ case 0x90: cstr = "euducation/science/factual topics (general)"; break;
+ case 0x91: cstr = "nature/animals/environment"; break;
+ case 0x92: cstr = "technology/natural science"; break;
+ case 0x93: cstr = "medicine/physioligy/psychology"; break;
+ case 0x94: cstr = "foreign countries/expeditions"; break;
+ case 0x95: cstr = "social/spiritual sciences"; break;
+ case 0x96: cstr = "further education"; break;
+ case 0x97: cstr = "languages"; break;
+ case 0x9f: cstr = "user defined"; break;
+ case 0xa0: cstr = "leisure hobbies (general)"; break;
+ case 0xa1: cstr = "tourism/travel"; break;
+ case 0xa2: cstr = "handicraft"; break;
+ case 0xa3: cstr = "motiring"; break;
+ case 0xa4: cstr = "fitnes & health"; break;
+ case 0xa5: cstr = "cooking"; break;
+ case 0xa6: cstr = "advertisment/shopping"; break;
+ case 0xa7: cstr = "gardening"; break;
+ case 0xaf: cstr = "user defined"; break;
+ case 0xb0: cstr = "original language"; break;
+ case 0xb1: cstr = "black & white"; break;
+ case 0xb2: cstr = "unpublished"; break;
+ case 0xb3: cstr = "live broadcast"; break;
+ case 0xbf: cstr = "user defined"; break;
+ default:
+ if((nibble >= 0xf0) & (nibble <= 0xff))
+ cstr = "user defined";
+ else if ((nibble >= 0x0) & (nibble <= 0x0f))
+ cstr = "undefined content";
+ else
+ cstr ="reserved for future use";
+ }
+ return cstr;
+
+
+
+ }
+
+gchar *dvb_cont_comp_str(gint cont_comp)
+ {
+ gchar *ret;
+ switch (cont_comp)
+ {
+ case 0x0100: ret = "reserved for future use"; break;
+ case 0x0101: ret = "video, 4:3 aspect ratio, 25 Hz"; break;
+ case 0x0102: ret = "video, 16:9 aspect ratio with pan vectors, 25 Hz"; break;
+ case 0x0103: ret = "video, 16:9 apsect ration without pan vectors, 25 HZ"; break;
+ case 0x0104: ret = "video, > 16:9 aspect ratio, 25 Hz"; break;
+ case 0x0105: ret = "video, 4:3 aspect ratio, 30 Hz"; break;
+ case 0x0106: ret = "video, 16:9 aspect ratio with pan vectors, 30 Hz"; break;
+ case 0x0107: ret = "video, 16:9 apsect ration without pan vectors, 30 HZ"; break;
+ case 0x0108: ret = "video, > 16:9 aspect ratio, 30 Hz"; break;
+ case 0x0109: ret = "high definiton video, 4:3 aspect ratio, 25 Hz"; break;
+ case 0x010a: ret = "high definiton video, 16:9 aspect ratio with pan vectors, 25 Hz"; break;
+ case 0x010b: ret = "high definiton video, 16:9 aspect ratio without pan vectors, 25 Hz"; break;
+ case 0x010c: ret = "high definiton video, > 16:9 aspect ratio, 25 Hz"; break;
+ case 0x010d: ret = "high definiton video, 4:3 aspect ratio, Hz"; break;
+ case 0x010e: ret = "high definiton video, 16:9 aspect ratio with pan vectors, 30 Hz"; break;
+ case 0x010f: ret = "high definiton video, 16:9 aspect ratio without pan vectors, 30 Hz"; break;
+ case 0x0110: ret = "high definiton video, > 16:9 aspect ratio, 30 Hz"; break;
+ case 0x0201: ret = "audio, single mono channel"; break;
+ case 0x0202: ret = "audio, dual mono channel"; break;
+ case 0x0203: ret = "audio, stereo (2 channel)"; break;
+ case 0x0204: ret = "audio, multi-lungual, multi-channel"; break;
+ case 0x0205: ret = "audio, surround sound"; break;
+ case 0x0240: ret = "audio descripton for the visually impaired"; break;
+ case 0x0241: ret = "audio for the hard of hearing"; break;
+ case 0x0301: ret = "EBU Teletext subtitles"; break;
+ case 0x0302: ret = "associated EBU Teletext"; break;
+ case 0x0303: ret = "VBI data"; break;
+ case 0x0310: ret = "DVB subtitles (normal) with no monitor aspect ratio criticality"; break;
+ case 0x0311: ret = "DVB subtitles (normal) for display on 4:3 aspect ratio monitor"; break;
+ case 0x0312: ret = "DVB subtitles (normal) for display on 16:9 asoect ratio monitor"; break;
+ case 0x0313: ret = "DVB subtitles (normal) for display on 2.21:1 aspet ratio monitor"; break;
+ case 0x0320: ret = "DVB subtitles (for the hard of hearing) with no monitor aspect ratio criticality"; break;
+ case 0x0321: ret = "DVB subtitles (for the hard of hearing) for display on 4:3 aspect ratio monitor"; break;
+ case 0x0322: ret = "DVB subtitles (for the hard of hearing) for display on 16:9 asoect ratio monitor"; break;
+ case 0x0323: ret = "DVB subtitles (for the hard of hearing) for display on 2.21:1 aspet ratio monitor"; break;
+ default:
+ if(((cont_comp >= 0x0) & (cont_comp <= 0x00ff)) | ((cont_comp >= 0x0111) & (cont_comp <= 0x01af)) |
+ ((cont_comp >= 0x0206) & (cont_comp <= 0x023f)) | ((cont_comp >= 0x0304) & (cont_comp <= 0x030f)) |
+ ((cont_comp >= 0x0314) & (cont_comp <= 0x031f)) | ((cont_comp >= 0x0324) & (cont_comp <= 0x03af)) |
+ ((cont_comp >= 0x03b0) & (cont_comp <= 0x03fe)) | ((cont_comp >= 0x0480) & (cont_comp <= 0x04ff)) |
+ ((cont_comp >= 0x0500) & (cont_comp <= 0x0bff)))
+ ret = "reserved for future use";
+ else if(((cont_comp >= 0x01b0) & (cont_comp <= 0x01fe)) | ((cont_comp >= 0x02b0) & (cont_comp <= 0x02fe)) |
+ ((cont_comp >= 0x03b0) & (cont_comp <= 0x03fe)) | ((cont_comp >= 0x0c00) & (cont_comp <= 0x0fff)))
+ ret = "user defined";
+ else
+ ret = "reserved for AC-3 audio modes (refer table D.1 of Annex E)";
+ }
+ return ret;
+
+ }
+gchar *dvb_descr_txt_type(gint type)
+ {
+ gchar *ret=NULL;
+ switch(type)
+ {
+ case DVB_TELETEXT_TYPE_INITIAL: ret = "initial Teletext page"; break;
+ case DVB_TELETEXT_TYPE_SUBTITLE: ret = "Teletext subtitle page"; break;
+ case DVB_TELETEXT_TYPE_INFO: ret = "additional info page"; break;
+ case DVB_TELETEXT_TYPE_SCHEDULE: ret = "programme schedule page"; break;
+ case DVB_TELETEXT_TYPE_IMPAIRED: ret = "Teletext subtitle page for hearing impaired people"; break;
+ default: ret = "reserved for future use";
+ }
+ return ret;
+ }
+
+gchar *dvb_descr_vbi_str(gint type)
+ {
+ gchar *ret = NULL;
+ switch(type)
+ {
+ case 0x01: ret = "EBU teletext (requires additional teletext descriptor)"; break;
+ case 0x02: ret = "inverted teletext"; break;
+ case 0x03: ret = "reserved"; break;
+ case 0x04: ret = "VPS"; break;
+ case 0x05: ret = "WSS"; break;
+ case 0x06: ret = "Closed Captioning"; break;
+ case 0x07: ret = "monochrome 4:2:2 samples"; break;
+ default: ret = "reserved for future use";
+ }
+ return ret;
+ }
+
+gchar *dvb_descr_audio_str(gint type)
+{
+
+ gchar *ret = NULL;
+ switch(type)
+ {
+ case 0x00: ret = "Undefined"; break;
+ case 0x01: ret = "Clean effects"; break;
+ case 0x02: ret = "Hearing impaired"; break;
+ case 0x03: ret = "Visual impaired commentary"; break;
+ default: ret = "Reserved"; break;
+ }
+ return ret;
+}
+
+gchar *dvb_descr_pds_str(gint type)
+{
+ gchar *ret = NULL;
+ switch(type)
+ {
+ case 0x00000000: ret = "Reserved"; break;
+ case 0x00000001: ret = "SES"; break;
+ case 0x00000002: ret = "BsSkyB 1"; break;
+ case 0x00000003: ret = "BsSkyB 2"; break;
+ case 0x00000004: ret = "BsSkyB 3"; break;
+ case 0x000000be: ret = "BetaTechnik"; break;
+ case 0x00006000: ret = "News Datacom"; break;
+ case 0x00006001: ret = "NDC 1"; break;
+ case 0x00006002: ret = "NDC 2"; break;
+ case 0x00006003: ret = "NDC 3"; break;
+ case 0x00006004: ret = "NDC 4"; break;
+ case 0x00006005: ret = "NDC 5"; break;
+ case 0x00006006: ret = "NDC 6"; break;
+ case 0x00362275: ret = "Irdeto"; break;
+ case 0x004E544C: ret = "NTL"; break;
+ case 0x00532D41: ret = "Scientific Atlanta"; break;
+ case 0x44414E59: ret = "News Datacom (IL) 1"; break;
+ case 0x46524549: ret = "News Datacom (IL) 1"; break;
+ case 0x53415053: ret = "Scientific Atlanta"; break;
+ default: ret = "future use"; break;
+ }
+ return ret;
+}
+
+
+
+/**
+ * According to ETR162, Table 5: CA System ID.
+ */
+gchar *dvb_CA_system_id_str( guint16 casid )
+{
+ gchar *castr = NULL;
+
+ if (casid != 0x00)
+ switch (casid & 0xFF00)
+ {
+ case 0x00: castr = "Standardized systems"; break;
+ case 0x01: castr = "Canal Plus"; break;
+ case 0x02: castr = "CCETT"; break;
+ case 0x03: castr = "Deutsche Telekom"; break;
+ case 0x04: castr = "Eurodec"; break;
+ case 0x05: castr = "France Telecom"; break;
+ case 0x06: castr = "Irdeto"; break;
+ case 0x07: castr = "Jerrold/GI"; break;
+ case 0x08: castr = "Matra Communication"; break;
+ case 0x09: castr = "News Datacom"; break;
+ case 0x0A: castr = "Nokia"; break;
+ case 0x0B: castr = "Norwegian Telekom"; break;
+ case 0x0C: castr = "NTL"; break;
+ case 0x0D: castr = "Philips"; break;
+ case 0x0E: castr = "Scientific Atlanta"; break;
+ case 0x0F: castr = "Sony"; break;
+ case 0x10: castr = "Tandberg Television"; break;
+ case 0x11: castr = "Thomson"; break;
+ case 0x12: castr = "TV/Com"; break;
+ case 0x13: castr = "HPT - Croatian Post and Teledommunications"; break;
+ case 0x14: castr = "HRT - Croatian Radio and Television"; break;
+ case 0x15: castr = "IBM"; break;
+ case 0x16: castr = "Nera"; break;
+ case 0x17: castr = "BetaTechnik"; break;
+ case 0x18: castr = "Kudelski SA"; break;
+ case 0x19: castr = "Titan Informatino Systems"; break;
+ case 0x20: castr = "Telefonica Servicios Audiovisuales"; break;
+ case 0x21: castr = "STENTOR (France Telecom, CNES and DGA)"; break;
+ default: castr = "UNDEFINED"; break;
+ }
+ else
+ castr = "Reserved";
+
+ return castr;
+}
+
+
+/**
+ * According to EN 300 468, Table 40: Linkage type coding.
+ */
+gchar *dvb_linkage_type_str( guint8 linkage_type )
+{
+ gchar *ltstr = NULL;
+ if(linkage_type >= 0x07 && linkage_type <= 0x7E)
+ ltstr = "reserved for future use";
+ else if (linkage_type >= 0x80 && linkage_type <= 0xFE)
+ ltstr = "user defined";
+ else
+ {
+ switch (linkage_type)
+ {
+ case 0x00: ltstr = "reserved for future use"; break;
+ case 0x01: ltstr = "information service"; break;
+ case 0x02: ltstr = "EPG service"; break;
+ case 0x03: ltstr = "CA replacement service"; break;
+ case 0x04: ltstr = "TS containing complete Network/Bouquet SI"; break;
+ case 0x05: ltstr = "service replacement service"; break;
+ case 0x06: ltstr = "data broadcast service"; break;
+ case 0xFF: ltstr = "reserved for future use"; break;
+ }
+ }
+ return ltstr;
+}
+
+
+gchar *char2alphabet( guchar fb)
+{
+ switch(fb){
+ case 0x01: return "ISO-8859-5";
+ case 0x02: return "ISO-8859-6";
+ case 0x03: return "ISO-8859-7";
+ case 0x04: return "ISO-8859-8";
+ case 0x05: return "ISO-8859-9";
+ case 0x10: return "ISO-8859";
+ case 0x11: return "ISO-10646-1";
+ case 0x12: return "KSC-5601";
+ default: return "ISO-8859-1";
+ }
+}
+
+void proto_tree_add_longtext(proto_tree *tree, tvbuff_t *tvb, guint16 offset, guchar *textstr, guint8 len)
+{
+ guchar tmp[150];
+ gchar *alph, *textend = textstr + (size_t)len;
+ gsize written;
+ alph = char2alphabet(*textstr);
+
+ while(textstr < (guchar *)textend)
+ {
+ if(len > 149)
+ {
+ memcpy(tmp,textstr,150);
+ if(tmp[0] < 0x20) /* just delete if is not a valid char*/
+ tmp[0] = ' ';
+ proto_tree_add_text(tree, tvb, offset, 150, "%s", g_convert(tmp,150, "UTF-8",alph,NULL,&written,NULL));
+ len -= 150;
+ textstr += 150;
+ offset += 150;
+ }
+ else
+ {
+ memcpy(tmp,textstr,len);
+ if(tmp[0] < 0x20)
+ tmp[0] = ' ';
+ proto_tree_add_text(tree, tvb, offset, len, "%s", g_convert(tmp,len, "UTF8",alph,NULL,&written,NULL));
+ textstr += len;
+ }
+
+ }
+ return;
+}
+
+char *dvb_data_broadcast_id_str(guint16 dbid )
+{
+ char *dbstr = NULL;
+ if(dbid >= 0x000A && dbid <= 0x00EF)
+ dbstr = "reserved future use by DVB";
+ else if(dbid >= 0x00FF && dbid <= 0x00FE)
+ dbstr = "reserved for MHP use";
+ else
+ {
+ switch (dbid)
+ {
+ case DVB_DBC_ID_DATA_PIPE: dbstr = "Data pipe"; break;
+ case DVB_DBC_ID_ASYNC_DATA_STREAM: dbstr = "Asynchronous data stream"; break;
+ case DVB_DBC_ID_SYNC_DATA_STREAM: dbstr = "Synchronous data stream"; break;
+ case DVB_DBC_ID_SYNCED_DATA_STREAM: dbstr = "Synchronized data stream"; break;
+ case DVB_DBC_ID_MPE: dbstr = "Multi protocol encapsulation"; break;
+ case DVB_DBC_ID_DATA_CAROUSEL: dbstr = "Data Carousel"; break;
+ case DVB_DBC_ID_OBJECT_CAROUSEL: dbstr = "Object Carousel"; break;
+ case DVB_DBC_ID_ATM_STREAMS: dbstr = "DVB ATM streams"; break;
+ case DVB_DBC_ID_HIGHER_PROTO: dbstr = "Higher Protocl Async Data"; break;
+ case DVB_DBC_ID_MHP_CAROUSEL: dbstr = "MHP Object Carousel"; break;
+ case DVB_DBC_ID_MHP_MPE: dbstr = "MHP Multi protocol encapsulation"; break;
+ case 0x00FF: dbstr = "reserved future use by DVB"; break;
+ default: {
+ if (dbid == 0 || dbid == 0xFFFF)
+ dbstr = "Reserved for future use";
+ else if (dbid >= 0x0100 && dbid <= 0xFFFE)
+ dbstr = "Reserved for registration";
+ }
+ }
+ }
+ return dbstr;
+}
+
+gchar *dvb_app_type_str( guint16 app_type )
+{
+ gchar *ats = NULL;
+
+ switch (app_type)
+ {
+ case 0x0000: ats = "reserved"; break;
+ case 0x0001: ats = "DVB-J"; break;
+ case 0x0002: ats = "DVB-HTML"; break;
+ default: ats = "to be registered w/ DVB"; break;
+ }
+ return ats;
+}
diff -ruN ethereal-0.10.7/mpeg2_convenience_routines.h ethereal-0.10.7_mpeg2_recent/mpeg2_convenience_routines.h
--- ethereal-0.10.7/mpeg2_convenience_routines.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/mpeg2_convenience_routines.h 2004-12-02 16:14:19.593696097 +0100
@@ -0,0 +1,170 @@
+/* mpeg2_convenience_routines.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ *
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING wolfi@xxxxxxxxxxxxxx
+ * Lutz FINDEISEN lfindeis@xxxxxxxxxxxxxx
+ *
+ * Project partially sponsored by ESA projectnr.: JR/UOS/17471/03/NL/ND
+ * "Standardisation Support of enhanced IEFTF IP Encapsulation Tecniques"
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * @file
+ */
+#ifndef __MPEG2_CONVENIENCE_ROUTINES_H__
+#define __MPEG2_CONVENIENCE_ROUTINES_H__
+
+#define BCD2INT(b) ((((b) & 0xF0)>>4) * 10 + ((b) & 0x0F))
+#define GET_ULONG(b) ((gulong)((b)[0] << 24 | (b)[1] << 16 | (b)[2] << 8 | (b)[3]))
+#define GET_USHORT(b) ((gushort)((b)[0] << 8 | (b)[1]))
+guint32 bcd2int( guint32 bcd );
+guint32 int2bcd( guint32 integer );
+/**
+ * Returns a string containing the name of a table_id
+ *
+ * @param tid inter with the table_id
+ */
+extern
+gchar *dvb_table_id_str(guint8 tid);
+
+/**
+ * Returns a string specifying the program element carried with a specific PID
+*
+* @param stype integer holding the stream_type
+*/
+extern
+gchar *dvb_stream_type_str( guint8 stype );
+
+/**
+ * Returns a string containing the name of the descriptor
+ *
+ * @param dtag integer holding the descriptor tag
+ */
+extern
+gchar *dvb_descr_tag_str( guint8 dtag );
+
+/**
+ * Returns a string specifying the service
+ *
+ * @param stype integer holding the service type
+ */
+
+extern
+gchar *dvb_service_type_str( guint8 stype );
+
+/**
+ * Returns a string containig the name of a CA system id
+ *
+ * @param casid integer holding the CA system id
+ */
+extern
+gchar *dvb_CA_system_id_str( guint16 casid );
+
+/**
+ * Returns a string containing the name of linkage type
+ *
+ * @param linkage_type integer holding the linkage type
+ */
+extern
+gchar *dvb_linkage_type_str( guint8 linkage_type );
+
+/**
+ * Returns a string specifying the content
+ *
+ * @param nibble integer
+ */
+extern
+gchar *dvb_content_str(gint nibble);
+
+/**
+ * Returns a string containing the name of the stream content and component type
+ *
+ * @param cont_comp integer holding the stream content and the component type
+ */
+extern
+gchar *dvb_cont_comp_str(gint cont_comp);
+
+/**
+ * Returns a string containing the name of the teletext type
+ *
+ * @param type integer holding the teletext type
+ */
+extern
+gchar *dvb_descr_txt_type(gint type);
+
+/**
+ * Returns a string containing the name of the VBI type
+ *
+ * @param type integer holding the VBI type
+ */
+extern
+gchar *dvb_descr_vbi_str(gint type);
+
+/**
+ * Returns a string containing the name of the audio type
+ *
+ * @param type integer holding the audio type
+ */
+extern
+gchar *dvb_descr_audio_str(gint type);
+
+/**
+ * Returns a string containing the name of the private data specifiaction
+ *
+ * @param type integer holding the private data specification type
+ */
+extern
+gchar *dvb_descr_pds_str(gint type);
+
+
+extern
+gchar *char2alphabet( guchar fb);
+
+/**
+ * Convenience function for the better displayability for long strings in Ethereal
+ *
+ * @param tree protocol tree displayed in the middle pane
+ * @param tvb testy virtulaizable buffer
+ * @param textstr rather long string
+ * @param len length of the string
+ */
+extern
+void proto_tree_add_longtext(proto_tree *tree, tvbuff_t *tvb, guint16 offset, guchar *textstr, guint8 len);
+
+/**
+ * Returns a string containing the name of a data broadcast id
+ *
+ * @param dbid integer holding the data broadcast id
+ */
+extern
+gchar *dvb_data_broadcast_id_str( guint16 dbid );
+
+/**
+ * Returns a string containing the name of application type
+ *
+ * @param app_type integer holding the application type
+ */
+extern
+gchar *dvb_app_type_str( guint16 app_type );
+
+#endif
diff -ruN ethereal-0.10.7/mpeg2_descriptors.c ethereal-0.10.7_mpeg2_recent/mpeg2_descriptors.c
--- ethereal-0.10.7/mpeg2_descriptors.c 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/mpeg2_descriptors.c 2004-12-02 16:14:19.688681805 +0100
@@ -0,0 +1,1469 @@
+/* mpeg2_descriptors.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ *
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING wolfi@xxxxxxxxxxxxxx
+ * Lutz FINDEISEN lfindeis@xxxxxxxxxxxxxx
+ *
+ * Project partially sponsored by ESA projectnr.: JR/UOS/17471/03/NL/ND
+ * "Standardisation Support of enhanced IEFTF IP Encapsulation Tecniques"
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#include <glib.h>
+
+#ifdef NEED_SNPRINTF_H
+# include "snprintf.h"
+#endif
+
+#include <epan/packet.h>
+#include "mpeg2_convenience_routines.h"
+#include "dvb_incs/descriptors.h"
+
+
+
+/* general fields */
+extern int hf_reserved1;
+extern int hf_reserved;
+
+/*video stream print */
+ extern int hf_multiple_frame_rate_flag;
+ extern int hf_constraint_parameter_flag;
+ extern int hf_MPEG_1_only_flag;
+ extern int hf_still_picture_flag;
+ extern int hf_frame_rate_code;
+ extern int hf_sprofile_and_level_indication;
+ extern int hf_frame_rate_extension_flag;
+ extern int hf_chroma_format;
+ extern int hf_constrained_parameter_flag;
+
+ /*audio stream print */
+ extern int hf_free_format_flag;
+ extern int hf_id;
+ extern int hf_layer;
+ extern int hf_variable_rate_audio_indicator;
+
+/*network name print */
+ extern int hf_network_name;
+
+/*service list print */
+ extern int hf_service_id;
+ extern int hf_service_type;
+
+ /* satellite delivery system print*/
+ /* cable delivery system print */
+ extern int hf_frequency;
+ extern int hf_modulation;
+ extern int hf_orbital_position;
+ extern int hf_symbol_rate;
+ extern int hf_west_east_flag;
+ extern int hf_FEC_inner;
+ extern int hf_polarization;
+ extern int hf_FEC_outer;
+
+ /*terrestrial delivery system print */
+ extern int hf_frequency_terr;
+ extern int hf_bandwitdth;
+ extern int hf_constellation;
+ extern int hf_hirachy;
+ extern int hf_code_rate_HP;
+ extern int hf_code_rate_LP;
+ extern int hf_quard_internal;
+ extern int hf_transmission_mode;
+ extern int hf_other_freq;
+
+ /*service print */
+ extern int hf_service_provider_name;
+ extern int hf_service_name;
+
+/* data broadcast print */
+ extern int hf_data_broadcast_id;
+ extern int hf_component_tag;
+ extern int hf_selector_length;
+ extern int hf_selector;
+ extern int hf_ISO_639_language_code;
+ extern int hf_text_length;
+ extern int hf_text;
+
+ /* broadcast id print*/
+ extern int hf_tsid;
+ extern int hf_onid;
+ extern int hf_linkage_type;
+ extern int hf_private_data_byte;
+
+ /*mpe info print*/
+ extern int hf_MAC_address_range;
+ extern int hf_MAC_IP_mapping_flag;
+ extern int hf_alignment_indicator;
+ extern int hf_section_per_datagram;
+
+ /* dbc dc info print */
+ extern int transaction_id;
+ extern int hf_carousel_type_id;
+ extern int hf_timeout_DSI;
+ extern int hf_timeout_DII;
+ extern int hf_leak_rate;
+ extern int hf_transaction_id;
+
+ /* dbc oc info print */
+ extern int hf_language_code;
+ extern int hf_object_name;
+
+ /*ca id print */
+ extern int hf_CA_system_id;
+
+ /*corousel id print */
+ extern int hf_carousel_id;
+ extern int hf_format_id;
+ extern int hf_private_data;
+
+/*stream id print */
+ extern int hf_component_id;
+
+/* appsig print */
+ extern int hf_application_type;
+ extern int hf_ait_version;
+
+/*assoc tag print*/
+ extern int hf_association_tag;
+ extern int hf_timeout;
+ extern int hf_use;
+
+/*short event print*/
+ extern int hf_event_text;
+ extern int hf_event_name;
+
+/* Initialize the subtree pointers */
+ extern proto_item *ti;
+
+ extern gint ett_table_print;
+
+ /*extendet event print */
+extern int hf_descriptor_number;
+extern int hf_last_descr_number;
+extern int hf_length_of_items;
+extern int hf_item_descr_len;
+extern int hf_textstr;
+
+/*tshift event print*/
+extern int hf_reference_service_id;
+extern int hf_reference_event_id;
+
+/*ac3 print */
+extern int hf_Flags;
+extern int hf_comp_type;
+extern int hf_bsid;
+extern int hf_mainid;
+extern int hf_asvc;
+extern int hf_component_type;
+extern int hf_bs_id;
+extern int hf_main_id;
+extern int hf_asvc_value;
+extern int hf_additional_info;
+
+/*Content print */
+extern int hf_content_nibble_level1;
+extern int hf_content_nibble_level2;
+extern int hf_user_nibble;
+
+extern int hf_country_code;
+extern int hf_rating;
+
+/*telephone print*/
+extern int hf_foreign_availability;
+extern int hf_connection_type;
+extern int hf_country_prefix_length;
+extern int hf_international_area_code_length;
+extern int hf_operator_code_length;
+extern int hf_national_area_code_length;
+extern int hf_core_number_length;
+
+/*component print*/
+extern int hf_stream_content;
+extern int hf_reserved_future_use;
+
+/* PDC print*/
+extern int hf_programme_identification_label;
+
+/*Teletext print*/
+extern int hf_teletext_type;
+extern int hf_teletext_magazine_number;
+extern int hf_teletext_page_number;
+
+/*VBI data print*/
+extern int hf_data_service_descriptor_length;
+extern int hf_data_service_id;
+extern int hf_field_parity;
+extern int hf_line_offset;
+
+/*iso 639 print*/
+extern int hf_audo_type;
+
+/*sdt print*/
+extern int hf_leak_valid_flag;
+
+/*registration print*/
+extern int hf_format_identifier;
+extern int hf_additional_identification_info;
+
+/*country avail. print*/
+extern int hf_country_availability_flag;
+
+/*priv data spec print */
+extern int hf_priv_data_spec;
+
+/*frequency list print*/
+extern int hf_coding_type;
+extern int hf_centre_frequency;
+
+/*local time offset print*/
+extern int hf_country_region_id;
+extern int hf_local_time_offset_polarity;
+extern int hf_time_of_change;
+extern int hf_local_time_offset;
+extern int hf_next_time_offset;
+
+/*mosaic print*/
+extern int hf_mosaic_entry_point;
+extern int hf_nohec;
+extern int hf_novec;
+extern int hf_log_cell_id;
+extern int hf_log_cell_pres_nfo;
+extern int hf_el_cell_fl;
+extern int hf_el_cell_id;
+extern int hf_cell_link_nfo;
+extern int hf_bouquet_id;
+extern int hf_event_id;
+
+/*multiling. bouqet name print*/
+extern int hf_bouquet_name_length;
+
+/*multiling. network name print*/
+extern int hf_network_name_length;
+
+/*multiling. service name print*/
+extern int hf_service_provider_name_length;
+extern int hf_service_name_length;
+
+/* CA print */
+extern int hf_CA_PID;
+
+
+ void dvb_descr_video_stream_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset)
+{
+ proto_tree *MPEG1only_tree = NULL;
+
+ dvb_descr_video_stream_t *vs = NULL;
+
+ if (! descrbuf)
+ return;
+ offset+=2;
+ vs = (dvb_descr_video_stream_t *)descrbuf;
+ proto_tree_add_uint(tree, hf_multiple_frame_rate_flag, tvb, offset, 1, vs->multiple_frame_rate_flag);
+ proto_tree_add_uint(tree, hf_frame_rate_code, tvb, offset,1, vs->frame_rate_code );
+ ti = proto_tree_add_uint(tree, hf_MPEG_1_only_flag, tvb,offset,1, vs->MPEG_1_only_flag);
+ proto_tree_add_uint(tree, hf_constrained_parameter_flag, tvb, offset,1, vs->constrained_parameter_flag);
+ proto_tree_add_uint(tree, hf_still_picture_flag, tvb, offset,1, vs->still_picture_flag);
+ MPEG1only_tree = proto_item_add_subtree(ti, ett_table_print);
+
+
+ offset++;
+
+ if (vs->MPEG_1_only_flag == 1) {
+ dvb_descr_vs_mpeg1_t *vsm1 = (dvb_descr_vs_mpeg1_t *)&descrbuf[3];
+ proto_tree_add_uint(MPEG1only_tree, hf_sprofile_and_level_indication, tvb, offset, 1, vsm1->profile_and_level_indication);
+ proto_tree_add_uint(MPEG1only_tree, hf_frame_rate_extension_flag, tvb, offset+1,1, vsm1->frame_rate_extension_flag);
+ proto_tree_add_uint(MPEG1only_tree, hf_chroma_format, tvb, offset+1, 1, vsm1->chroma_format);
+ proto_tree_add_uint(MPEG1only_tree, hf_reserved, tvb, offset+1, 1, vsm1->reserved );
+
+ }
+
+
+}
+void dvb_descr_audio_stream_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset)
+{
+ dvb_descr_audio_stream_t *as = NULL;
+ if (! descrbuf)
+ return;
+
+ as = (dvb_descr_audio_stream_t *)descrbuf;
+ proto_tree_add_uint(tree, hf_free_format_flag, tvb, offset, 1,as->free_format_flag);
+ proto_tree_add_uint(tree, hf_id, tvb, offset, 1, as->ID);
+ proto_tree_add_uint(tree, hf_layer, tvb, offset,1, as->layer);
+ proto_tree_add_uint(tree, hf_variable_rate_audio_indicator, tvb, offset, 1, as->variable_rate_audio_indicator);
+ proto_tree_add_uint(tree, hf_reserved, tvb, offset,1, as->reserved);
+ return;
+}
+void dvb_descr_network_name_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset)
+{
+ dvb_descr_network_name_t *nwn = NULL;
+ int len = 0;
+ gchar *nw_str = NULL;
+
+
+ if (! descrbuf)
+ return;
+ offset +=2;
+ nwn = (dvb_descr_network_name_t *)descrbuf;
+ len = nwn->gen_descr.descriptor_length + 1;
+ if ((nw_str = calloc( 1, len ))) {
+ memcpy( nw_str, descrbuf + 2, len-1 );
+ proto_tree_add_string(tree, hf_network_name, tvb, offset, len-1, nw_str);
+ free( nw_str );
+ } else
+ proto_tree_add_string(tree, hf_network_name, tvb, offset, 0, "(out of memory!");
+return;
+}
+void dvb_descr_service_list_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset )
+{
+ guchar *descr_off = NULL;
+ gint descr_len = 0;
+
+ if (! descrbuf)
+ return;
+
+ descr_len = ((dvb_descr_service_list_t *)descrbuf)->gen_descr.descriptor_length;
+ descr_off = descrbuf + 2;
+ offset +=2;
+ while (descr_off < (descrbuf + descr_len)) {
+ dvb_service_list_entry_t *se = (dvb_service_list_entry_t *)descr_off;
+ proto_tree_add_uint(tree, hf_service_id, tvb, offset, 2, DVB_GET_SVC_LIST_ENTRY_ID( se ));
+ ti = proto_tree_add_uint(tree, hf_service_type, tvb, offset+2,1, se->service_type);
+ proto_item_append_text(ti, " (%s)", dvb_service_type_str( se->service_type ));
+ offset +=3;
+ descr_off +=3; // sizeof(dvb_service_list_entry_t)
+ }
+ return;
+}
+
+void dvb_descr_satellite_delivery_system_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ dvb_descr_satellite_del_sys_t *ds = NULL;
+ static const gchar *polar_str[4] = { "linear - horizontal", "linear - veritcal",
+ "circular - left", "circular - right" };
+static const gchar *FEC_str[16] = { "notdef", "1/2", "2/3", "3/4", "5/6", "7/8", "res", "res",
+ "res", "res", "res", "res", "res", "res", "res", "no coding" };
+
+ if (! descrbuf)
+ return;
+
+ ds = (dvb_descr_satellite_del_sys_t *)descrbuf;
+ offset +=2;
+ ti = proto_tree_add_uint(tree, hf_frequency, tvb, offset, 4, bcd2int( DVB_GET_SAT_DEL_SYS_FREQ( ds ) ) * 10);
+ proto_item_append_text(ti, " kHz");
+ proto_tree_add_uint(tree, hf_orbital_position, tvb, offset+4,2, (guint16)bcd2int( (guint32)DVB_GET_SAT_DEL_SYS_ORB( ds ) ));
+ proto_tree_add_string(tree, hf_west_east_flag, tvb,offset +6, 1, (ds->west_east_flag ? "east" : "west"));
+ proto_tree_add_string(tree, hf_polarization, tvb, offset+6,1, polar_str[ds->polarization] );
+ proto_tree_add_string(tree, hf_modulation, tvb, offset + 6, 1, (ds->modulation == 1 ? "QPSK" : "UNKNOWN"));
+ ti = proto_tree_add_uint(tree, hf_symbol_rate, tvb, offset +7, 4, bcd2int( DVB_GET_SAT_DEL_SYS_SYMBOL( ds ) ) * 10 );
+ proto_item_append_text(ti, " symbols");
+ proto_tree_add_string(tree, hf_FEC_inner, tvb, offset+10, 1, FEC_str[ds->FEC_inner] );
+ return;
+}
+void dvb_descr_cable_delivery_system_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ static const char *cm_type[] = { "not defined", "16QAM", "32QAM", "64QAM", "128QAM", "256QAM" };
+ static const char *fec_outer[16] = { "not defined", "no FEC", "RS(204/188)", "res", "res", "res", "res", "res",
+ "res", "res", "res", "res", "res", "res", "res", "res" };
+ static const char *fec_inner[16] = { "notdef", "1/2", "2/3", "3/4", "5/6", "7/8", "res", "res",
+ "res", "res", "res", "res", "res", "res", "res", "no coding" };
+
+ if (! descrbuf)
+ return;
+ ti = proto_tree_add_uint(tree, hf_frequency, tvb, offset, 4, bcd2int( GET_ULONG( descrbuf + 2 ) ) * 100);
+ proto_item_append_text(ti, " Hz");
+ proto_tree_add_string(tree, hf_FEC_outer, tvb, offset, 0,fec_outer[descrbuf[7] & 0x0F]);
+ proto_tree_add_string(tree, hf_modulation, tvb, offset+4,2, ((descrbuf[8] < 6) ? cm_type[descrbuf[8]] : "reserved") );
+ proto_tree_add_uint(tree, hf_symbol_rate, tvb, offset, 0, bcd2int( GET_ULONG( descrbuf + 9 ) >> 4 ) * 10 );
+ proto_tree_add_string(tree, hf_FEC_inner, tvb, offset, 0, fec_inner[descrbuf[12] & 0x0F] );
+
+ return;
+}
+void dvb_descr_terr_delivery_system_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+
+ static const char *bandwidth[] = { "8MHz", "7MHz", "6MHz", "res", "res", "res", "res", "res" };
+ static const char *constellation[] = { "QPSK", "16QAM", "64QAM", "res" };
+ static const char *hierarchy[] = { "nonhierarchical", "alpha_1", "alpha_2", "alpha_4", "res", "res", "res", "res" };
+ static const char *code_rate[] = { "1/2", "2/3", "3/4", "5/6", "7/8", "res", "res", "res" };
+ static const char *guard_interval[] = { "1/32", "1/16", "1/8", "1/4" };
+ static const char *transmission_mode[] = { "2k", "8k", "res", "res" };
+
+ if (! descrbuf)
+ return;
+ proto_tree_add_uint(tree, hf_frequency_terr, tvb, offset, 0, GET_ULONG( descrbuf + 2 ));
+ proto_tree_add_string(tree, hf_bandwitdth, tvb, offset,0, bandwidth[(descrbuf[6] & 0xE0) >> 5] );
+ proto_tree_add_string_format(tree, hf_constellation, tvb, offset, 0, constellation[(descrbuf[7] & 0xC0) >> 6],"%11.11s",constellation[(descrbuf[7] & 0xC0) >> 6]);
+ proto_tree_add_string(tree, hf_hirachy, tvb, offset, 0, hierarchy[(descrbuf[7] & 0x38) >> 3]);
+ proto_tree_add_string_format(tree, hf_code_rate_HP, tvb, offset, 0, code_rate[descrbuf[7] & 0x07], "%11.11s",code_rate[descrbuf[7] & 0x07] );
+ proto_tree_add_string_format(tree, hf_code_rate_LP, tvb, offset, 0, (const char *)GET_ULONG( descrbuf + 2 ), "%11.11s", (const char *)GET_ULONG( descrbuf + 2 ));
+ proto_tree_add_string_format(tree, hf_quard_internal, tvb, offset, 0, guard_interval[(descrbuf[8] & 0x18) >> 3],"%11.11s",guard_interval[(descrbuf[8] & 0x18) >> 3]);
+ proto_tree_add_string(tree, hf_transmission_mode, tvb, offset, 0, transmission_mode[(descrbuf[8] & 0x06) >> 1]);
+ proto_tree_add_string(tree, hf_other_freq, tvb, offset, 0, (descrbuf[8] & 0x01) ? "yes" : "no" );
+ return;
+}
+void dvb_descr_service_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset)
+{
+ dvb_descr_service_t *svt = NULL;
+ gchar *tmpbuf = NULL, *printbuf;
+ gint snlen = 0;
+ gsize written;
+ gchar *alph;
+ if (! descrbuf)
+ return;
+ offset +=2;
+ svt = (dvb_descr_service_t *)descrbuf;
+ ti = proto_tree_add_uint(tree, hf_service_type, tvb, offset,1, svt->service_type);
+ proto_item_append_text(ti, " (%s)", dvb_service_type_str( svt->service_type ) );
+
+ if ((tmpbuf = calloc( 1, svt->service_provider_name_length + 1 ))) {
+ memcpy( tmpbuf, descrbuf + 4, svt->service_provider_name_length );
+ alph = char2alphabet(*descrbuf);
+ printbuf = tmpbuf;
+ if(*tmpbuf < 0x20)
+ printbuf++;
+ ti = proto_tree_add_string(tree, hf_service_provider_name, tvb, offset+=1, svt->service_provider_name_length+1,g_convert(printbuf,svt->service_provider_name_length+1, "UTF-8",alph,NULL,&written,NULL));
+ proto_item_append_text(ti, " -> len % 3d", svt->service_provider_name_length);
+ free( tmpbuf );
+ } else
+ {
+ ti = proto_tree_add_string(tree, hf_service_provider_name, tvb, offset+=1,svt->service_provider_name_length +1, "(out of memory!");
+ proto_item_append_text(ti, " -> len % 3d", svt->service_provider_name_length);
+ }
+ offset += svt->service_provider_name_length +1;
+ snlen = descrbuf[4 + svt->service_provider_name_length];
+ if ((tmpbuf = calloc( 1, snlen + 1 ))) {
+ memcpy( tmpbuf, descrbuf + 4 + svt->service_provider_name_length + 1, snlen );
+ alph = char2alphabet(*descrbuf);
+ printbuf = tmpbuf;
+ if(*tmpbuf < 0x20)
+ printbuf++;
+ ti = proto_tree_add_string(tree, hf_service_name, tvb, offset, snlen+1, g_convert(printbuf,svt->service_provider_name_length+1, "UTF-8",alph,NULL,&written,NULL));
+ proto_item_append_text(ti, "-> len % 3d", snlen);
+ free( tmpbuf );
+ } else
+ {
+ ti = proto_tree_add_string(tree, hf_service_name, tvb, offset, snlen, "(out of memory!)");
+ proto_item_append_text(ti, "-> len % 3d", snlen);
+ }
+return;
+}
+
+void dvb_descr_dbc_mpe_info_print( guchar *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset )
+{
+ dvb_mpe_info_t *mi = NULL;
+
+ if (!descrbuf)
+ return;
+
+ mi = (dvb_mpe_info_t *)descrbuf;
+ proto_tree_add_uint(tree, hf_MAC_address_range, tvb, offset,1, mi->mac_addr_range);
+ proto_tree_add_uint(tree, hf_MAC_IP_mapping_flag, tvb, offset,1, mi->mac_ip_map_flag );
+ proto_tree_add_uint(tree, hf_alignment_indicator, tvb, offset, 1, mi->alignment_indicator);
+ proto_tree_add_uint(tree, hf_section_per_datagram, tvb, offset+1,1, mi->max_sec_per_dg );
+}
+
+void dvb_descr_dbc_dc_info_print( guchar *descrbuf, proto_tree *tree, tvbuff_t *tvb, gint16 offset )
+{
+ guchar *p = descrbuf, ct = 0;
+ guchar *ct_str[] = { "reserved0", "one layer", "two layer", "reserved3" };
+ gulong tmp;
+
+ if (!descrbuf)
+ return;
+
+ ct = (*p++ & 0xC0) >> 6;
+ tmp = (gulong)p;
+ p +=4;
+ ti = proto_tree_add_uint(tree, hf_carousel_type_id, tvb, offset, 0, ct);
+ proto_item_append_text(ti, "(%s)", ct_str[ct]);
+ proto_tree_add_uint(tree, hf_transaction_id, tvb, offset, 4, tmp );
+
+ tmp = (gulong)p;
+ p += 4;
+ proto_tree_add_uint(tree, hf_timeout_DSI, tvb, offset, 4, tmp);
+ proto_tree_add_uint(tree, hf_timeout_DII, tvb, offset+4,4, (gulong)p);
+ p += 4;
+
+ tmp = (gulong)p;
+ p+=4;
+ tmp &= 0x3FFFFFFF;
+ ti = proto_tree_add_uint(tree, hf_leak_rate, tvb, offset, 0, tmp);
+ proto_item_append_text(ti, "[50Bytes/sec]");
+}
+
+void dvb_descr_dbc_oc_info_print( gchar *descrbuf, gint len, proto_tree *tree, tvbuff_t *tvb, gint16 offset )
+{
+ guchar *p = descrbuf;
+ guchar help[3];
+
+ if (!descrbuf)
+ return;
+
+ do {
+ help[0] = p[0]; help[1] = p[1]; help[2] = p[2];
+ proto_tree_add_string(tree, hf_language_code, tvb, offset,0,help);
+ proto_tree_add_uint(tree, hf_object_name, tvb, offset, 0, p[3]);
+ p += 4;
+ } while ((p - (guchar *)descrbuf) < len);
+}
+
+void dvb_descr_data_broadcast_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+
+ dvb_descr_data_broadcast_t *db = NULL;
+ dvb_descr_data_broadcast_ext_t *dbe = NULL;
+ gchar lang[4] = { 0, 0, 0, 0 }, *text = NULL;
+ gushort dbc_id;
+ gssize written;
+ proto_tree *select_tree = NULL;
+
+ if (! descrbuf)
+ return;
+
+ db = (dvb_descr_data_broadcast_t *)descrbuf;
+ offset +=2;
+ dbc_id = DVB_GET_DESCR_DBC_ID( db );
+ ti = proto_tree_add_uint(tree, hf_data_broadcast_id, tvb, offset, 2 ,dbc_id);
+ proto_item_append_text(ti, " %s", dvb_data_broadcast_id_str( dbc_id ) );
+ proto_tree_add_uint(tree, hf_component_tag, tvb, offset+ 2,1, db->component_tag);
+ ti = proto_tree_add_uint(tree, hf_selector_length, tvb, offset+3,1,db->selector_length );
+ select_tree = proto_item_add_subtree(ti, ett_table_print);
+ // print the selector bytes:
+ switch (dbc_id)
+ {
+ case DVB_DBC_ID_MPE: dvb_descr_dbc_mpe_info_print(descrbuf + sizeof *db, select_tree, tvb, offset+=4 ); break;
+ case DVB_DBC_ID_DATA_CAROUSEL: dvb_descr_dbc_dc_info_print(descrbuf + sizeof *db, select_tree, tvb,offset+=4 ); break;
+ case DVB_DBC_ID_OBJECT_CAROUSEL:
+ dvb_descr_dbc_dc_info_print(descrbuf + sizeof *db,select_tree, tvb, offset+4);
+ if (db->selector_length > 16)
+ dvb_descr_dbc_oc_info_print(descrbuf + sizeof *db, db->selector_length - 16, select_tree, tvb, offset+=4 );
+ break;
+ default:
+ proto_tree_add_item(select_tree, hf_selector, tvb,offset+=4,db->selector_length, TRUE);
+ }
+ offset += db->selector_length;
+ dbe = (dvb_descr_data_broadcast_ext_t *)(descrbuf + 6 + db->selector_length );
+
+ DVB_GET_DESCR_DBC_ISO_639( dbe, lang );
+ proto_tree_add_string(tree, hf_ISO_639_language_code, tvb, offset,3, g_convert(lang,3, "UTF8","ISO-8859-1",NULL,&written,NULL));
+ proto_tree_add_uint(tree, hf_text_length, tvb, offset +3, 1, dbe->text_length );
+
+ if ((text = calloc( 1, dbe->text_length + 1 ))) {
+ memcpy( text, descrbuf + 6 + db->selector_length + 4, dbe->text_length );
+ proto_tree_add_string(tree, hf_textstr, tvb,offset +4,dbe->text_length, text);
+ free( text );
+ } else
+ proto_tree_add_string(tree, hf_textstr,tvb,offset, 0, "(out of memory!)");
+
+
+return;
+}
+
+void dvb_descr_data_broadcast_id_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ dvb_descr_data_broadcast_id_t *dbi = NULL;
+
+ if (!descrbuf)
+ return;
+
+ dbi = (dvb_descr_data_broadcast_id_t *)descrbuf;
+ ti = proto_tree_add_uint(tree, hf_data_broadcast_id, tvb, offset+2, 2, g_ntohs( dbi->data_broadcast_id ));
+ proto_item_append_text(ti, "(%s)",dvb_data_broadcast_id_str( g_ntohs( dbi->data_broadcast_id ) ) );
+ proto_tree_add_item(tree, hf_selector, tvb,offset+4,dbi->gen_descr.descriptor_length - 2, TRUE);
+return;
+}
+void dvb_descr_ca_id_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset )
+{
+ dvb_descr_gen_t *ca = NULL;
+ gint i = 0;
+
+ if (! descrbuf)
+ return;
+
+ ca = (dvb_descr_gen_t *)descrbuf;
+ for (i = 0; i < ca->descriptor_length; i += 2)
+ {
+ ti = proto_tree_add_uint(tree, hf_CA_system_id, tvb, offset+2+i, 2,DVB_GET_DESCR_CA_ID( descrbuf + 2 + i ));
+ proto_item_append_text(ti, "(%s)",dvb_CA_system_id_str( DVB_GET_DESCR_CA_ID( descrbuf + 2 + i ) ) );
+ }
+ return;
+}
+void dvb_descr_linkage_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+
+ dvb_descr_linkage_t *li = NULL;
+ gint l = 0;
+
+ if (! descrbuf)
+ return;
+ offset +=2;
+ li = (dvb_descr_linkage_t *)descrbuf;
+ proto_tree_add_uint(tree, hf_tsid, tvb, offset, 2, DVB_GET_LINKAGE_TS_ID( li ));
+ proto_tree_add_uint(tree, hf_onid, tvb, offset+2, 2, DVB_GET_LINKAGE_NETW_ID( li ));
+ proto_tree_add_uint(tree, hf_service_id, tvb, offset+4,2,DVB_GET_LINKAGE_SVC_ID( li ));
+ ti = proto_tree_add_uint(tree, hf_linkage_type,tvb, offset+6,1,li->linkage_type);
+ proto_item_append_text(ti,"(%s)",dvb_linkage_type_str( li->linkage_type ) );
+ offset+=7;
+ proto_tree_add_item(tree, hf_private_data_byte, tvb, offset,l = (li->gen_descr.descriptor_length -7 ),TRUE);
+return;
+}
+
+void dvb_descr_carousel_id_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ dvb_descr_carousel_id_t *ci = (dvb_descr_carousel_id_t *)descrbuf;
+
+
+ if (! descrbuf)
+ return;
+
+ // some packing issues?? sizeof(*ci) == 7 !!
+ proto_tree_add_uint(tree, hf_carousel_id, tvb, (offset+=2), 4, g_ntohl( ci->carousel_id ) );
+ proto_tree_add_uint(tree, hf_format_id, tvb, offset+4,1, ci->format_id);
+ if (ci->format_id == 1) {
+ // TODO: print format_specifier */
+ }
+ /* Ob hf das zeigt wo priv data in HEX pane*/
+ proto_tree_add_item(tree, hf_private_data, tvb, offset+5,ci->gen_descr.descriptor_length - 5, TRUE);
+
+return;
+}
+void dvb_descr_stream_id_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset )
+{
+ if (! descrbuf)
+ return;
+ proto_tree_add_uint(tree, hf_component_id, tvb, offset+ 2,1, descrbuf[2]);
+ return;
+}
+void dvb_descr_appsig_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset )
+{
+ dvb_descr_app_sig_t *as = (dvb_descr_app_sig_t *)descrbuf;
+ dvb_appsig_entry_t *ase = NULL;
+ gint l;
+
+ if (! descrbuf)
+ return;
+
+ for (l = 0; l < as->gen_descr.descriptor_length; l += 3) {
+ ase = (dvb_appsig_entry_t *)(descrbuf + 2 + l);
+ ti = proto_tree_add_uint(tree, hf_application_type, tvb, offset+2, 2, g_ntohs( ase->app_type ));
+ proto_item_append_text(ti," %s", dvb_app_type_str( g_ntohs( ase->app_type )));
+ proto_tree_add_uint(tree, hf_ait_version, tvb, offset+4,1,ase->ait_ver );
+ }
+return;
+}
+
+void dvb_descr_assoc_tag_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset )
+{
+ dvb_descr_assoctag_t *atd = (dvb_descr_assoctag_t *)descrbuf;
+ guchar *sel = NULL;
+
+ proto_tree *select_tree = NULL;
+
+ if (! descrbuf)
+ return;
+ proto_tree_add_uint(tree, hf_association_tag, tvb, offset+=2, 2, g_ntohs( atd->assoc_tag ));
+ ti = proto_tree_add_uint(tree, hf_use, tvb, offset +2, 2, g_ntohs( atd->use ) );
+ if(atd->use >= (guint16)0x0101 && atd->use <= (guint16)0x1FFF)
+ proto_item_append_text( ti, " DVB reserved" );
+ else if(atd->use >= (guint16)0x2000)
+ proto_item_append_text( ti, " user private" );
+ else
+ {
+ switch (g_ntohs( atd->use )) {
+ case 0x0000: proto_item_append_text(ti, " DSI w/ IOR of SGW");break;
+ case 0x0100: proto_item_append_text( ti, " stream_id_descr" ); break;
+ default: proto_item_append_text( ti, " *** undefined" ); break;
+ }
+ }
+
+ // sel = descrbuf + sizeof atd->gen_descr + 5; // start offset of selector_bytes[]
+ sel = descrbuf + sizeof *atd; // start offset of selector_bytes[]
+ ti = proto_tree_add_item(tree, hf_selector, tvb, offset+=4,atd->selector_len+1, TRUE);
+ select_tree = proto_item_add_subtree(ti, ett_table_print);
+ switch (ntohs( atd->use )) {
+ case 0x0000: // selector is uint32 transaction_id, uint32 timeout, selector_length == 0x08
+ if (atd->selector_len != 0x08){
+ ti = proto_tree_add_uint(select_tree, hf_selector_length, tvb, offset,1,atd->selector_len);
+ proto_item_append_text(ti, "*** invalid selector length %d for use 0x%04x! Expected 0x08", atd->selector_len, ntohs( atd->use ) );
+ }
+ proto_tree_add_uint(select_tree, hf_selector_length, tvb, offset,1,atd->selector_len);
+ proto_tree_add_uint(select_tree, hf_transaction_id, tvb, offset+1, 4, g_ntohl( *((unsigned long *)sel) ));
+ proto_tree_add_uint(select_tree, hf_timeout, tvb, offset+5 ,4,g_ntohl( *((unsigned long *)(sel + 4)) ) );
+
+ break;
+ case 0x0001: // selector is empty, selector_length == 0x00
+ if (atd->selector_len != 0x00)
+ ti = proto_tree_add_uint(select_tree, hf_selector_length, tvb, offset,0,atd->selector_len);
+ proto_item_append_text(ti, "*** invalid selector length %d for use 0x%04x! Expected 0x08\n", atd->selector_len, ntohs( atd->use ) );
+ break;
+ default:
+ ti = proto_tree_add_uint(select_tree, hf_selector_length, tvb, offset,1,atd->selector_len); // offset korregieren
+ break;
+ }
+ proto_tree_add_item(tree, hf_private_data, tvb, offset+9, atd->gen_descr.descriptor_length - 5 - atd->selector_len,TRUE);
+
+return;
+}
+void dvb_descr_short_event_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset )
+{
+ guchar *b = descrbuf + 2;
+ guchar *help;
+ gsize written;
+ gchar *charset;
+ guint8 len;
+ if (! descrbuf)
+ return;
+ help = calloc(1,3);
+ memcpy(help, b, 3);
+ proto_tree_add_string(tree, hf_language_code, tvb, offset+=2,3,help);
+ free(help);
+ b += 3;
+ ti = proto_tree_add_uint(tree, hf_event_name, tvb, offset+=3, 1+b[0], b[0] );
+ help = calloc(1, len = b[0]);
+ b++;
+ memcpy(help,b,len);
+ charset = char2alphabet(*b);
+ if(*help < 0x20)
+ help[0] = ' ';
+ proto_item_append_text(ti, " '%s'",g_convert(help,strlen(help), "UTF8",charset,NULL,&written,NULL) );
+ free(help);
+ b += len;
+ offset += 1 +len;
+ ti = proto_tree_add_uint(tree, hf_event_text, tvb, offset, 1+b[0] , len = b[0] );
+ help = calloc(1, len);
+ b++;
+ memcpy(help,b,len);
+ charset = char2alphabet(*b);
+ if(*help < 0x20)
+ help[0] = ' ';
+ proto_item_append_text(ti, " '%s'", g_convert(help,len, "UTF8",charset,NULL,&written,NULL));
+ free(help);
+ b += len;
+ offset += 1 +len;
+
+
+
+
+return;
+}
+void dvb_descr_extended_event_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset)
+{
+ guchar *b = descrbuf + 2, *bend, ilen;
+ guchar *help;
+ size_t len;
+ proto_tree *item_tree = NULL, *text_tree;
+ proto_item *ti;
+ if (! descrbuf)
+ return;
+ proto_tree_add_uint(tree, hf_descriptor_number, tvb, offset+=2, 1,(b[0] & 0xf0));
+ proto_tree_add_uint(tree, hf_last_descr_number, tvb, offset, 1, (b[0] >> 4));
+ b += 1;
+ help = calloc(1, 3);
+ memcpy(help,b,3);
+ proto_tree_add_string(tree, hf_language_code, tvb, offset+1,3,help);
+ free(help);
+ b += 3;
+ ti = proto_tree_add_uint(tree, hf_length_of_items, tvb, offset+=5,1, ilen= *b++);
+ item_tree = proto_item_add_subtree(ti,ett_table_print);
+ for (bend = b + ilen; b < bend; ) {
+ ti = proto_tree_add_uint(item_tree, hf_item_descr_len,tvb,offset, 1, len = b[0]);
+ help = malloc(len);
+ b++;
+ memcpy(help, b,len);
+ proto_tree_add_longtext(item_tree, tvb, offset, help,len);
+ free(help);
+ b += len;
+ ti = proto_tree_add_uint(item_tree, hf_text, tvb, offset, 1 , len = b[0]);
+ ilen = b[0];
+ help = malloc(len);
+ b++;
+ memcpy(help, b, len);
+ proto_tree_add_longtext(item_tree, tvb, offset, help,len);
+ free(help);
+ b += len;
+ }
+ ti = proto_tree_add_uint(tree, hf_text_length, tvb, offset++, 1,len = b[0]);
+ text_tree = proto_item_add_subtree(ti,ett_table_print);
+ help = malloc(len);
+ b++;
+ memcpy(help, b,len);
+ proto_tree_add_longtext(text_tree,tvb, offset,help,len);
+ free(help);
+ b += len;
+
+return;
+}
+
+void dvb_descr_tshift_event_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ if (! descrbuf)
+ return;
+ proto_tree_add_uint(tree, hf_reference_service_id, tvb, offset,2, GET_USHORT( descrbuf + 2 ));
+ proto_tree_add_uint(tree, hf_reference_event_id, tvb, offset+2,2, GET_USHORT( descrbuf + 4 ) );
+
+
+return;
+}
+void dvb_descr_ac3_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ gint l = 1; // descriptor's actual length depends on the flags set.
+ gint i = 3; // index of first optional field.
+ proto_item *ti;
+ proto_tree *Flag_tree = NULL;
+ if (! descrbuf)
+ return;
+ ti = proto_tree_add_uint(tree, hf_Flags,tvb, offset +2,1, descrbuf[2] );
+ Flag_tree = proto_item_add_subtree(ti, ett_table_print);
+ if (descrbuf[2] & 0x80) { l += 1; proto_tree_add_item(Flag_tree, hf_comp_type, tvb, offset+2,1,TRUE);}
+ if (descrbuf[2] & 0x40) { l += 1; proto_tree_add_item(Flag_tree, hf_bsid, tvb, offset+2,1,TRUE);}
+ if (descrbuf[2] & 0x20) { l += 1; proto_tree_add_item(Flag_tree, hf_mainid, tvb, offset+2,1,TRUE);}
+ if (descrbuf[2] & 0x10) { l += 1; proto_tree_add_item(Flag_tree, hf_asvc, tvb, offset+2,1,TRUE);}
+
+ if (descrbuf[2] & 0x80)
+ proto_tree_add_uint(tree, hf_component_type, tvb, offset,0,descrbuf[i++] );
+ if (descrbuf[2] & 0x40)
+ proto_tree_add_uint(tree, hf_bs_id, tvb, offset, 0, descrbuf[i++] );
+ if (descrbuf[2] & 0x20)
+ proto_tree_add_uint(tree, hf_main_id, tvb, offset, 0, descrbuf[i++] );
+ if (descrbuf[2] & 0x10)
+ proto_tree_add_uint(tree, hf_asvc_value, tvb, offset, 0, descrbuf[i++] );
+
+
+ if (descrbuf[1] > l) {
+ // There's additional_info[] present.
+ proto_tree_add_item(tree, hf_additional_info, tvb, offset+ 2 +i,descrbuf[1] - l,TRUE);
+ }
+ return;
+}
+
+void dvb_descr_CA_id_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+
+ guchar *d = (guchar *)descrbuf, *dend;
+
+ if(!descrbuf)
+ return;
+ dend = d + d[1];
+ d +=2;
+
+ for(;d<dend; d+=2)
+ proto_tree_add_uint(tree,hf_CA_system_id, tvb, offset+=2, 2, (d[0] << 8 | d[1]));
+ return;
+}
+
+void dvb_descr_content_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+
+ guchar *d = (guchar *)descrbuf, *dend, len;
+
+ if(!descrbuf)
+ return;
+
+ len = d[1];
+ d +=2;
+ offset +=2;
+ for(dend = d +len;d<dend;)
+ {
+ proto_tree_add_uint(tree, hf_content_nibble_level1, tvb, offset,1, (*d >> 4));
+ ti = proto_tree_add_uint(tree, hf_content_nibble_level2, tvb, offset,1,(*d & 0x0f));
+ proto_item_append_text(ti, " (%s)", dvb_content_str(d[0]));
+ d++;
+ proto_tree_add_uint(tree, hf_user_nibble, tvb, offset +1, 1, (*d & 0x0f));
+ proto_tree_add_uint(tree, hf_user_nibble, tvb, offset +1, 1, (*d >> 4));
+ d++;
+ }
+ return;
+}
+
+void dvb_descr_parental_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+
+ guchar *d = (guchar *)descrbuf, *dend, *help;
+ if(!descrbuf)
+ return;
+ dend = d + d[1];
+ d +=2;
+ offset+=2;
+
+ for(;d<dend; d +=4)
+ {
+ help = calloc(1,3);
+ memcpy(help,d,3);
+ proto_tree_add_string(tree, hf_country_code, tvb, offset, 3, help);
+ free(help);
+ proto_tree_add_uint(tree, hf_rating, tvb, offset+3,1, d[3]);
+ offset +=4;
+ }
+ return;
+}
+
+void dvb_descr_tefephone_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ guchar *d= (guchar *)descrbuf, *help;
+ guint len, descroff = 5;
+
+ if(!descrbuf)
+ return;
+ d+=2;
+ offset +=2;
+ proto_tree_add_uint(tree, hf_foreign_availability, tvb, offset, 1, ((*d >>2) & 0x01));
+ proto_tree_add_uint(tree, hf_connection_type, tvb, offset,1,((*d>>3) & 0x1f));
+ ti = proto_tree_add_uint(tree, hf_country_prefix_length,tvb, offset+1,1,len = ((*(d+1)>>1) & 0x02));
+ help = calloc(1,len);
+ memcpy(help,(d +descroff), len);
+ free(help); descroff += len;
+ proto_item_append_text(ti, " prefix: %s", help);
+
+ ti = proto_tree_add_uint(tree, hf_international_area_code_length,tvb, offset+1, 1,len=((*(d+1)>>3) & 0x03));
+ help = calloc(1,len);
+ memcpy(help, (d + descroff), len);
+ proto_item_append_text(ti, " code: %s", help);
+ free(help); descroff +=len;
+ proto_tree_add_uint(tree, hf_operator_code_length,tvb, offset+1,1, len=((*(d+1)>>6) & 0x02));
+ help = calloc(1,len);
+ memcpy(help, (d+descroff), len);
+ proto_item_append_text(ti, "code: %s", help);
+ free(help); descroff +=len;
+ ti = proto_tree_add_uint(tree, hf_national_area_code_length, tvb, offset+2,1, len =((*(d+2)>>1)& 0x03));
+ help = calloc(1, len);
+ memcpy(help, (d+descroff), len);
+ proto_item_append_text(ti, " code: %s", help);
+ free(help); descroff += len;
+ ti = proto_tree_add_uint(tree, hf_core_number_length,tvb, offset +2,1, len=((*(d+2)>>4) &0x04));
+ help = calloc(1,len);
+ memcpy(help, (d+descroff), len);
+ proto_item_append_text(ti, " number: %s", help);
+ free(help); descroff += len;
+ return;
+}
+void dvb_descr_teletext_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+
+ size_t len;
+ dvb_descr_teletext_entry_t *txt =NULL;
+ guchar *d = descrbuf, *dend, *lang;
+ proto_item *ti;
+
+ if(!descrbuf)
+ return;
+
+ len = descrbuf[1];
+ dend = descrbuf + len;
+ d+=2; offset +=2;
+ for(;d < dend;)
+ {
+ txt = (dvb_descr_teletext_entry_t *)d;
+ lang = calloc(1,3);
+ memcpy(lang,d,3);
+ proto_tree_add_string(tree, hf_language_code, tvb, offset, 3, lang);
+ free(lang);
+ offset+=3;
+ ti = proto_tree_add_uint(tree, hf_teletext_type, tvb, offset, 1, txt->teletext_type);
+ proto_item_append_text(ti, " (%s)", dvb_descr_txt_type(txt->teletext_type));
+ proto_tree_add_uint(tree, hf_teletext_magazine_number, tvb, offset, 1, txt->teletext_magazine_number);
+ proto_tree_add_uint(tree, hf_teletext_page_number, tvb, offset+1, 1, txt->teletext_page_number);
+ d += 4; offset += 4;
+ }
+ return;
+}
+
+void dvb_descr_component_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+
+ guchar *d = descrbuf, *dend, *lang, *help;
+ size_t len = d[1] -6;
+ proto_item *ti; proto_tree *text_tree;
+ guint st = 0;
+
+ if(!descrbuf)
+ return;
+ dend = d +d[1];
+ d+=2;
+ offset +=2;
+ proto_tree_add_uint(tree, hf_reserved_future_use, tvb, offset, 1, d[0] >> 4);
+ proto_tree_add_uint(tree, hf_stream_content, tvb, offset, 1, st = d[0] & 0xf);
+ ti = proto_tree_add_uint(tree, hf_component_type, tvb, offset +1, 1, d[1]);
+ proto_item_append_text(ti, " (%s)", dvb_cont_comp_str((st << 8) | d[1]));
+ proto_tree_add_uint(tree, hf_component_tag, tvb, offset +2, 1, d[2]);
+ d+=3; offset+=3;
+ lang = calloc(1, 3);
+ memcpy(lang,d, 3);
+ proto_tree_add_string(tree, hf_language_code,tvb, offset, 3, lang);
+ free(lang);
+ d+=3;
+ ti = proto_tree_add_string(tree, hf_textstr,tvb, offset, 0, " ");
+ text_tree = proto_item_add_subtree(ti, ett_table_print);
+ help = malloc(len);
+ memcpy(help, d,len);
+ proto_tree_add_longtext(text_tree,tvb, offset,help,len);
+ free(help);
+}
+
+void dvb_descr_pdc_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+
+ pil_t *pidlbl = NULL;
+
+ proto_item *ti; proto_tree *pdc_tree;
+ if(!descrbuf)
+ return;
+ offset+=2;
+ pidlbl = (pil_t *)descrbuf;
+ proto_tree_add_uint(tree, hf_reserved_future_use, tvb, offset, 1, pidlbl->reserved);
+ ti = proto_tree_add_item(tree, hf_programme_identification_label, tvb, offset, 3, TRUE);
+ pdc_tree = proto_item_add_subtree(ti, ett_table_print);
+ proto_tree_add_text(pdc_tree, tvb, offset, 3, "day: %d month: %d hour: %d minute: %d", ((pidlbl->day_hi<<1) | pidlbl->day_lo), pidlbl->month,
+ ((pidlbl->hour_hi << 2) | pidlbl->hour_lo), pidlbl->minute);
+}
+
+void dvb_descr_vbi_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ guchar *d, *dend, id;
+ size_t len, cnt = 0;
+ proto_item *ti; proto_tree *vbi_tree;
+
+ if(!descrbuf)
+ return;
+ d = descrbuf;
+ dend = d + d[1];
+ offset +=2;
+ d = descrbuf +2;
+ while(d<dend)
+ {
+ ti = proto_tree_add_uint(tree, hf_data_service_id, tvb, offset, 1, id = d[0]);
+ proto_item_append_text(ti, " (%s)", dvb_descr_vbi_str(id));
+ ti = proto_tree_add_uint(tree, hf_data_service_descriptor_length, tvb, offset+1, 1, len = d[1]);
+ vbi_tree = proto_item_add_subtree(ti,ett_table_print);
+ d+=2; offset+=2;
+ if((id >= 0x01) & (id<= 0x07))
+ {
+ while(cnt < len)
+ {
+ proto_tree_add_uint(vbi_tree, hf_field_parity, tvb, offset, 1, (d[0] & 0x20) >>5);
+ proto_tree_add_uint(vbi_tree, hf_line_offset, tvb, offset, 1, d[0] & 0x1f);
+ d++; offset++; cnt++;
+ }
+ }
+ else
+ {
+ d += len;
+ offset += len;
+ }
+
+ }
+}
+
+void dvb_descr_iso639_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ guchar *d, *dend, *lang;
+ proto_item *ti;
+
+ if(!descrbuf)
+ return;
+ dend = descrbuf + descrbuf[1];
+ d= descrbuf +2;
+ offset+=2;
+ while(d<dend)
+ {
+ lang = calloc(1,3);
+ memcpy(lang,d,3);
+ proto_tree_add_string(tree, hf_language_code, tvb, offset,3, lang);
+ free(lang);
+ d+=3;
+ ti = proto_tree_add_uint(tree, hf_audo_type, tvb, offset+3, 1, d[0]);
+ proto_item_append_text(ti, " (%s)", dvb_descr_audio_str(d[0]));
+ d++;
+ offset+=4;
+ }
+}
+
+void dvb_descr_sdt_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ guchar *d;
+
+ if(!descrbuf)
+ return;
+ d = descrbuf;
+ d+=2;
+ offset+=2;
+ proto_tree_add_uint(tree, hf_reserved, tvb, offset, 1, d[0] >>1);
+ proto_tree_add_uint(tree, hf_leak_valid_flag, tvb, offset,1, d[0] & 0x01);
+ offset++; d++;
+}
+
+void dvb_descr_reg_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ guchar *d, *dend, *id;
+
+ if(!descrbuf)
+ return;
+
+ dend = descrbuf +descrbuf[1];
+ d = descrbuf +2;
+ id = calloc(1,4);
+ memcpy(id,d,4);
+ proto_tree_add_string(tree, hf_format_identifier, tvb, offset, 3, id);
+ free(id);
+ proto_tree_add_item(tree, hf_additional_identification_info, tvb, offset +3, d-dend, TRUE);
+
+
+}
+
+void dvb_descr_country_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ guchar *d, *dend, *ctry;
+
+ if(!descrbuf)
+ return;
+
+ dend = descrbuf +descrbuf[1];
+ d = descrbuf+2;
+ offset +=2;
+ proto_tree_add_uint(tree, hf_country_availability_flag, tvb, offset, 1, (d[0] & 0x80) >> 7);
+ d++;
+ offset++;
+ while(d<dend)
+ {
+ ctry = calloc(1,3);
+ memcpy(ctry, d, 3);
+ proto_tree_add_string(tree, hf_country_code, tvb, offset, 3, ctry);
+ free(ctry);
+ d+=3; offset+=3;
+ }
+}
+
+void dvb_descr_priv_data_spec_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ proto_item *ti;
+ gulong type;
+ if(!descrbuf)
+ return;
+
+ ti = proto_tree_add_uint(tree, hf_priv_data_spec, tvb, offset, 4, type = GET_ULONG(descrbuf+2));
+ proto_item_append_text(ti, " (%s)", dvb_descr_pds_str(type));
+}
+
+void dvb_descr_frequency_list_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ guchar *d, *dend;
+ proto_item *ti;
+ static const gchar *coding_type[] = { "not defined", "satellite", "cable", "terrestrial"};
+ if(!descrbuf)
+ return;
+ dend = descrbuf + descrbuf[1];
+ d = descrbuf +2;
+ offset+=2;
+ ti = proto_tree_add_uint(tree,hf_coding_type, tvb, offset, 1, d[0] & 0x2);
+ proto_item_append_text(ti, " (%s)", coding_type[d[0] & 0x2]);
+ d++; offset++;
+ while(d < dend)
+ {
+ proto_tree_add_uint(tree, hf_centre_frequency, tvb, offset, 4, GET_ULONG(descrbuf));
+ descrbuf+=4; offset+=4;
+ }
+}
+
+void dvb_descr_loc_time_offset_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ guchar *d, *dend, *lang;
+ proto_item *ti; proto_tree *toc_tree;
+
+ if(!descrbuf)
+ return;
+
+ d = descrbuf+2;
+ dend = descrbuf + descrbuf[1];
+ offset +=2;
+ while(d <dend)
+ {
+ lang = calloc(1,3);
+ memcpy(lang,d,3);
+ proto_tree_add_string(tree, hf_language_code, tvb,offset, 3, lang);
+ free(lang);
+ d+=3;
+ if((d[0] >>2) == 0x0)
+ {
+ ti = proto_tree_add_uint(tree, hf_country_region_id, tvb, offset,1, d[0] >> 2);
+ proto_item_append_text(ti, " no time zone extension used");
+ }
+ if((d[0] >>2) <= 0x3c)
+ proto_tree_add_uint(tree, hf_country_region_id, tvb, offset, 1, d[0] >> 2);
+ else
+ proto_tree_add_text(tree, tvb, offset,1,"reserved");
+ proto_tree_add_uint(tree, hf_local_time_offset_polarity, tvb, offset,1, d[0] & 0x1);
+ offset++; d++;
+ proto_tree_add_uint(tree, hf_local_time_offset, tvb, offset, 2, bcd2int((guint32)GET_USHORT(d)));
+ offset +=2; d +=2;
+ ti = proto_tree_add_item(tree, hf_time_of_change,tvb,offset, 5, TRUE);
+ toc_tree = proto_item_add_subtree(ti, ett_table_print);
+ /*dvb_time_print(d, toc_tree, tvb ); Vielleicht ganzen descr löschen */
+
+ d+=5; offset+=5;
+ proto_tree_add_uint(tree, hf_next_time_offset, tvb, offset, 2, bcd2int((guint32)GET_USHORT(d)));
+ }
+
+}
+
+void dvb_descr_mosaic_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ guchar *d, *dend, foo;
+ size_t len, cnt = 0;
+ proto_item *ti;
+ dvb_descr_mosaic_t *mosc;
+ static const gchar *nfo[] = { "undefined", "video", "still picture", "graphics/text"};
+ static const gchar *lnfo[] = { "undefined", "bouquet related", "service related", "other mosaic related", "event related"};
+
+ if(!descrbuf)
+ return;
+ mosc = (dvb_descr_mosaic_t *)descrbuf;
+ d = descrbuf +3; offset+=2;
+ dend = descrbuf + descrbuf[1];
+ proto_tree_add_uint(tree, hf_mosaic_entry_point, tvb, offset, 1, mosc->mosaic_entry_point);
+ proto_tree_add_uint(tree, hf_nohec, tvb, offset, 1, mosc->number_of_horizontal_elementary_cells+1); // plus 1 because 0x0 = 1 cell
+ proto_tree_add_uint(tree, hf_novec, tvb, offset, 1, mosc->number_of_vertical_elementary_cells+1); // plus 1 because 0x0 = 1 cell
+ offset++;
+ while(d <dend)
+ {
+ proto_tree_add_uint(tree, hf_log_cell_id, tvb, offset,1 , d[0] >>2);
+ ti = proto_tree_add_uint(tree, hf_log_cell_pres_nfo, tvb, offset +1, 1,foo=( d[1] & 0x7));
+ proto_item_append_text(ti, " (%s)", ((foo < 0x04) ? nfo[foo] : "reserved"));
+ proto_tree_add_uint(tree, hf_el_cell_fl,tvb, offset +2, 1, len=d[2]);
+ offset+=3; d +=3;
+ while(cnt < len)
+ {
+ proto_tree_add_uint(tree, hf_el_cell_id, tvb, offset, 1, d[0] & 0x3f);
+ ti = proto_tree_add_uint(tree, hf_cell_link_nfo, tvb, offset+1,1, d[1]);
+ proto_item_append_text(ti, " (%s)", ((d[1] <0x05) ? lnfo[d[1]] : "reserved"));
+ d+=2;
+ switch(d[1])
+ {
+ case 0x01:
+ {
+ proto_tree_add_uint(tree, hf_bouquet_id, tvb, offset+2, 2, GET_USHORT(d));
+ offset +=2; d+=2; cnt +=2;;
+ break;
+ }
+ case 0x02:
+ case 0x03:
+ {
+ proto_tree_add_uint(tree, hf_onid, tvb, offset+2, 2, GET_USHORT(d));
+ proto_tree_add_uint(tree, hf_tsid, tvb, offset+4, 2, GET_USHORT(d+2));
+ proto_tree_add_uint(tree, hf_service_id, tvb, offset+=6, 2, GET_USHORT(d+4));
+ d+=6; cnt +=6;
+ break;
+ }
+ case 0x04:
+ {
+ proto_tree_add_uint(tree, hf_onid, tvb, offset+2, 2, GET_USHORT(d));
+ proto_tree_add_uint(tree, hf_tsid, tvb, offset+4, 2, GET_USHORT(d+2));
+ proto_tree_add_uint(tree, hf_service_id, tvb, offset+6, 2, GET_USHORT(d+4));
+ proto_tree_add_uint(tree, hf_event_id, tvb, offset+=8, 2, GET_USHORT(d+6));
+ d+=8; cnt +=8;
+ break;
+ }
+ }
+ }
+ }
+}
+
+void dvb_descr_multiling_bouq_name_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ guchar *d, *dend, *lang, *help;
+ size_t len;
+ proto_item *ti; proto_tree *text_tree;
+
+ if(!descrbuf)
+ return;
+
+ d = descrbuf +2;
+ dend = descrbuf + descrbuf[1];
+ offset+=2;
+ while(d<dend)
+ {
+ lang = calloc(1,3);
+ memcpy(lang,d,3);
+ proto_tree_add_string(tree, hf_language_code, tvb, offset, 3, lang);
+ free(lang);
+ d+=3; offset+=3;
+ ti = proto_tree_add_uint(tree, hf_bouquet_name_length, tvb, offset, 1, len = d[0]);
+ text_tree = proto_item_add_subtree(ti, ett_table_print);
+ d++;
+ help = calloc(1,len);
+ memcpy(help, d, len);
+ proto_tree_add_longtext(text_tree, tvb, offset, help,len);
+ free(help);
+ d += len;
+ }
+}
+
+void dvb_descr_multiling_component_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ guchar *d, *dend, *lang, *help;
+ size_t len; proto_item *ti; proto_tree *text_tree;
+ if(!descrbuf)
+ return;
+
+ d = descrbuf +2;
+ dend = descrbuf + descrbuf[1];
+ offset +=2;
+ proto_tree_add_uint(tree, hf_component_tag, tvb, offset,1 ,d[0]);
+ while(d<dend)
+ {
+ lang = calloc(1,3);
+ memcpy(lang,d,3);
+ proto_tree_add_string(tree, hf_language_code, tvb, offset+1, 3, lang);
+ free(lang);
+ offset +=4; d+=3;
+ ti = proto_tree_add_uint(tree, hf_text_length,tvb, offset, 1, len = d[0]);
+ text_tree = proto_item_add_subtree(ti,ett_table_print);
+ d++;
+ help = calloc(1,len);
+ memcpy(help, d, len);
+ proto_tree_add_longtext(text_tree, tvb, offset, help,len);
+ free(help);
+ d += len;
+ }
+}
+
+void dvb_descr_multiling_netname_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ guchar *d, *dend, *lang, *help;
+ size_t len;
+ proto_item *ti; proto_tree *name_tree;
+ if(!descrbuf)
+ return;
+
+ d = descrbuf +2; offset +=2;
+ dend = descrbuf + descrbuf[1];
+
+ while(d<dend)
+ {
+ lang = calloc(1,3);
+ memcpy(lang,d,3);
+ proto_tree_add_string(tree,hf_language_code, tvb, offset, 3, lang);
+ free(lang);
+ ti = proto_tree_add_uint(tree, hf_network_name_length,tvb, offset+3, 1, len = d[3]);
+ d +=4; offset +=4;
+ name_tree = proto_item_add_subtree(ti, ett_table_print);
+ help = calloc(1,len);
+ memcpy(help, d, len);
+ proto_tree_add_longtext(name_tree, tvb, offset, help,len);
+ free(help);
+ d += len;
+ }
+}
+
+void dvb_descr_multiling_serv_name_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ guchar *d, *dend, *lang, *help;
+ size_t len;
+ proto_item *ti; proto_tree *prov_tree, *sname_tree;
+
+ if(!descrbuf)
+ return;
+ d = descrbuf +2; offset +=2;
+ dend = descrbuf + descrbuf[1];
+
+ while(d<dend)
+ {
+ lang = calloc(1,3);
+ memcpy(lang,d,3);
+ proto_tree_add_string(tree, hf_language_code, tvb, offset, 3, lang);
+ free(lang);
+ ti = proto_tree_add_uint(tree, hf_service_provider_name_length, tvb, offset +3, 1,len = d[3]);
+ prov_tree = proto_item_add_subtree(ti, ett_table_print);
+ d += 4; offset+=4;
+ help = calloc(1,len);
+ memcpy(help, d, len);
+ proto_tree_add_longtext(prov_tree, tvb, offset, help,len);
+ free(help);
+ d += len; offset+=len;
+ ti = proto_tree_add_uint(tree, hf_service_name_length, tvb, offset,1, len = d[0]);
+ sname_tree = proto_item_add_subtree(ti, ett_table_print);
+ d += 4; offset+=4;
+ help = calloc(1,len);
+ memcpy(help, d, len);
+ proto_tree_add_longtext(sname_tree, tvb, offset, help,len);
+ free(help);
+ }
+}
+
+void dvb_descr_CA_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset)
+{
+ guchar *d;
+ size_t len;
+ if(!descrbuf)
+ return;
+ d = descrbuf +2; offset +=2;
+ len = descrbuf[1];
+ proto_tree_add_uint(tree, hf_CA_system_id, tvb, offset, 2, (d[0]<<8) | d[1]);
+ d +=2;
+ offset +=2;
+ proto_tree_add_uint(tree, hf_CA_PID, tvb, offset, 2, ((d[0] & 0x1f) << 8) | d[1]);
+ proto_tree_add_item(tree, hf_private_data, tvb, offset+2,len -4, TRUE);
+}
+/*
+ * ====================================================================================================
+ * Local helper functions.
+ * ====================================================================================================
+ */
+
+guint32 bcd2int( guint32 bcd )
+{
+ guint32 factor = 10000000L;
+ guint32 mask = 0xF0000000L;
+ guint8 shift = 28;
+ guint32 ret = 0L;
+
+ while (mask > 0) {
+ ret += ((bcd & mask) >> shift) * factor;
+ factor /= 10;
+ mask >>= 4;
+ shift -= 4;
+ }
+ return ret;
+}
+
+guint32 int2bcd( guint32 integer )
+{
+ guint32 divisor = 10000000L;
+ gchar shifter = 28;
+ guint32 tmp = 0L;
+ guint32 ret = 0L;
+
+ while (integer > 0) {
+ ret += (tmp = (integer / divisor)) << shifter;
+ integer -= divisor * tmp;
+ divisor /= 10;
+ shifter -= 4;
+ }
+ return ret;
+}
diff -ruN ethereal-0.10.7/mpeg2_descriptors.h ethereal-0.10.7_mpeg2_recent/mpeg2_descriptors.h
--- ethereal-0.10.7/mpeg2_descriptors.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/mpeg2_descriptors.h 2004-12-02 16:14:19.732675185 +0100
@@ -0,0 +1,444 @@
+/* mpeg2_descriptors.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ *
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING wolfi@xxxxxxxxxxxxxx
+ * Lutz FINDEISEN lfindeis@xxxxxxxxxxxxxx
+ *
+ * Project partially sponsored by ESA projectnr.: JR/UOS/17471/03/NL/ND
+ * "Standardisation Support of enhanced IEFTF IP Encapsulation Tecniques"
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+/**
+ * @file
+ */
+#ifndef __MPEG2_DESCRIPTORS_H__
+#define __MPEG2_DESCRIPTORS_H__
+/**
+ * Video stream descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_video_stream_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset);
+
+/**
+ * Audio stream descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_audio_stream_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset);
+
+/**
+ * Networl name descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_network_name_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset);
+
+/**
+ * Service list descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_service_list_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Satellite delivery system print descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_satellite_delivery_system_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset );
+
+/**
+ * Cable delivery system descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_cable_delivery_system_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset );
+
+/**
+ * Terrestrial delivery system descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_terr_delivery_system_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Service descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_service_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Data broadcast descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_data_broadcast_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset );
+
+/**
+ * CA identifier descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_ca_id_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Linkage descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_linkage_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset );
+
+/**
+ * Data broadcast identifier descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_data_broadcast_id_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset );
+
+/**
+ * Carousel identifier descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_carousel_id_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Stream identifier descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_stream_id_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Application signaling descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_appsig_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Association tag descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_assoc_tag_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Short event descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_short_event_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Extended event descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_extended_event_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Time shifted event descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_tshift_event_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * AC3 descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_ac3_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * CA Identifier descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_CA_id_print( guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Content descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_content_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Parental rating descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_parental_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Telephone descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_tefephone_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Teletext descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_teletext_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Component descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_component_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * PDC descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_pdc_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * VBI descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_vbi_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * ISO639 language descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_iso639_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Service descriptor table descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_sdt_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Registration descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_reg_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Country availability descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_country_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Private data specification descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_priv_data_spec_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Frequency list descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_frequency_list_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Local time offset descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_loc_time_offset_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Mosaic descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_mosaic_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Multilingual bouquet name descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_multiling_bouq_name_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Multilingual component descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_multiling_component_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Multilingual network name descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_multiling_netname_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Mutlilingual service name descriptor printer
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_multiling_serv_name_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+
+/**
+ * Conditional Access descriptor
+ * Descriptor printer display the information in human readable format in the middle pane of Ethereal
+ * @param descrbuf pointer to a buffer containing the raw data
+ * @param tree protocol tree for constructing the tree in the middle pane
+ * @param offset integer holding the offset for the HEX pane in Ethereal
+ */
+extern
+void dvb_descr_CA_print(guint8 *descrbuf, proto_tree *tree, tvbuff_t *tvb , guint16 offset);
+#endif
diff -ruN ethereal-0.10.7/mpeg2_hf.h ethereal-0.10.7_mpeg2_recent/mpeg2_hf.h
--- ethereal-0.10.7/mpeg2_hf.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/mpeg2_hf.h 2004-12-02 16:14:19.781667813 +0100
@@ -0,0 +1,460 @@
+/* mpeg2_hf.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ * Copyright 2004, Lutz Findeisen lfindeis@xxxxxxxxxxxxxx
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#ifndef __MPEG2_HF_H__
+#define __MPEG2_HF_H__
+/* Initialize the protocol and registered fields */
+/* general field */
+ int hf_reserved1 = -1;
+ int hf_reserved = -1;
+ int hf_Descriptors = -1;
+ int hf_info_msg = -1;
+
+
+ int proto_table_print = -1;
+
+/*PAT print fields */
+ int hf_service_nr = -1;
+ int hf_program_number = -1;
+ int hf_network_PID = -1;
+ int hf_program_map_PID = -1;
+
+/*NIT print fields */
+ int hf_reserved_future_use = -1;
+ int hf_network_descriptors_length = -1;
+ int hf_transport_stream_loop_length = -1;
+ int hf_tsid = -1;
+ int hf_onid = -1;
+ int hf_TS_descriptor_length = -1;
+ int hf_Transport_Stream_Descriptions = -1;
+ int hf_Network_Descriptors = -1;
+
+/*mpe3e print fields */
+ int hf_payload_scrambling_control = -1;
+ int hf_LLC_SNAP_flag = -1;
+ int hf_address_scrambling_control = -1;
+ int hf_MAC_address = -1;
+ int hf_LLC_SNAP = -1;
+
+/*pmt print fields*/
+ int hf_PCR_PID = -1;
+ int hf_program_info_length = -1;
+ int hf_program_info_descriptors = -1;
+ int hf_stream_type = -1;
+ int hf_EPID = -1;
+ int hf_ES_info_length = -1;
+ int hf_Elementary_stream_descriptions = -1;
+
+ /*sdt print fields */
+ int hf_original_network_PID = -1;
+ int hf_SDT_Entry_loop = -1;
+ int hf_reserved_future_use0 = -1;
+ int hf_service_id = -1; /*also used for: service list descr*/
+ int hf_running_status = -1;
+ int hf_EIT_schedule_flag = -1;
+ int hf_free_CA_mode = -1;
+ int hf_EIT_present_following_flag = -1;
+ int hf_descriptor_loop_length = -1;
+ int hf_reserved_future_use1 = -1;
+
+ /* dsmcc ait fields */
+
+ /*dsmcc3b/3c print */
+ int hf_protocol_discriminator = -1;
+ int hf_dsmcc_type = -1;
+ int hf_message_id = -1;
+ int hf_transaction_id = -1;
+ int hf_reserved_dsmcc = -1;
+ int hf_adaptation_length = -1;
+ int hf_message_length =-1;
+ int hf_dsmcc_adapt_field = -1;
+ int hf_message = -1;
+ int hf_download_data_block = -1;
+ int hf_block_number = -1;
+
+ /*ait print*/
+ int hf_common_descriptor_length = -1;
+ int hf_common_descriptors = -1;
+ int hf_Application_loop_length = -1;
+ int hf_organization_id = -1;
+ int hf_application_id = -1;
+ int hf_application_control_code = -1;
+ int hf_application_descriptor_len = -1;
+ int hf_Application_descriptor = -1;
+
+/*time print*/
+ int hf_DAY = -1;
+ int hf_UNIX_time = -1;
+
+/*eit print*/
+ int hf_transport_stream_id = -1;
+ int hf_original_network_id = -1;
+ int hf_segment_last_section_number = -1;
+ int hf_last_label_id = -1;
+ int hf_event_loop = -1;
+
+/*eit event print*/
+ int hf_event_id = -1;
+ int hf_start_time = -1;
+ int hf_duration = -1;
+
+/*Descriptor printer fields */
+ int hf_descriptor_tag = -1;
+
+/* conditional access print */
+ int hf_CA_PID = -1;
+
+/*video stream print */
+ int hf_multiple_frame_rate_flag = -1;
+ int hf_constraint_parameter_flag = -1;
+ int hf_MPEG_1_only_flag = -1;
+ int hf_still_picture_flag = -1;
+ int hf_frame_rate_code = -1;
+ int hf_sprofile_and_level_indication = -1;
+ int hf_frame_rate_extension_flag = -1;
+ int hf_chroma_format = -1;
+ int hf_constrained_parameter_flag = -1;
+
+ /*audio stream print */
+ int hf_free_format_flag = -1;
+ int hf_id = -1;
+ int hf_layer = -1;
+ int hf_variable_rate_audio_indicator =-1;
+
+ /*network name print */
+ int hf_network_name = -1;
+
+ /* service list print */
+ int hf_service_type = -1;
+
+ /* satellite delivery system */
+ /* cable delivery system */
+ int hf_frequency_terr = -1;
+ int hf_frequency = -1;
+ int hf_modulation = -1;
+ int hf_orbital_position = -1;
+ int hf_symbol_rate = -1;
+ int hf_west_east_flag = -1;
+ int hf_FEC_inner = -1;
+ int hf_polarization = -1;
+ int hf_FEC_outer = -1;
+
+ /*terrestrial delivery system print */
+ int hf_bandwitdth = -1;
+ int hf_constellation = -1;
+ int hf_hirachy = -1;
+ int hf_code_rate_HP = -1;
+ int hf_code_rate_LP = -1;
+ int hf_quard_internal = -1;
+ int hf_transmission_mode = -1;
+ int hf_other_freq = -1;
+
+ /* service print */
+ int hf_service_provider_name = -1;
+ int hf_service_name = -1;
+
+ /* data broadcast print */
+ int hf_data_broadcast_id = -1;
+ int hf_component_tag = -1;
+ int hf_selector_length = -1;
+ int hf_selector = -1;
+ int hf_ISO_639_language_code = -1;
+ int hf_text_length = -1;
+ int hf_text = -1;
+
+ /*mpe info print*/
+ int hf_MAC_address_range = -1;
+ int hf_MAC_IP_mapping_flag = -1;
+ int hf_alignment_indicator = -1;
+ int hf_section_per_datagram = -1;
+
+ /*dbc dc info print*/
+ int hf_carousel_type_id = -1;
+ int hf_timeout_DSI = -1;
+ int hf_timeout_DII = -1;
+ int hf_leak_rate = -1;
+
+/* dbc oc info print*/
+ int hf_language_code = -1;
+ int hf_object_name = -1;
+
+/*ca id print*/
+ int hf_CA_system_id = -1;
+
+/*linkage print*/
+ int hf_linkage_type = -1;
+ int hf_private_data_byte = -1;
+
+
+/*corousel id print */
+ int hf_carousel_id = -1;
+ int hf_format_id = -1;
+ int hf_private_data = -1;
+
+/*stream id print */
+ int hf_component_id = -1;
+
+/* appsig print */
+int hf_application_type = -1;
+int hf_ait_version = -1;
+
+/*assoc tag print*/
+int hf_association_tag = -1;
+int hf_timeout = -1;
+int hf_use = -1;
+
+/*short event print */
+int hf_event_text = -1;
+int hf_event_name = -1;
+
+/*extendet event print */
+int hf_descriptor_number = -1;
+int hf_last_descr_number = -1;
+int hf_length_of_items = -1;
+int hf_item_descr_len = -1;
+int hf_textstr = -1;
+
+/*tshift event print*/
+int hf_reference_service_id = -1;
+int hf_reference_event_id = -1;
+
+/*ac3 print */
+int hf_Flags = -1;
+int hf_comp_type = -1;
+int hf_bsid = -1;
+int hf_mainid = -1;
+int hf_asvc = -1;
+int hf_component_type = -1;
+int hf_bs_id = -1;
+int hf_main_id = -1;
+int hf_asvc_value = -1;
+int hf_additional_info = -1;
+
+
+/*Content print */
+int hf_content_nibble_level1 = -1;
+int hf_content_nibble_level2 = -1;
+int hf_user_nibble = -1;
+
+int hf_country_code = -1;
+int hf_rating = -1;
+
+/*telephone print*/
+int hf_foreign_availability = -1;
+int hf_connection_type = -1;
+int hf_country_prefix_length = -1;
+int hf_international_area_code_length = -1;
+int hf_operator_code_length = -1;
+int hf_national_area_code_length = -1;
+int hf_core_number_length = -1;
+
+/*component print */
+int hf_stream_content = -1;
+
+/*PDC print*/
+int hf_programme_identification_label = -1;
+
+/*Teletext print*/
+int hf_teletext_type = -1;
+int hf_teletext_magazine_number = -1;
+int hf_teletext_page_number = -1;
+
+/*VBI data print*/
+int hf_data_service_descriptor_length = -1;
+int hf_data_service_id = -1;
+int hf_field_parity = -1;
+int hf_line_offset = -1;
+
+/*iso 639 print*/
+int hf_audo_type = -1;
+
+/*sdt print*/
+int hf_leak_valid_flag = -1;
+
+/*registration print */
+int hf_format_identifier = -1;
+int hf_additional_identification_info = -1;
+
+/*country avail. print*/
+int hf_country_availability_flag = -1;
+
+/*priv data spec print */
+int hf_priv_data_spec = -1;
+
+/*frequency list print*/
+int hf_coding_type = -1;
+int hf_centre_frequency = -1;
+
+/*local time offset print*/
+int hf_country_region_id = -1;
+int hf_local_time_offset_polarity = -1;
+int hf_time_of_change = -1;
+int hf_local_time_offset = -1;
+int hf_next_time_offset = -1;
+
+/*mosaic print*/
+int hf_mosaic_entry_point = -1;
+int hf_nohec = -1;
+int hf_novec = -1;
+int hf_log_cell_id = -1;
+int hf_log_cell_pres_nfo = -1;
+int hf_el_cell_fl = -1;
+int hf_el_cell_id = -1;
+int hf_cell_link_nfo = -1;
+int hf_bouquet_id = -1;
+
+/*multiling. bouqet name print*/
+int hf_bouquet_name_length = -1;
+
+/*multiling. network name print*/
+int hf_network_name_length = -1;
+
+/*multiling. service name print*/
+int hf_service_provider_name_length = -1;
+int hf_service_name_length = -1;
+
+
+
+
+/**************************************
+ * *
+ * MHP descriptors *
+ * *
+ **************************************/
+
+
+/*mhp app print*/
+int hf_application_profiles = -1;
+int hf_application_profile = -1;
+int hf_service_bound_flag = -1;
+int hf_visibility = -1;
+int hf_application_priority = -1;
+int hf_transport_protocol_lables = -1;
+int hf_application_name = -1;
+
+/*mhp trprot print*/
+int hf_protocol_id = -1;
+int hf_protocol_label = -1;
+
+/*mhp dvbjapp print*/
+int hf_len = -1;
+
+/*mhp japp loc print */
+int hf_base_directory = -1;
+int hf_classpath_extension = -1;
+int hf_initial_class = -1;
+
+/*mhp label print*/
+int hf_label = -1;
+
+/*mhp prio print */
+int hf_priority_value = -1;
+int hf_transparency_value = -1;
+
+/*dsmcc dii print*/
+int hf_download_id = -1;
+int hf_block_sz = -1;
+int hf_window_sz = -1;
+int hf_ack_period = -1;
+int hf_tc_dl_window = -1;
+int hf_tc_dl_scenario = -1;
+int hf_compability_descr_length =-1;
+int hf_compability_descr = -1;
+int hf_number_of_modules = -1;
+int hf_module = -1;
+int hf_module_id = -1;
+int hf_module_sz = -1;
+int hf_module_version = -1;
+int hf_module_info_length = -1;
+int hf_module_info = -1;
+int hf_module_timeout = -1;
+int hf_block_timeout = -1;
+int hf_min_block_time = -1;
+int hf_taps_count = -1;
+int hf_usr_info_len = -1;
+int hf_private_data_length = -1;
+
+/*dsmcc dsi print*/
+int hf_server_id = -1;
+
+/* dsmcc taps print */
+int hf_tap = -1;
+int hf_selector_type = -1;
+int hf_tap_id = -1;
+int hf_tap_use = -1;
+
+/* dvb dsmcc srginfo print*/
+int hf_service_gateway_info = -1;
+int hf_download_taps_count = -1;
+int hf_service_context_list_count = -1;
+
+/* dvb dsmcc IOP IOR Print */
+int hf_IOP_IOR = -1;
+int hf_type_id_len = -1;
+int hf_alignment_gap = -1;
+int hf_tagged_profiles_count = -1;
+int hf_IOP_IOR_id = -1;
+
+/* dvb dsmcc tagged profile print*/
+int hf_profile_id_tag = -1;
+int hf_profile_data_len = -1;
+int hf_byte_order = -1;
+int hf_lite_components_count = -1;
+
+/* dvb dsmcc lite component print */
+int hf_component_data_len = -1;
+int hf_version = -1;
+int hf_object_key_len = -1;
+
+/* dvb dsmcc sc print*/
+int hf_service_context_id = -1;
+int hf_data_len = -1;
+
+/*dvb dsmcc biop print*/
+int hf_BIOP_message = -1;
+int hf_magic = -1;
+int hf_BIOP_version = -1;
+int hf_message_type = -1;
+int hf_message_size = -1;
+int hf_object_key = -1;
+int hf_object_kind_len = -1;
+int hf_object_kind = -1;
+int hf_object_info_len = -1;
+int hf_content_size = -1;
+int hf_message_body_len = -1;
+int hf_content_length = -1;
+int hf_bindings_count = -1;
+
+
+/*dvb dsmcc BIOP bindings print */
+int hf_binding = -1;
+int hf_binding_type = -1;
+int hf_end_binding = -1;
+
+/*dvb dsmcc BIOP name print */
+int hf_name_components_count = -1;
+int hf_kind_len = -1;
+int hf_BIOP_id = -1;
+
+#endif
diff -ruN ethereal-0.10.7/mpeg2_psi.c ethereal-0.10.7_mpeg2_recent/mpeg2_psi.c
--- ethereal-0.10.7/mpeg2_psi.c 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/mpeg2_psi.c 2004-12-02 16:14:19.821661795 +0100
@@ -0,0 +1,473 @@
+/* mpeg2_psi.c
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ *
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING wolfi@xxxxxxxxxxxxxx
+ * Lutz FINDEISEN lfindeis@xxxxxxxxxxxxxx
+ *
+ * Project partially sponsored by ESA projectnr.: JR/UOS/17471/03/NL/ND
+ * "Standardisation Support of enhanced IEFTF IP Encapsulation Tecniques"
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#include <glib.h>
+
+#ifdef NEED_SNPRINTF_H
+# include "snprintf.h"
+#endif
+
+#include <epan/packet.h>
+
+
+/*DVB dump includes*/
+#include "dvb_incs/sect_gen.h"
+#include "dvb_incs/sect_pat.h"
+#include "dvb_incs/sect_gen.h"
+#include "dvb_incs/sect_pmt.h"
+#include "dvb_incs/sect_nit.h"
+#include "dvb_incs/sect_sdt.h"
+#include "dvb_incs/sect_mpe.h"
+#include "dvb_incs/descriptors.h"
+#include "mpeg2_convenience_routines.h"
+#include "mpeg2_descriptors.h"
+#include "mpeg2_psi.h"
+
+ extern int hf_reserved1;
+ extern int hf_reserved;
+ extern int hf_Descriptors;
+
+ extern int proto_table_print;
+
+/*PAT print fields */
+ extern int hf_service_nr;
+ extern int hf_program_number;
+ extern int hf_network_PID;
+ extern int hf_program_map_PID;
+
+/*NIT print fields */
+ extern int hf_reserved_future_use;
+ extern int hf_network_descriptors_length;
+ extern int hf_transport_stream_loop_length;
+ extern int hf_tsid;
+ extern int hf_onid;
+ extern int hf_TS_descriptor_length;
+ extern int hf_Transport_Stream_Descriptions ;
+ extern int hf_Network_Descriptors;
+
+/*mpe3e print fields */
+ extern int hf_payload_scrambling_control;
+ extern int hf_LLC_SNAP_flag;
+ extern int hf_address_scrambling_control;
+ extern int hf_MAC_address;
+ extern int hf_LLC_SNAP;
+
+/*pmt print fields*/
+ extern int hf_PCR_PID;
+ extern int hf_program_info_length;
+ extern int hf_program_info_descriptors;
+ extern int hf_stream_type;
+ extern int hf_EPID;
+ extern int hf_ES_info_length;
+ extern int hf_Elementary_stream_descriptions;
+
+ /*sdt print fields */
+ extern int hf_original_network_PID;
+ extern int hf_SDT_Entry_loop;
+ extern int hf_reserved_future_use0;
+ extern int hf_service_id;
+ extern int hf_running_status;
+ extern int hf_EIT_schedule_flag;
+ extern int hf_free_CA_mode;
+ extern int hf_EIT_present_following_flag;
+ extern int hf_descriptor_loop_length;
+ extern int hf_reserved_future_use1;
+
+ /*Descriptor printer fields */
+ extern int hf_descriptor_tag ;
+
+/*Subtree pointers */
+ extern gint ett_table_print;
+
+/*IP dissector handle for mpe3e */
+ extern dissector_handle_t ip_handle, llc_handle;
+
+ extern guint16 tvb_offset;
+ extern proto_item *ti;
+ extern packet_info *pinfo_mem;
+ extern tvbuff_t *next_tvb;
+
+
+
+
+/* Descriptor Type is the index. */
+dvb_descr_print_t descriptor_printer[255];
+
+static void table_init()
+ {
+ descriptor_printer[DVB_DESCR_TAG_VIDEO_STREAM] = dvb_descr_video_stream_print;
+ descriptor_printer[DVB_DESCR_TAG_AUDIO_STREAM] = dvb_descr_audio_stream_print;
+ descriptor_printer[DVB_DESCR_TAG_NETWORK_NAME] = dvb_descr_network_name_print;
+ descriptor_printer[DVB_DESCR_TAG_SERVICE_LIST] = dvb_descr_service_list_print;
+ descriptor_printer[DVB_DESCR_TAG_SAT_DELIV_SYS] = dvb_descr_satellite_delivery_system_print;
+ descriptor_printer[DVB_DESCR_TAG_CABLE_DELIV_SYS] = dvb_descr_cable_delivery_system_print;
+ descriptor_printer[DVB_DESCR_TAG_TERR_DELIV_SYS] = dvb_descr_terr_delivery_system_print;
+ descriptor_printer[DVB_DESCR_TAG_SERVICE] = dvb_descr_service_print;
+ descriptor_printer[DVB_DESCR_TAG_LINKAGE] = dvb_descr_linkage_print;
+ descriptor_printer[DVB_DESCR_TAG_CA_ID] = dvb_descr_ca_id_print;
+ descriptor_printer[DVB_DESCR_TAG_DATA_BROADCAST] = dvb_descr_data_broadcast_print;
+ descriptor_printer[DVB_DESCR_TAG_DATA_BROADCAST_ID] = dvb_descr_data_broadcast_id_print;
+ descriptor_printer[DVB_DESCR_TAG_CAROUSEL_ID] = dvb_descr_carousel_id_print;
+ descriptor_printer[DVB_DESCR_TAG_STREAM_ID] = dvb_descr_stream_id_print;
+ descriptor_printer[DVB_DESCR_TAG_APP_SIG] = dvb_descr_appsig_print;
+ descriptor_printer[DVB_DESCR_TAG_ASSOC_TAG] = dvb_descr_assoc_tag_print;
+ descriptor_printer[DVB_DESCR_TAG_SHORT_EVENT] = dvb_descr_short_event_print;
+ descriptor_printer[DVB_DESCR_TAG_EXTENDED_EVENT] = dvb_descr_extended_event_print;
+ descriptor_printer[DVB_DESCR_TAG_TSHIFT_EVENT] = dvb_descr_tshift_event_print;
+ descriptor_printer[DVB_DESCR_TAG_AC3] = dvb_descr_ac3_print;
+ descriptor_printer[DVB_DESCR_TAG_CA_ID] = dvb_descr_CA_id_print;
+ descriptor_printer[DVB_DESCR_TAG_CONTENT] = dvb_descr_content_print;
+ descriptor_printer[DVB_DESCR_TAG_PARENTAL_RATING] = dvb_descr_parental_print;
+ descriptor_printer[DVB_DESCR_TAG_COMPONENT] = dvb_descr_component_print;
+ descriptor_printer[DVB_DESCR_TAG_PDC] = dvb_descr_pdc_print;
+ descriptor_printer[DVB_DESCR_TAG_TELETEXT] = dvb_descr_teletext_print;
+ descriptor_printer[DVB_DESCR_TAG_VBI_DATA] = dvb_descr_vbi_print;
+ descriptor_printer[DVB_DESCR_TAG_ISO_639_LANG] = dvb_descr_iso639_print;
+ descriptor_printer[DVB_DESCR_TAG_SDT] = dvb_descr_sdt_print;
+ descriptor_printer[DVB_DESCR_TAG_REGISTRATION] = dvb_descr_reg_print;
+ descriptor_printer[DVB_DESCR_TAG_COUNTRY_AVAIL] = dvb_descr_country_print;
+ descriptor_printer[DVB_DESCR_TAG_PRIV_DATA_SPEC] = dvb_descr_priv_data_spec_print;
+ descriptor_printer[DVB_DESCR_TAG_VBI_TELETEXT] = dvb_descr_teletext_print;
+ descriptor_printer[DVB_DESCR_TAG_FREQ_LIST] = dvb_descr_frequency_list_print;
+ descriptor_printer[DVB_DESCR_TAG_LOC_TIME_OFF] = dvb_descr_loc_time_offset_print;
+ descriptor_printer[DVB_DESCR_TAG_MOSAIC] = dvb_descr_mosaic_print;
+ descriptor_printer[DVB_DESCR_TAG_MULING_BOU_NAME] = dvb_descr_multiling_bouq_name_print;
+ descriptor_printer[DVB_DESCR_TAG_MULING_COMP] = dvb_descr_multiling_component_print;
+ descriptor_printer[DVB_DESCR_TAG_MULING_NET_NAME] = dvb_descr_multiling_netname_print;
+ descriptor_printer[DVB_DESCR_TAG_MULING_SERV_NAME] = dvb_descr_multiling_serv_name_print;
+ descriptor_printer[DVB_DESCR_TAG_CA] = dvb_descr_CA_print;
+
+}
+
+
+void dvb_pat_print(guint8 *patbuf, proto_tree *tree, tvbuff_t *tvb)
+ {
+ dvb_sect_pat_t *pat = NULL;
+ gint num_progs = 0, i = 0;
+
+
+ if (!patbuf)
+ return;
+
+ pat = (dvb_sect_pat_t *)patbuf;
+ // slen = DVB_GET_SECTION_LENGTH( &(pat->gen_hdr) );
+ // num_progs = (slen - 9) / sizeof(dvb_sect_pat_program_t);
+ num_progs = DVB_GET_PAT_PROG_COUNT( pat );
+
+
+ for (i = 0; i < num_progs; i++)
+ {
+ dvb_pat_prog_print(
+ //(dvb_sect_pat_program_t *)&((dvb_sect_pat_program_t)(((dvb_sect_pat_program_t *)(patbuf+8))[i])), tree, tvb);
+ &(((dvb_sect_pat_program_t *)(patbuf+8))[i]), tree, tvb, i);
+ tvb_offset +=4; /* offset + program */
+ }
+ return;
+}
+
+void dvb_pat_prog_print(dvb_sect_pat_program_t *prog, proto_tree *tree, tvbuff_t *tvb, gint nr)
+{
+
+ proto_tree *pat_tree = NULL;
+ ti = proto_tree_add_uint(tree, hf_service_nr, tvb, tvb_offset, sizeof(dvb_sect_pat_program_t), nr);
+ pat_tree = proto_item_add_subtree(ti, ett_table_print);
+ if (DVB_GET_PAT_PROGNR( prog ) == 0)
+ {
+ proto_item_append_text(ti, " NIT PID 0x%04x", DVB_GET_PAT_PROG_PID( network_PID, prog));
+ proto_tree_add_uint(pat_tree, hf_program_number, tvb, tvb_offset, 2, DVB_GET_PAT_PROGNR( prog ) );
+ proto_tree_add_uint(pat_tree, hf_reserved, tvb, tvb_offset + 2, 1, prog->u.network_PID.reserved0 );
+ proto_tree_add_uint(pat_tree, hf_network_PID, tvb, tvb_offset + 2, 2, DVB_GET_PAT_PROG_PID( network_PID, prog));
+ }
+ else
+ {
+ proto_item_append_text(ti, " PAT PID 0x%04x", DVB_GET_PAT_PROG_PID( network_PID, prog));
+ proto_tree_add_uint(pat_tree, hf_program_number, tvb, tvb_offset, 2, DVB_GET_PAT_PROGNR( prog ) );
+ proto_tree_add_uint(pat_tree, hf_reserved, tvb, tvb_offset + 2, 1, prog->u.network_PID.reserved0 );
+ proto_tree_add_uint(pat_tree, hf_program_map_PID, tvb, tvb_offset + 2, 2, DVB_GET_PAT_PROG_PID( program_map_PID, prog ));
+ }
+ return;
+}
+
+void dvb_pmt_print( guint8 *pmtbuf, proto_tree *tree, tvbuff_t *tvb )
+{
+ proto_tree *pmt_tree, *prog_tree, *EPID_tree, *ES_info_length_tree = NULL;
+ dvb_sect_pmt_t *pmt = NULL;
+ guint16 proginfo_len = 0, slen = 0;
+ guchar *descr_start = NULL, *descr_off = NULL;
+
+ if (!pmtbuf)
+ return;
+
+ pmt = (dvb_sect_pmt_t *)pmtbuf;
+
+ proto_tree_add_uint( tree, hf_reserved, tvb, tvb_offset,1, pmt->reserved0);
+ proto_tree_add_uint( tree, hf_reserved1, tvb, tvb_offset+2,1, pmt->reserved1 );
+ proto_tree_add_uint( tree, hf_PCR_PID, tvb, tvb_offset, 2, DVB_GET_PMT_PCRPID( pmt ));
+ proto_tree_add_uint( tree, hf_program_info_length, tvb, (tvb_offset+=2),2, proginfo_len = DVB_GET_PROGINFO_LENGTH( pmt ));
+
+ // Program Descriptors
+ //
+
+ descr_start = descr_off = pmtbuf + sizeof(dvb_sect_pmt_t);
+ if (proginfo_len > 0) {
+ ti = proto_tree_add_string(tree, hf_program_info_descriptors, tvb, 0,0," " ); // Offset !!!
+ prog_tree = proto_item_add_subtree(ti, ett_table_print);
+ dvb_descr_print(descr_off, proginfo_len, prog_tree, tvb,tvb_offset);
+ descr_off += proginfo_len; //offset !!!
+
+ }
+
+
+ // Elementary Stream Descriptors
+ // buffer start addr + section length + 3 byte fixed section hdr - 4 bytes crc32
+ tvb_offset +=2;
+ ti = proto_tree_add_string(tree, hf_Elementary_stream_descriptions, tvb, tvb_offset ,(tvb_length(tvb) -tvb_offset - 4)," ");
+ slen = DVB_GET_SECTION_LENGTH( (dvb_sect_gen_t *)pmt );
+ pmt_tree = proto_item_add_subtree(ti, ett_table_print);
+ while (descr_off < (pmtbuf + slen + 3 - 4)) {
+ guint8 esinfolen = 0;
+ dvb_sect_pmt_entry_t *pmte = NULL;
+ pmte = (dvb_sect_pmt_entry_t *)descr_off;
+ ti = proto_tree_add_uint(pmt_tree, hf_EPID, tvb, tvb_offset +1,2, DVB_GET_SECT_PMT_EPID(pmte));
+ proto_item_append_text(ti, ": %s", dvb_stream_type_str( pmte->stream_type ) );
+ EPID_tree = proto_item_add_subtree(ti, ett_table_print);
+ ti = proto_tree_add_uint(EPID_tree, hf_stream_type, tvb, tvb_offset, 1, pmte->stream_type);
+ proto_item_append_text(ti, ": %s", dvb_stream_type_str( pmte->stream_type ) );
+ ti = proto_tree_add_uint(EPID_tree, hf_ES_info_length, tvb,(tvb_offset +=3),2,(esinfolen = DVB_GET_SECT_PMT_ESINFO_LEN( pmte )));
+ ES_info_length_tree = proto_item_add_subtree(ti, ett_table_print);
+ descr_off += 5;
+ tvb_offset += 2;
+ // Print ES Descriptors:
+ dvb_descr_print(descr_off,esinfolen, ES_info_length_tree, tvb, tvb_offset);
+ tvb_offset += esinfolen;
+ descr_off += esinfolen ;
+
+ }
+ return;
+}
+void dvb_nit_print( guint8 *nitbuf, proto_tree *tree, tvbuff_t *tvb)
+{
+ dvb_sect_nit_t *nit = NULL;
+ dvb_sect_nit_ext_t *nitext = NULL;
+ guint16 netinfo_len = 0, slen = 0;
+ guchar *descr_start = NULL, *descr_off = NULL;
+ proto_tree *nw_descr_tree = NULL, *TS_descr_tree = NULL, *ES_descr_tree = NULL, *tsid_tree = NULL;
+ proto_item *ti;
+
+ if (!nitbuf)
+ return;
+
+ nit = (dvb_sect_nit_t *)nitbuf;
+
+ proto_tree_add_uint(tree, hf_reserved_future_use, tvb, tvb_offset, 1, nit->reserved_future_use);
+ proto_tree_add_uint(tree, hf_network_descriptors_length, tvb, tvb_offset+1, 2, (netinfo_len = DVB_GET_NIT_NETDESC_LEN( nit )) );
+
+ // Network Descriptors
+ descr_start = descr_off = nitbuf + sizeof(dvb_sect_nit_t);
+ if (netinfo_len > 0) {
+ ti = proto_tree_add_item(tree, hf_Network_Descriptors, tvb, tvb_offset +=2, 0, TRUE);
+ nw_descr_tree = proto_item_add_subtree(ti, ett_table_print);
+ dvb_descr_print(descr_off, netinfo_len, nw_descr_tree, tvb, tvb_offset );
+ tvb_offset += netinfo_len;
+ descr_off += netinfo_len;
+ }
+ else
+ tvb_offset+=2;
+
+ nitext = (dvb_sect_nit_ext_t *)descr_off;
+ proto_tree_add_uint(tree, hf_reserved_future_use, tvb, tvb_offset, 1,nitext->reserved_future_use);
+ proto_tree_add_uint(tree, hf_transport_stream_loop_length, tvb, tvb_offset, 2, DVB_GET_NIT_TSL_LEN( nitext ) );
+ tvb_offset +=2;
+ descr_off += 2; // sizeof(dvb_sect_nit_ext_t)
+
+ // Network
+ ti = proto_tree_add_string(tree, hf_Transport_Stream_Descriptions, tvb, tvb_offset, 0, " ");
+ TS_descr_tree = proto_item_add_subtree(ti, ett_table_print);
+ slen = DVB_GET_SECTION_LENGTH( (dvb_sect_gen_t *)nit );
+ // NIT buffer start + section length + 3 bytes fixed nit info - 4 bytes CRC32
+ while (descr_off < (nitbuf + slen + 3 - 4)) {
+ guint8 tsinfolen = 0;
+ dvb_sect_nit_entry_t *nite = NULL;
+
+ nite = (dvb_sect_nit_entry_t *)descr_off;
+ ti = proto_tree_add_uint(TS_descr_tree, hf_tsid, tvb, tvb_offset, 2, DVB_GET_NIT_TS_ID( nite ));
+ tsid_tree = proto_item_add_subtree(ti, ett_table_print);
+ proto_tree_add_uint(tsid_tree, hf_onid, tvb, tvb_offset +2, 2,DVB_GET_NIT_ONET_ID( nite ));
+ proto_tree_add_uint(tsid_tree, hf_TS_descriptor_length, tvb , tvb_offset+4, 2, (tsinfolen = DVB_GET_NIT_TSDESC_LEN( nite )) );
+ ti = proto_tree_add_item(tsid_tree, hf_Descriptors, tvb, 0, 0, TRUE);
+ ES_descr_tree = proto_item_add_subtree(ti, ett_table_print);
+ tvb_offset +=6;
+ descr_off +=6; // the 6 bytes we just printed.
+ // Print ES Descriptors:
+ dvb_descr_print(descr_off, tsinfolen,ES_descr_tree, tvb, tvb_offset);
+ descr_off += tsinfolen;
+ tvb_offset += tsinfolen;
+
+ }
+ return;
+}
+void dvb_sdt_print( guint8 *sdtbuf, proto_tree *tree, tvbuff_t *tvb )
+{
+ dvb_sect_sdt_t *sdt = NULL;
+ guchar *descr_off = NULL;
+ guint16 slen = 0, dsll = 0;
+ proto_tree *sdt_tree = NULL, *service_id_tree = NULL, *descr_tree = NULL;
+ static const gchar *runn_str[5] = { "undefined", "not running", "starts in a few seconds", "pausing", "running" };
+
+ if (! sdtbuf)
+ return;
+
+ sdt = (dvb_sect_sdt_t *)sdtbuf;
+ proto_tree_add_uint(tree, hf_original_network_PID, tvb, tvb_offset, 2, DVB_GET_SDT_ONET_ID( sdt ));
+ proto_tree_add_uint(tree, hf_reserved_future_use0, tvb, (tvb_offset + 2), 1, sdt->reserved_future_use);
+ tvb_offset +=3;
+
+
+ ti = proto_tree_add_string(tree, hf_SDT_Entry_loop, tvb, tvb_offset ,0," ");
+ sdt_tree = proto_item_add_subtree(ti, ett_table_print);
+ descr_off = sdtbuf + 11; // sizeof(dvb_sect_sdt_t);
+ slen = DVB_GET_SECTION_LENGTH( &sdt->gen_hdr );
+ while (descr_off < sdtbuf + slen + 3 - 4) {
+ dvb_sect_sdt_entry_t *sdte = (dvb_sect_sdt_entry_t *)descr_off;
+ ti = proto_tree_add_uint(sdt_tree, hf_service_id, tvb, tvb_offset, 2, DVB_GET_SDT_SERVICE_ID( sdte ));
+ service_id_tree = proto_item_add_subtree(ti, ett_table_print);
+ proto_tree_add_string(service_id_tree, hf_running_status, tvb, tvb_offset +3, 1, sdte->running_status < 5 ? runn_str[sdte->running_status]: "reserved");
+ proto_tree_add_uint(service_id_tree, hf_EIT_schedule_flag, tvb, tvb_offset + 2, 1, sdte->EIT_schedule_flag);
+ proto_tree_add_uint(service_id_tree, hf_free_CA_mode, tvb, tvb_offset + 3, 1, sdte->free_CA_mode);
+ proto_tree_add_uint(service_id_tree, hf_EIT_present_following_flag, tvb, tvb_offset+ 2 ,1 , sdte->EIT_present_following_flag);
+ proto_tree_add_uint(service_id_tree, hf_descriptor_loop_length, tvb, tvb_offset + 3 , 2, (dsll = DVB_GET_SDT_DL_LEN( sdte )));
+ proto_tree_add_uint(service_id_tree, hf_reserved_future_use1, tvb, tvb_offset+ 2, 1, sdte->reserved_future_use );
+
+ descr_off +=5;
+ tvb_offset +=5;
+ ti = proto_tree_add_item(service_id_tree, hf_Descriptors, tvb, tvb_offset, 0, TRUE);
+ descr_tree = proto_item_add_subtree(ti, ett_table_print);
+ dvb_descr_print(descr_off, dsll, descr_tree, tvb, tvb_offset);
+ descr_off += dsll;
+ tvb_offset+= dsll;
+ }
+
+ return;
+}
+
+
+
+
+void dvb_mpe3e_print( guint8 *mpe3ebuf,proto_tree *tree, tvbuff_t *tvb )
+{
+ dvb_sect_mpe3e_t *mpe3e = NULL;
+ gushort sec_len = 0, pkt_off = 0;
+ guchar *pkt = NULL;
+ guchar MAC_full[6];
+
+ guint16 slen = tvb_length(tvb) -16; /* section length - Section header MPE header - CRC32 */
+ if (! mpe3ebuf)
+ return;
+
+ sec_len = DVB_GET_SECTION_LENGTH( (dvb_sect_gen_t *)mpe3ebuf );
+
+ mpe3e = (dvb_sect_mpe3e_t *)mpe3ebuf;
+
+ /*PUT the MAC address into one array needed by the the proto_tree_add_ether() function */
+ MAC_full[0] = mpe3e->MAC_lo[3];
+ MAC_full[1] = mpe3e->MAC_lo[2];
+ MAC_full[2] = mpe3e->MAC_lo[1];
+ MAC_full[3] = mpe3e->MAC_lo[0];
+ MAC_full[4] = mpe3e->MAC_hi[1];
+ MAC_full[5] = mpe3e->MAC_hi[0];
+ tvb_offset -= 3; /* Correct the offset because MPE has a special structure */
+ proto_tree_add_uint(tree, hf_reserved1, tvb, tvb_offset, 1, mpe3e->reserved1);
+ proto_tree_add_uint(tree, hf_payload_scrambling_control, tvb, tvb_offset, 1, mpe3e->payload_scrambling_control );
+ proto_tree_add_uint(tree, hf_address_scrambling_control, tvb, tvb_offset, 1, mpe3e->address_scrambling_control );
+ proto_tree_add_uint(tree, hf_LLC_SNAP_flag, tvb, tvb_offset, 1, mpe3e->LLC_SNAP_flag);
+ proto_tree_add_ether(tree, hf_MAC_address, tvb, tvb_offset+3,4, MAC_full);
+
+
+ pkt_off = sizeof(dvb_sect_mpe3e_t);
+ pkt = mpe3ebuf + pkt_off;
+
+ // Print the network packet.
+ //
+ if (mpe3e->LLC_SNAP_flag) {
+ // Print LLC/SNAP encapsulated packet.
+ proto_tree_add_item(tree, hf_LLC_SNAP, tvb, 0, 0, TRUE);
+ next_tvb = tvb_new_subset(tvb, 12, slen, slen);
+ call_dissector(llc_handle, next_tvb, pinfo_mem, tree); /* Call llc dissector*/
+ } else {
+ // Plain IP in MPE3E.
+ next_tvb = tvb_new_subset(tvb, 12, slen, slen);
+ call_dissector(ip_handle, next_tvb, pinfo_mem, tree); /* Call IP dissector for IP analysation */
+ }
+
+ return;
+}
+
+
+void dvb_descr_print_tbl( dvb_descr_print_t *tbl, guint8 *descrbuf, gint maxlen, proto_tree *tree, tvbuff_t *tvb, guint16 offset)
+{
+ dvb_descr_gen_t *desc = NULL;
+ gint descr_len = 0, descr_pr_tbl_offset = 0;
+ proto_tree *descr_sub_tree = NULL;
+ //proto_item *ti = NULL;
+ table_init();
+ /*(gchar *)(*tag2str)( guchar ) = tbl == descriptor_printer ? dvb_descr_tag_str : dvb_descr_mhp_str;*/
+
+
+ if (!descrbuf)
+ return;
+
+ descr_pr_tbl_offset = offset;
+ while (descr_len < maxlen) {
+ guint8 dtag = 0, dlen = 0;
+
+ desc = (dvb_descr_gen_t *)descrbuf;
+ dtag = desc->descriptor_tag;
+ dlen = desc->descriptor_length;
+ ti = proto_tree_add_uint(tree, hf_descriptor_tag, tvb, descr_pr_tbl_offset, (desc->descriptor_length+2), dtag);
+ proto_item_append_text(ti, ": %s -> length (%d)", dvb_descr_tag_str( dtag ), dlen);
+ descr_sub_tree = proto_item_add_subtree(ti, ett_table_print);
+
+
+ if(tbl[dtag])
+ tbl[dtag](descrbuf, descr_sub_tree, tvb, descr_pr_tbl_offset);
+ descrbuf += (dlen + 2);
+ descr_len += (dlen + 2);
+ descr_pr_tbl_offset += dlen+2;
+ }
+}
diff -ruN ethereal-0.10.7/mpeg2_psi.h ethereal-0.10.7_mpeg2_recent/mpeg2_psi.h
--- ethereal-0.10.7/mpeg2_psi.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/mpeg2_psi.h 2004-12-02 16:14:19.823661495 +0100
@@ -0,0 +1,93 @@
+/* mpeg2_psi.h
+ * Routines supporting MPEG2 Transport Stream ansalyzation
+ *
+ * Copyright 2004, Dipl.-Ing. Wolfram STERING wolfi@xxxxxxxxxxxxxx
+ * Lutz FINDEISEN lfindeis@xxxxxxxxxxxxxx
+ *
+ * Project partially sponsored by ESA projectnr.: JR/UOS/17471/03/NL/ND
+ * "Standardisation Support of enhanced IEFTF IP Encapsulation Tecniques"
+ *
+ * $Id: $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+/**
+ * @file
+ */
+#ifndef __MPEG2_PSI_H__
+#define __MPEG2_PSI_H__
+#include "dvb_incs/sect_pat.h"
+typedef void (*dvb_descr_print_t)( guint8 *descbuf, proto_tree *tree, tvbuff_t *tvb, guint16 offset );
+void dvb_pat_prog_print( dvb_sect_pat_program_t *prog, proto_tree *tree, tvbuff_t *tvb, gint nr);
+
+/* Descriptor Printers. */
+void dvb_descr_print_tbl( dvb_descr_print_t *dt, guint8 *descrbuf, gint maxlen, proto_tree *tree, tvbuff_t *tvb, guint16 offset);
+#define dvb_descr_print(f,b,l,i,h) dvb_descr_print_tbl( descriptor_printer, (f), (b), (l), (i), (h))
+#define dvb_descr_mhp_print(f,b,l,i,h) dvb_descr_print_tbl( mhp_descr_printer, (f), (b), (l), (i), (h))
+
+/**
+ * Program association table print for human readable output in the middle pane of Ethereal
+ *
+ * @param patbuf pointer to the raw data
+ * @param tree protocol tree to construct the tree in the middle pane
+ * @param tvb testy virtualizable buffer
+ */
+extern
+void dvb_pat_print( guint8 *patbuf, proto_tree *tree, tvbuff_t *tvb);
+
+/**
+ * Program map table print for human readable output in the middle pane of Ethereal
+ *
+ * @param patbuf pointer to the raw data
+ * @param tree protocol tree to construct the tree in the middle pane
+ * @param tvb testy virtualizable buffer
+ */
+extern
+void dvb_pmt_print( guint8 *pmtbuf, proto_tree *tree, tvbuff_t *tvb );
+
+/**
+ * Network information table print for human readable output in the middle pane of Ethereal
+ *
+ * @param patbuf pointer to the raw data
+ * @param tree protocol tree to construct the tree in the middle pane
+ * @param tvb testy virtualizable buffer
+ */
+extern
+void dvb_nit_print( guint8 *nitbuf, proto_tree *tree, tvbuff_t *tvb );
+
+/**
+ * Service description table print for human readable output in the middle pane of Ethereal
+ *
+ * @param patbuf pointer to the raw data
+ * @param tree protocol tree to construct the tree in the middle pane
+ * @param tvb testy virtualizable buffer
+ */
+extern
+void dvb_sdt_print( guint8 *sdtbuf, proto_tree *tree, tvbuff_t *tvb );
+
+/**
+ * Multioprotocol encapsulation table print for human readable output in the middle pane of Ethereal
+ *
+ * @param patbuf pointer to the raw data
+ * @param tree protocol tree to construct the tree in the middle pane
+ * @param tvb testy virtualizable buffer
+ */
+extern
+void dvb_mpe3e_print( guint8 *mpe3ebuf,proto_tree *tree, tvbuff_t *tvb );
+#endif
diff -ruN ethereal-0.10.7/wiretap/dvbtsdump.c ethereal-0.10.7_mpeg2_recent/wiretap/dvbtsdump.c
--- ethereal-0.10.7/wiretap/dvbtsdump.c 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/wiretap/dvbtsdump.c 2004-12-02 16:14:19.869654574 +0100
@@ -0,0 +1,182 @@
+/* dvbtsdump.c
+ *
+ * Copyright (c) 2003 by Lutz Findeisen <lfindeis@xxxxxxxxxxxxxx>
+ *
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include "wtap-int.h"
+#include "file_wrappers.h"
+#include "buffer.h"
+#include "dvbtsdump.h"
+
+
+/* The structure of the 4 byte large DVB Ts header used to indicate a TS-Stream Dump*/
+struct dvb_ts_hdr {
+ guint8 sync_byte; // 0x47
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 PID_hi :5;
+ guint8 transport_priority :1;
+ guint8 payload_unit_start_indicator :1;
+ guint8 transport_error_indicator :1;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 transport_error_indicator :1;
+ guint8 payload_unit_start_indicator :1;
+ guint8 transport_priority :1;
+ guint8 PID_hi :5;
+#else
+#error "Please specify the byte order!"
+#endif
+
+ guint8 PID_lo;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ guint8 continuity_counter :4;
+ guint8 adaptation_field_control :2;
+ guint8 transport_scrambling_control :2;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ guint8 transport_scrambling_control :2;
+ guint8 adaptation_field_control :2;
+ guint8 continuity_counter :4;
+#else
+#error "Please specify the byte order!"
+#endif
+};
+
+#define DUMP_HDR_SIZE (sizeof(struct dvb_ts_hdr))
+
+
+static gboolean dvbtsdump_read(wtap *wth, int *err, gchar **err_info,long *data_offset)
+{
+
+ guint8 *buf;
+ int bytes_read;
+ unsigned int packet_size;
+
+
+ *data_offset = wth->data_offset;
+
+ packet_size=188; /* 188 bytes fixed Packet size */
+
+ if (packet_size > WTAP_MAX_PACKET_SIZE)
+ {
+ /*
+ * Probably a corrupt capture file; don't blow up trying
+ * to allocate space for an immensely-large packet.
+ */
+ g_message("dvbdump: File has %u-byte packet, bigger than maximum of %u",
+ packet_size, WTAP_MAX_PACKET_SIZE);
+ *err = WTAP_ERR_BAD_RECORD;
+ return FALSE;
+ }
+
+ buffer_assure_space(wth->frame_buffer, packet_size);
+ buf = buffer_start_ptr(wth->frame_buffer);
+ bytes_read = file_read(buf, 1, packet_size, wth->fh);
+
+ if ((bytes_read) != packet_size)
+ {
+ *err = file_error(wth->fh);
+ return FALSE;
+ }
+ wth->data_offset += packet_size;
+ wth->phdr.ts.tv_sec = 0;
+ wth->phdr.ts.tv_usec = 0;
+ wth->phdr.caplen = packet_size;
+ wth->phdr.len = packet_size;
+ wth->phdr.pkt_encap = wth->file_type;
+ return TRUE;
+}
+
+
+
+
+
+static gboolean dvbtsdump_seek_read(wtap *wth, long seek_off,
+ union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
+ int *err, gchar **err_info _U_)
+{
+
+ int bytes_read;
+
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
+ return FALSE;
+
+ bytes_read = file_read(pd, 1, length, wth->random_fh);
+ if (bytes_read != length) {
+ *err = file_error(wth->random_fh);
+ if (*err == 0)
+ *err = WTAP_ERR_SHORT_READ;
+ return FALSE;
+ }
+
+
+
+ return TRUE;
+}
+
+/* For the detection of a DVB Transport Stream the sync_bytes of the first 3 TS * Packets are used
+ */
+
+
+int dvbtsdump_open(wtap *wth, int *err, gchar **err_info _U_)
+{
+ struct dvb_ts_hdr dh1, dh2, dh3;
+ int bytes_read;
+
+ bytes_read = file_read(&dh1, 1, DUMP_HDR_SIZE, wth->fh);
+ if (bytes_read != DUMP_HDR_SIZE)
+ {
+ *err = file_error(wth->fh);
+ return (*err != 0) ? -1 : 0;
+ }
+ if(file_seek(wth->fh, 188, SEEK_SET, err) == -1)
+ return -1;
+ bytes_read = file_read(&dh2, 1, DUMP_HDR_SIZE, wth->fh);
+ if (bytes_read != DUMP_HDR_SIZE)
+ {
+ *err = file_error(wth->fh);
+ return (*err != 0) ? -1 : 0;
+ }
+ if(file_seek(wth->fh, 184, SEEK_CUR, err) == -1)
+ return -1;
+ bytes_read = file_read(&dh3, 1, DUMP_HDR_SIZE, wth->fh);
+ if (bytes_read != DUMP_HDR_SIZE)
+ {
+ *err = file_error(wth->fh);
+ return (*err != 0) ? -1 : 0;
+ }
+ if(file_seek(wth->fh, 0, SEEK_SET, err) == -1)
+ return -1;
+ if((dh1.sync_byte == 0x47) && (dh2.sync_byte == 0x47) && (dh3.sync_byte == 0x47))
+ {
+
+ wth->file_type = WTAP_FILE_MPEG2;
+ wth->file_encap = WTAP_ENCAP_MPEG2;
+ wth->snapshot_length = 0;
+ wth->subtype_read = dvbtsdump_read;
+ wth->subtype_seek_read = dvbtsdump_seek_read;
+ return 1;
+ }
+ else
+ return 0;
+
+}
diff -ruN ethereal-0.10.7/wiretap/dvbtsdump.h ethereal-0.10.7_mpeg2_recent/wiretap/dvbtsdump.h
--- ethereal-0.10.7/wiretap/dvbtsdump.h 1970-01-01 01:00:00.000000000 +0100
+++ ethereal-0.10.7_mpeg2_recent/wiretap/dvbtsdump.h 2004-12-02 16:14:19.870654424 +0100
@@ -0,0 +1,28 @@
+/* hcidump.h
+ *
+ * $Id:dvbtsdump.h 2004/09/01 $
+ *
+ * Copyright (c) 2004 by Lutz Findeisen <lfindeis@xxxxxxxxxxxxxx>
+ *
+ * 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; either 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef __DVBTSDUMP_H__
+#define __DVBTSDUMP_H__
+
+int dvbtsdump_open(wtap *wth, int *err, gchar **err_info _U_);
+
+#endif
diff -ruN ethereal-0.10.7/wiretap/file_access.c ethereal-0.10.7_mpeg2_recent/wiretap/file_access.c
--- ethereal-0.10.7/wiretap/file_access.c 2004-10-21 00:35:05.000000000 +0200
+++ ethereal-0.10.7_mpeg2_recent/wiretap/file_access.c 2004-12-02 16:14:19.927645848 +0100
@@ -1,6 +1,6 @@
/* file_access.c
*
- * $Id: file_access.c 12258 2004-10-11 07:18:20Z guy $
+ * $Id: file_access.c 11400 2004-07-18 00:24:25Z guy $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xxxxxxxxxxxxxxx>
@@ -74,6 +74,7 @@
#include "erf.h"
#include "hcidump.h"
#include "network_instruments.h"
+#include "dvbtsdump.h"
/* The open_file_* routines should return:
*
@@ -117,6 +118,7 @@
* to some box.
*/
etherpeek_open,
+ dvbtsdump_open,
pppdump_open,
ascend_open,
eyesdn_open,
@@ -394,8 +396,8 @@
NULL, NULL },
/* WTAP_FILE_NETTL */
- { "HP-UX nettl trace", "nettl",
- nettl_dump_can_write_encap, nettl_dump_open },
+ { "HP-UX nettl trace", NULL,
+ NULL, NULL },
/* WTAP_FILE_TOSHIBA */
{ "Toshiba Compact ISDN Router snoop trace", NULL,
@@ -460,6 +462,10 @@
/* WTAP_FILE_EYESDN */
{ "EyeSDN USB S0/E1 ISDN trace format", NULL,
NULL, NULL },
+ /*WTAP_FILE_MPEG2 */
+ { "MPEG2 Transport stream", "MPEG2", NULL,
+ NULL, NULL },
+
};
/* Name that should be somewhat descriptive. */
diff -ruN ethereal-0.10.7/wiretap/Makefile.common ethereal-0.10.7_mpeg2_recent/wiretap/Makefile.common
--- ethereal-0.10.7/wiretap/Makefile.common 2004-10-21 00:35:06.000000000 +0200
+++ ethereal-0.10.7_mpeg2_recent/wiretap/Makefile.common 2004-12-02 16:14:19.929645547 +0100
@@ -58,7 +58,8 @@
toshiba.c \
visual.c \
vms.c \
- wtap.c
+ wtap.c \
+ dvbtsdump.c
# Header files that are not generated from other files
NONGENERATED_HEADER_FILES = \
@@ -94,7 +95,8 @@
vms.h \
wtap.h \
wtap-capture.h \
- wtap-int.h
+ wtap-int.h \
+ dvbtsdump.h
# Files that generate compileable files
GENERATOR_SOURCES = \
diff -ruN ethereal-0.10.7/wiretap/wtap.c ethereal-0.10.7_mpeg2_recent/wiretap/wtap.c
--- ethereal-0.10.7/wiretap/wtap.c 2004-10-21 00:35:06.000000000 +0200
+++ ethereal-0.10.7_mpeg2_recent/wiretap/wtap.c 2004-12-02 16:14:19.969639530 +0100
@@ -257,6 +257,9 @@
/* WTAP_ENCAP_RAW_ICMPV6 */
{ "Raw ICMPv6", "raw-icmpv6" },
+
+ /*WTAP_ENCAP_MPEG2*/
+ { "MPEG2 Transport streams", "MPEG2"},
};
/* Name that should be somewhat descriptive. */
diff -ruN ethereal-0.10.7/wiretap/wtap.h ethereal-0.10.7_mpeg2_recent/wiretap/wtap.h
--- ethereal-0.10.7/wiretap/wtap.h 2004-10-21 00:35:06.000000000 +0200
+++ ethereal-0.10.7_mpeg2_recent/wiretap/wtap.h 2004-12-02 16:14:19.971639229 +0100
@@ -155,9 +155,10 @@
#define WTAP_ENCAP_BACNET_MS_TP 63
#define WTAP_ENCAP_RAW_ICMP 64
#define WTAP_ENCAP_RAW_ICMPV6 65
+#define WTAP_ENCAP_MPEG2 66
/* last WTAP_ENCAP_ value + 1 */
-#define WTAP_NUM_ENCAP_TYPES 66
+#define WTAP_NUM_ENCAP_TYPES 67
/* File types that can be read by wiretap.
We support writing some many of these file types, too, so we
@@ -202,9 +203,10 @@
#define WTAP_FILE_NETWORK_INSTRUMENTS_V9 37
#define WTAP_FILE_AIROPEEK_V9 38
#define WTAP_FILE_EYESDN 39
+#define WTAP_FILE_MPEG2 40
/* last WTAP_FILE_ value + 1 */
-#define WTAP_NUM_FILE_TYPES 40
+#define WTAP_NUM_FILE_TYPES 41
/*
* Maximum packet size we'll support.
Powered by MHonArc 2.6.10