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 ...@@ -120,6 +120,7 @@ struct _NiceAgent
GSource *upnp_timer_source; /* source of upnp timeout timer */ GSource *upnp_timer_source; /* source of upnp timeout timer */
#endif #endif
gchar *software_attribute; /* SOFTWARE attribute */ gchar *software_attribute; /* SOFTWARE attribute */
gboolean reliable; /* property: reliable */
/* XXX: add pointer to internal data struct for ABI-safe extensions */ /* XXX: add pointer to internal data struct for ABI-safe extensions */
}; };
......
...@@ -7,4 +7,6 @@ VOID:UINT,UINT,STRING ...@@ -7,4 +7,6 @@ VOID:UINT,UINT,STRING
# candidate-gathering-done # candidate-gathering-done
# initial-binding-request-received # initial-binding-request-received
VOID:UINT VOID:UINT
# reliable-transport-writable
VOID:UINT,UINT
This diff is collapsed.
...@@ -277,6 +277,21 @@ typedef void (*NiceAgentRecvFunc) ( ...@@ -277,6 +277,21 @@ typedef void (*NiceAgentRecvFunc) (
NiceAgent * NiceAgent *
nice_agent_new (GMainContext *ctx, NiceCompatibility compat); 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: * nice_agent_add_local_address:
* @agent: The #NiceAgent Object * @agent: The #NiceAgent Object
......
...@@ -53,9 +53,7 @@ ...@@ -53,9 +53,7 @@
#include "agent-priv.h" #include "agent-priv.h"
Component * Component *
component_new ( component_new (guint id)
G_GNUC_UNUSED
guint id)
{ {
Component *component; Component *component;
...@@ -63,6 +61,8 @@ component_new ( ...@@ -63,6 +61,8 @@ component_new (
component->id = id; component->id = id;
component->state = NICE_COMPONENT_STATE_DISCONNECTED; component->state = NICE_COMPONENT_STATE_DISCONNECTED;
component->restart_candidate = NULL; component->restart_candidate = NULL;
component->tcp = NULL;
return component; return component;
} }
...@@ -213,8 +213,9 @@ void component_update_selected_pair (Component *component, const CandidatePair * ...@@ -213,8 +213,9 @@ void component_update_selected_pair (Component *component, const CandidatePair *
{ {
g_assert (component); g_assert (component);
g_assert (pair); g_assert (pair);
nice_debug ("setting SELECTED PAIR for component %u: %s:%s (prio:%lu).", nice_debug ("setting SELECTED PAIR for component %u: %s:%s (prio:%"
component->id, pair->local->foundation, pair->remote->foundation, (long unsigned)pair->priority); G_GUINT64_FORMAT ").", component->id, pair->local->foundation,
pair->remote->foundation, pair->priority);
if (component->selected_pair.keepalive.tick_source != NULL) { if (component->selected_pair.keepalive.tick_source != NULL) {
g_source_destroy (component->selected_pair.keepalive.tick_source); g_source_destroy (component->selected_pair.keepalive.tick_source);
......
...@@ -41,10 +41,14 @@ ...@@ -41,10 +41,14 @@
#include <glib.h> #include <glib.h>
typedef struct _Component Component;
#include "agent.h" #include "agent.h"
#include "candidate.h" #include "candidate.h"
#include "stun/stunagent.h" #include "stun/stunagent.h"
#include "stun/usages/timer.h" #include "stun/usages/timer.h"
#include "pseudotcp.h"
#include "stream.h"
G_BEGIN_DECLS G_BEGIN_DECLS
...@@ -55,7 +59,6 @@ G_BEGIN_DECLS ...@@ -55,7 +59,6 @@ G_BEGIN_DECLS
* would end up with 2*K host candidates if an agent has K interfaces."" * would end up with 2*K host candidates if an agent has K interfaces.""
*/ */
typedef struct _Component Component;
typedef struct _CandidatePair CandidatePair; typedef struct _CandidatePair CandidatePair;
typedef struct _CandidatePairKeepalive CandidatePairKeepalive; typedef struct _CandidatePairKeepalive CandidatePairKeepalive;
typedef struct _IncomingCheck IncomingCheck; typedef struct _IncomingCheck IncomingCheck;
...@@ -89,6 +92,12 @@ struct _IncomingCheck ...@@ -89,6 +92,12 @@ struct _IncomingCheck
uint16_t username_len; uint16_t username_len;
}; };
typedef struct {
NiceAgent *agent;
Stream *stream;
Component *component;
} TcpUserData;
struct _Component struct _Component
{ {
NiceComponentType type; NiceComponentType type;
...@@ -107,12 +116,13 @@ struct _Component ...@@ -107,12 +116,13 @@ struct _Component
gpointer data; /**< data passed to the io function */ gpointer data; /**< data passed to the io function */
GMainContext *ctx; /**< context for data callbacks for this GMainContext *ctx; /**< context for data callbacks for this
component */ component */
PseudoTcpSocket *tcp;
GSource* tcp_clock;
TcpUserData *tcp_data;
}; };
Component * Component *
component_new ( component_new (guint component_id);
G_GNUC_UNUSED
guint component_id);
void void
component_free (Component *cmp); component_free (Component *cmp);
......
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
#include <glib.h> #include <glib.h>
typedef struct _Stream Stream;
#include "component.h" #include "component.h"
#include "random.h" #include "random.h"
...@@ -68,8 +70,6 @@ typedef enum ...@@ -68,8 +70,6 @@ typedef enum
} NiceCheckListState; } NiceCheckListState;
typedef struct _Stream Stream;
struct _Stream struct _Stream
{ {
guint id; guint id;
...@@ -86,6 +86,7 @@ struct _Stream ...@@ -86,6 +86,7 @@ struct _Stream
gint tos; gint tos;
}; };
Stream * Stream *
stream_new (guint n_components); stream_new (guint n_components);
......
...@@ -9,6 +9,7 @@ NiceCompatibility ...@@ -9,6 +9,7 @@ NiceCompatibility
NiceAgentRecvFunc NiceAgentRecvFunc
NICE_AGENT_MAX_REMOTE_CANDIDATES NICE_AGENT_MAX_REMOTE_CANDIDATES
nice_agent_new nice_agent_new
nice_agent_new_reliable
nice_agent_add_local_address nice_agent_add_local_address
nice_agent_add_stream nice_agent_add_stream
nice_agent_remove_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