sdp: refactor session/media level handling of attributes

The media_count meaning is horrendous. -1 means "none", a count of "0"
actually means "1". This led to various bugs in the past, so just rip it
out and use a (wmem) array from which the length can be determined.

That also means that a hard-coded limit on the media can now easily be
lifted without affecting the size of the transport_info_t structure.
(This limit, SDP_MAX_RTP_CHANNELS,  is unchanged in this patch though.)

Refactor the SDP dissector such that:

 - Media and related attributes are no longer a bunch of fixed array
   fields, but grouped in one structure. This results in the largest
   changes all over the place since "transport_info->media[n]" is now
   transformed into "media_desc->media" where "media_desc" is an element
   of the "transport_info->media_descriptions" wmem array.
 - Simplify protocol (in "m=") parsing (lots of ifs -> array + loop).
 - Remove convert_disposable_media and disposable_media_info_t, parse
   fields (media protocol from "m=", connection address from "c=", etc.)
   while parsing the SDP instead of parsing it at the end.
 - Have two distinct structures for keeping the info for the session and
   media level. Emphasize that new media descriptions are inherited from
   session level attributes (via sdp_new_media_description).
 - Delay creation of dynamic payload type information table until we
   actually create the media description. Create function
   clean_unused_media_descriptions to handle the common of freeing
   unused dynamic pt.
 - Remove SDP_IPv4/SDP_IPv6, these are replaced by checking the type
   member of the address structure.

Changes to MSRP part:

 - Move MSRP attributes to the media-level attributes.
 - Remove msrp_transport_address_set attribute, rely on the AT_NONE
   address type for detecting bad addresses.
 - Remove SDP_MSRP_IPv4 check, this never worked as the flag was never
   set. Now it relies on the address family from the host in a=path:.

Tested with these capture files with no change in PDML output nor
improvements/regressions with memleaks (as reported by ASAN):

    capture sip call wireshark 1.8.2.pcap
    NOringback.pcapng
    rtp_not_parsed_by_1_10_1.pcap
    rtsp_interleaved_coreplayer.cap
    SIP_CALL_RTP_G711.pcapng
    srtpincorrectlyselected.pcap
    tdnwifitontwifi_withnatting_clientAbhopati_03082015.pcapng

Change-Id: Ia0dbc63f8bd78cc84dad2e18174540e31b78a80d
Reviewed-on: https://code.wireshark.org/review/19072
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Peter Wu 2016-12-05 00:43:02 +01:00 committed by Anders Broman
parent 104b9fe5af
commit 1d2f68b60f
1 changed files with 401 additions and 401 deletions

File diff suppressed because it is too large Load Diff