Commit bc140489 authored by Youness Alaoui's avatar Youness Alaoui

port tests to windows

parent 3c40f049
...@@ -39,11 +39,12 @@ ...@@ -39,11 +39,12 @@
# include <config.h> # include <config.h>
#endif #endif
#include "agent.h"
#include "agent-priv.h" /* for testing purposes */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "agent.h"
#include "agent-priv.h" /* for testing purposes */
static NiceComponentState global_lagent_state = NICE_COMPONENT_STATE_LAST; static NiceComponentState global_lagent_state = NICE_COMPONENT_STATE_LAST;
static NiceComponentState global_ragent_state = NICE_COMPONENT_STATE_LAST; static NiceComponentState global_ragent_state = NICE_COMPONENT_STATE_LAST;
......
...@@ -38,10 +38,11 @@ ...@@ -38,10 +38,11 @@
# include <config.h> # include <config.h>
#endif #endif
#include "agent.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "agent.h"
#define USE_TURN 0 #define USE_TURN 0
#define USE_LOOPBACK 1 #define USE_LOOPBACK 1
...@@ -127,7 +128,7 @@ static void cb_nice_recv (NiceAgent *agent, guint stream_id, guint component_id, ...@@ -127,7 +128,7 @@ static void cb_nice_recv (NiceAgent *agent, guint stream_id, guint component_id,
if (strncmp ("12345678", buf, 8)) if (strncmp ("12345678", buf, 8))
return; return;
if ((intptr_t)user_data == 2) { if ((int)user_data == 2) {
global_ragent_read = len; global_ragent_read = len;
g_main_loop_quit (global_mainloop); g_main_loop_quit (global_mainloop);
} }
...@@ -137,9 +138,9 @@ static void cb_candidate_gathering_done(NiceAgent *agent, gpointer data) ...@@ -137,9 +138,9 @@ static void cb_candidate_gathering_done(NiceAgent *agent, gpointer data)
{ {
g_debug ("test-fullmode:%s: %p", G_STRFUNC, data); g_debug ("test-fullmode:%s: %p", G_STRFUNC, data);
if ((intptr_t)data == 1) if ((int)data == 1)
global_lagent_gathering_done = TRUE; global_lagent_gathering_done = TRUE;
else if ((intptr_t)data == 2) else if ((int)data == 2)
global_ragent_gathering_done = TRUE; global_ragent_gathering_done = TRUE;
if (global_lagent_gathering_done && if (global_lagent_gathering_done &&
...@@ -154,9 +155,9 @@ static void cb_component_state_changed (NiceAgent *agent, guint stream_id, guint ...@@ -154,9 +155,9 @@ static void cb_component_state_changed (NiceAgent *agent, guint stream_id, guint
{ {
g_debug ("test-fullmode:%s: %p", __func__, data); g_debug ("test-fullmode:%s: %p", __func__, data);
if ((intptr_t)data == 1) if ((int)data == 1)
global_lagent_state[component_id - 1] = state; global_lagent_state[component_id - 1] = state;
else if ((intptr_t)data == 2) else if ((int)data == 2)
global_ragent_state[component_id - 1] = state; global_ragent_state[component_id - 1] = state;
if (state == NICE_COMPONENT_STATE_READY) if (state == NICE_COMPONENT_STATE_READY)
...@@ -191,9 +192,9 @@ static void cb_new_selected_pair(NiceAgent *agent, guint stream_id, guint compon ...@@ -191,9 +192,9 @@ static void cb_new_selected_pair(NiceAgent *agent, guint stream_id, guint compon
{ {
g_debug ("test-fullmode:%s: %p", __func__, data); g_debug ("test-fullmode:%s: %p", __func__, data);
if ((intptr_t)data == 1) if ((int)data == 1)
++global_lagent_cands; ++global_lagent_cands;
else if ((intptr_t)data == 2) else if ((int)data == 2)
++global_ragent_cands; ++global_ragent_cands;
/* XXX: dear compiler, these are for you: */ /* XXX: dear compiler, these are for you: */
...@@ -213,9 +214,9 @@ static void cb_initial_binding_request_received(NiceAgent *agent, guint stream_i ...@@ -213,9 +214,9 @@ static void cb_initial_binding_request_received(NiceAgent *agent, guint stream_i
{ {
g_debug ("test-fullmode:%s: %p", __func__, data); g_debug ("test-fullmode:%s: %p", __func__, data);
if ((intptr_t)data == 1) if ((int)data == 1)
global_lagent_ibr_received = TRUE; global_lagent_ibr_received = TRUE;
else if ((intptr_t)data == 2) else if ((int)data == 2)
global_ragent_ibr_received = TRUE; global_ragent_ibr_received = TRUE;
if (global_exit_when_ibr_received) if (global_exit_when_ibr_received)
......
...@@ -36,12 +36,12 @@ ...@@ -36,12 +36,12 @@
# include <config.h> # include <config.h>
#endif #endif
#include <stdlib.h>
#include <string.h>
#include "agent.h" #include "agent.h"
#include "agent-priv.h" /* for testing purposes */ #include "agent-priv.h" /* for testing purposes */
#include <stdlib.h>
#include <string.h>
static NiceComponentState global_lagent_state = NICE_COMPONENT_STATE_LAST; static NiceComponentState global_lagent_state = NICE_COMPONENT_STATE_LAST;
static NiceComponentState global_ragent_state = NICE_COMPONENT_STATE_LAST; static NiceComponentState global_ragent_state = NICE_COMPONENT_STATE_LAST;
static guint global_components_ready = 0; static guint global_components_ready = 0;
......
...@@ -38,11 +38,11 @@ ...@@ -38,11 +38,11 @@
# include <config.h> # include <config.h>
#endif #endif
#include "agent.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "agent.h"
GMainLoop *error_loop; GMainLoop *error_loop;
gint global_lagent_cands = 0; gint global_lagent_cands = 0;
...@@ -82,9 +82,9 @@ cb_new_selected_pair(NiceAgent *agent, ...@@ -82,9 +82,9 @@ cb_new_selected_pair(NiceAgent *agent,
{ {
g_debug ("test-thread:%s: %p", __func__, data); g_debug ("test-thread:%s: %p", __func__, data);
if ((intptr_t)data == 1) if ((int)data == 1)
g_atomic_int_inc (&global_lagent_cands); g_atomic_int_inc (&global_lagent_cands);
else if ((intptr_t)data == 2) else if ((int)data == 2)
g_atomic_int_inc (&global_ragent_cands); g_atomic_int_inc (&global_ragent_cands);
} }
......
...@@ -38,16 +38,38 @@ ...@@ -38,16 +38,38 @@
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h>
#include "stun/stunagent.h" #include "stun/stunagent.h"
#include "stun/usages/bind.h" #include "stun/usages/bind.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#define ENOENT -1
#define EINVAL -2
#define ENOBUFS -3
#define EAFNOSUPPORT -4
#define EPROTO -5
#define EACCES -6
#define EINPROGRESS -7
#define EAGAIN -8
#define ENOSYS -9
#define MSG_DONTWAIT 0
#define MSG_NOSIGNAL 0
#define alarm(...)
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netdb.h> #include <netdb.h>
#include <errno.h>
#endif
#undef NDEBUG /* ensure assertions are built-in */ #undef NDEBUG /* ensure assertions are built-in */
#include <assert.h> #include <assert.h>
......
...@@ -38,16 +38,39 @@ ...@@ -38,16 +38,39 @@
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h>
#include "stun/stunagent.h" #include "stun/stunagent.h"
#include "stun/usages/ice.h" #include "stun/usages/ice.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <unistd.h> #include <unistd.h>
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#define ENOENT -1
#define EINVAL -2
#define ENOBUFS -3
#define EAFNOSUPPORT -4
#define EPROTO -5
#define EACCES -6
#define EINPROGRESS -7
#define EAGAIN -8
#define ENOSYS -9
#define MSG_DONTWAIT 0
#define MSG_NOSIGNAL 0
#define alarm(...)
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h>
#include <errno.h>
#endif
#undef NDEBUG /* ensure assertions are built-in */ #undef NDEBUG /* ensure assertions are built-in */
#include <assert.h> #include <assert.h>
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h>
#include "stun/stunagent.h" #include "stun/stunagent.h"
#include <stdio.h> #include <stdio.h>
...@@ -46,8 +45,24 @@ ...@@ -46,8 +45,24 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#ifdef _WIN32
#include <winsock2.h>
#define ENOENT -1
#define EINVAL -2
#define ENOBUFS -3
#define EAFNOSUPPORT -4
#define EPROTO -5
#define EACCES -6
#define EINPROGRESS -7
#define EAGAIN -8
#define ENOSYS -9
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <errno.h> #include <errno.h>
#include <netinet/in.h> #endif
static void fatal (const char *msg, ...) static void fatal (const char *msg, ...)
......
...@@ -37,17 +37,29 @@ ...@@ -37,17 +37,29 @@
# include <config.h> # include <config.h>
#endif #endif
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "stun/stunagent.h" #include "stun/stunagent.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#ifdef _WIN32
#include <winsock2.h>
#define ENOENT -1
#define EINVAL -2
#define ENOBUFS -3
#define EAFNOSUPPORT -4
#define EPROTO -5
#define EACCES -6
#define EINPROGRESS -7
#define EAGAIN -8
#define ENOSYS -9
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <errno.h> #include <errno.h>
#endif
# define STUN_MAX_STR (763u) # define STUN_MAX_STR (763u)
......
...@@ -38,16 +38,38 @@ ...@@ -38,16 +38,38 @@
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h>
#include "stun/stunagent.h" #include "stun/stunagent.h"
#include "stun/usages/turn.h" #include "stun/usages/turn.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#define ENOENT -1
#define EINVAL -2
#define ENOBUFS -3
#define EAFNOSUPPORT -4
#define EPROTO -5
#define EACCES -6
#define EINPROGRESS -7
#define EAGAIN -8
#define ENOSYS -9
#define MSG_DONTWAIT 0
#define MSG_NOSIGNAL 0
#define alarm(...)
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netdb.h> #include <netdb.h>
#include <errno.h>
#endif
#undef NDEBUG /* ensure assertions are built-in */ #undef NDEBUG /* ensure assertions are built-in */
#include <assert.h> #include <assert.h>
......
#
# Makefile.am for the Nice Glib ICE library
#
# (C) 2006, 2007 Collabora Ltd.
# (C) 2006, 2007 Nokia Corporation. All rights reserved.
#
# Licensed under MPL 1.1/LGPL 2.1. See file COPYING.
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