Commit 02ff6c5f authored by Youness Alaoui's avatar Youness Alaoui

Add UPnP support to libnice

parent c4968e09
......@@ -12,12 +12,13 @@ AM_CFLAGS = \
-DG_LOG_DOMAIN=\"libnice\" \
$(ERROR_CFLAGS) \
$(GLIB_CFLAGS) \
$(GUPNP_CFLAGS) \
-I $(top_srcdir) \
-I $(top_srcdir)/random \
-I $(top_srcdir)/socket \
-I $(top_srcdir)/stun
COMMON_LDADD = libagent.la $(GLIB_LIBS)
COMMON_LDADD = libagent.la $(GLIB_LIBS) (GUPNP_LIBS)
dist_noinst_DATA = agent-signals-marshal.list
noinst_LTLIBRARIES = libagent.la
......
......@@ -41,6 +41,13 @@
/* note: this is a private header part of agent.h */
#ifdef HAVE_CONFIG_H
# include <config.h>
#else
#define NICEAPI_EXPORT
#endif
#include <glib.h>
#include "agent.h"
......@@ -53,6 +60,10 @@
#include "stun/usages/turn.h"
#include "stun/usages/ice.h"
#ifdef HAVE_GUPNP
#include <libgupnp-igd/gupnp-simple-igd.h>
#endif
/* XXX: starting from ICE ID-18, Ta SHOULD now be set according
* to session bandwidth -> this is not yet implemented in NICE */
......@@ -101,6 +112,13 @@ struct _NiceAgent
GStaticRecMutex mutex; /* Mutex used for thread-safe lib */
NiceCompatibility compatibility; /* property: Compatibility mode */
StunAgent stun_agent; /* STUN agent */
#ifdef HAVE_GUPNP
GUPnPSimpleIgd* upnp; /* GUPnP Single IGD agent */
gboolean upnp_enabled; /* whether UPnP discovery is enabled */
guint upnp_timeout; /* UPnP discovery timeout */
GSList *upnp_mapping; /* list of Candidates being mapped */
GSource *upnp_timer_source; /* source of upnp timeout timer */
#endif
/* XXX: add pointer to internal data struct for ABI-safe extensions */
};
......
This diff is collapsed.
......@@ -102,7 +102,7 @@ void discovery_free (NiceAgent *agent)
/*
* Prunes the list of discovery processes for items related
* to stream 'stream_id'.
* to stream 'stream_id'.
*
* @return TRUE on success, FALSE on a fatal error
*/
......@@ -316,7 +316,7 @@ static void priv_assign_foundation (NiceAgent *agent, NiceCandidate *candidate)
}
}
}
g_snprintf (candidate->foundation, NICE_CANDIDATE_MAX_FOUNDATION, "%u", agent->next_candidate_id++);
}
......@@ -436,7 +436,7 @@ NiceCandidate *discovery_add_local_host_candidate (
if (udp_socket)
nice_socket_free (udp_socket);
}
return candidate;
}
......@@ -446,7 +446,7 @@ NiceCandidate *discovery_add_local_host_candidate (
*
* @return pointer to the created candidate, or NULL on error
*/
NiceCandidate*
NiceCandidate*
discovery_add_server_reflexive_candidate (
NiceAgent *agent,
guint stream_id,
......
......@@ -66,7 +66,6 @@ AC_CHECK_LIB(rt, clock_gettime, [LIBRT="-lrt"], [LIBRT=""])
AC_CHECK_FUNCS([poll])
AC_SUBST(LIBRT)
PKG_CHECK_MODULES(GLIB, [dnl
glib-2.0 >= 2.10 dnl
gobject-2.0 >= 2.10 dnl
......@@ -102,6 +101,31 @@ AC_SUBST(gstplugindir)
AM_CONDITIONAL(WITH_GSTREAMER, test "$with_gstreamer" = yes)
AC_ARG_ENABLE([gupnp],
AC_HELP_STRING([--disable-gupnp], [Disable GUPnP IGD support]),
[case "${enableval}" in
yes) WANT_GUPNP=yes ;;
no) WANT_GUPNP=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-gupnp) ;;
esac],
WANT_GUPNP=test)
HAVE_GUPNP=no
if test "x$WANT_GUPNP" != "xno"; then
PKG_CHECK_MODULES(GUPNP, [ gupnp-igd-1.0 ],
[ HAVE_GUPNP=yes ],
[ HAVE_GUPNP=no ])
fi
if test "x$WANT_GUPNP" = "xyes" && test "x$HAVE_GUPNP" = "xno"; then
AC_ERROR([Requested GUPnP IGD, but it is not available])
fi
if test "x$HAVE_GUPNP" = "xyes"; then
AC_DEFINE(HAVE_GUPNP,,[Have the GUPnP IGD library])
fi
AC_SUBST(HAVE_GUPNP)
dnl Test coverage
AC_ARG_ENABLE([coverage],
[AS_HELP_STRING([--enable-coverage],
......
......@@ -12,6 +12,7 @@ AM_CFLAGS = \
-DG_LOG_DOMAIN=\"libnice-socket\" \
$(ERROR_CFLAGS) \
$(GLIB_CFLAGS) \
$(GUPNP_CFLAGS) \
-I $(top_srcdir)/random \
-I $(top_srcdir)/agent \
-I $(top_srcdir)/
......
......@@ -11,13 +11,14 @@ include $(top_srcdir)/common.mk
AM_CFLAGS = \
$(ERROR_CFLAGS) \
$(GLIB_CFLAGS) \
$(GUPNP_CFLAGS) \
-I $(top_srcdir) \
-I $(top_srcdir)/agent \
-I $(top_srcdir)/random \
-I $(top_srcdir)/socket \
-I $(top_srcdir)/stun
COMMON_LDADD = $(top_builddir)/agent/libagent.la $(top_builddir)/socket/libsocket.la $(GLIB_LIBS)
COMMON_LDADD = $(top_builddir)/agent/libagent.la $(top_builddir)/socket/libsocket.la $(GLIB_LIBS) $(GUPNP_LIBS)
check_PROGRAMS = \
test-bsd \
......
......@@ -214,6 +214,8 @@ int main (void)
g_object_set (G_OBJECT (lagent), "controlling-mode", TRUE, NULL);
g_object_set (G_OBJECT (ragent), "controlling-mode", FALSE, NULL);
g_object_set (G_OBJECT (lagent), "upnp", FALSE, NULL);
g_object_set (G_OBJECT (ragent), "upnp", FALSE, NULL);
/* step: add a timer to catch state changes triggered by signals */
timer_id = g_timeout_add (30000, timer_cb, NULL);
......
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