Commit 3d507cae authored by Youness Alaoui's avatar Youness Alaoui

Add nice_agent_new_reliable to the libnice API which uses pseudotcp

parent d3278562
......@@ -120,6 +120,7 @@ struct _NiceAgent
GSource *upnp_timer_source; /* source of upnp timeout timer */
#endif
gchar *software_attribute; /* SOFTWARE attribute */
gboolean reliable; /* property: reliable */
/* XXX: add pointer to internal data struct for ABI-safe extensions */
};
......
......@@ -7,4 +7,6 @@ VOID:UINT,UINT,STRING
# candidate-gathering-done
# initial-binding-request-received
VOID:UINT
# reliable-transport-writable
VOID:UINT,UINT
This diff is collapsed.
......@@ -277,6 +277,21 @@ typedef void (*NiceAgentRecvFunc) (
NiceAgent *
nice_agent_new (GMainContext *ctx, NiceCompatibility compat);
/**
* nice_agent_new_reliable:
* @ctx: The Glib Mainloop Context to use for timers
* @compat: The compatibility mode of the agent
*
* Create a new #NiceAgent in reliable mode, which uses #PseudoTcpSocket to
* assure reliability of the messages.
* The returned object must be freed with g_object_unref()
*
* Returns: The new agent GObject
*/
NiceAgent *
nice_agent_new_reliable (GMainContext *ctx, NiceCompatibility compat);
/**
* nice_agent_add_local_address:
* @agent: The #NiceAgent Object
......
......@@ -53,9 +53,7 @@
#include "agent-priv.h"
Component *
component_new (
G_GNUC_UNUSED
guint id)
component_new (guint id)
{
Component *component;
......@@ -63,6 +61,8 @@ component_new (
component->id = id;
component->state = NICE_COMPONENT_STATE_DISCONNECTED;
component->restart_candidate = NULL;
component->tcp = NULL;
return component;
}
......@@ -213,8 +213,9 @@ void component_update_selected_pair (Component *component, const CandidatePair *
{
g_assert (component);
g_assert (pair);
nice_debug ("setting SELECTED PAIR for component %u: %s:%s (prio:%lu).",
component->id, pair->local->foundation, pair->remote->foundation, (long unsigned)pair->priority);
nice_debug ("setting SELECTED PAIR for component %u: %s:%s (prio:%"
G_GUINT64_FORMAT ").", component->id, pair->local->foundation,
pair->remote->foundation, pair->priority);
if (component->selected_pair.keepalive.tick_source != NULL) {
g_source_destroy (component->selected_pair.keepalive.tick_source);
......
......@@ -41,10 +41,14 @@
#include <glib.h>
typedef struct _Component Component;
#include "agent.h"
#include "candidate.h"
#include "stun/stunagent.h"
#include "stun/usages/timer.h"
#include "pseudotcp.h"
#include "stream.h"
G_BEGIN_DECLS
......@@ -55,7 +59,6 @@ G_BEGIN_DECLS
* would end up with 2*K host candidates if an agent has K interfaces.""
*/
typedef struct _Component Component;
typedef struct _CandidatePair CandidatePair;
typedef struct _CandidatePairKeepalive CandidatePairKeepalive;
typedef struct _IncomingCheck IncomingCheck;
......@@ -89,6 +92,12 @@ struct _IncomingCheck
uint16_t username_len;
};
typedef struct {
NiceAgent *agent;
Stream *stream;
Component *component;
} TcpUserData;
struct _Component
{
NiceComponentType type;
......@@ -107,12 +116,13 @@ struct _Component
gpointer data; /**< data passed to the io function */
GMainContext *ctx; /**< context for data callbacks for this
component */
PseudoTcpSocket *tcp;
GSource* tcp_clock;
TcpUserData *tcp_data;
};
Component *
component_new (
G_GNUC_UNUSED
guint component_id);
component_new (guint component_id);
void
component_free (Component *cmp);
......
......@@ -40,6 +40,8 @@
#include <glib.h>
typedef struct _Stream Stream;
#include "component.h"
#include "random.h"
......@@ -68,8 +70,6 @@ typedef enum
} NiceCheckListState;
typedef struct _Stream Stream;
struct _Stream
{
guint id;
......@@ -86,6 +86,7 @@ struct _Stream
gint tos;
};
Stream *
stream_new (guint n_components);
......
......@@ -9,6 +9,7 @@ NiceCompatibility
NiceAgentRecvFunc
NICE_AGENT_MAX_REMOTE_CANDIDATES
nice_agent_new
nice_agent_new_reliable
nice_agent_add_local_address
nice_agent_add_stream
nice_agent_remove_stream
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment