Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
02ff6c5f
Commit
02ff6c5f
authored
Apr 24, 2009
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add UPnP support to libnice
parent
c4968e09
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
308 additions
and
13 deletions
+308
-13
agent/Makefile.am
agent/Makefile.am
+2
-1
agent/agent-priv.h
agent/agent-priv.h
+18
-0
agent/agent.c
agent/agent.c
+254
-6
agent/discovery.c
agent/discovery.c
+4
-4
configure.ac
configure.ac
+25
-1
socket/Makefile.am
socket/Makefile.am
+1
-0
tests/Makefile.am
tests/Makefile.am
+2
-1
tests/test-thread.c
tests/test-thread.c
+2
-0
No files found.
agent/Makefile.am
View file @
02ff6c5f
...
@@ -12,12 +12,13 @@ AM_CFLAGS = \
...
@@ -12,12 +12,13 @@ AM_CFLAGS = \
-DG_LOG_DOMAIN
=
\"
libnice
\"
\
-DG_LOG_DOMAIN
=
\"
libnice
\"
\
$(ERROR_CFLAGS)
\
$(ERROR_CFLAGS)
\
$(GLIB_CFLAGS)
\
$(GLIB_CFLAGS)
\
$(GUPNP_CFLAGS)
\
-I
$(top_srcdir)
\
-I
$(top_srcdir)
\
-I
$(top_srcdir)
/random
\
-I
$(top_srcdir)
/random
\
-I
$(top_srcdir)
/socket
\
-I
$(top_srcdir)
/socket
\
-I
$(top_srcdir)
/stun
-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
dist_noinst_DATA
=
agent-signals-marshal.list
noinst_LTLIBRARIES
=
libagent.la
noinst_LTLIBRARIES
=
libagent.la
...
...
agent/agent-priv.h
View file @
02ff6c5f
...
@@ -41,6 +41,13 @@
...
@@ -41,6 +41,13 @@
/* note: this is a private header part of agent.h */
/* 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 <glib.h>
#include "agent.h"
#include "agent.h"
...
@@ -53,6 +60,10 @@
...
@@ -53,6 +60,10 @@
#include "stun/usages/turn.h"
#include "stun/usages/turn.h"
#include "stun/usages/ice.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
/* XXX: starting from ICE ID-18, Ta SHOULD now be set according
* to session bandwidth -> this is not yet implemented in NICE */
* to session bandwidth -> this is not yet implemented in NICE */
...
@@ -101,6 +112,13 @@ struct _NiceAgent
...
@@ -101,6 +112,13 @@ struct _NiceAgent
GStaticRecMutex
mutex
;
/* Mutex used for thread-safe lib */
GStaticRecMutex
mutex
;
/* Mutex used for thread-safe lib */
NiceCompatibility
compatibility
;
/* property: Compatibility mode */
NiceCompatibility
compatibility
;
/* property: Compatibility mode */
StunAgent
stun_agent
;
/* STUN agent */
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 */
/* XXX: add pointer to internal data struct for ABI-safe extensions */
};
};
...
...
agent/agent.c
View file @
02ff6c5f
This diff is collapsed.
Click to expand it.
agent/discovery.c
View file @
02ff6c5f
...
@@ -102,7 +102,7 @@ void discovery_free (NiceAgent *agent)
...
@@ -102,7 +102,7 @@ void discovery_free (NiceAgent *agent)
/*
/*
* Prunes the list of discovery processes for items related
* 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
* @return TRUE on success, FALSE on a fatal error
*/
*/
...
@@ -316,7 +316,7 @@ static void priv_assign_foundation (NiceAgent *agent, NiceCandidate *candidate)
...
@@ -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
++
);
g_snprintf
(
candidate
->
foundation
,
NICE_CANDIDATE_MAX_FOUNDATION
,
"%u"
,
agent
->
next_candidate_id
++
);
}
}
...
@@ -436,7 +436,7 @@ NiceCandidate *discovery_add_local_host_candidate (
...
@@ -436,7 +436,7 @@ NiceCandidate *discovery_add_local_host_candidate (
if
(
udp_socket
)
if
(
udp_socket
)
nice_socket_free
(
udp_socket
);
nice_socket_free
(
udp_socket
);
}
}
return
candidate
;
return
candidate
;
}
}
...
@@ -446,7 +446,7 @@ NiceCandidate *discovery_add_local_host_candidate (
...
@@ -446,7 +446,7 @@ NiceCandidate *discovery_add_local_host_candidate (
*
*
* @return pointer to the created candidate, or NULL on error
* @return pointer to the created candidate, or NULL on error
*/
*/
NiceCandidate
*
NiceCandidate
*
discovery_add_server_reflexive_candidate
(
discovery_add_server_reflexive_candidate
(
NiceAgent
*
agent
,
NiceAgent
*
agent
,
guint
stream_id
,
guint
stream_id
,
...
...
configure.ac
View file @
02ff6c5f
...
@@ -66,7 +66,6 @@ AC_CHECK_LIB(rt, clock_gettime, [LIBRT="-lrt"], [LIBRT=""])
...
@@ -66,7 +66,6 @@ AC_CHECK_LIB(rt, clock_gettime, [LIBRT="-lrt"], [LIBRT=""])
AC_CHECK_FUNCS([poll])
AC_CHECK_FUNCS([poll])
AC_SUBST(LIBRT)
AC_SUBST(LIBRT)
PKG_CHECK_MODULES(GLIB, [dnl
PKG_CHECK_MODULES(GLIB, [dnl
glib-2.0 >= 2.10 dnl
glib-2.0 >= 2.10 dnl
gobject-2.0 >= 2.10 dnl
gobject-2.0 >= 2.10 dnl
...
@@ -102,6 +101,31 @@ AC_SUBST(gstplugindir)
...
@@ -102,6 +101,31 @@ AC_SUBST(gstplugindir)
AM_CONDITIONAL(WITH_GSTREAMER, test "$with_gstreamer" = yes)
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
dnl Test coverage
AC_ARG_ENABLE([coverage],
AC_ARG_ENABLE([coverage],
[AS_HELP_STRING([--enable-coverage],
[AS_HELP_STRING([--enable-coverage],
...
...
socket/Makefile.am
View file @
02ff6c5f
...
@@ -12,6 +12,7 @@ AM_CFLAGS = \
...
@@ -12,6 +12,7 @@ AM_CFLAGS = \
-DG_LOG_DOMAIN
=
\"
libnice-socket
\"
\
-DG_LOG_DOMAIN
=
\"
libnice-socket
\"
\
$(ERROR_CFLAGS)
\
$(ERROR_CFLAGS)
\
$(GLIB_CFLAGS)
\
$(GLIB_CFLAGS)
\
$(GUPNP_CFLAGS)
\
-I
$(top_srcdir)
/random
\
-I
$(top_srcdir)
/random
\
-I
$(top_srcdir)
/agent
\
-I
$(top_srcdir)
/agent
\
-I
$(top_srcdir)
/
-I
$(top_srcdir)
/
...
...
tests/Makefile.am
View file @
02ff6c5f
...
@@ -11,13 +11,14 @@ include $(top_srcdir)/common.mk
...
@@ -11,13 +11,14 @@ include $(top_srcdir)/common.mk
AM_CFLAGS
=
\
AM_CFLAGS
=
\
$(ERROR_CFLAGS)
\
$(ERROR_CFLAGS)
\
$(GLIB_CFLAGS)
\
$(GLIB_CFLAGS)
\
$(GUPNP_CFLAGS)
\
-I
$(top_srcdir)
\
-I
$(top_srcdir)
\
-I
$(top_srcdir)
/agent
\
-I
$(top_srcdir)
/agent
\
-I
$(top_srcdir)
/random
\
-I
$(top_srcdir)
/random
\
-I
$(top_srcdir)
/socket
\
-I
$(top_srcdir)
/socket
\
-I
$(top_srcdir)
/stun
-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
=
\
check_PROGRAMS
=
\
test-bsd
\
test-bsd
\
...
...
tests/test-thread.c
View file @
02ff6c5f
...
@@ -214,6 +214,8 @@ int main (void)
...
@@ -214,6 +214,8 @@ int main (void)
g_object_set
(
G_OBJECT
(
lagent
),
"controlling-mode"
,
TRUE
,
NULL
);
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
(
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 */
/* step: add a timer to catch state changes triggered by signals */
timer_id
=
g_timeout_add
(
30000
,
timer_cb
,
NULL
);
timer_id
=
g_timeout_add
(
30000
,
timer_cb
,
NULL
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment