diff options
author | Michael Mann <mmann78@netscape.net> | 2015-11-23 11:36:45 -0500 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2015-11-24 06:18:40 +0000 |
commit | 2bd360d8646fb530f21de39e77d4df55193c3bc3 (patch) | |
tree | 76938a0f140a587e5c2b9dc0ebc786688d4c60a0 | |
parent | ffb5b3d727e2f5bea0739512ed2d5d8a236c9ed9 (diff) |
Make dissect_mp4ves_config a real dissector to be called by SDP
Also convert packet-mp4ves.c to use only "new style" dissectors.
Change-Id: I949dd1300a66039906abffef5cc019f2b49cf414
Reviewed-on: https://code.wireshark.org/review/12074
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r-- | epan/dissectors/packet-mp4ves.c | 19 | ||||
-rw-r--r-- | epan/dissectors/packet-mp4ves.h | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-sdp.c | 8 |
3 files changed, 15 insertions, 13 deletions
diff --git a/epan/dissectors/packet-mp4ves.c b/epan/dissectors/packet-mp4ves.c index 8158c1b659..159f88f7ab 100644 --- a/epan/dissectors/packet-mp4ves.c +++ b/epan/dissectors/packet-mp4ves.c @@ -668,8 +668,8 @@ dissect_mp4ves_VisualObjectSequence(tvbuff_t *tvb, packet_info *pinfo, proto_tre return bit_offset; } -void -dissect_mp4ves_config(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +int +dissect_mp4ves_config(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *item; proto_tree *mp4ves_tree; @@ -678,10 +678,11 @@ dissect_mp4ves_config(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) mp4ves_tree = proto_item_add_subtree(item, ett_mp4ves_config); dissect_mp4ves_VisualObjectSequence(tvb, pinfo, mp4ves_tree, 0); + return tvb_captured_length(tvb); } -static void -dissect_mp4ves(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_mp4ves(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int bit_offset = 0; proto_item *item; @@ -746,13 +747,13 @@ dissect_mp4ves(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tvb_reported_length(tvb)< 4){ /* To short to be a start code */ proto_tree_add_item(mp4ves_tree, hf_mp4ves_data, tvb, bit_offset>>3, -1, ENC_NA); - return; + return tvb_captured_length(tvb); } dword = tvb_get_bits32(tvb,bit_offset, 24, ENC_BIG_ENDIAN); if (dword != 1){ /* if it's not 23 zeros followed by 1 it isn't a start code */ proto_tree_add_item(mp4ves_tree, hf_mp4ves_data, tvb, bit_offset>>3, -1, ENC_NA); - return; + return tvb_captured_length(tvb); } dword = tvb_get_bits8(tvb,24, 8); bit_offset = bit_offset+8; @@ -775,6 +776,7 @@ dissect_mp4ves(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } + return tvb_captured_length(tvb); } /* * Parameter name profileAndLevel @@ -841,7 +843,7 @@ dissect_mp4ves_par_decoderConfigurationInformation(tvbuff_t *tvb, packet_info *p actx = get_asn1_ctx(data); DISSECTOR_ASSERT(actx); - dissect_mp4ves_config(tvb, pinfo, tree); + dissect_mp4ves_config(tvb, pinfo, tree, data); return tvb_reported_length(tvb); } @@ -1015,7 +1017,8 @@ proto_register_mp4ves(void) expert_register_field_array(expert_mp4ves, ei, array_length(ei)); /* Register a configuration option for port */ - register_dissector("mp4ves", dissect_mp4ves, proto_mp4ves); + new_register_dissector("mp4ves", dissect_mp4ves, proto_mp4ves); + new_register_dissector("mp4ves_config", dissect_mp4ves_config, proto_mp4ves); /* Register a configuration option for port */ mp4ves_module = prefs_register_protocol(proto_mp4ves, proto_reg_handoff_mp4ves); diff --git a/epan/dissectors/packet-mp4ves.h b/epan/dissectors/packet-mp4ves.h index 95d8107890..283675081e 100644 --- a/epan/dissectors/packet-mp4ves.h +++ b/epan/dissectors/packet-mp4ves.h @@ -26,5 +26,4 @@ extern const value_string mp4ves_level_indication_vals[]; -void dissect_mp4ves_config(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); #endif /* PACKET_MP4VES_H */ diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c index 9e02e72fd5..8418746721 100644 --- a/epan/dissectors/packet-sdp.c +++ b/epan/dissectors/packet-sdp.c @@ -59,7 +59,7 @@ static dissector_handle_t rtcp_handle; static dissector_handle_t sprt_handle; static dissector_handle_t msrp_handle; static dissector_handle_t h264_handle; -static dissector_handle_t mp4ves_handle; +static dissector_handle_t mp4ves_config_handle; static int sdp_tap = -1; @@ -1168,8 +1168,8 @@ decode_sdp_fmtp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset format_specific_parameter = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tokenlen, ENC_UTF_8|ENC_NA); /* ascii_bytes_to_tvb requires the "=" to be in the buffer */ data_tvb = ascii_bytes_to_tvb(tvb, pinfo, tokenlen, format_specific_parameter); - if (mp4ves_handle && data_tvb) { - dissect_mp4ves_config(data_tvb, pinfo, tree); + if (mp4ves_config_handle && data_tvb) { + call_dissector(mp4ves_config_handle, data_tvb, pinfo, tree); } } } @@ -3115,7 +3115,7 @@ proto_reg_handoff_sdp(void) msrp_handle = find_dissector("msrp"); sprt_handle = find_dissector("sprt"); h264_handle = find_dissector("h264"); - mp4ves_handle = find_dissector("mp4ves"); + mp4ves_config_handle = find_dissector("mp4ves_config"); proto_sprt = dissector_handle_get_protocol_index(find_dissector("sprt")); |