mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Changes to support both miniupnpc 1.0 and up-to-date 1.2
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@786 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c0e846f7f7
commit
c222c354d6
@ -16,6 +16,10 @@ PQI_USE_XPGP = 1
|
|||||||
SSL_DIR=../../../../../src/openssl-0.9.7g-xpgp-0.1c
|
SSL_DIR=../../../../../src/openssl-0.9.7g-xpgp-0.1c
|
||||||
UPNPC_DIR=../../../../../src/miniupnpc-1.0
|
UPNPC_DIR=../../../../../src/miniupnpc-1.0
|
||||||
|
|
||||||
|
# Need to define miniupnpc version because API changed a little between v1.0 and 1.2
|
||||||
|
# put 10 for 1.0 and 12 for 1.2
|
||||||
|
DEFINES += -DMINIUPNPC_VERSION=10
|
||||||
|
|
||||||
include $(RS_TOP_DIR)/scripts/checks.mk
|
include $(RS_TOP_DIR)/scripts/checks.mk
|
||||||
|
|
||||||
############ ENFORCE DIRECTORY NAMING ########################
|
############ ENFORCE DIRECTORY NAMING ########################
|
||||||
@ -30,6 +34,7 @@ LIBRS = $(LIBDIR)/libretroshare.a
|
|||||||
INCLUDE = -I $(RS_TOP_DIR)
|
INCLUDE = -I $(RS_TOP_DIR)
|
||||||
#-I$(KADC_DIR)
|
#-I$(KADC_DIR)
|
||||||
CFLAGS = -Wall -g $(INCLUDE)
|
CFLAGS = -Wall -g $(INCLUDE)
|
||||||
|
CFLAGS += ${DEFINES}
|
||||||
|
|
||||||
ifdef PQI_USE_XPGP
|
ifdef PQI_USE_XPGP
|
||||||
INCLUDE += -I $(SSL_DIR)/include
|
INCLUDE += -I $(SSL_DIR)/include
|
||||||
@ -61,7 +66,7 @@ RSCFLAGS = -Wall -g $(INCLUDE)
|
|||||||
BIOCC = gcc
|
BIOCC = gcc
|
||||||
|
|
||||||
# Linux flags
|
# Linux flags
|
||||||
BIOCFLAGS = -I $(SSL_DIR)/include -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DOPENSSL_NO_KRB5 -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -march=i686 -Wall -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
|
BIOCFLAGS = -I $(SSL_DIR)/include ${DEFINES} -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DOPENSSL_NO_KRB5 -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -march=i686 -Wall -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# OS specific Linking.
|
# OS specific Linking.
|
||||||
|
@ -32,7 +32,13 @@ bool upnphandler::initUPnPState()
|
|||||||
/* allocate memory */
|
/* allocate memory */
|
||||||
uPnPConfigData *upcd = new uPnPConfigData;
|
uPnPConfigData *upcd = new uPnPConfigData;
|
||||||
|
|
||||||
|
#if MINIUPNPC_VERSION >= 11
|
||||||
|
/* Starting from version 1.1, miniupnpc api has a new parameter (int sameport) */
|
||||||
|
upcd->devlist = upnpDiscover(2000, NULL, NULL, 0);
|
||||||
|
#else
|
||||||
upcd->devlist = upnpDiscover(2000, NULL, NULL);
|
upcd->devlist = upnpDiscover(2000, NULL, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(upcd->devlist)
|
if(upcd->devlist)
|
||||||
{
|
{
|
||||||
struct UPNPDev * device;
|
struct UPNPDev * device;
|
||||||
|
@ -141,8 +141,14 @@ bool SetRedirectAndTest(struct UPNPUrls * urls,
|
|||||||
printf("GetExternalIPAddress failed.\n");
|
printf("GetExternalIPAddress failed.\n");
|
||||||
|
|
||||||
// Unix at the moment!
|
// Unix at the moment!
|
||||||
|
#if MINIUPNPC_VERSION >= 12
|
||||||
|
/* Starting from miniupnpc version 1.2, lease duration parameter is gone */
|
||||||
|
r = UPNP_AddPortMapping(urls->controlURL, data->servicetype,
|
||||||
|
eport, iport, iaddr, 0, proto);
|
||||||
|
#else
|
||||||
r = UPNP_AddPortMapping(urls->controlURL, data->servicetype,
|
r = UPNP_AddPortMapping(urls->controlURL, data->servicetype,
|
||||||
eport, iport, iaddr, 0, 0, proto);
|
eport, iport, iaddr, 0, 0, proto);
|
||||||
|
#endif
|
||||||
|
|
||||||
// r = UPNP_AddPortMapping(urls->controlURL, data->servicetype,
|
// r = UPNP_AddPortMapping(urls->controlURL, data->servicetype,
|
||||||
// eport, iport, iaddr, 0, leaseDuration, proto);
|
// eport, iport, iaddr, 0, leaseDuration, proto);
|
||||||
|
Loading…
Reference in New Issue
Block a user