wireshark/epan
Peter Wu 38f45e1e22 SDP: reduce code duplication
Observe that some code in setup_sdp_transport is effectively the same
code as a part from dissect_sdp with these differences:

 - Removal of these two conditions (setup_sdp_transport already returns
   early when a packet is visited):
    (!pinfo->fd->flags.visited) && (transport_info == &local_transport_info)
 - "establish_frame" in setup_sdp_transport is replaced by "pinfo->num"
   in dissect_sdp.

dissect_sdp further has two additional blocks that add information to
the VoIP calls dialog. This is preserved.

Freeing of the RTP payload information has also been simplified. Instead
of checking it inside the main loop that adds addresses (now moved to a
new function, "apply_sdp_transport"), let the caller do it outside the
loop.

The transformation in this patch is rather mechanical:

 0. Add a comment on what the new function is supposed to do.
 1. Move code from setup_sdp_transport into a new function,
    apply_sdp_transport and reduce indentation level.
 2. Copy all variables to the new function and populate the parameter
    list.
 3. Compile result, remove unused variables that the compiler warns for.
 4. Move freeing of unused media outside the loop to the caller.
 5. Create a new conditional statement before the duplicated loop, which
    checks whether setup_sdp_transport has been used before. (SIP first
    calls setup_sdp_transport, then it invokes the media type dissector
    which calls dissect_sdp to populate the tree.)
 6. Remove the duplicated code from the dissect_sdp loop until only the
    VoIP Calls dialog info remains.

There is no functional change intended.

