return ret;
}
+NICEAPI_EXPORT GSocket *
+nice_agent_get_selected_socket (NiceAgent *agent, guint stream_id,
+ guint component_id)
+{
+ Component *component;
+ Stream *stream;
+ NiceSocket *nice_socket;
+ GSocket *g_socket = NULL;
+
+ agent_lock();
+
+ /* step: check that params specify an existing pair */
+ if (!agent_find_component (agent, stream_id, component_id,
+ &stream, &component))
+ goto done;
+
+ if (component->selected_pair.local && component->selected_pair.remote) {
+ nice_socket = (NiceSocket *)component->selected_pair.local->sockptr;
+ g_socket = nice_socket->fileno;
+ }
+
+ done:
+ agent_unlock();
+
+ return g_socket;
+}
+
GSource* agent_timeout_add_with_context (NiceAgent *agent, guint interval,
GSourceFunc function, gpointer data)
{
#include <glib-object.h>
+#include <gio/gio.h>
/**
* NiceAgent:
NiceCandidate **remote);
/**
+ * nice_agent_get_selected_socket:
+ * @agent: The #NiceAgent Object
+ * @stream_id: The ID of the stream
+ * @component_id: The ID of the component
+ *
+ * Retreive the local socket associated with the selected candidate pair
+ * for media transmission for a given stream's component.
+ *
+ * This is useful for adding ICE support to legacy applications that already
+ * have a protocol that maintains a connection. If the socket is duplicated
+ * before unrefing the agent, the application can take over and continue to use
+ * it. New applications are encouraged to use the built in libnice stream
+ * handling instead and let libnice handle the connection maintenance.
+ *
+ * Returns: pointer to the socket, or NULL if there is no selected candidate
+ * Since: 0.1.5
+ */
+GSocket *
+nice_agent_get_selected_socket (
+ NiceAgent *agent,
+ guint stream_id,
+ guint component_id);
+
+/**
* nice_agent_set_selected_remote_candidate:
* @agent: The #NiceAgent Object
* @stream_id: The ID of the stream
nice_agent_get_local_credentials
nice_agent_get_remote_candidates
nice_agent_get_selected_pair
+nice_agent_get_selected_socket
nice_agent_get_stream_name
nice_agent_get_type
nice_agent_new
nice_agent_get_local_credentials
nice_agent_get_remote_candidates
nice_agent_get_selected_pair
+nice_agent_get_selected_socket
nice_agent_get_stream_name
nice_agent_get_type
nice_agent_new