diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2012-08-05 12:57:29 +0000 |
---|---|---|
committer | Martin Kaiser <wireshark@kaiser.cx> | 2012-08-05 12:57:29 +0000 |
commit | 7bef3391cf44076128d109b727e1a92fba194f8f (patch) | |
tree | 70a8d97f059c43d78a289f016626b1d053b33fe3 /epan/dissectors/packet-mpeg-pmt.c | |
parent | a0a35a9c49911c75a8827d35144dae446d50c5c8 (diff) |
make mpeg_pmt a new-style dissector
register it by name so that other protocols can call it more easily
highlight only the bytes that actually belong to the pmt
(the same changes as already applied to dvb-nit)
svn path=/trunk/; revision=44274
Diffstat (limited to 'epan/dissectors/packet-mpeg-pmt.c')
-rw-r--r-- | epan/dissectors/packet-mpeg-pmt.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/epan/dissectors/packet-mpeg-pmt.c b/epan/dissectors/packet-mpeg-pmt.c index 0af034f8c4..16fbb80cbe 100644 --- a/epan/dissectors/packet-mpeg-pmt.c +++ b/epan/dissectors/packet-mpeg-pmt.c @@ -119,7 +119,7 @@ static const value_string mpeg_pmt_stream_type_vals[] = { }; static value_string_ext mpeg_pmt_stream_type_vals_ext = VALUE_STRING_EXT_INIT(mpeg_pmt_stream_type_vals); -static void +static int dissect_mpeg_pmt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { @@ -127,8 +127,8 @@ dissect_mpeg_pmt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint descriptor_end, prog_info_len, es_info_len; guint16 pid; - proto_item *ti; - proto_tree *mpeg_pmt_tree; + proto_item *ti = NULL; + proto_tree *mpeg_pmt_tree = NULL; proto_item *si; proto_tree *mpeg_pmt_stream_tree; @@ -136,11 +136,10 @@ dissect_mpeg_pmt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_INFO, "Program Map Table (PMT)"); - if (!tree) - return; - - 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); + if (tree) { + 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; @@ -197,7 +196,10 @@ dissect_mpeg_pmt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } - 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; } @@ -295,6 +297,7 @@ proto_register_mpeg_pmt(void) 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); } @@ -303,6 +306,6 @@ proto_reg_handoff_mpeg_pmt(void) { dissector_handle_t mpeg_pmt_handle; - mpeg_pmt_handle = create_dissector_handle(dissect_mpeg_pmt, proto_mpeg_pmt); + 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); } |