Commit 181d9d56 authored by Kai Vehmanen's avatar Kai Vehmanen

Major NICE agent update. Added supprt for peer-reflexive candidates, media...

Major NICE agent update. Added supprt for peer-reflexive candidates, media keepalives, candidate keepalives, role conflict tie-breaking functionality, and for triggered checks. Added NICEAPI_EXPORT attributes to public functions. Includes numerous bugfixes to existing functionality.

darcs-hash:20070619080609-77cd4-d18bf44fe48a201e59556ae5a9dff2b5a2e7e073.gz
parent 99ff130b
...@@ -27,7 +27,7 @@ noinst_LTLIBRARIES = libagent.la ...@@ -27,7 +27,7 @@ noinst_LTLIBRARIES = libagent.la
%-signals-marshal.c: %-signals-marshal.list Makefile.am %-signals-marshal.c: %-signals-marshal.list Makefile.am
glib-genmarshal --body --prefix=$(subst -,_,$*)_marshal $< > $@ glib-genmarshal --body --prefix=$(subst -,_,$*)_marshal $< > $@
sed -i "1i#include \"$*-signals-marshal.h\"" $@ sed -i "1i#include \"$*-signals-marshal.h\"" $@
sed -ie 's/^}$$/(void)return_value;(void)invocation_hint;}/' $@ sed -i -e 's/^}$$/(void)return_value;(void)invocation_hint;}/' $@
BUILT_SOURCES = \ BUILT_SOURCES = \
agent-signals-marshal.h \ agent-signals-marshal.h \
...@@ -66,12 +66,15 @@ check_PROGRAMS = \ ...@@ -66,12 +66,15 @@ check_PROGRAMS = \
test-mainloop \ test-mainloop \
test-fullmode test-fullmode
check_SCRIPTS = \
check-test-fullmode-with-stun.sh
# disabled test programs (using the old STUN API): # disabled test programs (using the old STUN API):
noinst_PROGRAMS = \ EXTRA_PROGRAMS = \
test-stun \ test-stun \
test-send test-send
TESTS = $(check_PROGRAMS) TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
test_LDADD = $(COMMON_LDADD) test_LDADD = $(COMMON_LDADD)
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#include "stream.h" #include "stream.h"
#include "conncheck.h" #include "conncheck.h"
/** As specified in ICE spec ID-15 */
#define NICE_AGENT_TIMER_TA_DEFAULT 20 /* timer Ta, msecs */ #define NICE_AGENT_TIMER_TA_DEFAULT 20 /* timer Ta, msecs */
#define NICE_AGENT_TIMER_TR_DEFAULT 15000 /* timer Tr, msecs */ #define NICE_AGENT_TIMER_TR_DEFAULT 15000 /* timer Tr, msecs */
...@@ -59,6 +60,7 @@ ...@@ -59,6 +60,7 @@
struct _NiceAgent struct _NiceAgent
{ {
GObject parent; /**< gobject pointer */ GObject parent; /**< gobject pointer */
gboolean full_mode; /**< property: full-mode */ gboolean full_mode; /**< property: full-mode */
NiceUDPSocketFactory *socket_factory; /**< property: socket factory */ NiceUDPSocketFactory *socket_factory; /**< property: socket factory */
GTimeVal next_check_tv; /**< property: next conncheck timestamp */ GTimeVal next_check_tv; /**< property: next conncheck timestamp */
...@@ -67,6 +69,8 @@ struct _NiceAgent ...@@ -67,6 +69,8 @@ struct _NiceAgent
gchar *turn_server_ip; /**< property: TURN server IP */ gchar *turn_server_ip; /**< property: TURN server IP */
guint turn_server_port; /**< property: TURN server port */ guint turn_server_port; /**< property: TURN server port */
gboolean controlling_mode; /**< property: controlling-mode */ gboolean controlling_mode; /**< property: controlling-mode */
guint timer_ta; /**< property: timer Ta */
GSList *local_addresses; /**< list of NiceAddresses for local GSList *local_addresses; /**< list of NiceAddresses for local
interfaces */ interfaces */
GSList *streams; /**< list of Stream objects */ GSList *streams; /**< list of Stream objects */
...@@ -83,6 +87,10 @@ struct _NiceAgent ...@@ -83,6 +87,10 @@ struct _NiceAgent
GSList *conncheck_list; /**< list of CandidatePair items */ GSList *conncheck_list; /**< list of CandidatePair items */
guint conncheck_timer_id; /**< id of discovery timer */ guint conncheck_timer_id; /**< id of discovery timer */
NiceCheckListState conncheck_state; /**< checklist state */ NiceCheckListState conncheck_state; /**< checklist state */
guint keepalive_timer_id; /**< id of keepalive timer */
guint64 tie_breaker; /**< tie breaker (ICE ID-16 sect
5.2) */
gchar ufragtmp[NICE_STREAM_MAX_UNAME]; /**< preallocated buffer for uname processing */
/* XXX: add pointer to internal data struct for ABI-safe extensions */ /* XXX: add pointer to internal data struct for ABI-safe extensions */
}; };
...@@ -115,6 +123,8 @@ void agent_signal_new_candidate ( ...@@ -115,6 +123,8 @@ void agent_signal_new_candidate (
NiceAgent *agent, NiceAgent *agent,
NiceCandidate *candidate); NiceCandidate *candidate);
void agent_signal_new_remote_candidate (NiceAgent *agent, NiceCandidate *candidate);
void agent_signal_initial_binding_request_received (NiceAgent *agent, Stream *stream); void agent_signal_initial_binding_request_received (NiceAgent *agent, Stream *stream);
void agent_free_discovery_candidate_udp (gpointer data, gpointer user_data); void agent_free_discovery_candidate_udp (gpointer data, gpointer user_data);
......
This diff is collapsed.
...@@ -70,6 +70,13 @@ G_BEGIN_DECLS ...@@ -70,6 +70,13 @@ G_BEGIN_DECLS
(G_TYPE_INSTANCE_GET_CLASS ((obj), \ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
NICE_TYPE_AGENT, NiceAgentClass)) NICE_TYPE_AGENT, NiceAgentClass))
/**
* A hard limit for number for remote candidates. This
* limit is enforced to protect against malevolent remote
* clients.
*/
#define NICE_AGENT_MAX_REMOTE_CANDIDATES 25
typedef enum typedef enum
{ {
NICE_COMPONENT_STATE_DISCONNECTED, /* no activity scheduled */ NICE_COMPONENT_STATE_DISCONNECTED, /* no activity scheduled */
...@@ -92,13 +99,13 @@ typedef enum ...@@ -92,13 +99,13 @@ typedef enum
typedef struct _NiceCandidateDesc NiceCandidateDesc; typedef struct _NiceCandidateDesc NiceCandidateDesc;
struct _NiceCandidateDesc { struct _NiceCandidateDesc {
const gchar *foundation; gchar *foundation;
guint component_id; guint component_id;
NiceCandidateTransport transport; NiceCandidateTransport transport;
guint32 priority; guint32 priority;
const NiceAddress *addr; NiceAddress *addr;
NiceCandidateType type; NiceCandidateType type;
const NiceAddress *related_addr; /* optional */ NiceAddress *related_addr; /* optional */
}; };
typedef struct _NiceAgent NiceAgent; typedef struct _NiceAgent NiceAgent;
...@@ -120,7 +127,7 @@ GType nice_agent_get_type (void); ...@@ -120,7 +127,7 @@ GType nice_agent_get_type (void);
NiceAgent * NiceAgent *
nice_agent_new (NiceUDPSocketFactory *factory); nice_agent_new (NiceUDPSocketFactory *factory);
void gboolean
nice_agent_add_local_address (NiceAgent *agent, NiceAddress *addr); nice_agent_add_local_address (NiceAgent *agent, NiceAddress *addr);
guint guint
...@@ -145,7 +152,7 @@ nice_agent_get_local_credentials ( ...@@ -145,7 +152,7 @@ nice_agent_get_local_credentials (
guint stream_id, guint stream_id,
const gchar **ufrag, const gchar **pwd); const gchar **ufrag, const gchar **pwd);
void gboolean
nice_agent_add_remote_candidate ( nice_agent_add_remote_candidate (
NiceAgent *agent, NiceAgent *agent,
guint stream_id, guint stream_id,
...@@ -155,12 +162,12 @@ nice_agent_add_remote_candidate ( ...@@ -155,12 +162,12 @@ nice_agent_add_remote_candidate (
const gchar *username, const gchar *username,
const gchar *password); const gchar *password);
void int
nice_agent_set_remote_candidates ( nice_agent_set_remote_candidates (
NiceAgent *agent, NiceAgent *agent,
guint stream_id, guint stream_id,
guint component_id, guint component_id,
GSList *candidates); const GSList *candidates);
guint guint
nice_agent_recv ( nice_agent_recv (
...@@ -186,7 +193,7 @@ nice_agent_poll_read ( ...@@ -186,7 +193,7 @@ nice_agent_poll_read (
NiceAgentRecvFunc func, NiceAgentRecvFunc func,
gpointer data); gpointer data);
void gint
nice_agent_send ( nice_agent_send (
NiceAgent *agent, NiceAgent *agent,
guint stream_id, guint stream_id,
......
...@@ -36,6 +36,15 @@ ...@@ -36,6 +36,15 @@
* file under either the MPL or the LGPL. * file under either the MPL or the LGPL.
*/ */
/**
* @file candidate.c
* @brief ICE candidate functions
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "agent.h" #include "agent.h"
#include "component.h" #include "component.h"
...@@ -44,7 +53,7 @@ ...@@ -44,7 +53,7 @@
* candidates, server reflexive candidates, and relayed candidates. */ * candidates, server reflexive candidates, and relayed candidates. */
NiceCandidate * NICEAPI_EXPORT NiceCandidate *
nice_candidate_new (NiceCandidateType type) nice_candidate_new (NiceCandidateType type)
{ {
NiceCandidate *candidate; NiceCandidate *candidate;
...@@ -55,28 +64,22 @@ nice_candidate_new (NiceCandidateType type) ...@@ -55,28 +64,22 @@ nice_candidate_new (NiceCandidateType type)
} }
void NICEAPI_EXPORT void
nice_candidate_free (NiceCandidate *candidate) nice_candidate_free (NiceCandidate *candidate)
{ {
/* better way of checking if socket is allocated? */ /* better way of checking if socket is allocated? */
if (candidate->source)
g_source_destroy (candidate->source);
if (candidate->username) if (candidate->username)
g_free (candidate->username); g_free (candidate->username);
if (candidate->password) if (candidate->password)
g_free (candidate->password); g_free (candidate->password);
if (candidate->foundation)
g_free (candidate->foundation);
g_slice_free (NiceCandidate, candidate); g_slice_free (NiceCandidate, candidate);
} }
gfloat NICEAPI_EXPORT gfloat
nice_candidate_jingle_priority (NiceCandidate *candidate) nice_candidate_jingle_priority (NiceCandidate *candidate)
{ {
switch (candidate->type) switch (candidate->type)
...@@ -94,7 +97,7 @@ nice_candidate_jingle_priority (NiceCandidate *candidate) ...@@ -94,7 +97,7 @@ nice_candidate_jingle_priority (NiceCandidate *candidate)
/* ICE-15 §4.1.2.1; returns number between 1 and 0x7effffff */ /* ICE-15 §4.1.2.1; returns number between 1 and 0x7effffff */
G_GNUC_CONST G_GNUC_CONST
guint32 NICEAPI_EXPORT guint32
nice_candidate_ice_priority_full ( nice_candidate_ice_priority_full (
// must be ∈ (0, 126) (max 2^7 - 2) // must be ∈ (0, 126) (max 2^7 - 2)
guint type_preference, guint type_preference,
...@@ -111,7 +114,7 @@ nice_candidate_ice_priority_full ( ...@@ -111,7 +114,7 @@ nice_candidate_ice_priority_full (
G_GNUC_CONST G_GNUC_CONST
guint32 NICEAPI_EXPORT guint32
nice_candidate_ice_priority (const NiceCandidate *candidate) nice_candidate_ice_priority (const NiceCandidate *candidate)
{ {
guint8 type_preference = 0; guint8 type_preference = 0;
...@@ -135,7 +138,7 @@ nice_candidate_ice_priority (const NiceCandidate *candidate) ...@@ -135,7 +138,7 @@ nice_candidate_ice_priority (const NiceCandidate *candidate)
/** /**
* Calculates the pair priority as specified in ICE -15 spec 5.7.2. * Calculates the pair priority as specified in ICE -15 spec 5.7.2.
*/ */
guint64 NICEAPI_EXPORT guint64
nice_candidate_pair_priority (guint32 o_prio, guint32 a_prio) nice_candidate_pair_priority (guint32 o_prio, guint32 a_prio)
{ {
guint32 max = o_prio > a_prio ? o_prio : a_prio; guint32 max = o_prio > a_prio ? o_prio : a_prio;
......
...@@ -48,6 +48,8 @@ G_BEGIN_DECLS ...@@ -48,6 +48,8 @@ G_BEGIN_DECLS
#define NICE_CANDIDATE_TYPE_PREF_SERVER_REFLEXIVE 100 #define NICE_CANDIDATE_TYPE_PREF_SERVER_REFLEXIVE 100
#define NICE_CANDIDATE_TYPE_PREF_RELAYED 60 #define NICE_CANDIDATE_TYPE_PREF_RELAYED 60
#define NICE_CANDIDATE_MAX_FOUNDATION 16
typedef enum typedef enum
{ {
NICE_CANDIDATE_TYPE_HOST, NICE_CANDIDATE_TYPE_HOST,
...@@ -72,11 +74,10 @@ struct _NiceCandidate ...@@ -72,11 +74,10 @@ struct _NiceCandidate
guint32 priority; guint32 priority;
guint stream_id; guint stream_id;
guint component_id; guint component_id;
gchar *foundation; gchar foundation[NICE_CANDIDATE_MAX_FOUNDATION];
NiceUDPSocket *sockptr; /* XXX: to replace 'sock', see comment above */ NiceUDPSocket *sockptr;
gchar *username; /* pointer to a NULL-terminated username string */ gchar *username; /* pointer to a NULL-terminated username string */
gchar *password; /* pointer to a NULL-terminated password string */ gchar *password; /* pointer to a NULL-terminated password string */
GSource *source;
}; };
......
#! /bin/sh
STUND=../stun/stund
echo "Starting ICE full-mode with STUN unit test."
[ -e "$STUND" ] || {
echo "STUN server not found: Cannot run unit test!" >&2
exit 77
}
set -x
pidfile=./stund.pid
export NICE_STUN_SERVER=127.0.0.1
export NICE_STUN_SERVER_PORT=3800
echo "Launching stund on port ${NICE_STUN_SERVER_PORT}."
rm -f -- "$pidfile"
(sh -c "echo \$\$ > \"$pidfile\" && exec ../stun/stund ${NICE_STUN_SERVER_PORT}") &
sleep 1
./test-fullmode
error=$?
kill -- "$(cat "$pidfile")"
wait
exit ${error}
...@@ -35,6 +35,15 @@ ...@@ -35,6 +35,15 @@
* file under either the MPL or the LGPL. * file under either the MPL or the LGPL.
*/ */
/**
* @file component.c
* @brief ICE component functions
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "component.h" #include "component.h"
Component * Component *
......
...@@ -80,6 +80,8 @@ struct _Component ...@@ -80,6 +80,8 @@ struct _Component
GSList *gsources; /**< list of GSource objs */ GSList *gsources; /**< list of GSource objs */
CandidatePair selected_pair; /**< independent from checklists, CandidatePair selected_pair; /**< independent from checklists,
see ICE 11.1.1 (ID-15) */ see ICE 11.1.1 (ID-15) */
gboolean media_after_tick; /**< true if media received since last
keepalive tick */
/* XXX: **to be removed** /* XXX: **to be removed**
* --cut-- * --cut--
......
This diff is collapsed.
...@@ -44,7 +44,9 @@ ...@@ -44,7 +44,9 @@
#include "agent.h" #include "agent.h"
#include "stream.h" #include "stream.h"
#include "stun.h" /* XXX: using the old STUN API, to be removed */ #include "stun.h" /* XXX: using the old STUN API, to be removed */
#include "stun/conncheck.h" /* note: the new STUN API */ #include "stun-ice.h" /* note: the new STUN API */
#define NICE_CANDIDATE_PAIR_MAX_FOUNDATION NICE_CANDIDATE_MAX_FOUNDATION*2
typedef enum typedef enum
{ {
...@@ -53,7 +55,8 @@ typedef enum ...@@ -53,7 +55,8 @@ typedef enum
NICE_CHECK_SUCCEEDED, /**< conn. succesfully checked */ NICE_CHECK_SUCCEEDED, /**< conn. succesfully checked */
NICE_CHECK_FAILED, /**< no connectivity, retransmissions ceased */ NICE_CHECK_FAILED, /**< no connectivity, retransmissions ceased */
NICE_CHECK_FROZEN, /**< waiting to be scheduled to WAITING */ NICE_CHECK_FROZEN, /**< waiting to be scheduled to WAITING */
NICE_CHECK_CANCELLED /**< check cancelled */ NICE_CHECK_CANCELLED, /**< check cancelled */
NICE_CHECK_DISCOVERED /**< a valid candidate pair not on check list */
} NiceCheckState; } NiceCheckState;
typedef enum typedef enum
...@@ -73,11 +76,12 @@ struct _CandidateCheckPair ...@@ -73,11 +76,12 @@ struct _CandidateCheckPair
guint component_id; guint component_id;
NiceCandidate *local; NiceCandidate *local;
NiceCandidate *remote; NiceCandidate *remote;
gchar *foundation; gchar foundation[NICE_CANDIDATE_PAIR_MAX_FOUNDATION];
NiceCheckState state; NiceCheckState state;
gboolean nominated; gboolean nominated;
guint64 priority; guint64 priority;
GTimeVal next_tick; /* next tick timestamp */ GTimeVal next_tick; /* next tick timestamp */
gboolean traffic_after_tick;
stun_bind_t *stun_ctx; stun_bind_t *stun_ctx;
}; };
...@@ -87,17 +91,7 @@ void conn_check_free (NiceAgent *agent); ...@@ -87,17 +91,7 @@ void conn_check_free (NiceAgent *agent);
void conn_check_schedule_next (NiceAgent *agent); void conn_check_schedule_next (NiceAgent *agent);
int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair); int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair);
gboolean conn_check_prune_stream (NiceAgent *agent, guint stream_id); gboolean conn_check_prune_stream (NiceAgent *agent, guint stream_id);
gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, Component *component, const NiceAddress *from, gchar *buf, guint len); gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, Component *component, NiceUDPSocket *udp_socket, const NiceAddress *from, gchar *buf, guint len);
gint conn_check_compare (const CandidateCheckPair *a, const CandidateCheckPair *b);
/* functions using the old STUN API:
* ---------------------------------*/
void conn_check_handle_inbound_stun_old (
NiceAgent *agent,
Stream *stream,
Component *component,
NiceCandidate *local,
NiceAddress from,
StunMessage *msg);
#endif /*_NICE_CONNCHECK_H */ #endif /*_NICE_CONNCHECK_H */
This diff is collapsed.
...@@ -50,6 +50,7 @@ struct _CandidateDiscovery ...@@ -50,6 +50,7 @@ struct _CandidateDiscovery
guint socket; /**< XXX: should be taken from local cand: existing socket to use */ guint socket; /**< XXX: should be taken from local cand: existing socket to use */
NiceUDPSocket *nicesock; /**< XXX: should be taken from local cand: existing socket to use */ NiceUDPSocket *nicesock; /**< XXX: should be taken from local cand: existing socket to use */
const gchar *server_addr; /**< STUN/TURN server address, not owned */ const gchar *server_addr; /**< STUN/TURN server address, not owned */
guint server_port; /**< STUN/TURN server port */
NiceAddress *interface; /**< Address of local interface */ NiceAddress *interface; /**< Address of local interface */
stun_bind_t *stun_ctx; stun_bind_t *stun_ctx;
GTimeVal next_tick; /**< next tick timestamp */ GTimeVal next_tick; /**< next tick timestamp */
...@@ -64,7 +65,8 @@ void discovery_free (NiceAgent *agent); ...@@ -64,7 +65,8 @@ void discovery_free (NiceAgent *agent);
gboolean discovery_prune_stream (NiceAgent *agent, guint stream_id); gboolean discovery_prune_stream (NiceAgent *agent, guint stream_id);
void discovery_schedule (NiceAgent *agent); void discovery_schedule (NiceAgent *agent);
NiceCandidate *discovery_add_local_host_candidate ( NiceCandidate *
discovery_add_local_host_candidate (
NiceAgent *agent, NiceAgent *agent,
guint stream_id, guint stream_id,
guint component_id, guint component_id,
...@@ -78,4 +80,21 @@ discovery_add_server_reflexive_candidate ( ...@@ -78,4 +80,21 @@ discovery_add_server_reflexive_candidate (
NiceAddress *address, NiceAddress *address,
NiceUDPSocket *base_socket); NiceUDPSocket *base_socket);
NiceCandidate*
discovery_add_peer_reflexive_candidate (
NiceAgent *agent,
guint stream_id,
guint component_id,
NiceAddress *address,
NiceUDPSocket *base_socket);
NiceCandidate *
discovery_learn_remote_peer_reflexive_candidate (
NiceAgent *agent,
Stream *stream,
Component *component,
guint32 priority,
const NiceAddress *remote_address,
NiceUDPSocket *udp_socket);
#endif /*_NICE_CONNCHECK_H */ #endif /*_NICE_CONNCHECK_H */
...@@ -34,11 +34,19 @@ ...@@ -34,11 +34,19 @@
* not delete the provisions above, a recipient may use your version of this * not delete the provisions above, a recipient may use your version of this
* file under either the MPL or the LGPL. * file under either the MPL or the LGPL.
*/ */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <string.h> #include <string.h>
#include "stream.h" #include "stream.h"
/**
* @file stream.c
* @brief ICE stream functionality
*/
Stream * Stream *
stream_new (void) stream_new (void)
{ {
......
...@@ -44,10 +44,13 @@ ...@@ -44,10 +44,13 @@
G_BEGIN_DECLS G_BEGIN_DECLS
/* Following do not including the terminating NULL */ /* Following include the terminating NULL */
#define NICE_STREAM_MAX_UFRAG_LEN 4 #define NICE_STREAM_MAX_UFRAG 1024 + 1
#define NICE_STREAM_MAX_PWD_LEN 22 #define NICE_STREAM_MAX_UNAME 1024 + 1024 + 1 + 1 /* colon plus NULL */
#define NICE_STREAM_MAX_PWD 1024 + 1
#define NICE_STREAM_DEF_UFRAG 4 + 1
#define NICE_STREAM_DEF_PWD 22 + 1
typedef struct _Stream Stream; typedef struct _Stream Stream;
...@@ -58,10 +61,10 @@ struct _Stream ...@@ -58,10 +61,10 @@ struct _Stream
gboolean initial_binding_request_received; gboolean initial_binding_request_received;
/* XXX: streams can have multiple components */ /* XXX: streams can have multiple components */
Component *component; Component *component;
gchar local_ufrag[NICE_STREAM_MAX_UFRAG_LEN + 1]; gchar local_ufrag[NICE_STREAM_MAX_UFRAG];
gchar local_password[NICE_STREAM_MAX_PWD_LEN + 1]; gchar local_password[NICE_STREAM_MAX_PWD];
gchar remote_ufrag[NICE_STREAM_MAX_UFRAG_LEN + 1]; gchar remote_ufrag[NICE_STREAM_MAX_UFRAG];
gchar remote_password[NICE_STREAM_MAX_PWD_LEN + 1]; gchar remote_password[NICE_STREAM_MAX_PWD];
}; };
Stream * Stream *
......
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
* not delete the provisions above, a recipient may use your version of this * not delete the provisions above, a recipient may use your version of this
* file under either the MPL or the LGPL. * file under either the MPL or the LGPL.
*/ */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "agent.h" #include "agent.h"
#include "agent-priv.h" #include "agent-priv.h"
......
This diff is collapsed.
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
* not delete the provisions above, a recipient may use your version of this * not delete the provisions above, a recipient may use your version of this
* file under either the MPL or the LGPL. * file under either the MPL or the LGPL.
*/ */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <string.h> #include <string.h>
......
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
* not delete the provisions above, a recipient may use your version of this * not delete the provisions above, a recipient may use your version of this
* file under either the MPL or the LGPL. * file under either the MPL or the LGPL.
*/ */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <string.h> #include <string.h>
...@@ -73,6 +76,7 @@ main (void) ...@@ -73,6 +76,7 @@ main (void)
gint pipe_fds[2]; gint pipe_fds[2];
GSList *fds = NULL; GSList *fds = NULL;
GSList *readable; GSList *readable;
ssize_t w;
memset (&addr, 0, sizeof (addr)); memset (&addr, 0, sizeof (addr));
g_type_init (); g_type_init ();
...@@ -102,7 +106,8 @@ main (void) ...@@ -102,7 +106,8 @@ main (void)
if (pipe (pipe_fds) != 0) if (pipe (pipe_fds) != 0)
g_assert_not_reached (); g_assert_not_reached ();
write (pipe_fds[1], "hello", 5); w = write (pipe_fds[1], "hello", 5);
g_assert (w == 5);
fds = g_slist_append (fds, GUINT_TO_POINTER (pipe_fds[0])); fds = g_slist_append (fds, GUINT_TO_POINTER (pipe_fds[0]));
......
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
* not delete the provisions above, a recipient may use your version of this * not delete the provisions above, a recipient may use your version of this
* file under either the MPL or the LGPL. * file under either the MPL or the LGPL.
*/ */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "agent.h" #include "agent.h"
...@@ -53,10 +56,10 @@ main (void) ...@@ -53,10 +56,10 @@ main (void)
/* 2^32*MIN(O,A) + 2*MAX(O,A) + (O>A?1:0) /* 2^32*MIN(O,A) + 2*MAX(O,A) + (O>A?1:0)
= 2^32*1 + 2*5000 + 0 = 2^32*1 + 2*5000 + 0
= 4294977296 */ = 4294977296 */
g_assert (nice_candidate_pair_priority (1,5000) == 4294977296); g_assert (nice_candidate_pair_priority (1,5000) == 4294977296LL);
/* 2^32*1 + 2*5000 + 1 = 4294977297 */ /* 2^32*1 + 2*5000 + 1 = 4294977297 */
g_assert (nice_candidate_pair_priority (5000, 1) == 4294977297); g_assert (nice_candidate_pair_priority (5000, 1) == 4294977297LL);
return 0; return 0;
} }
......
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
* not delete the provisions above, a recipient may use your version of this * not delete the provisions above, a recipient may use your version of this
* file under either the MPL or the LGPL. * file under either the MPL or the LGPL.
*/ */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <string.h> #include <string.h>
......
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
* not delete the provisions above, a recipient may use your version of this * not delete the provisions above, a recipient may use your version of this
* file under either the MPL or the LGPL. * file under either the MPL or the LGPL.
*/ */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <string.h> #include <string.h>
......
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
* not delete the provisions above, a recipient may use your version of this * not delete the provisions above, a recipient may use your version of this
* file under either the MPL or the LGPL. * file under either the MPL or the LGPL.
*/ */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <string.h> #include <string.h>
...@@ -187,7 +190,7 @@ test_stun_valid_password ( ...@@ -187,7 +190,7 @@ test_stun_valid_password (
bres = stun_message_new (STUN_MESSAGE_BINDING_RESPONSE, bres = stun_message_new (STUN_MESSAGE_BINDING_RESPONSE,
"0123456789abcdef", 2); "0123456789abcdef", 2);
bres->attributes[0] = stun_attribute_mapped_address_new ( bres->attributes[0] = stun_attribute_mapped_address_new (
from.addr_ipv4, 5678); from.addr.addr_ipv4, 5678);
bres->attributes[1] = stun_attribute_username_new (username); bres->attributes[1] = stun_attribute_username_new (username);
packed_len = stun_message_pack (bres, &packed); packed_len = stun_message_pack (bres, &packed);
stun_message_free (bres); stun_message_free (bres);
......
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
* not delete the provisions above, a recipient may use your version of this * not delete the provisions above, a recipient may use your version of this
* file under either the MPL or the LGPL. * file under either the MPL or the LGPL.
*/ */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <string.h> #include <string.h>
......
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