diff --git a/agent/agent.c b/agent/agent.c index 8d978c0..d12c6fe 100644 --- a/agent/agent.c +++ b/agent/agent.c @@ -2036,6 +2036,35 @@ nice_agent_add_stream_local_address_from_string (NiceAgent * agent, return nice_agent_add_stream_local_address (agent, stream_id, &nice_addr); } +NICEAPI_EXPORT gboolean +nice_agent_clear_stream_local_addresses (NiceAgent * agent, guint stream_id) +{ + gboolean result = FALSE; + Stream *stream; + GSList *item; + + agent_lock (agent); + + stream = agent_find_stream (agent, stream_id); + + if (!stream) { + goto done; + } + + for (item = stream->local_addresses; item; item = g_slist_next (item)) { + NiceAddress *address = item->data; + nice_address_free (address); + } + g_slist_free (stream->local_addresses); + stream->local_addresses = NULL; + + result = TRUE; + +done: + agent_unlock (agent); + return result; +} + /* Recompute foundations of all candidate pairs from a given stream * having a specific remote candidate, and eventually update the * priority of the selected pair as well. diff --git a/agent/agent.h b/agent/agent.h index cb1be18..c9341f4 100644 --- a/agent/agent.h +++ b/agent/agent.h @@ -348,6 +348,22 @@ nice_agent_add_local_address_from_string (NiceAgent *agent, const gchar *addr); NICE_EXPORT gboolean nice_agent_add_stream_local_address (NiceAgent *agent, guint stream_id, NiceAddress *addr); +/** + * nice_agent_clear_stream_local_addresses: + * @agent: The #NiceAgent Object + * @stream_id: The stream whose local addresses should be cleared + * + * Remove all local addresses that were previously configured on the + * stream @stream_id with nice_agent_add_stream_local_address() or + * nice_agent_add_stream_local_address_from_string(). After this call, + * new local addresses may be added to replace the cleared ones. + * + * See also: nice_agent_add_stream_local_address() + * Returns: %TRUE on success, %FALSE if the stream id is invalid + */ +NICE_EXPORT gboolean +nice_agent_clear_stream_local_addresses (NiceAgent *agent, guint stream_id); + /** * nice_agent_add_stream_local_address_from_string: * @agent: The #NiceAgent Object diff --git a/nice/libnice.sym b/nice/libnice.sym index d2b93b9..cdda488 100644 --- a/nice/libnice.sym +++ b/nice/libnice.sym @@ -19,6 +19,7 @@ nice_agent_add_local_address nice_agent_add_local_address_from_string nice_agent_add_stream_local_address nice_agent_add_stream_local_address_from_string +nice_agent_clear_stream_local_addresses nice_agent_add_stream nice_agent_set_stream nice_agent_attach_recv