]> sjero.net Git - linphone/commitdiff
Start including upnp
authorYann Diorcet <yann.diorcet@belledonne-communications.com>
Wed, 19 Dec 2012 14:41:23 +0000 (15:41 +0100)
committerYann Diorcet <yann.diorcet@belledonne-communications.com>
Wed, 19 Dec 2012 14:41:23 +0000 (15:41 +0100)
configure.ac
coreapi/Makefile.am
coreapi/private.h
coreapi/upnp.c [new file with mode: 0644]
mediastreamer2

index 1005ab2f598d11fbcb486437f22943fb5bd2ee30..659a872b460829839a872a3ef9139c76454113d1 100644 (file)
@@ -149,6 +149,32 @@ AC_ARG_ENABLE(tools,
         *) AC_MSG_ERROR(bad value ${enableval} for --enable-tools) ;;
       esac],[build_tools=check])
 
+dnl check for installed version of libupnp
+AC_ARG_ENABLE(upnp,
+      [AS_HELP_STRING([--disable-upnp], [Disable uPnP support])],
+      [case "${enableval}" in
+        yes) build_upnp=true ;;
+        no)  build_upnp=false ;;
+        *) AC_MSG_ERROR(bad value ${enableval} for --disable-upnp) ;;
+      esac],[build_upnp=auto])
+
+if test "$build_upnp" != "false" ; then
+PKG_CHECK_MODULES([LIBUPNP], [libupnp], [build_upnp=true],
+       [
+               if test "$build_upnp" == "true" ; then
+                       AC_MSG_ERROR([libupnp not found.])
+               else
+                       build_upnp=false
+               fi
+       ])
+
+fi
+
+AM_CONDITIONAL(BUILD_UPNP, test x$build_upnp != xfalse)
+if test "$build_upnp" != "false" ; then
+       AC_DEFINE(BUILD_UPNP, 1, [Define if upnp enabled])
+fi
+
 dnl check libxml2 (needed for tools)
 if test "$build_tools" != "false" ; then
        PKG_CHECK_MODULES(LIBXML2, [libxml-2.0],[],
index 790612cab48b7b59ece5d5664e575cc6b78b077e..6d55a731f6a8c02535f5e25738023e240348ae80 100644 (file)
@@ -49,6 +49,10 @@ liblinphone_la_SOURCES=\
        conference.c \
        linphone_tunnel.cc \
        $(GITVERSION_FILE)
+
+if BUILD_UPNP
+liblinphone_la_SOURCES+=upnp.c
+endif
        
 if BUILD_WIZARD
 liblinphone_la_SOURCES+=sipwizard.c 
index 925a303605a1b8b99c9c48f0e2cb48c3aad602ce..f69eb2ff028ce344d628b850b5fa9f1cdfb3f118 100644 (file)
@@ -38,6 +38,9 @@ extern "C" {
 #include "mediastreamer2/ice.h"
 #include "mediastreamer2/mediastream.h"
 #include "mediastreamer2/msconference.h"
+#ifdef BUILD_UPNP
+#include "mediastreamer2/upnp_igd.h"
+#endif
 
 #ifndef LIBLINPHONE_VERSION
 #define LIBLINPHONE_VERSION LINPHONE_VERSION
@@ -558,8 +561,8 @@ struct _LinphoneCore
        bool_t network_reachable;
        bool_t use_preview_window;
        
-        time_t network_last_check;
-        bool_t network_last_status;
+       time_t network_last_check;
+       bool_t network_last_status;
 
        bool_t ringstream_autorelease;
        bool_t pad[3];
@@ -568,6 +571,9 @@ struct _LinphoneCore
        LinphoneTunnel *tunnel;
        char* device_id;
        MSList *last_recv_msg_ids;
+#ifdef BUILD_UPNP
+       upnp_igd_context *upnp_igd_ctxt;
+#endif
 };
 
 LinphoneTunnel *linphone_core_tunnel_new(LinphoneCore *lc);
@@ -642,6 +648,9 @@ void call_logs_write_to_config_file(LinphoneCore *lc);
 int linphone_core_get_edge_bw(LinphoneCore *lc);
 int linphone_core_get_edge_ptime(LinphoneCore *lc);
 
+int linphone_upnp_init(LinphoneCore *lc);
+void linphone_upnp_destroy(LinphoneCore *lc);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/coreapi/upnp.c b/coreapi/upnp.c
new file mode 100644 (file)
index 0000000..31fb5c5
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+linphone
+Copyright (C) 2012  Belledonne Communications SARL
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+*/
+
+#include "private.h"
+#include "mediastreamer2/upnp_igd.h"
+
+/* Convert uPnP IGD logs to ortp logs */
+void linphone_upnp_igd_print(void *cookie, upnp_igd_print_level level, const char *fmt, va_list list) {
+       int ortp_level = ORTP_DEBUG;
+       switch(level) {
+       case UPNP_IGD_MESSAGE:
+               ortp_level = ORTP_MESSAGE;
+               break;
+       case UPNP_IGD_WARNING:
+               ortp_level = ORTP_WARNING;
+               break;
+       case UPNP_IGD_ERROR:
+               ortp_level = ORTP_ERROR;
+               break;
+       default:
+               break;
+       }
+       ortp_logv(level, fmt, list);
+}
+
+void linphone_upnp_igd_callback(void *cookie, upnp_igd_event event, void *arg) {
+}
+
+int linphone_upnp_init(LinphoneCore *lc) {
+       lc->upnp_igd_ctxt = NULL;
+       return 0;
+}
+void linphone_upnp_destroy(LinphoneCore *lc) {
+
+}
index 9c3f1bdf1f7b51c5eeb020f68ef9a4019c66cc52..2093868ac68ffe62310cd0ad20b58ffa6860d7e3 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 9c3f1bdf1f7b51c5eeb020f68ef9a4019c66cc52
+Subproject commit 2093868ac68ffe62310cd0ad20b58ffa6860d7e3