The original sdp_manipulate_check's only purpose left is to check for an
attribute removal. Refactor accordingly.
Change-Id: I3be28e0a2c04461a60766afe7096ad3fb8bbe998
In order to perform a substitution we must do a lookup to the hash table
anyway. We can eliminate an extra lookup for the same key to check
whether a substitution exists by combining the two operations into one.
Change-Id: Ife8f1fbfd77ade1986a303a3a5503f4142f7de01
Operating on an empty queue is essentially a no-op, so there's no point
in doing an extra check first to see if the queue is empty. Remove this
extra check for the CMD_ADD case.
Change-Id: I3c7524cd407fb350a46bdf8d3a91014158c6bf44
Use an indexed array to generically support all possible media types
instead of hard-coding a few possible types. This makes lookup faster
and is also future-proof.
Add helper functions to allocate and lookup the appropriate object.
Change-Id: I28406b2c5a6829330f41601fa52e738d9a8ee315
Media types must be given explicitly anyway, so we don't need to warn
when we encounter a different one, as it's entirely expected that we
won't operate on it.
Change-Id: Ic6b808422ceb5ae857a4d0a99379a1c858bb6fd8
For efficiency reasons `substitute` kind of SDP manipulations
commands have been moved to the `GHashTable` instead of the `GQueue`.
Change-Id: Iec6c44109ae912ba0de440bbed6ecaee6a238b97
1) a=ice-options can be a session-level attribute. Use the correct
lookup function to check for both media-level and session-level
attributes.
2) The RTP endpoint address must be filled in before we do the trickle
ICE check, which uses 0.0.0.0:9 as determining factor.
3) Adapt a test case.
Change-Id: Ic0caffc85791131173848d28f5a652ad9d9124db
Using a pointer array instead of a linked lists allows us to directly
reference a media section by index number, without having to spool into
the linked list.
No functional changes.
Change-Id: I8b0e93f0c2e9addbcb4c938894118ed4a6aec768
Deprecate the `append_attr_to_gstring()` and combine the functionality
of it with the `append_attr_char_to_gstring()` to not have multiple
functions doing same thing.
Change-Id: Id955f79a4f3b0864427216af20b11fd4baeb2b93
Improve an efficiency of the code in terms of not checking anything
inside the function, if the `sdp_manipulation` flags are absent.
Change-Id: I2a5d8cf675a73ec7a2b4af94d5c7fe2f18fc1772
Do not use the `g_queue_is_empty()` to check the emptiness
of the `add_commands_*` GQueue. It's enough to check the pointer
and the first `->head` value.
Change-Id: Ie01f45d5f8bbaa5af3a09594cce145a0e83943c2
Do not proceed to the `g_hash_table_lookup()` if the `attr_name`
is empty.
Additonally: improve slightly the same check for the CMD_SUBST.
Change-Id: I39e34c34b458150ebae38dff5e6a46f6e8f17c66
It substitutes a specified `a=` line taken from the concerned
media attributes list. If such line has been not found,
the attributes list remains untouched.
It subsitutes one attribute at a time, so one attribute into
another attribute.
Change-Id: Ie0a48ba46a1b196fbe33b09dedc40e4498640e34
In order to improve the efficieny of the code (make lookups
faster) use GQueues for CMD_ADD manipulations and
GHashTable for CMD_REM manipulations.
This gives the following benefits:
- faster lookup (check), if any SDP command is to be applied
(no need to iterate through all values of commands, as it used to be)
- keep a sequence for CMD_ADD values given by option flag(s)
In order to keep the code more lightweight and clear,
add a separate struct ptr to queues and hash tables into
the call_interfaces header.
Change-Id: I7e45aca4062750c7b8959473edb410ed76cc04e7
New section of option flags has been introduced for SDP body
attributes manipulations.
Three levels of the SDP session are concerned:
- session level (global one)
- media level - audio
- media level - video
Three different actions are supported for now:
- add
- remove
The value of the command has a wildcard matching approach.
Other attributes apart `a=` can not be edited by this functionality.
So such headers as: `c=`, `s=`, `o=` cannot be touched.
Change-Id: I939d4582839096b2399f7ded865e91ff6eb960a4
(cherry picked from commit 3f06c18793fe95e5b070044a0291a3e1528ac6e4)
Because of the repeating code snippets, which insert attributes
into the SDP chop->output GString, it's just better to introduce
a separate function for that.
This will give one additional advantage — there will be only one
place, where we can control (for example, depending on manipulation
rules) whether to print this attribute or not.
Change-Id: I1b12f2dd2fda8475a783352678ac939267b64080
To better organizea code and not duplicate same functionality
in the future, it's better to handle an insertion of
the sdp_attribute object using a dedicated hanlder.
New handler:
attr_insert(struct sdp_attributes *attrs, struct sdp_attribute *attr)
Change-Id: I24236d81257b95ef98e0886d3ba362cc1e50dfbe
Defined in RFC 8842. If a tls-id was previously given and a the new SDP
shows a different tls-id or none at all, we must restart DTLS.
Relevant to #1585
Change-Id: I554234dfcacbd330c7a0c6aea68f24d0449cba21
In order to rewrite certain session-level SDP lines, we need to
reference a packet_stream which contains the correct information. But we
cannot simply rely on the first media section having a usable packet
stream, as the first media section could have been rejected. Iterate
media sections until we find a usable one.
Change-Id: I36594e80981fc0645a7747399bd9951fbc2e5676
Add a flag to force increasing the SDP version,
even if the SDP hasn't been changed.
And cover it with tests.
Flag name: 'force-increment-sdp-ver'
Additionally fix the name of the 'sdp-version' flag
in the 'rtpengine-ng-client' tool.
Change-Id: I466792668b0cd313b5e21b248dd14cd599333cbd
`flags` being NULL is not really a use case we have right now, but it
might be in the future. Make sure we don't crash.
Change-Id: I4400553fc0a665d94f2e1cdced855250b46d88a4
Warned-by: coverity