[Pkg-telepathy-commits] [libnice] 15/265: agent: Add API to retrieve the selected GSocket

Simon McVittie smcv at debian.org
Wed May 14 12:04:47 UTC 2014


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian
in repository libnice.

commit 19679283e080859f0faa3d3df39b4117ce74db86
Author: Bryce Allen <ballen at ci.uchicago.edu>
Date:   Wed Nov 20 16:46:06 2013 -0500

    agent: Add API to retrieve the selected GSocket
    
    This should be used only when the protocol has it's own keepalive mechanism
---
 agent/agent.c         | 27 +++++++++++++++++++++++++++
 agent/agent.h         | 25 +++++++++++++++++++++++++
 nice/libnice.sym      |  1 +
 win32/vs9/libnice.def |  1 +
 4 files changed, 54 insertions(+)

diff --git a/agent/agent.c b/agent/agent.c
index 034b53c..364dfac 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -2889,6 +2889,33 @@ nice_agent_get_selected_pair (NiceAgent *agent, guint stream_id,
   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)
 {
diff --git a/agent/agent.h b/agent/agent.h
index d03741f..7b2f45b 100644
--- a/agent/agent.h
+++ b/agent/agent.h
@@ -104,6 +104,7 @@
 
 
 #include <glib-object.h>
+#include <gio/gio.h>
 
 /**
  * NiceAgent:
@@ -715,6 +716,30 @@ nice_agent_get_selected_pair (
   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
diff --git a/nice/libnice.sym b/nice/libnice.sym
index d1a51ab..195092d 100644
--- a/nice/libnice.sym
+++ b/nice/libnice.sym
@@ -26,6 +26,7 @@ nice_agent_get_local_candidates
 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
diff --git a/win32/vs9/libnice.def b/win32/vs9/libnice.def
index 53d7cb0..abb7732 100644
--- a/win32/vs9/libnice.def
+++ b/win32/vs9/libnice.def
@@ -30,6 +30,7 @@ nice_agent_get_local_candidates
 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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/libnice.git



More information about the Pkg-telepathy-commits mailing list