Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aconfigure
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
2 changes: 1 addition & 1 deletion aconfigure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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)
],
Expand Down
2 changes: 1 addition & 1 deletion pjlib-util/build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions pjlib-util/build/pjlib_util.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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" />
Expand Down
6 changes: 0 additions & 6 deletions pjlib-util/build/pjlib_util.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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>
3 changes: 0 additions & 3 deletions pjlib-util/include/pjlib-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@
/* Old STUN */
#include <pjlib-util/stun_simple.h>

/* UPnP */
#include <pjlib-util/upnp.h>

/* PCAP */
#include <pjlib-util/pcap.h>

Expand Down
12 changes: 0 additions & 12 deletions pjlib-util/include/pjlib-util/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion pjnath/build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions pjnath/build/pjnath.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand All @@ -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">
Expand Down
6 changes: 6 additions & 0 deletions pjnath/build/pjnath.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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>
Expand Down
13 changes: 9 additions & 4 deletions pjnath/docs/doc_mainpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions pjnath/include/pjnath.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,8 @@
#include <pjnath/turn_sock.h>
#include <pjnath/types.h>

/* UPnP */
#include <pjnath/upnp.h>

#endif

13 changes: 13 additions & 0 deletions pjnath/include/pjnath/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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


/**
* @}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* @{
*
Expand Down
9 changes: 4 additions & 5 deletions pjlib-util/src/pjlib-util/upnp.c → pjnath/src/pjnath/upnp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
10 changes: 5 additions & 5 deletions pjsip/src/pjsua-lib/pjsua_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions pjsip/src/pjsua-lib/pjsua_media.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down