Move UPnP to PJNATH (#3195)
This commit is contained in:
parent
e0b15546df
commit
8861441ec8
|
@ -6653,7 +6653,7 @@ UpnpInit2(NULL, 0);
|
|||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
CFLAGS="$CFLAGS -DPJLIB_UTIL_HAS_UPNP=1 $UPNP_CFLAGS"
|
||||
CFLAGS="$CFLAGS -DPJNATH_HAS_UPNP=1 $UPNP_CFLAGS"
|
||||
LDFLAGS="$LDFLAGS $UPNP_LDFLAGS $UPNP_LIBS"
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
|
|
|
@ -605,7 +605,7 @@ AC_ARG_ENABLE(upnp,
|
|||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <upnp/upnp.h>]],
|
||||
[UpnpInit2(NULL, 0);]
|
||||
)],
|
||||
[ CFLAGS="$CFLAGS -DPJLIB_UTIL_HAS_UPNP=1 $UPNP_CFLAGS"
|
||||
[ CFLAGS="$CFLAGS -DPJNATH_HAS_UPNP=1 $UPNP_CFLAGS"
|
||||
LDFLAGS="$LDFLAGS $UPNP_LDFLAGS $UPNP_LIBS"
|
||||
AC_MSG_RESULT(yes)
|
||||
],
|
||||
|
|
|
@ -40,7 +40,7 @@ export PJLIB_UTIL_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
|
|||
dns_dump.o dns_server.o getopt.o hmac_md5.o hmac_sha1.o \
|
||||
http_client.o json.o md5.o pcap.o resolver.o scanner.o sha1.o \
|
||||
srv_resolver.o string.o stun_simple.o \
|
||||
stun_simple_client.o upnp.o xml.o
|
||||
stun_simple_client.o xml.o
|
||||
export PJLIB_UTIL_CFLAGS += $(_CFLAGS)
|
||||
export PJLIB_UTIL_CXXFLAGS += $(_CXXFLAGS)
|
||||
export PJLIB_UTIL_LDFLAGS += $(PJLIB_LDLIB) $(_LDFLAGS)
|
||||
|
|
|
@ -750,7 +750,6 @@
|
|||
<ClCompile Include="..\src\pjlib-util\stun_simple.c" />
|
||||
<ClCompile Include="..\src\pjlib-util\stun_simple_client.c" />
|
||||
<ClCompile Include="..\src\pjlib-util\symbols.c" />
|
||||
<ClCompile Include="..\src\pjlib-util\upnp.c" />
|
||||
<ClCompile Include="..\src\pjlib-util\xml.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -781,7 +780,6 @@
|
|||
<ClInclude Include="..\include\pjlib-util\string.h" />
|
||||
<ClInclude Include="..\include\pjlib-util\stun_simple.h" />
|
||||
<ClInclude Include="..\include\pjlib-util\types.h" />
|
||||
<ClInclude Include="..\include\pjlib-util\upnp.h" />
|
||||
<ClInclude Include="..\include\pjlib-util\xml.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
|
|
@ -92,9 +92,6 @@
|
|||
<ClCompile Include="..\src\pjlib-util\xml.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\pjlib-util\upnp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\pjlib-util\base64.h">
|
||||
|
@ -181,8 +178,5 @@
|
|||
<ClInclude Include="..\include\pjlib-util\xml.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\pjlib-util\upnp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -61,9 +61,6 @@
|
|||
/* Old STUN */
|
||||
#include <pjlib-util/stun_simple.h>
|
||||
|
||||
/* UPnP */
|
||||
#include <pjlib-util/upnp.h>
|
||||
|
||||
/* PCAP */
|
||||
#include <pjlib-util/pcap.h>
|
||||
|
||||
|
|
|
@ -238,18 +238,6 @@
|
|||
#endif
|
||||
|
||||
|
||||
/* **************************************************************************
|
||||
* UPnP
|
||||
*/
|
||||
|
||||
/* Default duration for searching UPnP Internet Gateway Devices (in seconds).
|
||||
* Default: 5 seconds
|
||||
*/
|
||||
#ifndef PJ_UPNP_DEFAULT_SEARCH_TIME
|
||||
# define PJ_UPNP_DEFAULT_SEARCH_TIME 5
|
||||
#endif
|
||||
|
||||
|
||||
/* **************************************************************************
|
||||
* ENCRYPTION
|
||||
*/
|
||||
|
|
|
@ -40,7 +40,7 @@ export PJNATH_SRCDIR = ../src/pjnath
|
|||
export PJNATH_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
|
||||
errno.o ice_session.o ice_strans.o nat_detect.o stun_auth.o \
|
||||
stun_msg.o stun_msg_dump.o stun_session.o stun_sock.o \
|
||||
stun_transaction.o turn_session.o turn_sock.o
|
||||
stun_transaction.o turn_session.o turn_sock.o upnp.o
|
||||
export PJNATH_CFLAGS += $(_CFLAGS)
|
||||
export PJNATH_CXXFLAGS += $(_CXXFLAGS)
|
||||
export PJNATH_LDFLAGS += $(PJLIB_UTIL_LDLIB) $(PJLIB_LDLIB) $(_LDFLAGS)
|
||||
|
|
|
@ -733,6 +733,7 @@
|
|||
<ClCompile Include="..\src\pjnath\stun_transaction.c" />
|
||||
<ClCompile Include="..\src\pjnath\turn_session.c" />
|
||||
<ClCompile Include="..\src\pjnath\turn_sock.c" />
|
||||
<ClCompile Include="..\src\pjnath\upnp.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\docs\doc_ice.h" />
|
||||
|
@ -755,6 +756,7 @@
|
|||
<ClInclude Include="..\include\pjnath\turn_session.h" />
|
||||
<ClInclude Include="..\include\pjnath\turn_sock.h" />
|
||||
<ClInclude Include="..\include\pjnath\types.h" />
|
||||
<ClInclude Include="..\include\pjnath\upnp.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
|
|
@ -50,6 +50,9 @@
|
|||
<ClCompile Include="..\src\pjnath\turn_sock.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\pjnath\upnp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\pjnath\config.h">
|
||||
|
@ -94,6 +97,9 @@
|
|||
<ClInclude Include="..\include\pjnath\types.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\pjnath\upnp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\docs\doc_ice.h">
|
||||
<Filter>Doxygen Files</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -76,8 +76,12 @@ PJNATH has the following features:
|
|||
<A HREF="http://www.ietf.org/internet-drafts/draft-ietf-mmusic-ice-19.txt">
|
||||
draft-ietf-mmusic-ice-19.txt</A> draft
|
||||
|
||||
In the future, more protocols will be implemented (such as UPnP IGD, and
|
||||
SOCKS5).
|
||||
- <strong>Universal Plug and Play (UPnP)</strong> control point implementation.\n
|
||||
Universal Plug and Play (UPnP) Internet Gateway Device (IGD) Protocol
|
||||
allows any local UPnP control point to retrieve the external IP address of
|
||||
the device, and add or remove port mappings. By adding a port mapping,
|
||||
a UPnP controller behind the IGD can enable traversal of the IGD from
|
||||
an external address to an internal client.\n\n
|
||||
|
||||
|
||||
\section pjnath_organization_sec Library Organization
|
||||
|
@ -88,9 +92,10 @@ The library provides the following main component groups:
|
|||
- \ref PJNATH_TURN\n\n
|
||||
- \ref PJNATH_ICE\n\n
|
||||
- \ref PJNATH_NAT_DETECT\n\n
|
||||
- \ref PJNATH_UPNP\n\n
|
||||
|
||||
Apart from the \ref PJNATH_NAT_DETECT, each component group are further
|
||||
divided into two functionalities:
|
||||
Apart from the \ref PJNATH_NAT_DETECT and \ref PJNATH_UPNP, each component
|
||||
group are further divided into two functionalities:
|
||||
|
||||
- <b>Transport objects</b>\n
|
||||
The transport objects (such as STUN transport, TURN transport, and ICE
|
||||
|
|
|
@ -40,5 +40,8 @@
|
|||
#include <pjnath/turn_sock.h>
|
||||
#include <pjnath/types.h>
|
||||
|
||||
/* UPnP */
|
||||
#include <pjnath/upnp.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -573,6 +573,19 @@
|
|||
PJ_VERSION_NUM_EXTRA)
|
||||
#endif
|
||||
|
||||
|
||||
/* **************************************************************************
|
||||
* UPnP
|
||||
*/
|
||||
|
||||
/* Default duration for searching UPnP Internet Gateway Devices (in seconds).
|
||||
* Default: 5 seconds
|
||||
*/
|
||||
#ifndef PJ_UPNP_DEFAULT_SEARCH_TIME
|
||||
# define PJ_UPNP_DEFAULT_SEARCH_TIME 5
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
PJ_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* @defgroup PJLIB_UTIL_UPNP Simple UPnP Client
|
||||
* @ingroup PJ_PROTOCOLS
|
||||
* @defgroup PJNATH_UPNP Simple UPnP Client
|
||||
* @brief A simple UPnP client implementation.
|
||||
* @{
|
||||
*
|
|
@ -15,8 +15,8 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include <pjlib-util/upnp.h>
|
||||
#include <pjlib-util/config.h>
|
||||
#include <pjnath/upnp.h>
|
||||
#include <pjnath/config.h>
|
||||
#include <pj/addr_resolv.h>
|
||||
#include <pj/assert.h>
|
||||
#include <pj/errno.h>
|
||||
|
@ -25,7 +25,7 @@
|
|||
#include <pj/pool.h>
|
||||
#include <pj/string.h>
|
||||
|
||||
#if defined(PJLIB_UTIL_HAS_UPNP) && (PJLIB_UTIL_HAS_UPNP != 0)
|
||||
#if defined(PJNATH_HAS_UPNP) && (PJNATH_HAS_UPNP != 0)
|
||||
|
||||
#include <upnp/upnp.h>
|
||||
#include <upnp/upnpdebug.h>
|
||||
|
@ -560,7 +560,6 @@ PJ_DEF(pj_status_t) pj_upnp_init(const pj_upnp_init_param *param)
|
|||
unsigned short port;
|
||||
const char *ip_address6 = NULL;
|
||||
unsigned short port6 = 0;
|
||||
pj_status_t status;
|
||||
|
||||
if (upnp_mgr.initialized)
|
||||
return PJ_SUCCESS;
|
||||
|
@ -914,4 +913,4 @@ PJ_DEF(pj_status_t)pj_upnp_del_port_mapping(const pj_sockaddr *mapped_addr)
|
|||
# pragma comment(lib, "libpthread")
|
||||
#endif
|
||||
|
||||
#endif /* PJLIB_UTIL_HAS_UPNP */
|
||||
#endif /* PJNATH_HAS_UPNP */
|
|
@ -994,7 +994,7 @@ PJ_DEF(pj_status_t) pjsua_create(void)
|
|||
}
|
||||
|
||||
|
||||
#if defined(PJLIB_UTIL_HAS_UPNP) && (PJLIB_UTIL_HAS_UPNP != 0)
|
||||
#if defined(PJNATH_HAS_UPNP) && (PJNATH_HAS_UPNP != 0)
|
||||
/* UPnP callback. */
|
||||
static void upnp_cb(pj_status_t status)
|
||||
{
|
||||
|
@ -1202,7 +1202,7 @@ PJ_DEF(pj_status_t) pjsua_init( const pjsua_config *ua_cfg,
|
|||
goto on_error;
|
||||
}
|
||||
|
||||
#if defined(PJLIB_UTIL_HAS_UPNP) && (PJLIB_UTIL_HAS_UPNP != 0)
|
||||
#if defined(PJNATH_HAS_UPNP) && (PJNATH_HAS_UPNP != 0)
|
||||
/* Initialize UPnP if enabled */
|
||||
if (pjsua_var.ua_cfg.enable_upnp) {
|
||||
pj_upnp_init_param param;
|
||||
|
@ -2085,7 +2085,7 @@ PJ_DEF(pj_status_t) pjsua_destroy2(unsigned flags)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(PJLIB_UTIL_HAS_UPNP) && (PJLIB_UTIL_HAS_UPNP != 0)
|
||||
#if defined(PJNATH_HAS_UPNP) && (PJNATH_HAS_UPNP != 0)
|
||||
/* Deinitialize UPnP */
|
||||
if (pjsua_var.ua_cfg.enable_upnp) {
|
||||
pj_upnp_deinit();
|
||||
|
@ -2444,7 +2444,7 @@ static pj_status_t create_sip_udp_sock(int af,
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(PJLIB_UTIL_HAS_UPNP) && (PJLIB_UTIL_HAS_UPNP != 0)
|
||||
#if defined(PJNATH_HAS_UPNP) && (PJNATH_HAS_UPNP != 0)
|
||||
else if (pjsua_var.ua_cfg.enable_upnp &&
|
||||
pjsua_var.upnp_status == PJ_SUCCESS)
|
||||
{
|
||||
|
@ -2961,7 +2961,7 @@ PJ_DEF(pj_status_t) pjsua_transport_close( pjsua_transport_id id,
|
|||
*/
|
||||
switch (tp_type) {
|
||||
case PJSIP_TRANSPORT_UDP:
|
||||
#if defined(PJLIB_UTIL_HAS_UPNP) && (PJLIB_UTIL_HAS_UPNP != 0)
|
||||
#if defined(PJNATH_HAS_UPNP) && (PJNATH_HAS_UPNP != 0)
|
||||
if (pjsua_var.ua_cfg.enable_upnp &&
|
||||
pjsua_var.upnp_status == PJ_SUCCESS)
|
||||
{
|
||||
|
|
|
@ -542,7 +542,7 @@ static pj_status_t create_rtp_rtcp_sock(pjsua_call_media *call_med,
|
|||
break;
|
||||
#endif
|
||||
|
||||
#if defined(PJLIB_UTIL_HAS_UPNP) && (PJLIB_UTIL_HAS_UPNP != 0)
|
||||
#if defined(PJNATH_HAS_UPNP) && (PJNATH_HAS_UPNP != 0)
|
||||
} else if ((!use_ipv6 || use_nat64) &&
|
||||
pjsua_media_acc_is_using_upnp(call_med->call->acc_id) &&
|
||||
pjsua_var.upnp_status == PJ_SUCCESS)
|
||||
|
@ -3264,7 +3264,7 @@ pj_status_t pjsua_media_channel_deinit(pjsua_call_id call_id)
|
|||
pjsua_call_media *call_med = &call->media[mi];
|
||||
|
||||
if (call_med->use_upnp) {
|
||||
#if defined(PJLIB_UTIL_HAS_UPNP) && (PJLIB_UTIL_HAS_UPNP != 0)
|
||||
#if defined(PJNATH_HAS_UPNP) && (PJNATH_HAS_UPNP != 0)
|
||||
pj_upnp_del_port_mapping(&call_med->mapped_addr[0]);
|
||||
pj_upnp_del_port_mapping(&call_med->mapped_addr[1]);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue