mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-24 03:32:22 +00:00
update SRB2 to use miniUPnPc API version 17
update miniUPnPc function calls to API version 17 update include statements for miniUPnPcc use PKGCONFIG to find lib and inc forminiUPnPc
This commit is contained in:
parent
95803eca16
commit
322dfac85f
3 changed files with 19 additions and 18 deletions
|
@ -49,10 +49,13 @@ CURLCONFIG?=curl-config
|
|||
$(eval $(call Configure,CURL,$(CURLCONFIG)))
|
||||
opts+=-DHAVE_CURL
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef HAVE_MINIUPNPC
|
||||
libs+=-lminiupnpc
|
||||
ifndef NOUPNP
|
||||
MINIUPNPC_PKGCONFIG?=miniupnpc
|
||||
$(eval $(call Use_pkg_config,MINIUPNPC))
|
||||
HAVE_MINIUPNPC=1
|
||||
opts+=-DHAVE_MINIUPNP
|
||||
endif
|
||||
endif
|
||||
|
||||
# (Valgrind is a memory debugger.)
|
||||
|
|
|
@ -33,11 +33,6 @@ libs+=-lws2_32
|
|||
endif
|
||||
endif
|
||||
|
||||
ifndef NONET
|
||||
opts+=-I../libs -DSTATIC_MINIUPNPC
|
||||
libs+=-L../libs/miniupnpc/mingw$(32) -lws2_32 -liphlpapi
|
||||
endif
|
||||
|
||||
ifndef MINGW64
|
||||
32=32
|
||||
x86=x86
|
||||
|
@ -100,3 +95,8 @@ lib:=../libs/curl
|
|||
CURL_opts:=-I$(lib)/include
|
||||
CURL_libs:=-L$(lib)/lib$(32) -lcurl
|
||||
$(eval $(call _set,CURL))
|
||||
|
||||
lib:=../libs/miniupnpc
|
||||
MINIUPNPC_opts:=-I$(lib)/include -DMINIUPNP_STATICLIB
|
||||
MINIUPNPC_libs:=-L$(lib)/mingw$(32) -lminiupnpc -lws2_32 -liphlpapi
|
||||
$(eval $(call _set,MINIUPNPC))
|
||||
|
|
18
src/i_tcp.c
18
src/i_tcp.c
|
@ -117,13 +117,9 @@
|
|||
} mysockaddr_t;
|
||||
|
||||
#ifdef HAVE_MINIUPNPC
|
||||
#ifdef STATIC_MINIUPNPC
|
||||
#define STATICLIB
|
||||
#endif
|
||||
#include "miniupnpc/miniwget.h"
|
||||
#include "miniupnpc/miniupnpc.h"
|
||||
#include "miniupnpc/upnpcommands.h"
|
||||
#undef STATICLIB
|
||||
#include "miniwget.h"
|
||||
#include "miniupnpc.h"
|
||||
#include "upnpcommands.h"
|
||||
static UINT8 UPNP_support = TRUE;
|
||||
#endif // HAVE_MINIUPNC
|
||||
|
||||
|
@ -279,8 +275,10 @@ static inline void I_InitUPnP(void)
|
|||
{
|
||||
struct UPNPDev * devlist = NULL;
|
||||
int upnp_error = -2;
|
||||
int scope_id = 0;
|
||||
int status_code = 0;
|
||||
CONS_Printf(M_GetText("Looking for UPnP Internet Gateway Device\n"));
|
||||
devlist = upnpDiscover(2000, NULL, NULL, 0, false, &upnp_error);
|
||||
devlist = upnpDiscover(2000, NULL, NULL, 0, false, 2, &upnp_error);
|
||||
if (devlist)
|
||||
{
|
||||
struct UPNPDev *dev = devlist;
|
||||
|
@ -300,7 +298,7 @@ static inline void I_InitUPnP(void)
|
|||
|
||||
UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr));
|
||||
CONS_Printf(M_GetText("Local LAN IP address: %s\n"), lanaddr);
|
||||
descXML = miniwget(dev->descURL, &descXMLsize);
|
||||
descXML = miniwget(dev->descURL, &descXMLsize, scope_id, &status_code);
|
||||
if (descXML)
|
||||
{
|
||||
parserootdesc(descXML, descXMLsize, &data);
|
||||
|
@ -308,7 +306,7 @@ static inline void I_InitUPnP(void)
|
|||
descXML = NULL;
|
||||
memset(&urls, 0, sizeof(struct UPNPUrls));
|
||||
memset(&data, 0, sizeof(struct IGDdatas));
|
||||
GetUPNPUrls(&urls, &data, dev->descURL);
|
||||
GetUPNPUrls(&urls, &data, dev->descURL, status_code);
|
||||
I_AddExitFunc(I_ShutdownUPnP);
|
||||
}
|
||||
freeUPNPDevlist(devlist);
|
||||
|
|
Loading…
Reference in a new issue