Change-Id: I928379466af56ef1729cccbf4a5b60895ddb3227
Reviewed-on: https://code.wireshark.org/review/19047
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-12-06 00:21:09 +00:00
..
compress
crypt Squelch a casting-away-constness warning. 2016-12-04 03:03:11 +00:00
dfilter Include config.h at the very beginning of all Flex scanners. 2016-12-02 21:02:10 +00:00
dissectors SDP: reduce code duplication 2016-12-06 00:21:09 +00:00
ftypes ftype-guid.c: fix FT_GUID filtering 2016-11-11 16:17:19 +00:00
wmem
wslua Include config.h first, for large-file-related #defines. 2016-12-02 21:06:24 +00:00
.editorconfig
addr_and_mask.c
addr_and_mask.h
addr_resolv.c Improve name resolution preference tooltips. 2016-11-22 16:47:11 +00:00
addr_resolv.h Resolv: various code / comment cleanups 2016-11-16 05:15:52 +00:00
address.h
address_types.c
address_types.h
afn.c
afn.h
aftypes.c
aftypes.h
app_mem_usage.c
app_mem_usage.h
arcnet_pids.h
arptypes.h
asm_utils.c
asm_utils.h
asm_utils_win32_x86.asm
asn1.c
asn1.h
ax25_pids.h
bridged_pids.h
capture_dissectors.c Implement registration of capture dissectors by name 2016-10-28 17:39:04 +00:00
capture_dissectors.h Implement registration of capture dissectors by name 2016-10-28 17:39:04 +00:00
charsets.c
charsets.h
chdlctypes.h
circuit.c
circuit.h
CMakeLists.txt Enable exporting objects with tshark 2016-12-02 16:07:35 +00:00
color_filters.c
color_filters.h
column-info.h
column-utils.c
column-utils.h
column.c Fix lintian found spelling error "occurence" -> "occurrence" 2016-11-03 02:31:20 +00:00
column.h
conv_id.h
conversation.c packet-infiniband: Fixed duplicate conversation entries 2016-12-03 13:24:16 +00:00
conversation.h
conversation_debug.h
conversation_table.c
conversation_table.h
crc6-tvb.c
crc6-tvb.h
crc8-tvb.c
crc8-tvb.h
crc10-tvb.c
crc10-tvb.h
crc16-tvb.c
crc16-tvb.h
crc32-tvb.c
crc32-tvb.h
decode_as.c
decode_as.h
diam_dict.h
diam_dict.l Include config.h at the very beginning of all Flex scanners. 2016-12-02 21:02:10 +00:00
disabled_protos.c
disabled_protos.h
dissector_filters.c
dissector_filters.h
doxygen.cfg.in
dtd.h
dtd_grammar.lemon
dtd_parse.h
dtd_parse.l Include config.h at the very beginning of all Flex scanners. 2016-12-02 21:02:10 +00:00
dtd_preparse.l Include config.h at the very beginning of all Flex scanners. 2016-12-02 21:02:10 +00:00
dvb_chartbl.c
dvb_chartbl.h
dwarf.c
dwarf.h
eap.h
eapol_keydes_types.h
enterprise-numbers [Automatic update for 2016-12-04] 2016-12-04 16:13:27 +00:00
epan-int.h
epan.c
epan.h
epan_dissect.h
etypes.h
ex-opt.c
ex-opt.h
except.c
except.h
exceptions.h
exntest.c
expert.c
expert.h
export_object.c Enable exporting objects with tshark 2016-12-02 16:07:35 +00:00
export_object.h Enable exporting objects with tshark 2016-12-02 16:07:35 +00:00
exported_pdu.c
exported_pdu.h
filter_expressions.c
filter_expressions.h
follow.c tcp: Fix Follow TCP tap data and when its tapped. 2016-11-10 20:48:18 +00:00
follow.h tcp: Fix Follow TCP tap data and when its tapped. 2016-11-10 20:48:18 +00:00
frame_data.c
frame_data.h
frame_data_sequence.c
frame_data_sequence.h
funnel.c
funnel.h
garrayfix.h
geoip_db.c Improve name resolution preference tooltips. 2016-11-22 16:47:11 +00:00
geoip_db.h
golay.c
golay.h
guid-utils.c
guid-utils.h
iana_charsets.c
iana_charsets.h
iax2_codec_type.h
in_cksum.c
in_cksum.h
ip_opts.h
ipproto.c
ipproto.h
ipv4.c
ipv4.h
ipv6.h
lapd_sapi.h
llcsaps.h
Makefile.am Enable exporting objects with tshark 2016-12-02 16:07:35 +00:00
media_params.c
media_params.h
next_tvb.c
next_tvb.h
nlpid.h
oids.c Improve name resolution preference tooltips. 2016-11-22 16:47:11 +00:00
oids.h
oids_test.c
osi-utils.c
osi-utils.h
oui.c ieee80211: Add Meru (Fortinet) Vendor Specific TLV 2016-11-25 15:33:18 +00:00
oui.h ieee80211: Add Meru (Fortinet) Vendor Specific TLV 2016-11-25 15:33:18 +00:00
packet-range.c
packet-range.h
packet.c
packet.h
packet_info.h
params.h
plugin_if.c
plugin_if.h
ppptypes.h
prefs-int.h
prefs.c Prefs: Use g_utf8_strlen instead of strlen. 2016-12-02 01:09:54 +00:00
prefs.h Check preference titles and descriptions. 2016-12-01 01:26:39 +00:00
print.c Honor protocols.display_hidden_proto_items preferences when outputting fields in TShark 2016-12-05 06:28:32 +00:00
print.h
print.ps
print_stream.c
print_stream.h
proto.c extract common logic of proto_item_set_len/proto_item_set_end 2016-11-22 16:46:48 +00:00
proto.h
proto_data.c
proto_data.h
ps.h
ptvcursor.h
radius_dict.l Include config.h at the very beginning of all Flex scanners. 2016-12-02 21:02:10 +00:00
range.c
range.h
reassemble.c Reassemble: fix premature free 2016-11-19 22:58:08 +00:00
reassemble.h Fragmentation reassembly as in PPP MP (RFC 1990/2686) 2016-11-03 05:08:07 +00:00
reassemble_test.c Fragmentation reassembly as in PPP MP (RFC 1990/2686) 2016-11-03 05:08:07 +00:00
reedsolomon.c
reedsolomon.h
req_resp_hdrs.c
req_resp_hdrs.h
rtd_table.c
rtd_table.h
rtp_pt.h
sctpppids.h
show_exception.c
show_exception.h
slow_protocol_subtypes.h
sminmpec.c [Automatic update for 2016-12-04] 2016-12-04 16:13:27 +00:00
sminmpec.h
srt_table.c
srt_table.h
stat_groups.h
stat_tap_ui.c
stat_tap_ui.h
stats_tree.c
stats_tree.h
stats_tree_priv.h
stream.c
stream.h
strutil.c
strutil.h
t35.c
t35.h
tap-voip.h
tap.c
tap.h
tfs.c
tfs.h
time_fmt.h
timestamp.c
timestamp.h
timestats.c
timestats.h
to_str-int.h
to_str.c
to_str.h
tpg.c
tpg.h
tvbparse.c
tvbparse.h
tvbtest.c
tvbuff-int.h
tvbuff.c [tvbuff] Fix tvb_find_guint16() searched_bytes is from 2016-11-11 16:05:52 +00:00
tvbuff.h
tvbuff_base64.c
tvbuff_composite.c tvbuff_composite.c: fix composite_get_ptr when length is over 2 segments 2016-11-13 22:30:57 +00:00
tvbuff_real.c
tvbuff_subset.c
tvbuff_zlib.c
uat-int.h
uat.c
uat.h
uat_load.l Include config.h at the very beginning of all Flex scanners. 2016-12-02 21:02:10 +00:00
value_string.c
value_string.h
x264_prt_id.h
xdlc.c
xdlc.h