Change "4 space tabs" indentation to use "4 spaces" indentation.

Also:
- remove some unneeded initializers;
- remove several unneeded 'col_clear()' calls;
- guint8 --> guint to prevent a possible overflow;
- reformat for style in some cases.


svn path=/trunk/; revision=48297
This commit is contained in:
Bill Meier 2013-03-14 14:42:12 +00:00
parent 8dfa2eac7e
commit 77376a2363
13 changed files with 5163 additions and 5159 deletions

View File

@ -55,120 +55,119 @@ static gint ett_dvb_bat = -1;
static gint ett_dvb_bat_transport_stream = -1;
#define DVB_BAT_TID 0x4A
#define DVB_BAT_TID 0x4A
#define DVB_BAT_RESERVED1_MASK 0xC0
#define DVB_BAT_VERSION_NUMBER_MASK 0x3E
#define DVB_BAT_CURRENT_NEXT_INDICATOR_MASK 0x01
#define DVB_BAT_RESERVED1_MASK 0xC0
#define DVB_BAT_VERSION_NUMBER_MASK 0x3E
#define DVB_BAT_CURRENT_NEXT_INDICATOR_MASK 0x01
#define DVB_BAT_RESERVED2_MASK 0xF000
#define DVB_BAT_BOUQUET_DESCRIPTORS_LENGTH_MASK 0x0FFF
#define DVB_BAT_RESERVED2_MASK 0xF000
#define DVB_BAT_BOUQUET_DESCRIPTORS_LENGTH_MASK 0x0FFF
#define DVB_BAT_RESERVED3_MASK 0xF000
#define DVB_BAT_TRANSPORT_STREAM_LOOP_LENGTH_MASK 0x0FFF
#define DVB_BAT_RESERVED3_MASK 0xF000
#define DVB_BAT_TRANSPORT_STREAM_LOOP_LENGTH_MASK 0x0FFF
#define DVB_BAT_RESERVED4_MASK 0xF000
#define DVB_BAT_TRANSPORT_DESCRIPTORS_LENGTH_MASK 0x0FFF
#define DVB_BAT_RESERVED4_MASK 0xF000
#define DVB_BAT_TRANSPORT_DESCRIPTORS_LENGTH_MASK 0x0FFF
static const value_string dvb_bat_cur_next_vals[] = {
{ 0, "Not yet applicable" },
{ 1, "Currently applicable" },
{ 0, "Not yet applicable" },
{ 1, "Currently applicable" },
{ 0, NULL }
{ 0, NULL }
};
static const value_string dvb_bat_running_status_vals[] = {
{ 0, "Undefined" },
{ 1, "Not Running" },
{ 2, "Starts in a few seconds" },
{ 3, "Pausing" },
{ 4, "Running" },
{ 5, "Service off-air" },
{ 0, "Undefined" },
{ 1, "Not Running" },
{ 2, "Starts in a few seconds" },
{ 3, "Pausing" },
{ 4, "Running" },
{ 5, "Service off-air" },
{ 0, NULL }
{ 0, NULL }
};
static const value_string dvb_bat_free_ca_mode_vals[] = {
{ 0, "Not Scrambled" },
{ 1, "One or more component scrambled" },
{ 0, "Not Scrambled" },
{ 1, "One or more component scrambled" },
{ 0, NULL }
{ 0, NULL }
};
static void
dissect_dvb_bat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint offset = 0, length = 0, descriptor_end = 0, ts_loop_end = 0;
guint16 ts_id = 0, descriptor_len = 0, ts_loop_len = 0;
guint offset = 0, length = 0, descriptor_end, ts_loop_end;
guint16 ts_id, descriptor_len, ts_loop_len;
proto_item *ti;
proto_tree *dvb_bat_tree;
proto_item *tsi;
proto_tree *transport_stream_tree;
proto_item *ti;
proto_tree *dvb_bat_tree;
proto_item *tsi;
proto_tree *transport_stream_tree;
col_clear(pinfo->cinfo, COL_INFO);
col_set_str(pinfo->cinfo, COL_INFO, "Bouquet Association Table (BAT)");
col_set_str(pinfo->cinfo, COL_INFO, "Bouquet Association Table (BAT)");
ti = proto_tree_add_item(tree, proto_dvb_bat, tvb, offset, -1, ENC_NA);
dvb_bat_tree = proto_item_add_subtree(ti, ett_dvb_bat);
ti = proto_tree_add_item(tree, proto_dvb_bat, tvb, offset, -1, ENC_NA);
dvb_bat_tree = proto_item_add_subtree(ti, ett_dvb_bat);
offset += packet_mpeg_sect_header(tvb, offset, dvb_bat_tree, &length, NULL);
length -= 4;
offset += packet_mpeg_sect_header(tvb, offset, dvb_bat_tree, &length, NULL);
length -= 4;
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_bouquet_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_bouquet_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_version_number, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_current_next_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_version_number, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_current_next_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
descriptor_len = tvb_get_ntohs(tvb, offset) & DVB_BAT_BOUQUET_DESCRIPTORS_LENGTH_MASK;
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_reserved2, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_bouquet_descriptors_length, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
descriptor_len = tvb_get_ntohs(tvb, offset) & DVB_BAT_BOUQUET_DESCRIPTORS_LENGTH_MASK;
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_reserved2, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_bouquet_descriptors_length, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
descriptor_end = offset + descriptor_len;
while (offset < descriptor_end)
offset += proto_mpeg_descriptor_dissect(tvb, offset, dvb_bat_tree);
descriptor_end = offset + descriptor_len;
while (offset < descriptor_end)
offset += proto_mpeg_descriptor_dissect(tvb, offset, dvb_bat_tree);
ts_loop_len = tvb_get_ntohs(tvb, offset) & DVB_BAT_TRANSPORT_STREAM_LOOP_LENGTH_MASK;
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_reserved3, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_transport_stream_loop_length, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
ts_loop_len = tvb_get_ntohs(tvb, offset) & DVB_BAT_TRANSPORT_STREAM_LOOP_LENGTH_MASK;
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_reserved3, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_bat_tree, hf_dvb_bat_transport_stream_loop_length, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
ts_loop_end = offset + ts_loop_len;
while (offset < ts_loop_end) {
ts_id = tvb_get_ntohs(tvb, offset);
descriptor_len = tvb_get_ntohs(tvb, offset + 4) & DVB_BAT_TRANSPORT_DESCRIPTORS_LENGTH_MASK;
ts_loop_end = offset + ts_loop_len;
while (offset < ts_loop_end) {
ts_id = tvb_get_ntohs(tvb, offset);
descriptor_len = tvb_get_ntohs(tvb, offset + 4) & DVB_BAT_TRANSPORT_DESCRIPTORS_LENGTH_MASK;
tsi = proto_tree_add_text(dvb_bat_tree, tvb, offset, 6 + descriptor_len, "Transport Stream 0x%04x", ts_id);
transport_stream_tree = proto_item_add_subtree(tsi, ett_dvb_bat_transport_stream);
tsi = proto_tree_add_text(dvb_bat_tree, tvb, offset, 6 + descriptor_len, "Transport Stream 0x%04x", ts_id);
transport_stream_tree = proto_item_add_subtree(tsi, ett_dvb_bat_transport_stream);
proto_tree_add_item(transport_stream_tree, hf_dvb_bat_transport_stream_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(transport_stream_tree, hf_dvb_bat_transport_stream_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(transport_stream_tree, hf_dvb_bat_original_network_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(transport_stream_tree, hf_dvb_bat_original_network_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(transport_stream_tree, hf_dvb_bat_reserved4, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(transport_stream_tree, hf_dvb_bat_transport_descriptors_length, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(transport_stream_tree, hf_dvb_bat_reserved4, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(transport_stream_tree, hf_dvb_bat_transport_descriptors_length, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
descriptor_end = offset + descriptor_len;
while (offset < descriptor_end)
offset += proto_mpeg_descriptor_dissect(tvb, offset, transport_stream_tree);
}
descriptor_end = offset + descriptor_len;
while (offset < descriptor_end)
offset += proto_mpeg_descriptor_dissect(tvb, offset, transport_stream_tree);
}
offset += packet_mpeg_sect_crc(tvb, pinfo, dvb_bat_tree, 0, offset);
proto_item_set_len(ti, offset);
offset += packet_mpeg_sect_crc(tvb, pinfo, dvb_bat_tree, 0, offset);
proto_item_set_len(ti, offset);
}
@ -176,100 +175,100 @@ void
proto_register_dvb_bat(void)
{
static hf_register_info hf[] = {
static hf_register_info hf[] = {
{ &hf_dvb_bat_bouquet_id, {
"Service ID", "dvb_bat.sid",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_bat_bouquet_id, {
"Service ID", "dvb_bat.sid",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_bat_reserved1, {
"Reserved", "dvb_bat.reserved1",
FT_UINT8, BASE_HEX, NULL, DVB_BAT_RESERVED1_MASK, NULL, HFILL
} },
{ &hf_dvb_bat_reserved1, {
"Reserved", "dvb_bat.reserved1",
FT_UINT8, BASE_HEX, NULL, DVB_BAT_RESERVED1_MASK, NULL, HFILL
} },
{ &hf_dvb_bat_version_number, {
"Version Number", "dvb_bat.version",
FT_UINT8, BASE_HEX, NULL, DVB_BAT_VERSION_NUMBER_MASK, NULL, HFILL
} },
{ &hf_dvb_bat_version_number, {
"Version Number", "dvb_bat.version",
FT_UINT8, BASE_HEX, NULL, DVB_BAT_VERSION_NUMBER_MASK, NULL, HFILL
} },
{ &hf_dvb_bat_current_next_indicator, {
"Current/Next Indicator", "dvb_bat.cur_next_ind",
FT_UINT8, BASE_DEC, VALS(dvb_bat_cur_next_vals), DVB_BAT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_dvb_bat_current_next_indicator, {
"Current/Next Indicator", "dvb_bat.cur_next_ind",
FT_UINT8, BASE_DEC, VALS(dvb_bat_cur_next_vals), DVB_BAT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_dvb_bat_section_number, {
"Section Number", "dvb_bat.sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_bat_section_number, {
"Section Number", "dvb_bat.sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_bat_last_section_number, {
"Last Section Number", "dvb_bat.last_sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_bat_last_section_number, {
"Last Section Number", "dvb_bat.last_sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_bat_reserved2, {
"Reserved", "dvb_bat.reserved2",
FT_UINT16, BASE_HEX, NULL, DVB_BAT_RESERVED2_MASK, NULL, HFILL
} },
{ &hf_dvb_bat_reserved2, {
"Reserved", "dvb_bat.reserved2",
FT_UINT16, BASE_HEX, NULL, DVB_BAT_RESERVED2_MASK, NULL, HFILL
} },
{ &hf_dvb_bat_bouquet_descriptors_length, {
"Bouquet Descriptors Length", "dvb_bat.bouquet_desc_len",
FT_UINT16, BASE_DEC, NULL, DVB_BAT_BOUQUET_DESCRIPTORS_LENGTH_MASK, NULL, HFILL
} },
{ &hf_dvb_bat_bouquet_descriptors_length, {
"Bouquet Descriptors Length", "dvb_bat.bouquet_desc_len",
FT_UINT16, BASE_DEC, NULL, DVB_BAT_BOUQUET_DESCRIPTORS_LENGTH_MASK, NULL, HFILL
} },
{ &hf_dvb_bat_reserved3, {
"Reserved", "dvb_bat.reserved3",
FT_UINT16, BASE_HEX, NULL, DVB_BAT_RESERVED3_MASK, NULL, HFILL
} },
{ &hf_dvb_bat_reserved3, {
"Reserved", "dvb_bat.reserved3",
FT_UINT16, BASE_HEX, NULL, DVB_BAT_RESERVED3_MASK, NULL, HFILL
} },
{ &hf_dvb_bat_transport_stream_loop_length, {
"Transport Stream Loop Length", "dvb_bat.ts_loop_len",
FT_UINT16, BASE_DEC, NULL, DVB_BAT_TRANSPORT_STREAM_LOOP_LENGTH_MASK, NULL, HFILL
} },
{ &hf_dvb_bat_transport_stream_loop_length, {
"Transport Stream Loop Length", "dvb_bat.ts_loop_len",
FT_UINT16, BASE_DEC, NULL, DVB_BAT_TRANSPORT_STREAM_LOOP_LENGTH_MASK, NULL, HFILL
} },
{ &hf_dvb_bat_transport_stream_id, {
"Transport Stream ID", "dvb_bat.ts.id",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_bat_transport_stream_id, {
"Transport Stream ID", "dvb_bat.ts.id",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_bat_original_network_id, {
"Original Network ID", "dvb_bat.ts.original_nid",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_bat_original_network_id, {
"Original Network ID", "dvb_bat.ts.original_nid",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_bat_reserved4, {
"Reserved", "dvb_bat.ts.reserved",
FT_UINT16, BASE_HEX, NULL, DVB_BAT_RESERVED4_MASK, NULL, HFILL
} },
{ &hf_dvb_bat_reserved4, {
"Reserved", "dvb_bat.ts.reserved",
FT_UINT16, BASE_HEX, NULL, DVB_BAT_RESERVED4_MASK, NULL, HFILL
} },
{ &hf_dvb_bat_transport_descriptors_length, {
"Bouquet Descriptors Length", "dvb_bat.ts.desc_len",
FT_UINT16, BASE_DEC, NULL, DVB_BAT_BOUQUET_DESCRIPTORS_LENGTH_MASK, NULL, HFILL
} },
{ &hf_dvb_bat_transport_descriptors_length, {
"Bouquet Descriptors Length", "dvb_bat.ts.desc_len",
FT_UINT16, BASE_DEC, NULL, DVB_BAT_BOUQUET_DESCRIPTORS_LENGTH_MASK, NULL, HFILL
} },
};
};
static gint *ett[] = {
&ett_dvb_bat,
&ett_dvb_bat_transport_stream
};
static gint *ett[] = {
&ett_dvb_bat,
&ett_dvb_bat_transport_stream
};
proto_dvb_bat = proto_register_protocol("DVB Bouquet Association Table", "DVB BAT", "dvb_bat");
proto_dvb_bat = proto_register_protocol("DVB Bouquet Association Table", "DVB BAT", "dvb_bat");
proto_register_field_array(proto_dvb_bat, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
proto_register_field_array(proto_dvb_bat, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
void proto_reg_handoff_dvb_bat(void)
{
dissector_handle_t dvb_bat_handle;
dissector_handle_t dvb_bat_handle;
dvb_bat_handle = create_dissector_handle(dissect_dvb_bat, proto_dvb_bat);
dvb_bat_handle = create_dissector_handle(dissect_dvb_bat, proto_dvb_bat);
dissector_add_uint("mpeg_sect.tid", DVB_BAT_TID, dvb_bat_handle);
dissector_add_uint("mpeg_sect.tid", DVB_BAT_TID, dvb_bat_handle);
}
/*
@ -277,10 +276,10 @@ void proto_reg_handoff_dvb_bat(void)
*
* Local variables:
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: t
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=4 noexpandtab:
* :indentSize=4:tabSize=4:noTabs=false:
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -45,20 +45,20 @@ static gint ett_dvb_data_mpe = -1;
static dissector_handle_t ip_handle;
static dissector_handle_t llc_handle;
#define DVB_DATA_MPE_TID 0x3E
#define DVB_DATA_MPE_TID 0x3E
#define DVB_DATA_MPE_RESERVED_MASK 0xC0
#define DVB_DATA_MPE_PAYLOAD_SCRAMBLING_MASK 0x30
#define DVB_DATA_MPE_ADDRESS_SCRAMBLING_MASK 0x0C
#define DVB_DATA_MPE_LLC_SNAP_FLAG_MASK 0x02
#define DVB_DATA_MPE_CURRENT_NEXT_INDICATOR_MASK 0x01
#define DVB_DATA_MPE_RESERVED_MASK 0xC0
#define DVB_DATA_MPE_PAYLOAD_SCRAMBLING_MASK 0x30
#define DVB_DATA_MPE_ADDRESS_SCRAMBLING_MASK 0x0C
#define DVB_DATA_MPE_LLC_SNAP_FLAG_MASK 0x02
#define DVB_DATA_MPE_CURRENT_NEXT_INDICATOR_MASK 0x01
static const value_string dvb_rcs_cur_next_vals[] = {
{ 0x0, "Not yet applicable" },
{ 0x1, "Currently applicable" },
{ 0, NULL },
{ 0x0, "Not yet applicable" },
{ 0x1, "Currently applicable" },
{ 0, NULL },
};
@ -67,73 +67,73 @@ static void
dissect_dvb_data_mpe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint offset = 0, tot_len = 0;
guint8 llc_snap_flag = 0;
int i;
guint offset = 0, tot_len = 0;
guint8 llc_snap_flag;
int i;
proto_item *ti = NULL;
proto_tree *dvb_data_mpe_tree = NULL;
tvbuff_t *mac_tvb = NULL;
tvbuff_t *mac_bytes_tvb[6];
tvbuff_t *data_tvb = NULL;
proto_item *ti;
proto_tree *dvb_data_mpe_tree;
tvbuff_t *mac_tvb;
tvbuff_t *mac_bytes_tvb[6];
tvbuff_t *data_tvb;
/* The TVB should start right after the section_length in the Section packet */
/* The TVB should start right after the section_length in the Section packet */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DVB-DATA");
col_set_str(pinfo->cinfo, COL_INFO, "MultiProtocol Encapsulation");
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DVB-DATA");
col_set_str(pinfo->cinfo, COL_INFO, "MultiProtocol Encapsulation");
ti = proto_tree_add_item(tree, proto_dvb_data_mpe, tvb, offset, -1, ENC_NA);
dvb_data_mpe_tree = proto_item_add_subtree(ti, ett_dvb_data_mpe);
ti = proto_tree_add_item(tree, proto_dvb_data_mpe, tvb, offset, -1, ENC_NA);
dvb_data_mpe_tree = proto_item_add_subtree(ti, ett_dvb_data_mpe);
offset += packet_mpeg_sect_header(tvb, offset, dvb_data_mpe_tree, &tot_len, NULL);
offset += packet_mpeg_sect_header(tvb, offset, dvb_data_mpe_tree, &tot_len, NULL);
/* Parse the DMC-CC private section header */
/* Parse the DMC-CC private section header */
mac_bytes_tvb[5] = tvb_new_subset(tvb, offset, 1, 1);
offset++;
mac_bytes_tvb[4] = tvb_new_subset(tvb, offset, 1, 1);
offset++;
mac_bytes_tvb[5] = tvb_new_subset(tvb, offset, 1, 1);
offset += 1;
mac_bytes_tvb[4] = tvb_new_subset(tvb, offset, 1, 1);
offset += 1;
proto_tree_add_item(dvb_data_mpe_tree, hf_dvb_data_mpe_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_data_mpe_tree, hf_dvb_data_mpe_payload_scrambling_control, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_data_mpe_tree, hf_dvb_data_mpe_address_scrambling_control, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_data_mpe_tree, hf_dvb_data_mpe_llc_snap_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_data_mpe_tree, hf_dvb_data_mpe_current_next_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
llc_snap_flag = tvb_get_guint8(tvb, offset) & DVB_DATA_MPE_LLC_SNAP_FLAG_MASK;
offset++;
proto_tree_add_item(dvb_data_mpe_tree, hf_dvb_data_mpe_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_data_mpe_tree, hf_dvb_data_mpe_payload_scrambling_control, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_data_mpe_tree, hf_dvb_data_mpe_address_scrambling_control, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_data_mpe_tree, hf_dvb_data_mpe_llc_snap_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_data_mpe_tree, hf_dvb_data_mpe_current_next_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
llc_snap_flag = tvb_get_guint8(tvb, offset) & DVB_DATA_MPE_LLC_SNAP_FLAG_MASK;
offset += 1;
proto_tree_add_item(dvb_data_mpe_tree, hf_dvb_data_mpe_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(dvb_data_mpe_tree, hf_dvb_data_mpe_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_data_mpe_tree, hf_dvb_data_mpe_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(dvb_data_mpe_tree, hf_dvb_data_mpe_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
for (i = 3; i >= 0; i--) {
mac_bytes_tvb[i] = tvb_new_subset(tvb, offset, 1, 1);
offset++;
}
for (i = 3; i >= 0; i--) {
mac_bytes_tvb[i] = tvb_new_subset(tvb, offset, 1, 1);
offset += 1;
}
mac_tvb = tvb_new_composite();
mac_tvb = tvb_new_composite();
for (i = 0; i < 6; i++)
tvb_composite_append(mac_tvb, mac_bytes_tvb[i]);
for (i = 0; i < 6; i++)
tvb_composite_append(mac_tvb, mac_bytes_tvb[i]);
tvb_composite_finalize(mac_tvb);
tvb_composite_finalize(mac_tvb);
proto_tree_add_item(dvb_data_mpe_tree, hf_dvb_data_mpe_dst_mac, mac_tvb, 0 , 6, ENC_NA);
col_add_str(pinfo->cinfo, COL_RES_DL_DST, tvb_ether_to_str(mac_tvb, 0));
proto_tree_add_item(dvb_data_mpe_tree, hf_dvb_data_mpe_dst_mac, mac_tvb, 0 , 6, ENC_NA);
col_add_str(pinfo->cinfo, COL_RES_DL_DST, tvb_ether_to_str(mac_tvb, 0));
data_tvb = tvb_new_subset_remaining(tvb, offset);
data_tvb = tvb_new_subset_remaining(tvb, offset);
if (llc_snap_flag) {
call_dissector(llc_handle, data_tvb, pinfo, tree);
} else {
call_dissector(ip_handle, data_tvb, pinfo, tree);
}
if (llc_snap_flag) {
call_dissector(llc_handle, data_tvb, pinfo, tree);
} else {
call_dissector(ip_handle, data_tvb, pinfo, tree);
}
packet_mpeg_sect_crc(tvb, pinfo, dvb_data_mpe_tree, 0, tot_len - 1);
return;
packet_mpeg_sect_crc(tvb, pinfo, dvb_data_mpe_tree, 0, tot_len - 1);
return;
}
@ -141,60 +141,60 @@ void
proto_register_dvb_data_mpe(void)
{
static hf_register_info hf[] = {
static hf_register_info hf[] = {
/* DSM-CC common fields */
{ &hf_dvb_data_mpe_reserved, {
"Reserved", "dvb_data_mpe.reserved",
FT_UINT8, BASE_HEX, NULL, DVB_DATA_MPE_RESERVED_MASK, NULL, HFILL
} },
/* DSM-CC common fields */
{ &hf_dvb_data_mpe_reserved, {
"Reserved", "dvb_data_mpe.reserved",
FT_UINT8, BASE_HEX, NULL, DVB_DATA_MPE_RESERVED_MASK, NULL, HFILL
} },
{ &hf_dvb_data_mpe_payload_scrambling_control, {
"Payload Scrambling Control", "dvb_data_mpe.pload_scrambling",
FT_UINT8, BASE_HEX, NULL, DVB_DATA_MPE_PAYLOAD_SCRAMBLING_MASK, NULL, HFILL
} },
{ &hf_dvb_data_mpe_payload_scrambling_control, {
"Payload Scrambling Control", "dvb_data_mpe.pload_scrambling",
FT_UINT8, BASE_HEX, NULL, DVB_DATA_MPE_PAYLOAD_SCRAMBLING_MASK, NULL, HFILL
} },
{ &hf_dvb_data_mpe_address_scrambling_control, {
"Address Scrambling Control", "dvb_data_mpe.addr_scrambling",
FT_UINT8, BASE_HEX, NULL, DVB_DATA_MPE_ADDRESS_SCRAMBLING_MASK, NULL, HFILL
} },
{ &hf_dvb_data_mpe_address_scrambling_control, {
"Address Scrambling Control", "dvb_data_mpe.addr_scrambling",
FT_UINT8, BASE_HEX, NULL, DVB_DATA_MPE_ADDRESS_SCRAMBLING_MASK, NULL, HFILL
} },
{ &hf_dvb_data_mpe_llc_snap_flag, {
"LLC SNAP Flag", "dvb_data_mpe.llc_snap_flag",
FT_UINT8, BASE_HEX, NULL, DVB_DATA_MPE_LLC_SNAP_FLAG_MASK, NULL, HFILL
} },
{ &hf_dvb_data_mpe_llc_snap_flag, {
"LLC SNAP Flag", "dvb_data_mpe.llc_snap_flag",
FT_UINT8, BASE_HEX, NULL, DVB_DATA_MPE_LLC_SNAP_FLAG_MASK, NULL, HFILL
} },
{ &hf_dvb_data_mpe_current_next_indicator, {
"Current/Next Indicator", "mpeg_sect.cur_next_ind",
FT_UINT8, BASE_HEX, VALS(dvb_rcs_cur_next_vals), DVB_DATA_MPE_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_dvb_data_mpe_current_next_indicator, {
"Current/Next Indicator", "mpeg_sect.cur_next_ind",
FT_UINT8, BASE_HEX, VALS(dvb_rcs_cur_next_vals), DVB_DATA_MPE_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_dvb_data_mpe_section_number, {
"Section Number", "dvb_data_mpe.sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_data_mpe_section_number, {
"Section Number", "dvb_data_mpe.sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_data_mpe_last_section_number, {
"Last Section Number", "dvb_data_mpe.last_sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_data_mpe_last_section_number, {
"Last Section Number", "dvb_data_mpe.last_sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_data_mpe_dst_mac, {
"Destination MAC address", "dvb_data_mpe.dst_mac",
FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_data_mpe_dst_mac, {
"Destination MAC address", "dvb_data_mpe.dst_mac",
FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
} },
};
};
static gint *ett[] = {
&ett_dvb_data_mpe,
};
static gint *ett[] = {
&ett_dvb_data_mpe,
};
proto_dvb_data_mpe = proto_register_protocol("DVB-DATA MultiProtocol Encapsulation", "DVB-DATA MPE", "dvb_data_mpe");
proto_register_field_array(proto_dvb_data_mpe, hf, array_length(hf));
proto_dvb_data_mpe = proto_register_protocol("DVB-DATA MultiProtocol Encapsulation", "DVB-DATA MPE", "dvb_data_mpe");
proto_register_field_array(proto_dvb_data_mpe, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
proto_register_subtree_array(ett, array_length(ett));
}
@ -203,13 +203,13 @@ void
proto_reg_handoff_dvb_data_mpe(void)
{
dissector_handle_t dvb_data_mpe_handle;
dissector_handle_t dvb_data_mpe_handle;
dvb_data_mpe_handle = create_dissector_handle(dissect_dvb_data_mpe, proto_dvb_data_mpe);
dissector_add_uint("mpeg_sect.tid", DVB_DATA_MPE_TID, dvb_data_mpe_handle);
dvb_data_mpe_handle = create_dissector_handle(dissect_dvb_data_mpe, proto_dvb_data_mpe);
dissector_add_uint("mpeg_sect.tid", DVB_DATA_MPE_TID, dvb_data_mpe_handle);
ip_handle = find_dissector("ip");
llc_handle = find_dissector("llc");
ip_handle = find_dissector("ip");
llc_handle = find_dissector("llc");
}
@ -218,10 +218,10 @@ proto_reg_handoff_dvb_data_mpe(void)
*
* Local variables:
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: t
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=4 noexpandtab:
* :indentSize=4:tabSize=4:noTabs=false:
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -56,142 +56,142 @@ static gint ett_dvb_eit = -1;
static gint ett_dvb_eit_event = -1;
#define DVB_EIT_TID_MIN 0x4E
#define DVB_EIT_TID_MAX 0x6F
#define DVB_EIT_TID_MIN 0x4E
#define DVB_EIT_TID_MAX 0x6F
#define DVB_EIT_RESERVED_MASK 0xC0
#define DVB_EIT_VERSION_NUMBER_MASK 0x3E
#define DVB_EIT_CURRENT_NEXT_INDICATOR_MASK 0x01
#define DVB_EIT_RESERVED_MASK 0xC0
#define DVB_EIT_VERSION_NUMBER_MASK 0x3E
#define DVB_EIT_CURRENT_NEXT_INDICATOR_MASK 0x01
#define DVB_EIT_RUNNING_STATUS_MASK 0xE000
#define DVB_EIT_FREE_CA_MODE_MASK 0x1000
#define DVB_EIT_DESCRIPTORS_LOOP_LENGTH_MASK 0x0FFF
#define DVB_EIT_RUNNING_STATUS_MASK 0xE000
#define DVB_EIT_FREE_CA_MODE_MASK 0x1000
#define DVB_EIT_DESCRIPTORS_LOOP_LENGTH_MASK 0x0FFF
static const value_string dvb_eit_cur_next_vals[] = {
{ 0, "Not yet applicable" },
{ 1, "Currently applicable" },
{ 0, "Not yet applicable" },
{ 1, "Currently applicable" },
{ 0, NULL }
{ 0, NULL }
};
static const value_string dvb_eit_running_status_vals[] = {
{ 0, "Undefined" },
{ 1, "Not Running" },
{ 2, "Starts in a few seconds" },
{ 3, "Pausing" },
{ 4, "Running" },
{ 5, "Service off-air" },
{ 0, "Undefined" },
{ 1, "Not Running" },
{ 2, "Starts in a few seconds" },
{ 3, "Pausing" },
{ 4, "Running" },
{ 5, "Service off-air" },
{ 0, NULL }
{ 0, NULL }
};
static const value_string dvb_eit_free_ca_mode_vals[] = {
{ 0, "Not Scrambled" },
{ 1, "One or more component scrambled" },
{ 0, "Not Scrambled" },
{ 1, "One or more component scrambled" },
{ 0, NULL }
{ 0, NULL }
};
static void
dissect_dvb_eit(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint offset = 0, length = 0;
guint descriptor_len, descriptor_end;
guint16 evt_id;
guint offset = 0, length = 0;
guint descriptor_len, descriptor_end;
guint16 evt_id;
proto_item *ti;
proto_tree *dvb_eit_tree;
proto_item *ei;
proto_tree *dvb_eit_event_tree;
proto_item *duration_item;
proto_item *ti;
proto_tree *dvb_eit_tree;
proto_item *ei;
proto_tree *dvb_eit_event_tree;
proto_item *duration_item;
nstime_t start_time;
nstime_t start_time;
col_set_str(pinfo->cinfo, COL_INFO, "Event Information Table (EIT)");
col_set_str(pinfo->cinfo, COL_INFO, "Event Information Table (EIT)");
ti = proto_tree_add_item(tree, proto_dvb_eit, tvb, offset, -1, ENC_NA);
dvb_eit_tree = proto_item_add_subtree(ti, ett_dvb_eit);
ti = proto_tree_add_item(tree, proto_dvb_eit, tvb, offset, -1, ENC_NA);
dvb_eit_tree = proto_item_add_subtree(ti, ett_dvb_eit);
offset += packet_mpeg_sect_header(tvb, offset, dvb_eit_tree, &length, NULL);
length -= 4;
offset += packet_mpeg_sect_header(tvb, offset, dvb_eit_tree, &length, NULL);
length -= 4;
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_service_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_service_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_version_number, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_current_next_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_version_number, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_current_next_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_transport_stream_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_transport_stream_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_original_network_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_original_network_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_segment_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_segment_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_last_table_id, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_eit_tree, hf_dvb_eit_last_table_id, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
if (offset >= length) {
packet_mpeg_sect_crc(tvb, pinfo, dvb_eit_tree, 0, offset);
if (offset >= length) {
packet_mpeg_sect_crc(tvb, pinfo, dvb_eit_tree, 0, offset);
return;
}
return;
}
/* Parse all the events */
while (offset < length) {
/* Parse all the events */
while (offset < length) {
evt_id = tvb_get_ntohs(tvb, offset);
ei = proto_tree_add_text(dvb_eit_tree, tvb, offset, 12, "Event 0x%04hx", evt_id);
dvb_eit_event_tree = proto_item_add_subtree(ei, ett_dvb_eit_event);
evt_id = tvb_get_ntohs(tvb, offset);
ei = proto_tree_add_text(dvb_eit_tree, tvb, offset, 12, "Event 0x%04hx", evt_id);
dvb_eit_event_tree = proto_item_add_subtree(ei, ett_dvb_eit_event);
proto_tree_add_item(dvb_eit_event_tree, hf_dvb_eit_event_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_eit_event_tree, hf_dvb_eit_event_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
if (tvb_memeql(tvb, offset, "\xFF\xFF\xFF\xFF\xFF", 5)) {
if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &start_time) < 0) {
proto_tree_add_text(tree, tvb, offset, 5, "Unparseable time");
} else {
proto_tree_add_time_format(dvb_eit_event_tree, hf_dvb_eit_start_time, tvb, offset,
5, &start_time,
"Start Time: %s UTC", abs_time_to_str(&start_time, ABSOLUTE_TIME_UTC, FALSE));
}
} else {
proto_tree_add_text(tree, tvb, offset, 5, "Start Time: Undefined (0xFFFFFFFFFF)");
}
offset += 5;
if (tvb_memeql(tvb, offset, "\xFF\xFF\xFF\xFF\xFF", 5)) {
if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &start_time) < 0) {
proto_tree_add_text(tree, tvb, offset, 5, "Unparseable time");
} else {
proto_tree_add_time_format(dvb_eit_event_tree, hf_dvb_eit_start_time, tvb, offset,
5, &start_time,
"Start Time: %s UTC", abs_time_to_str(&start_time, ABSOLUTE_TIME_UTC, FALSE));
}
} else {
proto_tree_add_text(tree, tvb, offset, 5, "Start Time: Undefined (0xFFFFFFFFFF)");
}
offset += 5;
duration_item = proto_tree_add_item(dvb_eit_event_tree, hf_dvb_eit_duration, tvb, offset, 3, ENC_BIG_ENDIAN);
proto_item_append_text(duration_item, " (%02u:%02u:%02u)",
MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset)),
MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset + 1)),
MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset + 2)));
offset += 3;
duration_item = proto_tree_add_item(dvb_eit_event_tree, hf_dvb_eit_duration, tvb, offset, 3, ENC_BIG_ENDIAN);
proto_item_append_text(duration_item, " (%02u:%02u:%02u)",
MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset)),
MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset + 1)),
MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset + 2)));
offset += 3;
proto_tree_add_item(dvb_eit_event_tree, hf_dvb_eit_running_status, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_eit_event_tree, hf_dvb_eit_free_ca_mode, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_eit_event_tree, hf_dvb_eit_descriptors_loop_length, tvb, offset, 2, ENC_BIG_ENDIAN);
descriptor_len = tvb_get_ntohs(tvb, offset) & DVB_EIT_DESCRIPTORS_LOOP_LENGTH_MASK;
offset += 2;
proto_tree_add_item(dvb_eit_event_tree, hf_dvb_eit_running_status, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_eit_event_tree, hf_dvb_eit_free_ca_mode, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_eit_event_tree, hf_dvb_eit_descriptors_loop_length, tvb, offset, 2, ENC_BIG_ENDIAN);
descriptor_len = tvb_get_ntohs(tvb, offset) & DVB_EIT_DESCRIPTORS_LOOP_LENGTH_MASK;
offset += 2;
descriptor_end = offset + descriptor_len;
while (offset < descriptor_end)
offset += proto_mpeg_descriptor_dissect(tvb, offset, dvb_eit_event_tree);
descriptor_end = offset + descriptor_len;
while (offset < descriptor_end)
offset += proto_mpeg_descriptor_dissect(tvb, offset, dvb_eit_event_tree);
}
}
offset += packet_mpeg_sect_crc(tvb, pinfo, dvb_eit_tree, 0, offset);
proto_item_set_len(ti, offset);
offset += packet_mpeg_sect_crc(tvb, pinfo, dvb_eit_tree, 0, offset);
proto_item_set_len(ti, offset);
}
@ -199,122 +199,123 @@ void
proto_register_dvb_eit(void)
{
static hf_register_info hf[] = {
static hf_register_info hf[] = {
{ &hf_dvb_eit_service_id, {
"Service ID", "dvb_eit.sid",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_service_id, {
"Service ID", "dvb_eit.sid",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_reserved, {
"Reserved", "dvb_eit.reserved",
FT_UINT8, BASE_HEX, NULL, DVB_EIT_RESERVED_MASK, NULL, HFILL
} },
{ &hf_dvb_eit_reserved, {
"Reserved", "dvb_eit.reserved",
FT_UINT8, BASE_HEX, NULL, DVB_EIT_RESERVED_MASK, NULL, HFILL
} },
{ &hf_dvb_eit_version_number, {
"Version Number", "dvb_eit.version",
FT_UINT8, BASE_HEX, NULL, DVB_EIT_VERSION_NUMBER_MASK, NULL, HFILL
} },
{ &hf_dvb_eit_version_number, {
"Version Number", "dvb_eit.version",
FT_UINT8, BASE_HEX, NULL, DVB_EIT_VERSION_NUMBER_MASK, NULL, HFILL
} },
{ &hf_dvb_eit_current_next_indicator, {
"Current/Next Indicator", "dvb_eit.cur_next_ind",
FT_UINT8, BASE_DEC, VALS(dvb_eit_cur_next_vals), DVB_EIT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_dvb_eit_current_next_indicator, {
"Current/Next Indicator", "dvb_eit.cur_next_ind",
FT_UINT8, BASE_DEC, VALS(dvb_eit_cur_next_vals), DVB_EIT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_dvb_eit_section_number, {
"Section Number", "dvb_eit.sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_section_number, {
"Section Number", "dvb_eit.sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_last_section_number, {
"Last Section Number", "dvb_eit.last_sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_last_section_number, {
"Last Section Number", "dvb_eit.last_sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_transport_stream_id, {
"Transport Stream ID", "dvb_eit.tsid",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_transport_stream_id, {
"Transport Stream ID", "dvb_eit.tsid",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_original_network_id, {
"Original Network ID", "dvb_eit.original_nid",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_original_network_id, {
"Original Network ID", "dvb_eit.original_nid",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_segment_last_section_number, {
"Segment Last Section Number", "dvb_eit.segment_last_sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_segment_last_section_number, {
"Segment Last Section Number", "dvb_eit.segment_last_sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_last_table_id, {
"Last Table ID", "dvb_eit.last_tid",
FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_last_table_id, {
"Last Table ID", "dvb_eit.last_tid",
FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_event_id, {
"Event ID", "dvb_eit.evt.id",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_event_id, {
"Event ID", "dvb_eit.evt.id",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_start_time, {
"UTC Start Time", "dvb_eit.evt.start_time",
FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_start_time, {
"UTC Start Time", "dvb_eit.evt.start_time",
FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_duration, {
"Duration", "dvb_eit.evt.duration",
FT_UINT24, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_duration, {
"Duration", "dvb_eit.evt.duration",
FT_UINT24, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_eit_running_status, {
"Running Status", "dvb_eit.evt.running_status",
FT_UINT16, BASE_HEX, VALS(dvb_eit_running_status_vals), DVB_EIT_RUNNING_STATUS_MASK, NULL, HFILL
} },
{ &hf_dvb_eit_running_status, {
"Running Status", "dvb_eit.evt.running_status",
FT_UINT16, BASE_HEX, VALS(dvb_eit_running_status_vals), DVB_EIT_RUNNING_STATUS_MASK, NULL, HFILL
} },
{ &hf_dvb_eit_free_ca_mode, {
"Free CA Mode", "dvb_eit.evt.free_ca_mode",
FT_UINT16, BASE_HEX, VALS(dvb_eit_free_ca_mode_vals), DVB_EIT_FREE_CA_MODE_MASK, NULL, HFILL
} },
{ &hf_dvb_eit_free_ca_mode, {
"Free CA Mode", "dvb_eit.evt.free_ca_mode",
FT_UINT16, BASE_HEX, VALS(dvb_eit_free_ca_mode_vals), DVB_EIT_FREE_CA_MODE_MASK, NULL, HFILL
} },
{ &hf_dvb_eit_descriptors_loop_length, {
"Descriptors Loop Length", "dvb_eit.evt.descr_loop_len",
FT_UINT16, BASE_HEX, NULL, DVB_EIT_DESCRIPTORS_LOOP_LENGTH_MASK, NULL, HFILL
} }
};
{ &hf_dvb_eit_descriptors_loop_length, {
"Descriptors Loop Length", "dvb_eit.evt.descr_loop_len",
FT_UINT16, BASE_HEX, NULL, DVB_EIT_DESCRIPTORS_LOOP_LENGTH_MASK, NULL, HFILL
} }
};
static gint *ett[] = {
&ett_dvb_eit,
&ett_dvb_eit_event
};
static gint *ett[] = {
&ett_dvb_eit,
&ett_dvb_eit_event
};
proto_dvb_eit = proto_register_protocol("DVB Event Information Table", "DVB EIT", "dvb_eit");
proto_dvb_eit = proto_register_protocol("DVB Event Information Table", "DVB EIT", "dvb_eit");
proto_register_field_array(proto_dvb_eit, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
proto_register_field_array(proto_dvb_eit, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
void proto_reg_handoff_dvb_eit(void)
{
int tid;
dissector_handle_t dvb_eit_handle;
int tid;
dissector_handle_t dvb_eit_handle;
dvb_eit_handle = create_dissector_handle(dissect_dvb_eit, proto_dvb_eit);
dvb_eit_handle = create_dissector_handle(dissect_dvb_eit, proto_dvb_eit);
for (tid = DVB_EIT_TID_MIN; tid <= DVB_EIT_TID_MAX; tid++)
dissector_add_uint("mpeg_sect.tid", tid, dvb_eit_handle);
for (tid = DVB_EIT_TID_MIN; tid <= DVB_EIT_TID_MAX; tid++)
dissector_add_uint("mpeg_sect.tid", tid, dvb_eit_handle);
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: t
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=4 noexpandtab:
* :indentSize=4:tabSize=4:noTabs=false:
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -54,24 +54,24 @@ static gint ett_dvb_nit = -1;
static gint ett_dvb_nit_ts = -1;
#define DVB_NIT_TID 0x40
#define DVB_NIT_TID_OTHER 0x41
#define DVB_NIT_TID 0x40
#define DVB_NIT_TID_OTHER 0x41
#define DVB_NIT_RESERVED1_MASK 0xC0
#define DVB_NIT_VERSION_NUMBER_MASK 0x3E
#define DVB_NIT_CURRENT_NEXT_INDICATOR_MASK 0x01
#define DVB_NIT_RESERVED2_MASK 0xF000
#define DVB_NIT_NETWORK_DESCRIPTORS_LENGTH_MASK 0x0FFF
#define DVB_NIT_RESERVED3_MASK 0xF000
#define DVB_NIT_TRANSPORT_STREAM_LOOP_LENGTH_MASK 0x0FFF
#define DVB_NIT_RESERVED4_MASK 0xF000
#define DVB_NIT_TRANSPORT_DESCRIPTORS_LENGTH_MASK 0x0FFF
#define DVB_NIT_RESERVED1_MASK 0xC0
#define DVB_NIT_VERSION_NUMBER_MASK 0x3E
#define DVB_NIT_CURRENT_NEXT_INDICATOR_MASK 0x01
#define DVB_NIT_RESERVED2_MASK 0xF000
#define DVB_NIT_NETWORK_DESCRIPTORS_LENGTH_MASK 0x0FFF
#define DVB_NIT_RESERVED3_MASK 0xF000
#define DVB_NIT_TRANSPORT_STREAM_LOOP_LENGTH_MASK 0x0FFF
#define DVB_NIT_RESERVED4_MASK 0xF000
#define DVB_NIT_TRANSPORT_DESCRIPTORS_LENGTH_MASK 0x0FFF
static const value_string dvb_nit_cur_next_vals[] = {
{ 0, "Not yet applicable" },
{ 1, "Currently applicable" },
{ 0, "Not yet applicable" },
{ 1, "Currently applicable" },
{ 0, NULL }
{ 0, NULL }
};
@ -79,74 +79,74 @@ static int
dissect_dvb_nit(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
guint offset = 0;
guint ts_desc_len, desc_loop_len, ts_end;
guint offset = 0;
guint ts_desc_len, desc_loop_len, ts_end;
guint16 tsid;
guint16 tsid;
proto_item *ti;
proto_tree *dvb_nit_tree;
proto_item *tsi;
proto_tree *dvb_nit_ts_tree;
proto_item *ti;
proto_tree *dvb_nit_tree;
proto_item *tsi;
proto_tree *dvb_nit_ts_tree;
col_set_str(pinfo->cinfo, COL_INFO, "Network Information Table (NIT)");
col_set_str(pinfo->cinfo, COL_INFO, "Network Information Table (NIT)");
ti = proto_tree_add_item(tree, proto_dvb_nit, tvb, offset, -1, ENC_NA);
dvb_nit_tree = proto_item_add_subtree(ti, ett_dvb_nit);
ti = proto_tree_add_item(tree, proto_dvb_nit, tvb, offset, -1, ENC_NA);
dvb_nit_tree = proto_item_add_subtree(ti, ett_dvb_nit);
offset += packet_mpeg_sect_header(tvb, offset, dvb_nit_tree, NULL, NULL);
offset += packet_mpeg_sect_header(tvb, offset, dvb_nit_tree, NULL, NULL);
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_network_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_network_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_version_number, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_current_next_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_version_number, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_current_next_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_reserved2, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_network_descriptors_length, tvb, offset, 2, ENC_BIG_ENDIAN);
desc_loop_len = tvb_get_ntohs(tvb, offset) & DVB_NIT_NETWORK_DESCRIPTORS_LENGTH_MASK;
offset += 2;
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_reserved2, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_network_descriptors_length, tvb, offset, 2, ENC_BIG_ENDIAN);
desc_loop_len = tvb_get_ntohs(tvb, offset) & DVB_NIT_NETWORK_DESCRIPTORS_LENGTH_MASK;
offset += 2;
offset += proto_mpeg_descriptor_loop_dissect(tvb, offset, desc_loop_len, dvb_nit_tree);
offset += proto_mpeg_descriptor_loop_dissect(tvb, offset, desc_loop_len, dvb_nit_tree);
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_reserved3, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_transport_stream_loop_length, tvb, offset, 2, ENC_BIG_ENDIAN);
ts_end = offset + (tvb_get_ntohs(tvb, offset) & DVB_NIT_TRANSPORT_STREAM_LOOP_LENGTH_MASK);
offset += 2;
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_reserved3, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_nit_tree, hf_dvb_nit_transport_stream_loop_length, tvb, offset, 2, ENC_BIG_ENDIAN);
ts_end = offset + (tvb_get_ntohs(tvb, offset) & DVB_NIT_TRANSPORT_STREAM_LOOP_LENGTH_MASK);
offset += 2;
while (offset < ts_end) {
tsid = tvb_get_ntohs(tvb, offset);
ts_desc_len = 3 + (tvb_get_ntohs(tvb, offset + 4) & DVB_NIT_TRANSPORT_DESCRIPTORS_LENGTH_MASK);
while (offset < ts_end) {
tsid = tvb_get_ntohs(tvb, offset);
ts_desc_len = 3 + (tvb_get_ntohs(tvb, offset + 4) & DVB_NIT_TRANSPORT_DESCRIPTORS_LENGTH_MASK);
tsi = proto_tree_add_text(dvb_nit_tree, tvb, offset, ts_desc_len, "Stream ID=0x%04hx", tsid);
dvb_nit_ts_tree = proto_item_add_subtree(tsi, ett_dvb_nit_ts);
tsi = proto_tree_add_text(dvb_nit_tree, tvb, offset, ts_desc_len, "Stream ID=0x%04hx", tsid);
dvb_nit_ts_tree = proto_item_add_subtree(tsi, ett_dvb_nit_ts);
proto_tree_add_item(dvb_nit_ts_tree, hf_dvb_nit_transport_stream_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_nit_ts_tree, hf_dvb_nit_transport_stream_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_nit_ts_tree, hf_dvb_nit_original_network_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_nit_ts_tree, hf_dvb_nit_original_network_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_nit_ts_tree, hf_dvb_nit_reserved4, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_nit_ts_tree, hf_dvb_nit_transport_descriptors_length, tvb, offset, 2, ENC_BIG_ENDIAN);
desc_loop_len = tvb_get_ntohs(tvb, offset) & DVB_NIT_TRANSPORT_DESCRIPTORS_LENGTH_MASK;
offset += 2;
proto_tree_add_item(dvb_nit_ts_tree, hf_dvb_nit_reserved4, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_nit_ts_tree, hf_dvb_nit_transport_descriptors_length, tvb, offset, 2, ENC_BIG_ENDIAN);
desc_loop_len = tvb_get_ntohs(tvb, offset) & DVB_NIT_TRANSPORT_DESCRIPTORS_LENGTH_MASK;
offset += 2;
offset += proto_mpeg_descriptor_loop_dissect(tvb, offset, desc_loop_len, dvb_nit_ts_tree);
}
offset += proto_mpeg_descriptor_loop_dissect(tvb, offset, desc_loop_len, dvb_nit_ts_tree);
}
offset += packet_mpeg_sect_crc(tvb, pinfo, dvb_nit_tree, 0, offset);
offset += packet_mpeg_sect_crc(tvb, pinfo, dvb_nit_tree, 0, offset);
proto_item_set_len(ti, offset);
return offset;
proto_item_set_len(ti, offset);
return offset;
}
@ -154,113 +154,114 @@ void
proto_register_dvb_nit(void)
{
static hf_register_info hf[] = {
static hf_register_info hf[] = {
{ &hf_dvb_nit_network_id, {
"Network ID", "dvb_nit.sid",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_nit_network_id, {
"Network ID", "dvb_nit.sid",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_nit_reserved1, {
"Reserved", "dvb_nit.reserved1",
FT_UINT8, BASE_HEX, NULL, DVB_NIT_RESERVED1_MASK, NULL, HFILL
} },
{ &hf_dvb_nit_reserved1, {
"Reserved", "dvb_nit.reserved1",
FT_UINT8, BASE_HEX, NULL, DVB_NIT_RESERVED1_MASK, NULL, HFILL
} },
{ &hf_dvb_nit_version_number, {
"Version Number", "dvb_nit.version",
FT_UINT8, BASE_HEX, NULL, DVB_NIT_VERSION_NUMBER_MASK, NULL, HFILL
} },
{ &hf_dvb_nit_version_number, {
"Version Number", "dvb_nit.version",
FT_UINT8, BASE_HEX, NULL, DVB_NIT_VERSION_NUMBER_MASK, NULL, HFILL
} },
{ &hf_dvb_nit_current_next_indicator, {
"Current/Next Indicator", "dvb_nit.cur_next_ind",
FT_UINT8, BASE_DEC, VALS(dvb_nit_cur_next_vals), DVB_NIT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_dvb_nit_current_next_indicator, {
"Current/Next Indicator", "dvb_nit.cur_next_ind",
FT_UINT8, BASE_DEC, VALS(dvb_nit_cur_next_vals), DVB_NIT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_dvb_nit_section_number, {
"Section Number", "dvb_nit.sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_nit_section_number, {
"Section Number", "dvb_nit.sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_nit_last_section_number, {
"Last Section Number", "dvb_nit.last_sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_nit_last_section_number, {
"Last Section Number", "dvb_nit.last_sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_nit_reserved2, {
"Reserved", "dvb_nit.reserved2",
FT_UINT16, BASE_HEX, NULL, DVB_NIT_RESERVED2_MASK, NULL, HFILL
} },
{ &hf_dvb_nit_reserved2, {
"Reserved", "dvb_nit.reserved2",
FT_UINT16, BASE_HEX, NULL, DVB_NIT_RESERVED2_MASK, NULL, HFILL
} },
{ &hf_dvb_nit_network_descriptors_length, {
"Network Descriptors Length", "dvb_nit.network_desc_len",
FT_UINT16, BASE_DEC, NULL, DVB_NIT_NETWORK_DESCRIPTORS_LENGTH_MASK, NULL, HFILL
} },
{ &hf_dvb_nit_network_descriptors_length, {
"Network Descriptors Length", "dvb_nit.network_desc_len",
FT_UINT16, BASE_DEC, NULL, DVB_NIT_NETWORK_DESCRIPTORS_LENGTH_MASK, NULL, HFILL
} },
{ &hf_dvb_nit_reserved3, {
"Reserved", "dvb_nit.reserved3",
FT_UINT16, BASE_HEX, NULL, DVB_NIT_RESERVED3_MASK, NULL, HFILL
} },
{ &hf_dvb_nit_reserved3, {
"Reserved", "dvb_nit.reserved3",
FT_UINT16, BASE_HEX, NULL, DVB_NIT_RESERVED3_MASK, NULL, HFILL
} },
{ &hf_dvb_nit_transport_stream_loop_length, {
"Transport Stream Loop Length", "dvb_nit.ts_loop_len",
FT_UINT16, BASE_DEC, NULL, DVB_NIT_TRANSPORT_STREAM_LOOP_LENGTH_MASK, NULL, HFILL
} },
{ &hf_dvb_nit_transport_stream_loop_length, {
"Transport Stream Loop Length", "dvb_nit.ts_loop_len",
FT_UINT16, BASE_DEC, NULL, DVB_NIT_TRANSPORT_STREAM_LOOP_LENGTH_MASK, NULL, HFILL
} },
{ &hf_dvb_nit_transport_stream_id, {
"Transport Stream ID", "dvb_nit.ts.id",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_nit_transport_stream_id, {
"Transport Stream ID", "dvb_nit.ts.id",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_nit_original_network_id, {
"Original Network ID", "dvb_nit.ts.original_network_id",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_nit_original_network_id, {
"Original Network ID", "dvb_nit.ts.original_network_id",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_nit_reserved4, {
"Reserved", "dvb_nit.ts.reserved",
FT_UINT16, BASE_HEX, NULL, DVB_NIT_RESERVED4_MASK, NULL, HFILL
} },
{ &hf_dvb_nit_reserved4, {
"Reserved", "dvb_nit.ts.reserved",
FT_UINT16, BASE_HEX, NULL, DVB_NIT_RESERVED4_MASK, NULL, HFILL
} },
{ &hf_dvb_nit_transport_descriptors_length, {
"Transport Descriptors Length", "dvb_nit.ts.desc_len",
FT_UINT16, BASE_DEC, NULL, DVB_NIT_TRANSPORT_DESCRIPTORS_LENGTH_MASK, NULL, HFILL
} },
{ &hf_dvb_nit_transport_descriptors_length, {
"Transport Descriptors Length", "dvb_nit.ts.desc_len",
FT_UINT16, BASE_DEC, NULL, DVB_NIT_TRANSPORT_DESCRIPTORS_LENGTH_MASK, NULL, HFILL
} },
};
};
static gint *ett[] = {
&ett_dvb_nit,
&ett_dvb_nit_ts
};
static gint *ett[] = {
&ett_dvb_nit,
&ett_dvb_nit_ts
};
proto_dvb_nit = proto_register_protocol("DVB Network Information Table", "DVB NIT", "dvb_nit");
proto_dvb_nit = proto_register_protocol("DVB Network Information Table", "DVB NIT", "dvb_nit");
proto_register_field_array(proto_dvb_nit, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
proto_register_field_array(proto_dvb_nit, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
new_register_dissector("dvb_nit", dissect_dvb_nit, proto_dvb_nit);
new_register_dissector("dvb_nit", dissect_dvb_nit, proto_dvb_nit);
}
void proto_reg_handoff_dvb_nit(void)
{
dissector_handle_t dvb_nit_handle;
dissector_handle_t dvb_nit_handle;
dvb_nit_handle = new_create_dissector_handle(dissect_dvb_nit, proto_dvb_nit);
dvb_nit_handle = find_dissector("dvb_nit");
dissector_add_uint("mpeg_sect.tid", DVB_NIT_TID, dvb_nit_handle);
dissector_add_uint("mpeg_sect.tid", DVB_NIT_TID_OTHER, dvb_nit_handle);
dissector_add_uint("mpeg_sect.tid", DVB_NIT_TID, dvb_nit_handle);
dissector_add_uint("mpeg_sect.tid", DVB_NIT_TID_OTHER, dvb_nit_handle);
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: t
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=4 noexpandtab:
* :indentSize=4:tabSize=4:noTabs=false:
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -54,123 +54,123 @@ static int hf_dvb_sdt_descriptors_loop_length = -1;
static gint ett_dvb_sdt = -1;
static gint ett_dvb_sdt_service = -1;
#define DVB_SDT_TID_ACTUAL 0x42
#define DVB_SDT_TID_OTHER 0x46
#define DVB_SDT_TID_ACTUAL 0x42
#define DVB_SDT_TID_OTHER 0x46
#define DVB_SDT_RESERVED1_MASK 0xC0
#define DVB_SDT_VERSION_NUMBER_MASK 0x3E
#define DVB_SDT_CURRENT_NEXT_INDICATOR_MASK 0x01
#define DVB_SDT_RESERVED1_MASK 0xC0
#define DVB_SDT_VERSION_NUMBER_MASK 0x3E
#define DVB_SDT_CURRENT_NEXT_INDICATOR_MASK 0x01
#define DVB_SDT_RESERVED3_MASK 0xFC
#define DVB_SDT_EIT_SCHEDULE_FLAG_MASK 0x02
#define DVB_SDT_EIT_PRESENT_FOLLOWING_FLAG_MASK 0x01
#define DVB_SDT_RESERVED3_MASK 0xFC
#define DVB_SDT_EIT_SCHEDULE_FLAG_MASK 0x02
#define DVB_SDT_EIT_PRESENT_FOLLOWING_FLAG_MASK 0x01
#define DVB_SDT_RUNNING_STATUS_MASK 0xE000
#define DVB_SDT_FREE_CA_MODE_MASK 0x1000
#define DVB_SDT_DESCRIPTORS_LOOP_LENGTH_MASK 0x0FFF
#define DVB_SDT_RUNNING_STATUS_MASK 0xE000
#define DVB_SDT_FREE_CA_MODE_MASK 0x1000
#define DVB_SDT_DESCRIPTORS_LOOP_LENGTH_MASK 0x0FFF
static const value_string dvb_sdt_cur_next_vals[] = {
{ 0, "Not yet applicable" },
{ 1, "Currently applicable" },
{ 0, "Not yet applicable" },
{ 1, "Currently applicable" },
{ 0, NULL }
{ 0, NULL }
};
static const value_string dvb_sdt_running_status_vals[] = {
{ 0, "Undefined" },
{ 1, "Not Running" },
{ 2, "Starts in a few seconds" },
{ 3, "Pausing" },
{ 4, "Running" },
{ 5, "Service off-air" },
{ 0, "Undefined" },
{ 1, "Not Running" },
{ 2, "Starts in a few seconds" },
{ 3, "Pausing" },
{ 4, "Running" },
{ 5, "Service off-air" },
{ 0, NULL }
{ 0, NULL }
};
static const value_string dvb_sdt_free_ca_mode_vals[] = {
{ 0, "Not Scrambled" },
{ 1, "One or more component scrambled" },
{ 0, "Not Scrambled" },
{ 1, "One or more component scrambled" },
{ 0, NULL }
{ 0, NULL }
};
static void
dissect_dvb_sdt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint offset = 0, length = 0;
guint descriptor_len, descriptor_end;
guint16 svc_id;
guint offset = 0, length = 0;
guint descriptor_len, descriptor_end;
guint16 svc_id;
proto_item *ti;
proto_tree *dvb_sdt_tree;
proto_item *si;
proto_tree *dvb_sdt_service_tree;
proto_item *ti;
proto_tree *dvb_sdt_tree;
proto_item *si;
proto_tree *dvb_sdt_service_tree;
/* The TVB should start right after the section_length in the Section packet */
/* The TVB should start right after the section_length in the Section packet */
col_set_str(pinfo->cinfo, COL_INFO, "Service Description Table (SDT)");
col_set_str(pinfo->cinfo, COL_INFO, "Service Description Table (SDT)");
ti = proto_tree_add_item(tree, proto_dvb_sdt, tvb, offset, -1, ENC_NA);
dvb_sdt_tree = proto_item_add_subtree(ti, ett_dvb_sdt);
ti = proto_tree_add_item(tree, proto_dvb_sdt, tvb, offset, -1, ENC_NA);
dvb_sdt_tree = proto_item_add_subtree(ti, ett_dvb_sdt);
offset += packet_mpeg_sect_header(tvb, offset, dvb_sdt_tree, &length, NULL);
length -= 4;
offset += packet_mpeg_sect_header(tvb, offset, dvb_sdt_tree, &length, NULL);
length -= 4;
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_transport_stream_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_transport_stream_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_version_number, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_current_next_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_version_number, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_current_next_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_original_network_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_original_network_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_reserved2, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_sdt_tree, hf_dvb_sdt_reserved2, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
if (offset >= length)
return;
if (offset >= length)
return;
/* Parse all the services */
while (offset < length) {
/* Parse all the services */
while (offset < length) {
svc_id = tvb_get_ntohs(tvb, offset);
si = proto_tree_add_text(dvb_sdt_tree, tvb, offset, 5, "Service 0x%04hx", svc_id);
dvb_sdt_service_tree = proto_item_add_subtree(si, ett_dvb_sdt_service);
svc_id = tvb_get_ntohs(tvb, offset);
si = proto_tree_add_text(dvb_sdt_tree, tvb, offset, 5, "Service 0x%04hx", svc_id);
dvb_sdt_service_tree = proto_item_add_subtree(si, ett_dvb_sdt_service);
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_service_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_service_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_reserved3, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_eit_schedule_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_eit_present_following_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_reserved3, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_eit_schedule_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_eit_present_following_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_running_status, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_free_ca_mode, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_descriptors_loop_length, tvb, offset, 2, ENC_BIG_ENDIAN);
descriptor_len = tvb_get_ntohs(tvb, offset) & DVB_SDT_DESCRIPTORS_LOOP_LENGTH_MASK;
offset += 2;
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_running_status, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_free_ca_mode, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_sdt_service_tree, hf_dvb_sdt_descriptors_loop_length, tvb, offset, 2, ENC_BIG_ENDIAN);
descriptor_len = tvb_get_ntohs(tvb, offset) & DVB_SDT_DESCRIPTORS_LOOP_LENGTH_MASK;
offset += 2;
descriptor_end = offset + descriptor_len;
while (offset < descriptor_end)
offset += proto_mpeg_descriptor_dissect(tvb, offset, dvb_sdt_service_tree);
descriptor_end = offset + descriptor_len;
while (offset < descriptor_end)
offset += proto_mpeg_descriptor_dissect(tvb, offset, dvb_sdt_service_tree);
}
}
offset += packet_mpeg_sect_crc(tvb, pinfo, dvb_sdt_tree, 0, offset);
proto_item_set_len(ti, offset);
offset += packet_mpeg_sect_crc(tvb, pinfo, dvb_sdt_tree, 0, offset);
proto_item_set_len(ti, offset);
}
@ -178,117 +178,118 @@ void
proto_register_dvb_sdt(void)
{
static hf_register_info hf[] = {
static hf_register_info hf[] = {
{ &hf_dvb_sdt_transport_stream_id, {
"Transport Stream ID", "dvb_sdt.tsid",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_sdt_transport_stream_id, {
"Transport Stream ID", "dvb_sdt.tsid",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_sdt_reserved1, {
"Reserved", "dvb_sdt.reserved1",
FT_UINT8, BASE_HEX, NULL, DVB_SDT_RESERVED1_MASK, NULL, HFILL
} },
{ &hf_dvb_sdt_reserved1, {
"Reserved", "dvb_sdt.reserved1",
FT_UINT8, BASE_HEX, NULL, DVB_SDT_RESERVED1_MASK, NULL, HFILL
} },
{ &hf_dvb_sdt_version_number, {
"Version Number", "dvb_sdt.version",
FT_UINT8, BASE_HEX, NULL, DVB_SDT_VERSION_NUMBER_MASK, NULL, HFILL
} },
{ &hf_dvb_sdt_version_number, {
"Version Number", "dvb_sdt.version",
FT_UINT8, BASE_HEX, NULL, DVB_SDT_VERSION_NUMBER_MASK, NULL, HFILL
} },
{ &hf_dvb_sdt_current_next_indicator, {
"Current/Next Indicator", "dvb_sdt.cur_next_ind",
FT_UINT8, BASE_DEC, VALS(dvb_sdt_cur_next_vals), DVB_SDT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_dvb_sdt_current_next_indicator, {
"Current/Next Indicator", "dvb_sdt.cur_next_ind",
FT_UINT8, BASE_DEC, VALS(dvb_sdt_cur_next_vals), DVB_SDT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_dvb_sdt_section_number, {
"Section Number", "dvb_sdt.sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_sdt_section_number, {
"Section Number", "dvb_sdt.sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_sdt_last_section_number, {
"Last Section Number", "dvb_sdt.last_sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_sdt_last_section_number, {
"Last Section Number", "dvb_sdt.last_sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_sdt_original_network_id, {
"Original Network ID", "dvb_sdt.original_nid",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_sdt_original_network_id, {
"Original Network ID", "dvb_sdt.original_nid",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_sdt_reserved2, {
"Reserved", "dvb_sdt.reserved2",
FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_sdt_reserved2, {
"Reserved", "dvb_sdt.reserved2",
FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_sdt_service_id, {
"Service ID", "dvb_sdt.svc.id",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_sdt_service_id, {
"Service ID", "dvb_sdt.svc.id",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_sdt_reserved3, {
"Reserved", "dvb_sdt.svc.reserved",
FT_UINT8, BASE_HEX, NULL, DVB_SDT_RESERVED3_MASK, NULL, HFILL
} },
{ &hf_dvb_sdt_reserved3, {
"Reserved", "dvb_sdt.svc.reserved",
FT_UINT8, BASE_HEX, NULL, DVB_SDT_RESERVED3_MASK, NULL, HFILL
} },
{ &hf_dvb_sdt_eit_schedule_flag, {
"EIT Schedule Flag", "dvb_sdt.svc.eit_schedule_flag",
FT_UINT8, BASE_DEC, NULL, DVB_SDT_EIT_SCHEDULE_FLAG_MASK, NULL, HFILL
} },
{ &hf_dvb_sdt_eit_schedule_flag, {
"EIT Schedule Flag", "dvb_sdt.svc.eit_schedule_flag",
FT_UINT8, BASE_DEC, NULL, DVB_SDT_EIT_SCHEDULE_FLAG_MASK, NULL, HFILL
} },
{ &hf_dvb_sdt_eit_present_following_flag, {
"EIT Present Following Flag", "dvb_sdt.svc.eit_present_following_flag",
FT_UINT8, BASE_DEC, NULL, DVB_SDT_EIT_PRESENT_FOLLOWING_FLAG_MASK, NULL, HFILL
} },
{ &hf_dvb_sdt_eit_present_following_flag, {
"EIT Present Following Flag", "dvb_sdt.svc.eit_present_following_flag",
FT_UINT8, BASE_DEC, NULL, DVB_SDT_EIT_PRESENT_FOLLOWING_FLAG_MASK, NULL, HFILL
} },
{ &hf_dvb_sdt_running_status, {
"Running Status", "dvb_sdt.svc.running_status",
FT_UINT16, BASE_HEX, VALS(dvb_sdt_running_status_vals), DVB_SDT_RUNNING_STATUS_MASK, NULL, HFILL
} },
{ &hf_dvb_sdt_running_status, {
"Running Status", "dvb_sdt.svc.running_status",
FT_UINT16, BASE_HEX, VALS(dvb_sdt_running_status_vals), DVB_SDT_RUNNING_STATUS_MASK, NULL, HFILL
} },
{ &hf_dvb_sdt_free_ca_mode, {
"Free CA Mode", "dvb_sdt.svc.free_ca_mode",
FT_UINT16, BASE_HEX, VALS(dvb_sdt_free_ca_mode_vals), DVB_SDT_FREE_CA_MODE_MASK, NULL, HFILL
} },
{ &hf_dvb_sdt_free_ca_mode, {
"Free CA Mode", "dvb_sdt.svc.free_ca_mode",
FT_UINT16, BASE_HEX, VALS(dvb_sdt_free_ca_mode_vals), DVB_SDT_FREE_CA_MODE_MASK, NULL, HFILL
} },
{ &hf_dvb_sdt_descriptors_loop_length, {
"Descriptors Loop Length", "dvb_sdt.svc.descr_loop_len",
FT_UINT16, BASE_HEX, NULL, DVB_SDT_DESCRIPTORS_LOOP_LENGTH_MASK, NULL, HFILL
} }
{ &hf_dvb_sdt_descriptors_loop_length, {
"Descriptors Loop Length", "dvb_sdt.svc.descr_loop_len",
FT_UINT16, BASE_HEX, NULL, DVB_SDT_DESCRIPTORS_LOOP_LENGTH_MASK, NULL, HFILL
} }
};
};
static gint *ett[] = {
&ett_dvb_sdt,
&ett_dvb_sdt_service
};
static gint *ett[] = {
&ett_dvb_sdt,
&ett_dvb_sdt_service
};
proto_dvb_sdt = proto_register_protocol("DVB Service Description Table", "DVB SDT", "dvb_sdt");
proto_dvb_sdt = proto_register_protocol("DVB Service Description Table", "DVB SDT", "dvb_sdt");
proto_register_field_array(proto_dvb_sdt, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
proto_register_field_array(proto_dvb_sdt, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
void proto_reg_handoff_dvb_sdt(void)
{
dissector_handle_t dvb_sdt_handle;
dissector_handle_t dvb_sdt_handle;
dvb_sdt_handle = create_dissector_handle(dissect_dvb_sdt, proto_dvb_sdt);
dissector_add_uint("mpeg_sect.tid", DVB_SDT_TID_ACTUAL, dvb_sdt_handle);
dissector_add_uint("mpeg_sect.tid", DVB_SDT_TID_OTHER, dvb_sdt_handle);
dvb_sdt_handle = create_dissector_handle(dissect_dvb_sdt, proto_dvb_sdt);
dissector_add_uint("mpeg_sect.tid", DVB_SDT_TID_ACTUAL, dvb_sdt_handle);
dissector_add_uint("mpeg_sect.tid", DVB_SDT_TID_OTHER, dvb_sdt_handle);
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: t
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=4 noexpandtab:
* :indentSize=4:tabSize=4:noTabs=false:
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -35,35 +35,35 @@ static int hf_dvb_tdt_utc_time = -1;
static gint ett_dvb_tdt = -1;
#define DVB_TDT_TID 0x70
#define DVB_TDT_TID 0x70
static void
dissect_dvb_tdt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint offset = 0;
guint offset = 0;
proto_item *ti;
proto_tree *dvb_tdt_tree;
proto_item *ti;
proto_tree *dvb_tdt_tree;
nstime_t utc_time;
nstime_t utc_time;
col_set_str(pinfo->cinfo, COL_INFO, "Time and Date Table (TDT)");
col_set_str(pinfo->cinfo, COL_INFO, "Time and Date Table (TDT)");
ti = proto_tree_add_item(tree, proto_dvb_tdt, tvb, offset, -1, ENC_NA);
dvb_tdt_tree = proto_item_add_subtree(ti, ett_dvb_tdt);
ti = proto_tree_add_item(tree, proto_dvb_tdt, tvb, offset, -1, ENC_NA);
dvb_tdt_tree = proto_item_add_subtree(ti, ett_dvb_tdt);
offset += packet_mpeg_sect_header(tvb, offset, dvb_tdt_tree, NULL, NULL);
offset += packet_mpeg_sect_header(tvb, offset, dvb_tdt_tree, NULL, NULL);
if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &utc_time) < 0) {
proto_tree_add_text(dvb_tdt_tree, tvb, offset, 5, "Unparseable time");
} else {
proto_tree_add_time_format(dvb_tdt_tree, hf_dvb_tdt_utc_time, tvb, offset, 5, &utc_time,
"UTC Time : %s UTC", abs_time_to_str(&utc_time, ABSOLUTE_TIME_UTC, FALSE));
}
offset += 5;
if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &utc_time) < 0) {
proto_tree_add_text(dvb_tdt_tree, tvb, offset, 5, "Unparseable time");
} else {
proto_tree_add_time_format(dvb_tdt_tree, hf_dvb_tdt_utc_time, tvb, offset, 5, &utc_time,
"UTC Time : %s UTC", abs_time_to_str(&utc_time, ABSOLUTE_TIME_UTC, FALSE));
}
offset += 5;
proto_item_set_len(ti, offset);
proto_item_set_len(ti, offset);
}
@ -71,33 +71,33 @@ void
proto_register_dvb_tdt(void)
{
static hf_register_info hf[] = {
static hf_register_info hf[] = {
{ &hf_dvb_tdt_utc_time, {
"UTC Time", "dvb_tdt.utc_time",
FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL
} }
};
{ &hf_dvb_tdt_utc_time, {
"UTC Time", "dvb_tdt.utc_time",
FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL
} }
};
static gint *ett[] = {
&ett_dvb_tdt
};
static gint *ett[] = {
&ett_dvb_tdt
};
proto_dvb_tdt = proto_register_protocol("DVB Time and Date Table", "DVB TDT", "dvb_tdt");
proto_dvb_tdt = proto_register_protocol("DVB Time and Date Table", "DVB TDT", "dvb_tdt");
proto_register_field_array(proto_dvb_tdt, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
proto_register_field_array(proto_dvb_tdt, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
void proto_reg_handoff_dvb_tdt(void)
{
dissector_handle_t dvb_tdt_handle;
dissector_handle_t dvb_tdt_handle;
dvb_tdt_handle = create_dissector_handle(dissect_dvb_tdt, proto_dvb_tdt);
dvb_tdt_handle = create_dissector_handle(dissect_dvb_tdt, proto_dvb_tdt);
dissector_add_uint("mpeg_sect.tid", DVB_TDT_TID, dvb_tdt_handle);
dissector_add_uint("mpeg_sect.tid", DVB_TDT_TID, dvb_tdt_handle);
}
/*
@ -105,10 +105,10 @@ void proto_reg_handoff_dvb_tdt(void)
*
* Local variables:
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: t
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=4 noexpandtab:
* :indentSize=4:tabSize=4:noTabs=false:
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -39,50 +39,50 @@ static int hf_dvb_tot_descriptors_loop_length = -1;
static gint ett_dvb_tot = -1;
#define DVB_TOT_TID 0x73
#define DVB_TOT_TID 0x73
#define DVB_TOT_RESERVED_MASK 0xF000
#define DVB_TOT_DESCRIPTORS_LOOP_LENGTH_MASK 0x0FFF
#define DVB_TOT_RESERVED_MASK 0xF000
#define DVB_TOT_DESCRIPTORS_LOOP_LENGTH_MASK 0x0FFF
static void
dissect_dvb_tot(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint offset = 0;
guint descriptor_len, descriptor_end;
guint offset = 0;
guint descriptor_len, descriptor_end;
proto_item *ti;
proto_tree *dvb_tot_tree;
proto_item *ti;
proto_tree *dvb_tot_tree;
nstime_t utc_time;
nstime_t utc_time;
col_set_str(pinfo->cinfo, COL_INFO, "Time Offset Table (TOT)");
col_set_str(pinfo->cinfo, COL_INFO, "Time Offset Table (TOT)");
ti = proto_tree_add_item(tree, proto_dvb_tot, tvb, offset, -1, ENC_NA);
dvb_tot_tree = proto_item_add_subtree(ti, ett_dvb_tot);
ti = proto_tree_add_item(tree, proto_dvb_tot, tvb, offset, -1, ENC_NA);
dvb_tot_tree = proto_item_add_subtree(ti, ett_dvb_tot);
offset += packet_mpeg_sect_header(tvb, offset, dvb_tot_tree, NULL, NULL);
offset += packet_mpeg_sect_header(tvb, offset, dvb_tot_tree, NULL, NULL);
if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &utc_time) < 0) {
proto_tree_add_text(dvb_tot_tree, tvb, offset, 5, "UTC Time : Unparseable time");
} else {
proto_tree_add_time_format(dvb_tot_tree, hf_dvb_tot_utc_time, tvb, offset, 5, &utc_time,
"UTC Time : %s UTC", abs_time_to_str(&utc_time, ABSOLUTE_TIME_UTC, FALSE));
}
if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &utc_time) < 0) {
proto_tree_add_text(dvb_tot_tree, tvb, offset, 5, "UTC Time : Unparseable time");
} else {
proto_tree_add_time_format(dvb_tot_tree, hf_dvb_tot_utc_time, tvb, offset, 5, &utc_time,
"UTC Time : %s UTC", abs_time_to_str(&utc_time, ABSOLUTE_TIME_UTC, FALSE));
}
offset += 5;
offset += 5;
descriptor_len = tvb_get_ntohs(tvb, offset) & DVB_TOT_DESCRIPTORS_LOOP_LENGTH_MASK;
proto_tree_add_item(dvb_tot_tree, hf_dvb_tot_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_tot_tree, hf_dvb_tot_descriptors_loop_length, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
descriptor_len = tvb_get_ntohs(tvb, offset) & DVB_TOT_DESCRIPTORS_LOOP_LENGTH_MASK;
proto_tree_add_item(dvb_tot_tree, hf_dvb_tot_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_tot_tree, hf_dvb_tot_descriptors_loop_length, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
descriptor_end = offset + descriptor_len;
while (offset < descriptor_end)
offset += proto_mpeg_descriptor_dissect(tvb, offset, dvb_tot_tree);
descriptor_end = offset + descriptor_len;
while (offset < descriptor_end)
offset += proto_mpeg_descriptor_dissect(tvb, offset, dvb_tot_tree);
offset += packet_mpeg_sect_crc(tvb, pinfo, dvb_tot_tree, 0, offset);
proto_item_set_len(ti, offset);
offset += packet_mpeg_sect_crc(tvb, pinfo, dvb_tot_tree, 0, offset);
proto_item_set_len(ti, offset);
}
@ -90,43 +90,43 @@ void
proto_register_dvb_tot(void)
{
static hf_register_info hf[] = {
static hf_register_info hf[] = {
{ &hf_dvb_tot_utc_time, {
"UTC Time", "dvb_tot.utc_time",
FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_tot_utc_time, {
"UTC Time", "dvb_tot.utc_time",
FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL
} },
{ &hf_dvb_tot_reserved, {
"Reserved", "dvb_tot.reserved",
FT_UINT16, BASE_HEX, NULL, DVB_TOT_RESERVED_MASK, NULL, HFILL
} },
{ &hf_dvb_tot_reserved, {
"Reserved", "dvb_tot.reserved",
FT_UINT16, BASE_HEX, NULL, DVB_TOT_RESERVED_MASK, NULL, HFILL
} },
{ &hf_dvb_tot_descriptors_loop_length, {
"Descriptors Loop Length", "dvb_tot.descr_loop_len",
FT_UINT16, BASE_DEC, NULL, DVB_TOT_DESCRIPTORS_LOOP_LENGTH_MASK, NULL, HFILL
} }
};
{ &hf_dvb_tot_descriptors_loop_length, {
"Descriptors Loop Length", "dvb_tot.descr_loop_len",
FT_UINT16, BASE_DEC, NULL, DVB_TOT_DESCRIPTORS_LOOP_LENGTH_MASK, NULL, HFILL
} }
};
static gint *ett[] = {
&ett_dvb_tot
};
static gint *ett[] = {
&ett_dvb_tot
};
proto_dvb_tot = proto_register_protocol("DVB Time Offset Table", "DVB TOT", "dvb_tot");
proto_dvb_tot = proto_register_protocol("DVB Time Offset Table", "DVB TOT", "dvb_tot");
proto_register_field_array(proto_dvb_tot, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
proto_register_field_array(proto_dvb_tot, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
void proto_reg_handoff_dvb_tot(void)
{
dissector_handle_t dvb_tot_handle;
dissector_handle_t dvb_tot_handle;
dvb_tot_handle = create_dissector_handle(dissect_dvb_tot, proto_dvb_tot);
dvb_tot_handle = create_dissector_handle(dissect_dvb_tot, proto_dvb_tot);
dissector_add_uint("mpeg_sect.tid", DVB_TOT_TID, dvb_tot_handle);
dissector_add_uint("mpeg_sect.tid", DVB_TOT_TID, dvb_tot_handle);
}
/*
@ -134,10 +134,10 @@ void proto_reg_handoff_dvb_tot(void)
*
* Local variables:
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: t
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=4 noexpandtab:
* :indentSize=4:tabSize=4:noTabs=false:
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -41,17 +41,17 @@ static int hf_mpeg_ca_last_section_number = -1;
static gint ett_mpeg_ca = -1;
#define MPEG_CA_TID 0x01
#define MPEG_CA_TID 0x01
#define MPEG_CA_RESERVED_MASK 0xFFFFC0
#define MPEG_CA_VERSION_NUMBER_MASK 0x00003E
#define MPEG_CA_CURRENT_NEXT_INDICATOR_MASK 0x000001
#define MPEG_CA_RESERVED_MASK 0xFFFFC0
#define MPEG_CA_VERSION_NUMBER_MASK 0x00003E
#define MPEG_CA_CURRENT_NEXT_INDICATOR_MASK 0x000001
static const value_string mpeg_ca_cur_next_vals[] = {
{ 0x0, "Not yet applicable" },
{ 0x1, "Currently applicable" },
{ 0x0, NULL }
{ 0x0, "Not yet applicable" },
{ 0x1, "Currently applicable" },
{ 0x0, NULL }
};
@ -59,39 +59,39 @@ static void
dissect_mpeg_ca(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint offset = 0, length = 0;
guint offset = 0, length = 0;
proto_item *ti;
proto_tree *mpeg_ca_tree;
proto_item *ti;
proto_tree *mpeg_ca_tree;
/* The TVB should start right after the section_length in the Section packet */
/* The TVB should start right after the section_length in the Section packet */
col_set_str(pinfo->cinfo, COL_INFO, "Conditional Access Table (CA)");
col_set_str(pinfo->cinfo, COL_INFO, "Conditional Access Table (CA)");
ti = proto_tree_add_item(tree, proto_mpeg_ca, tvb, offset, -1, ENC_NA);
mpeg_ca_tree = proto_item_add_subtree(ti, ett_mpeg_ca);
ti = proto_tree_add_item(tree, proto_mpeg_ca, tvb, offset, -1, ENC_NA);
mpeg_ca_tree = proto_item_add_subtree(ti, ett_mpeg_ca);
offset += packet_mpeg_sect_header(tvb, offset, mpeg_ca_tree, &length, NULL);
length -= 4;
offset += packet_mpeg_sect_header(tvb, offset, mpeg_ca_tree, &length, NULL);
length -= 4;
proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_reserved, tvb, offset, 3, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_version_number, tvb, offset, 3, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_current_next_indicator, tvb, offset, 3, ENC_BIG_ENDIAN);
offset += 3;
proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_reserved, tvb, offset, 3, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_version_number, tvb, offset, 3, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_current_next_indicator, tvb, offset, 3, ENC_BIG_ENDIAN);
offset += 3;
proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
/* Parse all the programs */
while (offset < length)
offset += proto_mpeg_descriptor_dissect(tvb, offset, mpeg_ca_tree);
/* Parse all the programs */
while (offset < length)
offset += proto_mpeg_descriptor_dissect(tvb, offset, mpeg_ca_tree);
offset += packet_mpeg_sect_crc(tvb, pinfo, mpeg_ca_tree, 0, offset);
offset += packet_mpeg_sect_crc(tvb, pinfo, mpeg_ca_tree, 0, offset);
proto_item_set_len(ti, offset);
proto_item_set_len(ti, offset);
}
@ -99,58 +99,58 @@ void
proto_register_mpeg_ca(void)
{
static hf_register_info hf[] = {
static hf_register_info hf[] = {
{ &hf_mpeg_ca_reserved, {
"Reserved", "mpeg_ca.reserved",
FT_UINT24, BASE_HEX, NULL, MPEG_CA_RESERVED_MASK,
{ &hf_mpeg_ca_reserved, {
"Reserved", "mpeg_ca.reserved",
FT_UINT24, BASE_HEX, NULL, MPEG_CA_RESERVED_MASK,
NULL, HFILL
} },
} },
{ &hf_mpeg_ca_version_number, {
"Version Number", "mpeg_ca.version",
FT_UINT24, BASE_HEX, NULL, MPEG_CA_VERSION_NUMBER_MASK,
{ &hf_mpeg_ca_version_number, {
"Version Number", "mpeg_ca.version",
FT_UINT24, BASE_HEX, NULL, MPEG_CA_VERSION_NUMBER_MASK,
NULL, HFILL
} },
} },
{ &hf_mpeg_ca_current_next_indicator, {
"Current/Next Indicator", "mpeg_ca.cur_next_ind",
FT_UINT24, BASE_HEX, VALS(mpeg_ca_cur_next_vals), MPEG_CA_CURRENT_NEXT_INDICATOR_MASK,
{ &hf_mpeg_ca_current_next_indicator, {
"Current/Next Indicator", "mpeg_ca.cur_next_ind",
FT_UINT24, BASE_HEX, VALS(mpeg_ca_cur_next_vals), MPEG_CA_CURRENT_NEXT_INDICATOR_MASK,
NULL, HFILL
} },
} },
{ &hf_mpeg_ca_section_number, {
"Section Number", "mpeg_ca.sect_num",
FT_UINT8, BASE_DEC, NULL, 0,
{ &hf_mpeg_ca_section_number, {
"Section Number", "mpeg_ca.sect_num",
FT_UINT8, BASE_DEC, NULL, 0,
NULL, HFILL
} },
} },
{ &hf_mpeg_ca_last_section_number, {
"Last Section Number", "mpeg_ca.last_sect_num",
FT_UINT8, BASE_DEC, NULL, 0,
{ &hf_mpeg_ca_last_section_number, {
"Last Section Number", "mpeg_ca.last_sect_num",
FT_UINT8, BASE_DEC, NULL, 0,
NULL, HFILL
} },
} },
};
};
static gint *ett[] = {
&ett_mpeg_ca,
};
static gint *ett[] = {
&ett_mpeg_ca,
};
proto_mpeg_ca = proto_register_protocol("MPEG2 Conditional Access Table", "MPEG CA", "mpeg_ca");
proto_mpeg_ca = proto_register_protocol("MPEG2 Conditional Access Table", "MPEG CA", "mpeg_ca");
proto_register_field_array(proto_mpeg_ca, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
proto_register_field_array(proto_mpeg_ca, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
void proto_reg_handoff_mpeg_ca(void)
{
dissector_handle_t mpeg_ca_handle;
dissector_handle_t mpeg_ca_handle;
mpeg_ca_handle = create_dissector_handle(dissect_mpeg_ca, proto_mpeg_ca);
dissector_add_uint("mpeg_sect.tid", MPEG_CA_TID, mpeg_ca_handle);
mpeg_ca_handle = create_dissector_handle(dissect_mpeg_ca, proto_mpeg_ca);
dissector_add_uint("mpeg_sect.tid", MPEG_CA_TID, mpeg_ca_handle);
}
/*
@ -158,10 +158,10 @@ void proto_reg_handoff_mpeg_ca(void)
*
* Local variables:
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: t
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=4 noexpandtab:
* :indentSize=4:tabSize=4:noTabs=false:
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -47,18 +47,18 @@ static int hf_mpeg_pat_program_map_pid = -1;
static gint ett_mpeg_pat = -1;
static gint ett_mpeg_pat_prog = -1;
#define MPEG_PAT_TID 0x00
#define MPEG_PAT_TID 0x00
#define MPEG_PAT_RESERVED_MASK 0xC0
#define MPEG_PAT_VERSION_NUMBER_MASK 0x3E
#define MPEG_PAT_CURRENT_NEXT_INDICATOR_MASK 0x01
#define MPEG_PAT_RESERVED_MASK 0xC0
#define MPEG_PAT_VERSION_NUMBER_MASK 0x3E
#define MPEG_PAT_CURRENT_NEXT_INDICATOR_MASK 0x01
#define MPEG_PAT_PROGRAM_RESERVED_MASK 0xE000
#define MPEG_PAT_PROGRAM_MAP_PID_MASK 0x1FFF
#define MPEG_PAT_PROGRAM_RESERVED_MASK 0xE000
#define MPEG_PAT_PROGRAM_MAP_PID_MASK 0x1FFF
static const true_false_string mpeg_pat_cur_next_vals = {
"Currently applicable", "Not yet applicable"
"Currently applicable", "Not yet applicable"
};
@ -66,63 +66,62 @@ static void
dissect_mpeg_pat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint offset = 0, length = 0;
guint16 prog_num = 0, prog_pid;
guint offset = 0, length = 0;
guint16 prog_num, prog_pid;
proto_item *ti;
proto_tree *mpeg_pat_tree;
proto_item *pi;
proto_tree *mpeg_pat_prog_tree;
proto_item *ti;
proto_tree *mpeg_pat_tree;
proto_item *pi;
proto_tree *mpeg_pat_prog_tree;
/* The TVB should start right after the section_length in the Section packet */
/* The TVB should start right after the section_length in the Section packet */
col_clear(pinfo->cinfo, COL_INFO);
col_set_str(pinfo->cinfo, COL_INFO, "Program Association Table (PAT)");
col_set_str(pinfo->cinfo, COL_INFO, "Program Association Table (PAT)");
ti = proto_tree_add_item(tree, proto_mpeg_pat, tvb, offset, -1, ENC_NA);
mpeg_pat_tree = proto_item_add_subtree(ti, ett_mpeg_pat);
ti = proto_tree_add_item(tree, proto_mpeg_pat, tvb, offset, -1, ENC_NA);
mpeg_pat_tree = proto_item_add_subtree(ti, ett_mpeg_pat);
offset += packet_mpeg_sect_header(tvb, offset, mpeg_pat_tree, &length, NULL);
length -= 4;
offset += packet_mpeg_sect_header(tvb, offset, mpeg_pat_tree, &length, NULL);
length -= 4;
proto_tree_add_item(mpeg_pat_tree, hf_mpeg_pat_transport_stream_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(mpeg_pat_tree, hf_mpeg_pat_transport_stream_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(mpeg_pat_tree, hf_mpeg_pat_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_pat_tree, hf_mpeg_pat_version_number, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_pat_tree, hf_mpeg_pat_current_next_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(mpeg_pat_tree, hf_mpeg_pat_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_pat_tree, hf_mpeg_pat_version_number, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_pat_tree, hf_mpeg_pat_current_next_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(mpeg_pat_tree, hf_mpeg_pat_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(mpeg_pat_tree, hf_mpeg_pat_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(mpeg_pat_tree, hf_mpeg_pat_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(mpeg_pat_tree, hf_mpeg_pat_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
if (offset >= length)
return;
if (offset >= length)
return;
/* Parse all the programs */
while (offset < length) {
/* Parse all the programs */
while (offset < length) {
prog_num = tvb_get_ntohs(tvb, offset);
prog_pid = tvb_get_ntohs(tvb, offset + 2) & MPEG_PAT_PROGRAM_MAP_PID_MASK;
prog_num = tvb_get_ntohs(tvb, offset);
prog_pid = tvb_get_ntohs(tvb, offset + 2) & MPEG_PAT_PROGRAM_MAP_PID_MASK;
pi = proto_tree_add_text(mpeg_pat_tree, tvb, offset, 4, "Program 0x%04hx -> PID 0x%04hx", prog_num, prog_pid);
mpeg_pat_prog_tree = proto_item_add_subtree(pi, ett_mpeg_pat_prog);
pi = proto_tree_add_text(mpeg_pat_tree, tvb, offset, 4, "Program 0x%04hx -> PID 0x%04hx", prog_num, prog_pid);
mpeg_pat_prog_tree = proto_item_add_subtree(pi, ett_mpeg_pat_prog);
proto_tree_add_item(mpeg_pat_prog_tree, hf_mpeg_pat_program_number, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(mpeg_pat_prog_tree, hf_mpeg_pat_program_number, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(mpeg_pat_prog_tree, hf_mpeg_pat_program_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_pat_prog_tree, hf_mpeg_pat_program_map_pid, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(mpeg_pat_prog_tree, hf_mpeg_pat_program_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_pat_prog_tree, hf_mpeg_pat_program_map_pid, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
}
}
offset += packet_mpeg_sect_crc(tvb, pinfo, mpeg_pat_tree, 0, offset);
proto_item_set_len(ti, offset);
offset += packet_mpeg_sect_crc(tvb, pinfo, mpeg_pat_tree, 0, offset);
proto_item_set_len(ti, offset);
}
@ -130,74 +129,74 @@ void
proto_register_mpeg_pat(void)
{
static hf_register_info hf[] = {
static hf_register_info hf[] = {
{ &hf_mpeg_pat_transport_stream_id, {
"Transport Stream ID", "mpeg_pat.tsid",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_mpeg_pat_transport_stream_id, {
"Transport Stream ID", "mpeg_pat.tsid",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_mpeg_pat_reserved, {
"Reserved", "mpeg_pat.reserved",
FT_UINT8, BASE_HEX, NULL, MPEG_PAT_RESERVED_MASK, NULL, HFILL
} },
{ &hf_mpeg_pat_reserved, {
"Reserved", "mpeg_pat.reserved",
FT_UINT8, BASE_HEX, NULL, MPEG_PAT_RESERVED_MASK, NULL, HFILL
} },
{ &hf_mpeg_pat_version_number, {
"Version Number", "mpeg_pat.version",
FT_UINT8, BASE_HEX, NULL, MPEG_PAT_VERSION_NUMBER_MASK, NULL, HFILL
} },
{ &hf_mpeg_pat_version_number, {
"Version Number", "mpeg_pat.version",
FT_UINT8, BASE_HEX, NULL, MPEG_PAT_VERSION_NUMBER_MASK, NULL, HFILL
} },
{ &hf_mpeg_pat_current_next_indicator, {
"Current/Next Indicator", "mpeg_pat.cur_next_ind",
FT_BOOLEAN, 8, TFS(&mpeg_pat_cur_next_vals), MPEG_PAT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_mpeg_pat_current_next_indicator, {
"Current/Next Indicator", "mpeg_pat.cur_next_ind",
FT_BOOLEAN, 8, TFS(&mpeg_pat_cur_next_vals), MPEG_PAT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_mpeg_pat_section_number, {
"Section Number", "mpeg_pat.sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_mpeg_pat_section_number, {
"Section Number", "mpeg_pat.sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_mpeg_pat_last_section_number, {
"Last Section Number", "mpeg_pat.last_sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_mpeg_pat_last_section_number, {
"Last Section Number", "mpeg_pat.last_sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_mpeg_pat_program_number, {
"Program Number", "mpeg_pat.prog_num",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_mpeg_pat_program_number, {
"Program Number", "mpeg_pat.prog_num",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_mpeg_pat_program_reserved, {
"Reserved", "mpeg_pat.prog_reserved",
FT_UINT16, BASE_HEX, NULL, MPEG_PAT_PROGRAM_RESERVED_MASK, NULL, HFILL
} },
{ &hf_mpeg_pat_program_reserved, {
"Reserved", "mpeg_pat.prog_reserved",
FT_UINT16, BASE_HEX, NULL, MPEG_PAT_PROGRAM_RESERVED_MASK, NULL, HFILL
} },
{ &hf_mpeg_pat_program_map_pid, {
"Program Map PID", "mpeg_pat.prog_map_pid",
FT_UINT16, BASE_HEX, NULL, MPEG_PAT_PROGRAM_MAP_PID_MASK, NULL, HFILL
} },
{ &hf_mpeg_pat_program_map_pid, {
"Program Map PID", "mpeg_pat.prog_map_pid",
FT_UINT16, BASE_HEX, NULL, MPEG_PAT_PROGRAM_MAP_PID_MASK, NULL, HFILL
} },
};
};
static gint *ett[] = {
&ett_mpeg_pat,
&ett_mpeg_pat_prog
};
static gint *ett[] = {
&ett_mpeg_pat,
&ett_mpeg_pat_prog
};
proto_mpeg_pat = proto_register_protocol("MPEG2 Program Association Table", "MPEG PAT", "mpeg_pat");
proto_mpeg_pat = proto_register_protocol("MPEG2 Program Association Table", "MPEG PAT", "mpeg_pat");
proto_register_field_array(proto_mpeg_pat, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
proto_register_field_array(proto_mpeg_pat, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
void proto_reg_handoff_mpeg_pat(void)
{
dissector_handle_t mpeg_pat_handle;
dissector_handle_t mpeg_pat_handle;
mpeg_pat_handle = create_dissector_handle(dissect_mpeg_pat, proto_mpeg_pat);
dissector_add_uint("mpeg_sect.tid", MPEG_PAT_TID, mpeg_pat_handle);
mpeg_pat_handle = create_dissector_handle(dissect_mpeg_pat, proto_mpeg_pat);
dissector_add_uint("mpeg_sect.tid", MPEG_PAT_TID, mpeg_pat_handle);
}
/*
@ -205,10 +204,10 @@ void proto_reg_handoff_mpeg_pat(void)
*
* Local variables:
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: t
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=4 noexpandtab:
* :indentSize=4:tabSize=4:noTabs=false:
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -54,66 +54,66 @@ static int hf_mpeg_pmt_stream_es_info_length = -1;
static gint ett_mpeg_pmt = -1;
static gint ett_mpeg_pmt_stream = -1;
#define MPEG_PMT_TID 0x02
#define MPEG_PMT_TID 0x02
#define MPEG_PMT_RESERVED1_MASK 0xC0
#define MPEG_PMT_VERSION_NUMBER_MASK 0x3E
#define MPEG_PMT_CURRENT_NEXT_INDICATOR_MASK 0x01
#define MPEG_PMT_RESERVED1_MASK 0xC0
#define MPEG_PMT_VERSION_NUMBER_MASK 0x3E
#define MPEG_PMT_CURRENT_NEXT_INDICATOR_MASK 0x01
#define MPEG_PMT_RESERVED2_MASK 0xE000
#define MPEG_PMT_PCR_PID_MASK 0x1FFF
#define MPEG_PMT_RESERVED3_MASK 0xF000
#define MPEG_PMT_PROGRAM_INFO_LENGTH_MASK 0x0FFF
#define MPEG_PMT_RESERVED2_MASK 0xE000
#define MPEG_PMT_PCR_PID_MASK 0x1FFF
#define MPEG_PMT_RESERVED3_MASK 0xF000
#define MPEG_PMT_PROGRAM_INFO_LENGTH_MASK 0x0FFF
#define MPEG_PMT_STREAM_RESERVED1_MASK 0xE000
#define MPEG_PMT_STREAM_ELEMENTARY_PID_MASK 0x1FFF
#define MPEG_PMT_STREAM_RESERVED1_MASK 0xE000
#define MPEG_PMT_STREAM_ELEMENTARY_PID_MASK 0x1FFF
#define MPEG_PMT_STREAM_RESERVED2_MASK 0xF000
#define MPEG_PMT_STREAM_ES_INFO_LENGTH_MASK 0x0FFF
#define MPEG_PMT_STREAM_RESERVED2_MASK 0xF000
#define MPEG_PMT_STREAM_ES_INFO_LENGTH_MASK 0x0FFF
static const value_string mpeg_pmt_cur_next_vals[] = {
{ 0x0, "Not yet applicable" },
{ 0x1, "Currently applicable" },
{ 0x0, "Not yet applicable" },
{ 0x1, "Currently applicable" },
{ 0x0, NULL }
{ 0x0, NULL }
};
static const value_string mpeg_pmt_stream_type_vals[] = {
{ 0x00, "ITU-T | ISO/IEC Reserved" },
{ 0x01, "ISO/IEC 11172 Video" },
{ 0x02, "ITU-T Rec. H.262 | ISO/IEC 13818-2 Video or ISO/IEC 11172-2 constrained parameter video stream" },
{ 0x03, "ISO/IEC 11172 Audio" },
{ 0x04, "ISO/IEC 13818-3 Audio" },
{ 0x05, "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 private_sections" },
{ 0x06, "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 PES packets containing private data" },
{ 0x07, "ISO/IEC 13522 MHEG" },
{ 0x08, "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Annex A DSM-CC" },
{ 0x09, "ITU-T Rec. H.222.1" },
{ 0x0A, "ISO/IEC 13818-6 type A" },
{ 0x0B, "ISO/IEC 13818-6 type B" },
{ 0x0C, "ISO/IEC 13818-6 type C" },
{ 0x0D, "ISO/IEC 13818-6 type D" },
{ 0x0E, "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 auxiliary" },
{ 0x0F, "ISO/IEC 13818-7 Audio with ADTS transport syntax" },
{ 0x10, "ISO/IEC 14496-2 Visual" },
{ 0x11, "ISO/IEC 14496-3 Audio with the LATM transport syntax as defined in ISO/IEC 14496-3 / AMD 1" },
{ 0x12, "ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in PES packets" },
{ 0x13, "ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in ISO/IEC14496_sections" },
{ 0x14, "ISO/IEC 13818-6 Synchronized Download Protocol" },
{ 0x15, "Metadata carried in PES packets" },
{ 0x16, "Metadata carried in metadata sections" },
{ 0x17, "Metadata carried in ISO/IEC 13818-6 Data Carousel" },
{ 0x18, "Metadata carried in ISO/IEC 13818-6 Object Carousel" },
{ 0x19, "Metadata carried in ISO/IEC 13818-6 Synchronized Download Protocol" },
{ 0x1A, "IPMP stream (defined in ISO/IEC 13818-11, MPEG-2 IPMP)" },
{ 0x1B, "AVC video stream as defined in ITU-T Rec. H.264 | ISO/IEC 14496-10 Video" },
{ 0x7F, "IPMP stream" },
{ 0xA1, "ETV-AM BIF Data Stream" },
{ 0xC0, "ETV-AM EISS Signaling" },
{ 0x00, NULL }
{ 0x00, "ITU-T | ISO/IEC Reserved" },
{ 0x01, "ISO/IEC 11172 Video" },
{ 0x02, "ITU-T Rec. H.262 | ISO/IEC 13818-2 Video or ISO/IEC 11172-2 constrained parameter video stream" },
{ 0x03, "ISO/IEC 11172 Audio" },
{ 0x04, "ISO/IEC 13818-3 Audio" },
{ 0x05, "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 private_sections" },
{ 0x06, "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 PES packets containing private data" },
{ 0x07, "ISO/IEC 13522 MHEG" },
{ 0x08, "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Annex A DSM-CC" },
{ 0x09, "ITU-T Rec. H.222.1" },
{ 0x0A, "ISO/IEC 13818-6 type A" },
{ 0x0B, "ISO/IEC 13818-6 type B" },
{ 0x0C, "ISO/IEC 13818-6 type C" },
{ 0x0D, "ISO/IEC 13818-6 type D" },
{ 0x0E, "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 auxiliary" },
{ 0x0F, "ISO/IEC 13818-7 Audio with ADTS transport syntax" },
{ 0x10, "ISO/IEC 14496-2 Visual" },
{ 0x11, "ISO/IEC 14496-3 Audio with the LATM transport syntax as defined in ISO/IEC 14496-3 / AMD 1" },
{ 0x12, "ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in PES packets" },
{ 0x13, "ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in ISO/IEC14496_sections" },
{ 0x14, "ISO/IEC 13818-6 Synchronized Download Protocol" },
{ 0x15, "Metadata carried in PES packets" },
{ 0x16, "Metadata carried in metadata sections" },
{ 0x17, "Metadata carried in ISO/IEC 13818-6 Data Carousel" },
{ 0x18, "Metadata carried in ISO/IEC 13818-6 Object Carousel" },
{ 0x19, "Metadata carried in ISO/IEC 13818-6 Synchronized Download Protocol" },
{ 0x1A, "IPMP stream (defined in ISO/IEC 13818-11, MPEG-2 IPMP)" },
{ 0x1B, "AVC video stream as defined in ITU-T Rec. H.264 | ISO/IEC 14496-10 Video" },
{ 0x7F, "IPMP stream" },
{ 0xA1, "ETV-AM BIF Data Stream" },
{ 0xC0, "ETV-AM EISS Signaling" },
{ 0x00, NULL }
};
static value_string_ext mpeg_pmt_stream_type_vals_ext = VALUE_STRING_EXT_INIT(mpeg_pmt_stream_type_vals);
@ -121,81 +121,81 @@ static int
dissect_mpeg_pmt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
guint offset = 0, length = 0;
guint descriptor_end, prog_info_len, es_info_len;
guint16 pid;
guint offset = 0, length = 0;
guint descriptor_end, prog_info_len, es_info_len;
guint16 pid;
proto_item *ti;
proto_tree *mpeg_pmt_tree;
proto_item *si;
proto_tree *mpeg_pmt_stream_tree;
proto_item *ti;
proto_tree *mpeg_pmt_tree;
proto_item *si;
proto_tree *mpeg_pmt_stream_tree;
/* The TVB should start right after the section_length in the Section packet */
/* The TVB should start right after the section_length in the Section packet */
col_set_str(pinfo->cinfo, COL_INFO, "Program Map Table (PMT)");
col_set_str(pinfo->cinfo, COL_INFO, "Program Map Table (PMT)");
ti = proto_tree_add_item(tree, proto_mpeg_pmt, tvb, offset, -1, ENC_NA);
mpeg_pmt_tree = proto_item_add_subtree(ti, ett_mpeg_pmt);
ti = proto_tree_add_item(tree, proto_mpeg_pmt, tvb, offset, -1, ENC_NA);
mpeg_pmt_tree = proto_item_add_subtree(ti, ett_mpeg_pmt);
offset += packet_mpeg_sect_header(tvb, offset, mpeg_pmt_tree, &length, NULL);
length -= 4;
offset += packet_mpeg_sect_header(tvb, offset, mpeg_pmt_tree, &length, NULL);
length -= 4;
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_program_number, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_program_number, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_version_number, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_current_next_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_version_number, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_current_next_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_reserved2, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_pcr_pid, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_reserved2, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_pcr_pid, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
prog_info_len = tvb_get_ntohs(tvb, offset) & MPEG_PMT_PROGRAM_INFO_LENGTH_MASK;
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_reserved3, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_program_info_length, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
prog_info_len = tvb_get_ntohs(tvb, offset) & MPEG_PMT_PROGRAM_INFO_LENGTH_MASK;
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_reserved3, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_program_info_length, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
descriptor_end = offset + prog_info_len;
while (offset < descriptor_end)
offset += proto_mpeg_descriptor_dissect(tvb, offset, mpeg_pmt_tree);
descriptor_end = offset + prog_info_len;
while (offset < descriptor_end)
offset += proto_mpeg_descriptor_dissect(tvb, offset, mpeg_pmt_tree);
while (offset < length) {
while (offset < length) {
pid = tvb_get_ntohs(tvb, offset + 1) & MPEG_PMT_STREAM_ELEMENTARY_PID_MASK;
es_info_len = tvb_get_ntohs(tvb, offset + 3) & MPEG_PMT_STREAM_ES_INFO_LENGTH_MASK;
pid = tvb_get_ntohs(tvb, offset + 1) & MPEG_PMT_STREAM_ELEMENTARY_PID_MASK;
es_info_len = tvb_get_ntohs(tvb, offset + 3) & MPEG_PMT_STREAM_ES_INFO_LENGTH_MASK;
si = proto_tree_add_text(mpeg_pmt_tree, tvb, offset, 5 + es_info_len, "Stream PID=0x%04hx", pid);
mpeg_pmt_stream_tree = proto_item_add_subtree(si, ett_mpeg_pmt_stream);
si = proto_tree_add_text(mpeg_pmt_tree, tvb, offset, 5 + es_info_len, "Stream PID=0x%04hx", pid);
mpeg_pmt_stream_tree = proto_item_add_subtree(si, ett_mpeg_pmt_stream);
proto_tree_add_item(mpeg_pmt_stream_tree, hf_mpeg_pmt_stream_type, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
proto_tree_add_item(mpeg_pmt_stream_tree, hf_mpeg_pmt_stream_type, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(mpeg_pmt_stream_tree, hf_mpeg_pmt_stream_reserved1, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_pmt_stream_tree, hf_mpeg_pmt_stream_elementary_pid, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(mpeg_pmt_stream_tree, hf_mpeg_pmt_stream_reserved1, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_pmt_stream_tree, hf_mpeg_pmt_stream_elementary_pid, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(mpeg_pmt_stream_tree, hf_mpeg_pmt_stream_reserved2, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_pmt_stream_tree, hf_mpeg_pmt_stream_es_info_length, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(mpeg_pmt_stream_tree, hf_mpeg_pmt_stream_reserved2, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_pmt_stream_tree, hf_mpeg_pmt_stream_es_info_length, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
descriptor_end = offset + es_info_len;
while (offset < descriptor_end)
offset += proto_mpeg_descriptor_dissect(tvb, offset, mpeg_pmt_stream_tree);
descriptor_end = offset + es_info_len;
while (offset < descriptor_end)
offset += proto_mpeg_descriptor_dissect(tvb, offset, mpeg_pmt_stream_tree);
}
}
offset += packet_mpeg_sect_crc(tvb, pinfo, mpeg_pmt_tree, 0, offset);
offset += packet_mpeg_sect_crc(tvb, pinfo, mpeg_pmt_tree, 0, offset);
proto_item_set_len(ti, offset);
return offset;
proto_item_set_len(ti, offset);
return offset;
}
@ -203,107 +203,108 @@ void
proto_register_mpeg_pmt(void)
{
static hf_register_info hf[] = {
static hf_register_info hf[] = {
{ &hf_mpeg_pmt_program_number, {
"Program Number", "mpeg_pmt.pg_num",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_mpeg_pmt_program_number, {
"Program Number", "mpeg_pmt.pg_num",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
} },
{ &hf_mpeg_pmt_reserved1, {
"Reserved", "mpeg_pmt.reserved1",
FT_UINT8, BASE_HEX, NULL, MPEG_PMT_RESERVED1_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_reserved1, {
"Reserved", "mpeg_pmt.reserved1",
FT_UINT8, BASE_HEX, NULL, MPEG_PMT_RESERVED1_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_version_number, {
"Version Number", "mpeg_pmt.version",
FT_UINT8, BASE_HEX, NULL, MPEG_PMT_VERSION_NUMBER_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_version_number, {
"Version Number", "mpeg_pmt.version",
FT_UINT8, BASE_HEX, NULL, MPEG_PMT_VERSION_NUMBER_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_current_next_indicator, {
"Current/Next Indicator", "mpeg_pmt.cur_next_ind",
FT_UINT8, BASE_HEX, VALS(mpeg_pmt_cur_next_vals), MPEG_PMT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_current_next_indicator, {
"Current/Next Indicator", "mpeg_pmt.cur_next_ind",
FT_UINT8, BASE_HEX, VALS(mpeg_pmt_cur_next_vals), MPEG_PMT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_section_number, {
"Section Number", "mpeg_pmt.sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_mpeg_pmt_section_number, {
"Section Number", "mpeg_pmt.sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_mpeg_pmt_last_section_number, {
"Last Section Number", "mpeg_pmt.last_sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_mpeg_pmt_last_section_number, {
"Last Section Number", "mpeg_pmt.last_sect_num",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
} },
{ &hf_mpeg_pmt_reserved2, {
"Reserved", "mpeg_pmt.reserved2",
FT_UINT16, BASE_HEX, NULL, MPEG_PMT_RESERVED2_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_reserved2, {
"Reserved", "mpeg_pmt.reserved2",
FT_UINT16, BASE_HEX, NULL, MPEG_PMT_RESERVED2_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_pcr_pid, {
"PCR PID", "mpeg_pmt.pcr_pid",
FT_UINT16, BASE_HEX, NULL, MPEG_PMT_PCR_PID_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_pcr_pid, {
"PCR PID", "mpeg_pmt.pcr_pid",
FT_UINT16, BASE_HEX, NULL, MPEG_PMT_PCR_PID_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_reserved3, {
"Reserved", "mpeg_pmt.reserved3",
FT_UINT16, BASE_HEX, NULL, MPEG_PMT_RESERVED3_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_reserved3, {
"Reserved", "mpeg_pmt.reserved3",
FT_UINT16, BASE_HEX, NULL, MPEG_PMT_RESERVED3_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_program_info_length, {
"Program Info Length", "mpeg_pmt.prog_info_len",
FT_UINT16, BASE_HEX, NULL, MPEG_PMT_PROGRAM_INFO_LENGTH_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_program_info_length, {
"Program Info Length", "mpeg_pmt.prog_info_len",
FT_UINT16, BASE_HEX, NULL, MPEG_PMT_PROGRAM_INFO_LENGTH_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_stream_type, {
"Stream type", "mpeg_pmt.stream.type",
FT_UINT8, BASE_HEX | BASE_EXT_STRING, &mpeg_pmt_stream_type_vals_ext, 0, NULL, HFILL
} },
{ &hf_mpeg_pmt_stream_type, {
"Stream type", "mpeg_pmt.stream.type",
FT_UINT8, BASE_HEX | BASE_EXT_STRING, &mpeg_pmt_stream_type_vals_ext, 0, NULL, HFILL
} },
{ &hf_mpeg_pmt_stream_reserved1, {
"Reserved", "mpeg_pmt.stream.reserved1",
FT_UINT16, BASE_HEX, NULL, MPEG_PMT_STREAM_RESERVED1_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_stream_reserved1, {
"Reserved", "mpeg_pmt.stream.reserved1",
FT_UINT16, BASE_HEX, NULL, MPEG_PMT_STREAM_RESERVED1_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_stream_elementary_pid, {
"Elementary PID", "mpeg_pmt.stream.elementary_pid",
FT_UINT16, BASE_HEX, NULL, MPEG_PMT_STREAM_ELEMENTARY_PID_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_stream_elementary_pid, {
"Elementary PID", "mpeg_pmt.stream.elementary_pid",
FT_UINT16, BASE_HEX, NULL, MPEG_PMT_STREAM_ELEMENTARY_PID_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_stream_reserved2, {
"Reserved", "mpeg_pmt.stream.reserved2",
FT_UINT16, BASE_HEX, NULL, MPEG_PMT_STREAM_RESERVED2_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_stream_reserved2, {
"Reserved", "mpeg_pmt.stream.reserved2",
FT_UINT16, BASE_HEX, NULL, MPEG_PMT_STREAM_RESERVED2_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_stream_es_info_length, {
"ES Info Length", "mpeg_pmt.stream.es_info_len",
FT_UINT16, BASE_HEX, NULL, MPEG_PMT_STREAM_ES_INFO_LENGTH_MASK, NULL, HFILL
} },
{ &hf_mpeg_pmt_stream_es_info_length, {
"ES Info Length", "mpeg_pmt.stream.es_info_len",
FT_UINT16, BASE_HEX, NULL, MPEG_PMT_STREAM_ES_INFO_LENGTH_MASK, NULL, HFILL
} },
};
};
static gint *ett[] = {
&ett_mpeg_pmt,
&ett_mpeg_pmt_stream,
};
static gint *ett[] = {
&ett_mpeg_pmt,
&ett_mpeg_pmt_stream,
};
proto_mpeg_pmt = proto_register_protocol("MPEG2 Program Map Table", "MPEG PMT", "mpeg_pmt");
proto_mpeg_pmt = proto_register_protocol("MPEG2 Program Map Table", "MPEG PMT", "mpeg_pmt");
proto_register_field_array(proto_mpeg_pmt, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
proto_register_field_array(proto_mpeg_pmt, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
new_register_dissector("mpeg_pmt", dissect_mpeg_pmt, proto_mpeg_pmt);
new_register_dissector("mpeg_pmt", dissect_mpeg_pmt, proto_mpeg_pmt);
}
void
proto_reg_handoff_mpeg_pmt(void)
{
dissector_handle_t mpeg_pmt_handle;
dissector_handle_t mpeg_pmt_handle;
mpeg_pmt_handle = new_create_dissector_handle(dissect_mpeg_pmt, proto_mpeg_pmt);
dissector_add_uint("mpeg_sect.tid", MPEG_PMT_TID, mpeg_pmt_handle);
mpeg_pmt_handle = find_dissector("mpeg_pmt");
dissector_add_uint("mpeg_sect.tid", MPEG_PMT_TID, mpeg_pmt_handle);
}
/*
@ -311,10 +312,10 @@ proto_reg_handoff_mpeg_pmt(void)
*
* Local variables:
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: t
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=4 noexpandtab:
* :indentSize=4:tabSize=4:noTabs=false:
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -46,100 +46,100 @@ static dissector_table_t mpeg_sect_tid_dissector_table;
static gboolean mpeg_sect_check_crc = FALSE;
#define MPEG_SECT_SYNTAX_INDICATOR_MASK 0x8000
#define MPEG_SECT_RESERVED_MASK 0x7000
#define MPEG_SECT_LENGTH_MASK 0x0FFF
#define MPEG_SECT_SYNTAX_INDICATOR_MASK 0x8000
#define MPEG_SECT_RESERVED_MASK 0x7000
#define MPEG_SECT_LENGTH_MASK 0x0FFF
/* From ISO/IEC 13818-1 */
enum {
TID_PAT,
TID_CA,
TID_PMT,
TID_TS_DESC,
TID_SCENE_DESC,
TID_OBJECT_DESC,
TID_FORBIDEN = 0xFF
TID_PAT,
TID_CA,
TID_PMT,
TID_TS_DESC,
TID_SCENE_DESC,
TID_OBJECT_DESC,
TID_FORBIDEN = 0xFF
};
/* From ETSI EN 300 468 */
enum {
TID_NIT = 0x40,
TID_NIT_OTHER,
TID_SDT,
TID_SDT_OTHER = 0x46,
TID_BAT = 0x4A,
TID_EIT = 0x4E,
TID_EIT_OTHER,
TID_TDT = 0x70,
TID_RST,
TID_ST,
TID_TOT
TID_NIT = 0x40,
TID_NIT_OTHER,
TID_SDT,
TID_SDT_OTHER = 0x46,
TID_BAT = 0x4A,
TID_EIT = 0x4E,
TID_EIT_OTHER,
TID_TDT = 0x70,
TID_RST,
TID_ST,
TID_TOT
};
/* From ETSI EN 301 790 */
enum {
TID_RMT = 0x41, /* Conflict with TID_NIT_OTHER */
TID_SCT = 0xA0,
TID_FCT,
TID_TCT,
TID_SPT,
TID_CMT,
TID_TBTP,
TID_PCR,
TID_TIM = 0xB0
TID_RMT = 0x41, /* Conflict with TID_NIT_OTHER */
TID_SCT = 0xA0,
TID_FCT,
TID_TCT,
TID_SPT,
TID_CMT,
TID_TBTP,
TID_PCR,
TID_TIM = 0xB0
};
/* From ESTI EN 301 192 */
enum {
TID_DVB_MPE = 0x3E
TID_DVB_MPE = 0x3E
};
/* From OC-SP-ETV-AM 1.0-IO5 */
enum {
TID_ETV_EISS = 0xE0,
TID_ETV_DII = 0xE3,
TID_ETV_DDB = 0xE4
TID_ETV_EISS = 0xE0,
TID_ETV_DII = 0xE3,
TID_ETV_DDB = 0xE4
};
/* From ETSI TS 102 899 */
enum {
TID_AIT = 0x74
TID_AIT = 0x74
};
static const value_string mpeg_sect_table_id_vals[] = {
{ TID_PAT, "Program Association Table (PAT)" },
{ TID_CA, "Conditional Access (CA)" },
{ TID_PMT, "Program Map Table (PMT)" },
{ TID_TS_DESC, "Transport Stream Description" },
{ TID_SCENE_DESC, "ISO/IEC 14496 Scene Description" },
{ TID_OBJECT_DESC, "ISO/IEC 14496 Object Description" },
{ TID_NIT, "Network Information Table (NIT), current network" },
{ TID_NIT_OTHER, "Network Information Table (NIT), other network" },
{ TID_SDT, "Service Description Table (SDT), current network" },
{ TID_SDT_OTHER, "Service Description (SDT), other network" },
{ TID_BAT, "Bouquet Associatoin Table (BAT)" },
{ TID_EIT, "Event Information Table (EIT), actual TS" },
{ TID_EIT_OTHER, "Event Information Table (EIT), other TS" },
{ TID_TDT, "Time and Date Table (TDT)" },
{ TID_RST, "Running Status Table (RST)" },
{ TID_ST, "Stuffing Table (ST)" },
{ TID_TOT, "Time Offset Table (TOT)" },
{ TID_AIT, "Application Information Table (AIT)" },
{ TID_SCT, "Superframe Composition Table (SCT)" },
{ TID_FCT, "Frame Composition Table (FCT)" },
{ TID_TCT, "Time-Slot Composition Table (TCT)" },
{ TID_SPT, "Satellite Position Table (SPT)" },
{ TID_CMT, "Correction Message Table (CMT)" },
{ TID_TBTP, "Terminal Burst Time Plan (TBTP)" },
{ TID_TIM, "Terminal Information Message (TIM)" },
{ TID_DVB_MPE, "DVB MultiProtocol Encapsulation (MPE)" },
{ TID_ETV_EISS, "ETV Integrated Signaling Stream (EISS)" },
{ TID_ETV_DII, "ETV Download Info Indication" },
{ TID_ETV_DDB, "ETV Download Data Block" },
{ TID_FORBIDEN, "Forbidden" },
{ 0, NULL }
{ TID_PAT, "Program Association Table (PAT)" },
{ TID_CA, "Conditional Access (CA)" },
{ TID_PMT, "Program Map Table (PMT)" },
{ TID_TS_DESC, "Transport Stream Description" },
{ TID_SCENE_DESC, "ISO/IEC 14496 Scene Description" },
{ TID_OBJECT_DESC, "ISO/IEC 14496 Object Description" },
{ TID_NIT, "Network Information Table (NIT), current network" },
{ TID_NIT_OTHER, "Network Information Table (NIT), other network" },
{ TID_SDT, "Service Description Table (SDT), current network" },
{ TID_SDT_OTHER, "Service Description (SDT), other network" },
{ TID_BAT, "Bouquet Associatoin Table (BAT)" },
{ TID_EIT, "Event Information Table (EIT), actual TS" },
{ TID_EIT_OTHER, "Event Information Table (EIT), other TS" },
{ TID_TDT, "Time and Date Table (TDT)" },
{ TID_RST, "Running Status Table (RST)" },
{ TID_ST, "Stuffing Table (ST)" },
{ TID_TOT, "Time Offset Table (TOT)" },
{ TID_AIT, "Application Information Table (AIT)" },
{ TID_SCT, "Superframe Composition Table (SCT)" },
{ TID_FCT, "Frame Composition Table (FCT)" },
{ TID_TCT, "Time-Slot Composition Table (TCT)" },
{ TID_SPT, "Satellite Position Table (SPT)" },
{ TID_CMT, "Correction Message Table (CMT)" },
{ TID_TBTP, "Terminal Burst Time Plan (TBTP)" },
{ TID_TIM, "Terminal Information Message (TIM)" },
{ TID_DVB_MPE, "DVB MultiProtocol Encapsulation (MPE)" },
{ TID_ETV_EISS, "ETV Integrated Signaling Stream (EISS)" },
{ TID_ETV_DII, "ETV Download Info Indication" },
{ TID_ETV_DDB, "ETV Download Data Block" },
{ TID_FORBIDEN, "Forbidden" },
{ 0, NULL }
};
/* From packet-dvbci.c
@ -150,213 +150,213 @@ static const value_string mpeg_sect_table_id_vals[] = {
gint
packet_mpeg_sect_mjd_to_utc_time(tvbuff_t *tvb, gint offset, nstime_t *utc_time)
{
gint bcd_time_offset; /* start offset of the bcd time in the tvbuff */
guint8 hour, min, sec;
gint bcd_time_offset; /* start offset of the bcd time in the tvbuff */
guint8 hour, min, sec;
if (!utc_time)
return -1;
if (!utc_time)
return -1;
nstime_set_zero(utc_time);
utc_time->secs = (tvb_get_ntohs(tvb, offset) - 40587) * 86400;
bcd_time_offset = offset+2;
hour = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, bcd_time_offset));
min = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, bcd_time_offset+1));
sec = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, bcd_time_offset+2));
if (hour>23 || min>59 || sec>59)
return -1;
nstime_set_zero(utc_time);
utc_time->secs = (tvb_get_ntohs(tvb, offset) - 40587) * 86400;
bcd_time_offset = offset+2;
hour = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, bcd_time_offset));
min = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, bcd_time_offset+1));
sec = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, bcd_time_offset+2));
if (hour>23 || min>59 || sec>59)
return -1;
utc_time->secs += hour*3600 + min*60 + sec;
return 5;
utc_time->secs += hour*3600 + min*60 + sec;
return 5;
}
guint
packet_mpeg_sect_header(tvbuff_t *tvb, guint offset,
proto_tree *tree, guint *sect_len, gboolean *ssi)
proto_tree *tree, guint *sect_len, gboolean *ssi)
{
return packet_mpeg_sect_header_extra(tvb, offset, tree, sect_len,
NULL, ssi, NULL);
return packet_mpeg_sect_header_extra(tvb, offset, tree, sect_len,
NULL, ssi, NULL);
}
guint
packet_mpeg_sect_header_extra(tvbuff_t *tvb, guint offset, proto_tree *tree,
guint *sect_len, guint *reserved, gboolean *ssi,
proto_item **items)
guint *sect_len, guint *reserved, gboolean *ssi,
proto_item **items)
{
guint tmp;
guint len = 0;
proto_item *pi[PACKET_MPEG_SECT_PI__SIZE];
gint i;
guint tmp;
guint len = 0;
proto_item *pi[PACKET_MPEG_SECT_PI__SIZE];
gint i;
for (i = 0; i < PACKET_MPEG_SECT_PI__SIZE; i++) {
pi[i] = NULL;
}
for (i = 0; i < PACKET_MPEG_SECT_PI__SIZE; i++) {
pi[i] = NULL;
}
if (tree) {
pi[PACKET_MPEG_SECT_PI__TABLE_ID] =
proto_tree_add_item(tree, hf_mpeg_sect_table_id,
tvb, offset + len, 1, ENC_BIG_ENDIAN);
}
if (tree) {
pi[PACKET_MPEG_SECT_PI__TABLE_ID] =
proto_tree_add_item(tree, hf_mpeg_sect_table_id,
tvb, offset + len, 1, ENC_BIG_ENDIAN);
}
len++;
len++;
if (tree) {
pi[PACKET_MPEG_SECT_PI__SSI] =
proto_tree_add_item(tree, hf_mpeg_sect_syntax_indicator,
tvb, offset + len, 2, ENC_BIG_ENDIAN);
if (tree) {
pi[PACKET_MPEG_SECT_PI__SSI] =
proto_tree_add_item(tree, hf_mpeg_sect_syntax_indicator,
tvb, offset + len, 2, ENC_BIG_ENDIAN);
pi[PACKET_MPEG_SECT_PI__RESERVED] =
proto_tree_add_item(tree, hf_mpeg_sect_reserved, tvb,
offset + len, 2, ENC_BIG_ENDIAN);
pi[PACKET_MPEG_SECT_PI__RESERVED] =
proto_tree_add_item(tree, hf_mpeg_sect_reserved, tvb,
offset + len, 2, ENC_BIG_ENDIAN);
pi[PACKET_MPEG_SECT_PI__LENGTH] =
proto_tree_add_item(tree, hf_mpeg_sect_length, tvb,
offset + len, 2, ENC_BIG_ENDIAN);
}
pi[PACKET_MPEG_SECT_PI__LENGTH] =
proto_tree_add_item(tree, hf_mpeg_sect_length, tvb,
offset + len, 2, ENC_BIG_ENDIAN);
}
tmp = tvb_get_ntohs(tvb, offset + len);
tmp = tvb_get_ntohs(tvb, offset + len);
if (sect_len)
*sect_len = MPEG_SECT_LENGTH_MASK & tmp;
if (sect_len)
*sect_len = MPEG_SECT_LENGTH_MASK & tmp;
if (reserved)
*reserved = (MPEG_SECT_RESERVED_MASK & tmp) >> 12;
if (reserved)
*reserved = (MPEG_SECT_RESERVED_MASK & tmp) >> 12;
if (ssi)
*ssi = (MPEG_SECT_SYNTAX_INDICATOR_MASK & tmp);
if (ssi)
*ssi = (MPEG_SECT_SYNTAX_INDICATOR_MASK & tmp);
if (items) {
for (i = 0; i < PACKET_MPEG_SECT_PI__SIZE; i++) {
items[i] = pi[i];
}
}
if (items) {
for (i = 0; i < PACKET_MPEG_SECT_PI__SIZE; i++) {
items[i] = pi[i];
}
}
len += 2;
len += 2;
return len;
return len;
}
guint
packet_mpeg_sect_crc(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree, guint start, guint end)
proto_tree *tree, guint start, guint end)
{
guint32 crc, calculated_crc;
const char *label;
guint32 crc, calculated_crc;
const char *label;
crc = tvb_get_ntohl(tvb, end);
crc = tvb_get_ntohl(tvb, end);
calculated_crc = crc;
label = "Unverified";
if (mpeg_sect_check_crc) {
label = "Verified";
calculated_crc = crc32_mpeg2_tvb_offset(tvb, start, end);
}
calculated_crc = crc;
label = "Unverified";
if (mpeg_sect_check_crc) {
label = "Verified";
calculated_crc = crc32_mpeg2_tvb_offset(tvb, start, end);
}
if (calculated_crc == crc) {
proto_tree_add_uint_format( tree, hf_mpeg_sect_crc, tvb,
end, 4, crc, "CRC: 0x%08x [%s]", crc, label);
} else {
proto_item *msg_error = NULL;
if (calculated_crc == crc) {
proto_tree_add_uint_format( tree, hf_mpeg_sect_crc, tvb,
end, 4, crc, "CRC: 0x%08x [%s]", crc, label);
} else {
proto_item *msg_error = NULL;
msg_error = proto_tree_add_uint_format( tree, hf_mpeg_sect_crc, tvb,
end, 4, crc,
"CRC: 0x%08x [Failed Verification (Calculated: 0x%08x)]",
crc, calculated_crc );
PROTO_ITEM_SET_GENERATED(msg_error);
expert_add_info_format( pinfo, msg_error, PI_MALFORMED,
PI_ERROR, "Invalid CRC" );
}
msg_error = proto_tree_add_uint_format( tree, hf_mpeg_sect_crc, tvb,
end, 4, crc,
"CRC: 0x%08x [Failed Verification (Calculated: 0x%08x)]",
crc, calculated_crc );
PROTO_ITEM_SET_GENERATED(msg_error);
expert_add_info_format( pinfo, msg_error, PI_MALFORMED,
PI_ERROR, "Invalid CRC" );
}
return 4;
return 4;
}
static void
dissect_mpeg_sect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
gint offset = 0;
guint section_length = 0;
gboolean syntax_indicator = FALSE;
guint8 table_id;
gint offset = 0;
guint section_length = 0;
gboolean syntax_indicator = FALSE;
guint8 table_id;
proto_item *ti;
proto_tree *mpeg_sect_tree;
proto_item *ti;
proto_tree *mpeg_sect_tree;
table_id = tvb_get_guint8(tvb, offset);
table_id = tvb_get_guint8(tvb, offset);
/* Check if a dissector can parse the current table */
if (dissector_try_uint(mpeg_sect_tid_dissector_table, table_id, tvb, pinfo, tree))
return;
/* Check if a dissector can parse the current table */
if (dissector_try_uint(mpeg_sect_tid_dissector_table, table_id, tvb, pinfo, tree))
return;
/* If no dissector is registered, use the common one */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPEG SECT");
col_add_fstr(pinfo->cinfo, COL_INFO, "Table ID 0x%02x", table_id);
/* If no dissector is registered, use the common one */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPEG SECT");
col_add_fstr(pinfo->cinfo, COL_INFO, "Table ID 0x%02x", table_id);
ti = proto_tree_add_item(tree, proto_mpeg_sect, tvb, offset, -1, ENC_NA);
mpeg_sect_tree = proto_item_add_subtree(ti, ett_mpeg_sect);
ti = proto_tree_add_item(tree, proto_mpeg_sect, tvb, offset, -1, ENC_NA);
mpeg_sect_tree = proto_item_add_subtree(ti, ett_mpeg_sect);
proto_item_append_text(ti, " Table_ID=0x%02x", table_id);
proto_item_append_text(ti, " Table_ID=0x%02x", table_id);
packet_mpeg_sect_header(tvb, offset, mpeg_sect_tree,
&section_length, &syntax_indicator);
packet_mpeg_sect_header(tvb, offset, mpeg_sect_tree,
&section_length, &syntax_indicator);
if (syntax_indicator)
packet_mpeg_sect_crc(tvb, pinfo, mpeg_sect_tree, 0, (section_length-1));
if (syntax_indicator)
packet_mpeg_sect_crc(tvb, pinfo, mpeg_sect_tree, 0, (section_length-1));
}
void
proto_register_mpeg_sect(void)
{
static hf_register_info hf[] = {
{ &hf_mpeg_sect_table_id, {
"Table ID", "mpeg_sect.tid",
FT_UINT8, BASE_HEX, VALS(mpeg_sect_table_id_vals), 0, NULL, HFILL
} },
static hf_register_info hf[] = {
{ &hf_mpeg_sect_table_id, {
"Table ID", "mpeg_sect.tid",
FT_UINT8, BASE_HEX, VALS(mpeg_sect_table_id_vals), 0, NULL, HFILL
} },
{ &hf_mpeg_sect_syntax_indicator, {
"Syntax indicator", "mpeg_sect.syntax_indicator",
FT_UINT16, BASE_DEC, NULL, MPEG_SECT_SYNTAX_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_mpeg_sect_syntax_indicator, {
"Syntax indicator", "mpeg_sect.syntax_indicator",
FT_UINT16, BASE_DEC, NULL, MPEG_SECT_SYNTAX_INDICATOR_MASK, NULL, HFILL
} },
{ &hf_mpeg_sect_reserved, {
"Reserved", "mpeg_sect.reserved",
FT_UINT16, BASE_HEX, NULL, MPEG_SECT_RESERVED_MASK, NULL, HFILL
} },
{ &hf_mpeg_sect_reserved, {
"Reserved", "mpeg_sect.reserved",
FT_UINT16, BASE_HEX, NULL, MPEG_SECT_RESERVED_MASK, NULL, HFILL
} },
{ &hf_mpeg_sect_length, {
"Length", "mpeg_sect.len",
FT_UINT16, BASE_DEC, NULL, MPEG_SECT_LENGTH_MASK, NULL, HFILL
} },
{ &hf_mpeg_sect_length, {
"Length", "mpeg_sect.len",
FT_UINT16, BASE_DEC, NULL, MPEG_SECT_LENGTH_MASK, NULL, HFILL
} },
{ &hf_mpeg_sect_crc, {
"CRC 32", "mpeg_sect.crc",
FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL
} }
};
{ &hf_mpeg_sect_crc, {
"CRC 32", "mpeg_sect.crc",
FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL
} }
};
static gint *ett[] = {
&ett_mpeg_sect
};
module_t *mpeg_sect_module;
static gint *ett[] = {
&ett_mpeg_sect
};
module_t *mpeg_sect_module;
proto_mpeg_sect = proto_register_protocol("MPEG2 Section", "MPEG SECT", "mpeg_sect");
register_dissector("mpeg_sect", dissect_mpeg_sect, proto_mpeg_sect);
proto_mpeg_sect = proto_register_protocol("MPEG2 Section", "MPEG SECT", "mpeg_sect");
register_dissector("mpeg_sect", dissect_mpeg_sect, proto_mpeg_sect);
proto_register_field_array(proto_mpeg_sect, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
proto_register_field_array(proto_mpeg_sect, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
mpeg_sect_module = prefs_register_protocol(proto_mpeg_sect, NULL);
mpeg_sect_module = prefs_register_protocol(proto_mpeg_sect, NULL);
prefs_register_bool_preference(mpeg_sect_module,
"verify_crc",
"Verify the section CRC",
"Whether the section dissector should verify the CRC",
&mpeg_sect_check_crc);
prefs_register_bool_preference(mpeg_sect_module,
"verify_crc",
"Verify the section CRC",
"Whether the section dissector should verify the CRC",
&mpeg_sect_check_crc);
mpeg_sect_tid_dissector_table = register_dissector_table("mpeg_sect.tid",
"MPEG SECT Table ID",
FT_UINT8, BASE_HEX);
mpeg_sect_tid_dissector_table = register_dissector_table("mpeg_sect.tid",
"MPEG SECT Table ID",
FT_UINT8, BASE_HEX);
}
@ -365,10 +365,10 @@ proto_register_mpeg_sect(void)
*
* Local variables:
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: t
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=4 noexpandtab:
* :indentSize=4:tabSize=4:noTabs=false:
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/