update miniupnpc
This commit is contained in:
parent
72b5f37f58
commit
b338dad241
4
external/miniupnpc/.gitignore
vendored
4
external/miniupnpc/.gitignore
vendored
@ -4,6 +4,9 @@ build/
|
|||||||
*.a
|
*.a
|
||||||
*.so
|
*.so
|
||||||
*.dll
|
*.dll
|
||||||
|
*.dll.def
|
||||||
|
*.exe
|
||||||
|
*.lib
|
||||||
*.dylib
|
*.dylib
|
||||||
Makefile.bak
|
Makefile.bak
|
||||||
miniupnpcstrings.h
|
miniupnpcstrings.h
|
||||||
@ -30,3 +33,4 @@ testigddescparse
|
|||||||
validateigddescparse
|
validateigddescparse
|
||||||
dist/
|
dist/
|
||||||
miniupnpc.egg-info/
|
miniupnpc.egg-info/
|
||||||
|
init
|
||||||
|
12
external/miniupnpc/Changelog.txt
vendored
12
external/miniupnpc/Changelog.txt
vendored
@ -1,6 +1,16 @@
|
|||||||
$Id: Changelog.txt,v 1.223 2016/04/19 21:06:20 nanard Exp $
|
$Id: Changelog.txt,v 1.226 2016/12/16 08:57:19 nanard Exp $
|
||||||
miniUPnP client Changelog.
|
miniUPnP client Changelog.
|
||||||
|
|
||||||
|
2017/05/05:
|
||||||
|
Fix CVE-2017-8798 Thanks to tin/Team OSTStrom
|
||||||
|
|
||||||
|
2016/11/11:
|
||||||
|
check strlen before memcmp in XML parsing portlistingparse.c
|
||||||
|
fix build under SOLARIS and CYGWIN
|
||||||
|
|
||||||
|
2016/10/11:
|
||||||
|
Add python 3 compatibility to IGD test
|
||||||
|
|
||||||
VERSION 2.0 : released 2016/04/19
|
VERSION 2.0 : released 2016/04/19
|
||||||
|
|
||||||
2016/01/24:
|
2016/01/24:
|
||||||
|
2
external/miniupnpc/LICENSE
vendored
2
external/miniupnpc/LICENSE
vendored
@ -1,5 +1,5 @@
|
|||||||
MiniUPnPc
|
MiniUPnPc
|
||||||
Copyright (c) 2005-2015, Thomas BERNARD
|
Copyright (c) 2005-2016, Thomas BERNARD
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
2
external/miniupnpc/MANIFEST.in
vendored
2
external/miniupnpc/MANIFEST.in
vendored
@ -1,4 +1,6 @@
|
|||||||
include README
|
include README
|
||||||
|
include VERSION
|
||||||
|
include LICENSE
|
||||||
include miniupnpcmodule.c
|
include miniupnpcmodule.c
|
||||||
include setup.py
|
include setup.py
|
||||||
include *.h
|
include *.h
|
||||||
|
20
external/miniupnpc/Makefile
vendored
20
external/miniupnpc/Makefile
vendored
@ -1,9 +1,9 @@
|
|||||||
# $Id: Makefile,v 1.133 2016/01/24 17:24:35 nanard Exp $
|
# $Id: Makefile,v 1.134 2016/10/07 09:04:36 nanard Exp $
|
||||||
# MiniUPnP Project
|
# MiniUPnP Project
|
||||||
# http://miniupnp.free.fr/
|
# http://miniupnp.free.fr/
|
||||||
# http://miniupnp.tuxfamily.org/
|
# http://miniupnp.tuxfamily.org/
|
||||||
# https://github.com/miniupnp/miniupnp
|
# https://github.com/miniupnp/miniupnp
|
||||||
# (c) 2005-2015 Thomas Bernard
|
# (c) 2005-2017 Thomas Bernard
|
||||||
# to install use :
|
# to install use :
|
||||||
# $ make DESTDIR=/tmp/dummylocation install
|
# $ make DESTDIR=/tmp/dummylocation install
|
||||||
# or
|
# or
|
||||||
@ -48,7 +48,7 @@ CFLAGS += -D_XOPEN_SOURCE=600
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
#CFLAGS += -ansi
|
#CFLAGS += -ansi
|
||||||
# -DNO_GETADDRINFO
|
#CFLAGS += -DNO_GETADDRINFO
|
||||||
INSTALL = install
|
INSTALL = install
|
||||||
SH = /bin/sh
|
SH = /bin/sh
|
||||||
JAVA = java
|
JAVA = java
|
||||||
@ -65,7 +65,9 @@ JNAERATORARGS = -mode StandaloneJar -runtime JNAerator -library miniupnpc
|
|||||||
JNAERATORBASEURL = https://repo1.maven.org/maven2/com/nativelibs4java/jnaerator/0.12
|
JNAERATORBASEURL = https://repo1.maven.org/maven2/com/nativelibs4java/jnaerator/0.12
|
||||||
|
|
||||||
ifeq (SunOS, $(OS))
|
ifeq (SunOS, $(OS))
|
||||||
LDFLAGS=-lsocket -lnsl -lresolv
|
LDLIBS=-lsocket -lnsl -lresolv
|
||||||
|
CFLAGS += -D__EXTENSIONS__
|
||||||
|
CFLAGS += -std=c99
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# APIVERSION is used to build SONAME
|
# APIVERSION is used to build SONAME
|
||||||
@ -85,7 +87,9 @@ LIBOBJS = miniwget.o minixml.o igd_desc_parse.o minisoap.o \
|
|||||||
connecthostport.o portlistingparse.o receivedata.o upnpdev.o
|
connecthostport.o portlistingparse.o receivedata.o upnpdev.o
|
||||||
|
|
||||||
ifneq ($(OS), AmigaOS)
|
ifneq ($(OS), AmigaOS)
|
||||||
|
ifeq (,$(findstring CYGWIN,$(OS)))
|
||||||
CFLAGS := -fPIC $(CFLAGS)
|
CFLAGS := -fPIC $(CFLAGS)
|
||||||
|
endif
|
||||||
LIBOBJS := $(LIBOBJS) minissdpc.o
|
LIBOBJS := $(LIBOBJS) minissdpc.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -169,18 +173,18 @@ check: validateminixml validateminiwget validateupnpreplyparse \
|
|||||||
everything: all $(EXECUTABLES_ADDTESTS)
|
everything: all $(EXECUTABLES_ADDTESTS)
|
||||||
|
|
||||||
pythonmodule: $(LIBRARY) miniupnpcmodule.c setup.py
|
pythonmodule: $(LIBRARY) miniupnpcmodule.c setup.py
|
||||||
python setup.py build
|
MAKE=$(MAKE) python setup.py build
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
installpythonmodule: pythonmodule
|
installpythonmodule: pythonmodule
|
||||||
python setup.py install
|
MAKE=$(MAKE) python setup.py install
|
||||||
|
|
||||||
pythonmodule3: $(LIBRARY) miniupnpcmodule.c setup.py
|
pythonmodule3: $(LIBRARY) miniupnpcmodule.c setup.py
|
||||||
python3 setup.py build
|
MAKE=$(MAKE) python3 setup.py build
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
installpythonmodule3: pythonmodule3
|
installpythonmodule3: pythonmodule3
|
||||||
python3 setup.py install
|
MAKE=$(MAKE) python3 setup.py install
|
||||||
|
|
||||||
validateminixml: minixmlvalid
|
validateminixml: minixmlvalid
|
||||||
@echo "minixml validation test"
|
@echo "minixml validation test"
|
||||||
|
7
external/miniupnpc/README
vendored
7
external/miniupnpc/README
vendored
@ -1,9 +1,8 @@
|
|||||||
Project: miniupnp
|
Project: miniupnp
|
||||||
Project web page: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
Project web page: http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
|
||||||
github: https://github.com/miniupnp/miniupnp
|
github: https://github.com/miniupnp/miniupnp
|
||||||
freecode: http://freecode.com/projects/miniupnp
|
|
||||||
Author: Thomas Bernard
|
Author: Thomas Bernard
|
||||||
Copyright (c) 2005-2016 Thomas Bernard
|
Copyright (c) 2005-2017 Thomas Bernard
|
||||||
This software is subject to the conditions detailed in the
|
This software is subject to the conditions detailed in the
|
||||||
LICENSE file provided within this distribution.
|
LICENSE file provided within this distribution.
|
||||||
|
|
||||||
@ -58,7 +57,7 @@ If you are using libminiupnpc in your application, please
|
|||||||
send me an email !
|
send me an email !
|
||||||
|
|
||||||
For any question, you can use the web forum :
|
For any question, you can use the web forum :
|
||||||
http://miniupnp.tuxfamily.org/forum/
|
https://miniupnp.tuxfamily.org/forum/
|
||||||
|
|
||||||
Bugs should be reported on github :
|
Bugs should be reported on github :
|
||||||
https://github.com/miniupnp/miniupnp/issues
|
https://github.com/miniupnp/miniupnp/issues
|
||||||
|
10
external/miniupnpc/connecthostport.c
vendored
10
external/miniupnpc/connecthostport.c
vendored
@ -1,7 +1,7 @@
|
|||||||
/* $Id: connecthostport.c,v 1.15 2015/10/09 16:26:19 nanard Exp $ */
|
/* $Id: connecthostport.c,v 1.15 2015/10/09 16:26:19 nanard Exp $ */
|
||||||
/* Project : miniupnp
|
/* Project : miniupnp
|
||||||
* Author : Thomas Bernard
|
* Author : Thomas Bernard
|
||||||
* Copyright (c) 2010-2015 Thomas Bernard
|
* Copyright (c) 2010-2017 Thomas Bernard
|
||||||
* This software is subject to the conditions detailed in the
|
* This software is subject to the conditions detailed in the
|
||||||
* LICENCE file provided in this distribution. */
|
* LICENCE file provided in this distribution. */
|
||||||
|
|
||||||
@ -36,15 +36,13 @@
|
|||||||
/* defining MINIUPNPC_IGNORE_EINTR enable the ignore of interruptions
|
/* defining MINIUPNPC_IGNORE_EINTR enable the ignore of interruptions
|
||||||
* during the connect() call */
|
* during the connect() call */
|
||||||
#define MINIUPNPC_IGNORE_EINTR
|
#define MINIUPNPC_IGNORE_EINTR
|
||||||
#ifndef USE_GETHOSTBYNAME
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#endif /* #ifndef USE_GETHOSTBYNAME */
|
|
||||||
#endif /* #else _WIN32 */
|
#endif /* #else _WIN32 */
|
||||||
|
|
||||||
/* definition of PRINT_SOCKET_ERROR */
|
/* definition of PRINT_SOCKET_ERROR */
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define PRINT_SOCKET_ERROR(x) printf("Socket error: %s, %d\n", x, WSAGetLastError());
|
#define PRINT_SOCKET_ERROR(x) fprintf(stderr, "Socket error: %s, %d\n", x, WSAGetLastError());
|
||||||
#else
|
#else
|
||||||
#define PRINT_SOCKET_ERROR(x) perror(x)
|
#define PRINT_SOCKET_ERROR(x) perror(x)
|
||||||
#endif
|
#endif
|
||||||
@ -100,13 +98,13 @@ int connecthostport(const char * host, unsigned short port,
|
|||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
if(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(struct timeval)) < 0)
|
if(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(struct timeval)) < 0)
|
||||||
{
|
{
|
||||||
PRINT_SOCKET_ERROR("setsockopt");
|
PRINT_SOCKET_ERROR("setsockopt SO_RCVTIMEO");
|
||||||
}
|
}
|
||||||
timeout.tv_sec = 3;
|
timeout.tv_sec = 3;
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
if(setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(struct timeval)) < 0)
|
if(setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(struct timeval)) < 0)
|
||||||
{
|
{
|
||||||
PRINT_SOCKET_ERROR("setsockopt");
|
PRINT_SOCKET_ERROR("setsockopt SO_SNDTIMEO");
|
||||||
}
|
}
|
||||||
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
|
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
|
||||||
dest.sin_family = AF_INET;
|
dest.sin_family = AF_INET;
|
||||||
|
6
external/miniupnpc/minihttptestserver.c
vendored
6
external/miniupnpc/minihttptestserver.c
vendored
@ -1,7 +1,7 @@
|
|||||||
/* $Id: minihttptestserver.c,v 1.19 2015/11/17 09:07:17 nanard Exp $ */
|
/* $Id: minihttptestserver.c,v 1.19 2015/11/17 09:07:17 nanard Exp $ */
|
||||||
/* Project : miniUPnP
|
/* Project : miniUPnP
|
||||||
* Author : Thomas Bernard
|
* Author : Thomas Bernard
|
||||||
* Copyright (c) 2011-2015 Thomas Bernard
|
* Copyright (c) 2011-2016 Thomas Bernard
|
||||||
* This software is subject to the conditions detailed in the
|
* This software is subject to the conditions detailed in the
|
||||||
* LICENCE file provided in this distribution.
|
* LICENCE file provided in this distribution.
|
||||||
* */
|
* */
|
||||||
@ -611,7 +611,7 @@ int main(int argc, char * * argv) {
|
|||||||
if(pid < 0) {
|
if(pid < 0) {
|
||||||
perror("wait");
|
perror("wait");
|
||||||
} else {
|
} else {
|
||||||
printf("child(%d) terminated with status %d\n", pid, status);
|
printf("child(%d) terminated with status %d\n", (int)pid, status);
|
||||||
}
|
}
|
||||||
--child_to_wait_for;
|
--child_to_wait_for;
|
||||||
}
|
}
|
||||||
@ -648,7 +648,7 @@ int main(int argc, char * * argv) {
|
|||||||
if(pid < 0) {
|
if(pid < 0) {
|
||||||
perror("wait");
|
perror("wait");
|
||||||
} else {
|
} else {
|
||||||
printf("child(%d) terminated with status %d\n", pid, status);
|
printf("child(%d) terminated with status %d\n", (int)pid, status);
|
||||||
}
|
}
|
||||||
--child_to_wait_for;
|
--child_to_wait_for;
|
||||||
}
|
}
|
||||||
|
2
external/miniupnpc/minisoap.c
vendored
2
external/miniupnpc/minisoap.c
vendored
@ -25,7 +25,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define PRINT_SOCKET_ERROR(x) printf("Socket error: %s, %d\n", x, WSAGetLastError());
|
#define PRINT_SOCKET_ERROR(x) fprintf(stderr, "Socket error: %s, %d\n", x, WSAGetLastError());
|
||||||
#else
|
#else
|
||||||
#define PRINT_SOCKET_ERROR(x) perror(x)
|
#define PRINT_SOCKET_ERROR(x) perror(x)
|
||||||
#endif
|
#endif
|
||||||
|
57
external/miniupnpc/minissdpc.c
vendored
57
external/miniupnpc/minissdpc.c
vendored
@ -1,9 +1,9 @@
|
|||||||
/* $Id: minissdpc.c,v 1.28 2015/09/18 13:05:39 nanard Exp $ */
|
/* $Id: minissdpc.c,v 1.32 2016/10/07 09:04:36 nanard Exp $ */
|
||||||
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
||||||
* Project : miniupnp
|
* Project : miniupnp
|
||||||
* Web : http://miniupnp.free.fr/
|
* Web : http://miniupnp.free.fr/
|
||||||
* Author : Thomas BERNARD
|
* Author : Thomas BERNARD
|
||||||
* copyright (c) 2005-2015 Thomas Bernard
|
* copyright (c) 2005-2017 Thomas Bernard
|
||||||
* This software is subjet to the conditions detailed in the
|
* This software is subjet to the conditions detailed in the
|
||||||
* provided LICENCE file. */
|
* provided LICENCE file. */
|
||||||
/*#include <syslog.h>*/
|
/*#include <syslog.h>*/
|
||||||
@ -62,7 +62,7 @@ struct sockaddr_un {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define PRINT_SOCKET_ERROR(x) printf("Socket error: %s, %d\n", x, WSAGetLastError());
|
#define PRINT_SOCKET_ERROR(x) fprintf(stderr, "Socket error: %s, %d\n", x, WSAGetLastError());
|
||||||
#else
|
#else
|
||||||
#define PRINT_SOCKET_ERROR(x) perror(x)
|
#define PRINT_SOCKET_ERROR(x) perror(x)
|
||||||
#endif
|
#endif
|
||||||
@ -73,6 +73,9 @@ struct sockaddr_un {
|
|||||||
|
|
||||||
#if !defined(HAS_IP_MREQN) && !defined(_WIN32)
|
#if !defined(HAS_IP_MREQN) && !defined(_WIN32)
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#if defined(__sun)
|
||||||
|
#include <sys/sockio.h>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAS_IP_MREQN) && defined(NEED_STRUCT_IP_MREQN)
|
#if defined(HAS_IP_MREQN) && defined(NEED_STRUCT_IP_MREQN)
|
||||||
@ -169,7 +172,7 @@ connectToMiniSSDPD(const char * socketpath)
|
|||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
struct sockaddr_un addr;
|
struct sockaddr_un addr;
|
||||||
#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
|
#if defined(MINIUPNPC_SET_SOCKET_TIMEOUT) && !defined(__sun)
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
|
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
|
||||||
|
|
||||||
@ -180,23 +183,25 @@ connectToMiniSSDPD(const char * socketpath)
|
|||||||
perror("socket(unix)");
|
perror("socket(unix)");
|
||||||
return MINISSDPC_SOCKET_ERROR;
|
return MINISSDPC_SOCKET_ERROR;
|
||||||
}
|
}
|
||||||
#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
|
#if defined(MINIUPNPC_SET_SOCKET_TIMEOUT) && !defined(__sun)
|
||||||
/* setting a 3 seconds timeout */
|
/* setting a 3 seconds timeout */
|
||||||
|
/* not supported for AF_UNIX sockets under Solaris */
|
||||||
timeout.tv_sec = 3;
|
timeout.tv_sec = 3;
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
if(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(struct timeval)) < 0)
|
if(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(struct timeval)) < 0)
|
||||||
{
|
{
|
||||||
perror("setsockopt");
|
perror("setsockopt SO_RCVTIMEO unix");
|
||||||
}
|
}
|
||||||
timeout.tv_sec = 3;
|
timeout.tv_sec = 3;
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
if(setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(struct timeval)) < 0)
|
if(setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(struct timeval)) < 0)
|
||||||
{
|
{
|
||||||
perror("setsockopt");
|
perror("setsockopt SO_SNDTIMEO unix");
|
||||||
}
|
}
|
||||||
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
|
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
|
||||||
if(!socketpath)
|
if(!socketpath)
|
||||||
socketpath = "/var/run/minissdpd.sock";
|
socketpath = "/var/run/minissdpd.sock";
|
||||||
|
memset(&addr, 0, sizeof(addr));
|
||||||
addr.sun_family = AF_UNIX;
|
addr.sun_family = AF_UNIX;
|
||||||
strncpy(addr.sun_path, socketpath, sizeof(addr.sun_path));
|
strncpy(addr.sun_path, socketpath, sizeof(addr.sun_path));
|
||||||
/* TODO : check if we need to handle the EINTR */
|
/* TODO : check if we need to handle the EINTR */
|
||||||
@ -498,6 +503,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|||||||
unsigned long _ttl = (unsigned long)ttl;
|
unsigned long _ttl = (unsigned long)ttl;
|
||||||
#endif
|
#endif
|
||||||
int linklocal = 1;
|
int linklocal = 1;
|
||||||
|
int sentok;
|
||||||
|
|
||||||
if(error)
|
if(error)
|
||||||
*error = MINISSDPC_UNKNOWN_ERROR;
|
*error = MINISSDPC_UNKNOWN_ERROR;
|
||||||
@ -608,14 +614,22 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ipv6) {
|
||||||
|
int mcastHops = ttl;
|
||||||
|
if(setsockopt(sudp, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &mcastHops, sizeof(mcastHops)) < 0)
|
||||||
|
{
|
||||||
|
PRINT_SOCKET_ERROR("setsockopt(IPV6_MULTICAST_HOPS,...)");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_TTL, (const char *)&_ttl, sizeof(_ttl)) < 0)
|
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_TTL, (const char *)&_ttl, sizeof(_ttl)) < 0)
|
||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)) < 0)
|
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)) < 0)
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
{
|
{
|
||||||
/* not a fatal error */
|
/* not a fatal error */
|
||||||
PRINT_SOCKET_ERROR("setsockopt(IP_MULTICAST_TTL,...)");
|
PRINT_SOCKET_ERROR("setsockopt(IP_MULTICAST_TTL,...)");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(multicastif)
|
if(multicastif)
|
||||||
@ -628,7 +642,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|||||||
unsigned int ifindex = if_nametoindex(multicastif); /* eth0, etc. */
|
unsigned int ifindex = if_nametoindex(multicastif); /* eth0, etc. */
|
||||||
if(setsockopt(sudp, IPPROTO_IPV6, IPV6_MULTICAST_IF, &ifindex, sizeof(ifindex)) < 0)
|
if(setsockopt(sudp, IPPROTO_IPV6, IPV6_MULTICAST_IF, &ifindex, sizeof(ifindex)) < 0)
|
||||||
{
|
{
|
||||||
PRINT_SOCKET_ERROR("setsockopt");
|
PRINT_SOCKET_ERROR("setsockopt IPV6_MULTICAST_IF");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -643,7 +657,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|||||||
((struct sockaddr_in *)&sockudp_r)->sin_addr.s_addr = mc_if.s_addr;
|
((struct sockaddr_in *)&sockudp_r)->sin_addr.s_addr = mc_if.s_addr;
|
||||||
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&mc_if, sizeof(mc_if)) < 0)
|
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&mc_if, sizeof(mc_if)) < 0)
|
||||||
{
|
{
|
||||||
PRINT_SOCKET_ERROR("setsockopt");
|
PRINT_SOCKET_ERROR("setsockopt IP_MULTICAST_IF");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#ifdef HAS_IP_MREQN
|
#ifdef HAS_IP_MREQN
|
||||||
@ -653,7 +667,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|||||||
reqn.imr_ifindex = if_nametoindex(multicastif);
|
reqn.imr_ifindex = if_nametoindex(multicastif);
|
||||||
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&reqn, sizeof(reqn)) < 0)
|
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&reqn, sizeof(reqn)) < 0)
|
||||||
{
|
{
|
||||||
PRINT_SOCKET_ERROR("setsockopt");
|
PRINT_SOCKET_ERROR("setsockopt IP_MULTICAST_IF");
|
||||||
}
|
}
|
||||||
#elif !defined(_WIN32)
|
#elif !defined(_WIN32)
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
@ -667,7 +681,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|||||||
mc_if.s_addr = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr;
|
mc_if.s_addr = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr;
|
||||||
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&mc_if, sizeof(mc_if)) < 0)
|
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&mc_if, sizeof(mc_if)) < 0)
|
||||||
{
|
{
|
||||||
PRINT_SOCKET_ERROR("setsockopt");
|
PRINT_SOCKET_ERROR("setsockopt IP_MULTICAST_IF");
|
||||||
}
|
}
|
||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -700,6 +714,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|||||||
}
|
}
|
||||||
/* receiving SSDP response packet */
|
/* receiving SSDP response packet */
|
||||||
for(deviceIndex = 0; deviceTypes[deviceIndex]; deviceIndex++) {
|
for(deviceIndex = 0; deviceTypes[deviceIndex]; deviceIndex++) {
|
||||||
|
sentok = 0;
|
||||||
/* sending the SSDP M-SEARCH packet */
|
/* sending the SSDP M-SEARCH packet */
|
||||||
n = snprintf(bufr, sizeof(bufr),
|
n = snprintf(bufr, sizeof(bufr),
|
||||||
MSearchMsgFmt,
|
MSearchMsgFmt,
|
||||||
@ -743,7 +758,8 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|||||||
if(error)
|
if(error)
|
||||||
*error = MINISSDPC_SOCKET_ERROR;
|
*error = MINISSDPC_SOCKET_ERROR;
|
||||||
PRINT_SOCKET_ERROR("sendto");
|
PRINT_SOCKET_ERROR("sendto");
|
||||||
break;
|
} else {
|
||||||
|
sentok = 1;
|
||||||
}
|
}
|
||||||
#else /* #ifdef NO_GETADDRINFO */
|
#else /* #ifdef NO_GETADDRINFO */
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
@ -775,19 +791,20 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|||||||
#endif
|
#endif
|
||||||
PRINT_SOCKET_ERROR("sendto");
|
PRINT_SOCKET_ERROR("sendto");
|
||||||
continue;
|
continue;
|
||||||
|
} else {
|
||||||
|
sentok = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
freeaddrinfo(servinfo);
|
freeaddrinfo(servinfo);
|
||||||
if(n < 0) {
|
if(!sentok) {
|
||||||
if(error)
|
if(error)
|
||||||
*error = MINISSDPC_SOCKET_ERROR;
|
*error = MINISSDPC_SOCKET_ERROR;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
#endif /* #ifdef NO_GETADDRINFO */
|
#endif /* #ifdef NO_GETADDRINFO */
|
||||||
/* Waiting for SSDP REPLY packet to M-SEARCH
|
/* Waiting for SSDP REPLY packet to M-SEARCH
|
||||||
* if searchalltypes is set, enter the loop only
|
* if searchalltypes is set, enter the loop only
|
||||||
* when the last deviceType is reached */
|
* when the last deviceType is reached */
|
||||||
if(!searchalltypes || !deviceTypes[deviceIndex + 1]) do {
|
if((sentok && !searchalltypes) || !deviceTypes[deviceIndex + 1]) do {
|
||||||
n = receivedata(sudp, bufr, sizeof(bufr), delay, &scope_id);
|
n = receivedata(sudp, bufr, sizeof(bufr), delay, &scope_id);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
/* error */
|
/* error */
|
||||||
|
14
external/miniupnpc/miniupnpcmodule.c
vendored
14
external/miniupnpc/miniupnpcmodule.c
vendored
@ -2,7 +2,7 @@
|
|||||||
/* Project : miniupnp
|
/* Project : miniupnp
|
||||||
* Author : Thomas BERNARD
|
* Author : Thomas BERNARD
|
||||||
* website : http://miniupnp.tuxfamily.org/
|
* website : http://miniupnp.tuxfamily.org/
|
||||||
* copyright (c) 2007-2014 Thomas Bernard
|
* copyright (c) 2007-2016 Thomas Bernard
|
||||||
* This software is subjet to the conditions detailed in the
|
* This software is subjet to the conditions detailed in the
|
||||||
* provided LICENCE file. */
|
* provided LICENCE file. */
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
@ -12,6 +12,10 @@
|
|||||||
#include "upnpcommands.h"
|
#include "upnpcommands.h"
|
||||||
#include "upnperrors.h"
|
#include "upnperrors.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <winsock2.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* for compatibility with Python < 2.4 */
|
/* for compatibility with Python < 2.4 */
|
||||||
#ifndef Py_RETURN_NONE
|
#ifndef Py_RETURN_NONE
|
||||||
#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
|
#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
|
||||||
@ -303,7 +307,7 @@ UPnP_addportmapping(UPnPObject *self, PyObject *args)
|
|||||||
const char * remoteHost;
|
const char * remoteHost;
|
||||||
const char * leaseDuration = "0";
|
const char * leaseDuration = "0";
|
||||||
int r;
|
int r;
|
||||||
if (!PyArg_ParseTuple(args, "HssHss", &ePort, &proto,
|
if (!PyArg_ParseTuple(args, "HssHzz", &ePort, &proto,
|
||||||
&host, &iPort, &desc, &remoteHost))
|
&host, &iPort, &desc, &remoteHost))
|
||||||
return NULL;
|
return NULL;
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
@ -345,7 +349,7 @@ UPnP_addanyportmapping(UPnPObject *self, PyObject *args)
|
|||||||
const char * remoteHost;
|
const char * remoteHost;
|
||||||
const char * leaseDuration = "0";
|
const char * leaseDuration = "0";
|
||||||
int r;
|
int r;
|
||||||
if (!PyArg_ParseTuple(args, "HssHss", &ePort, &proto, &host, &iPort, &desc, &remoteHost))
|
if (!PyArg_ParseTuple(args, "HssHzz", &ePort, &proto, &host, &iPort, &desc, &remoteHost))
|
||||||
return NULL;
|
return NULL;
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
sprintf(extPort, "%hu", ePort);
|
sprintf(extPort, "%hu", ePort);
|
||||||
@ -669,6 +673,10 @@ initminiupnpc(void)
|
|||||||
PyObject* m;
|
PyObject* m;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
/* initialize Winsock. */
|
||||||
|
WSADATA wsaData;
|
||||||
|
int nResult = WSAStartup(MAKEWORD(2,2), &wsaData);
|
||||||
|
|
||||||
UPnPType.tp_new = PyType_GenericNew;
|
UPnPType.tp_new = PyType_GenericNew;
|
||||||
#endif
|
#endif
|
||||||
if (PyType_Ready(&UPnPType) < 0)
|
if (PyType_Ready(&UPnPType) < 0)
|
||||||
|
20
external/miniupnpc/miniwget.c
vendored
20
external/miniupnpc/miniwget.c
vendored
@ -2,7 +2,7 @@
|
|||||||
/* Project : miniupnp
|
/* Project : miniupnp
|
||||||
* Website : http://miniupnp.free.fr/
|
* Website : http://miniupnp.free.fr/
|
||||||
* Author : Thomas Bernard
|
* Author : Thomas Bernard
|
||||||
* Copyright (c) 2005-2016 Thomas Bernard
|
* Copyright (c) 2005-2017 Thomas Bernard
|
||||||
* This software is subject to the conditions detailed in the
|
* This software is subject to the conditions detailed in the
|
||||||
* LICENCE file provided in this distribution. */
|
* LICENCE file provided in this distribution. */
|
||||||
|
|
||||||
@ -83,8 +83,10 @@ getHTTPResponse(int s, int * size, int * status_code)
|
|||||||
unsigned int content_buf_used = 0;
|
unsigned int content_buf_used = 0;
|
||||||
char chunksize_buf[32];
|
char chunksize_buf[32];
|
||||||
unsigned int chunksize_buf_index;
|
unsigned int chunksize_buf_index;
|
||||||
|
#ifdef DEBUG
|
||||||
char * reason_phrase = NULL;
|
char * reason_phrase = NULL;
|
||||||
int reason_phrase_len = 0;
|
int reason_phrase_len = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
if(status_code) *status_code = -1;
|
if(status_code) *status_code = -1;
|
||||||
header_buf = malloc(header_buf_len);
|
header_buf = malloc(header_buf_len);
|
||||||
@ -109,7 +111,7 @@ getHTTPResponse(int s, int * size, int * status_code)
|
|||||||
chunksize_buf[0] = '\0';
|
chunksize_buf[0] = '\0';
|
||||||
chunksize_buf_index = 0;
|
chunksize_buf_index = 0;
|
||||||
|
|
||||||
while((n = receivedata(s, buf, 2048, 5000, NULL)) > 0)
|
while((n = receivedata(s, buf, sizeof(buf), 5000, NULL)) > 0)
|
||||||
{
|
{
|
||||||
if(endofheaders == 0)
|
if(endofheaders == 0)
|
||||||
{
|
{
|
||||||
@ -181,8 +183,10 @@ getHTTPResponse(int s, int * size, int * status_code)
|
|||||||
*status_code = atoi(header_buf + sp + 1);
|
*status_code = atoi(header_buf + sp + 1);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
reason_phrase = header_buf + sp + 1;
|
reason_phrase = header_buf + sp + 1;
|
||||||
reason_phrase_len = i - sp - 1;
|
reason_phrase_len = i - sp - 1;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -280,11 +284,12 @@ getHTTPResponse(int s, int * size, int * status_code)
|
|||||||
goto end_of_stream;
|
goto end_of_stream;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bytestocopy = ((int)chunksize < (n - i))?chunksize:(unsigned int)(n - i);
|
/* it is guaranteed that (n >= i) */
|
||||||
|
bytestocopy = (chunksize < (unsigned int)(n - i))?chunksize:(unsigned int)(n - i);
|
||||||
if((content_buf_used + bytestocopy) > content_buf_len)
|
if((content_buf_used + bytestocopy) > content_buf_len)
|
||||||
{
|
{
|
||||||
char * tmp;
|
char * tmp;
|
||||||
if(content_length >= (int)(content_buf_used + bytestocopy)) {
|
if((content_length >= 0) && ((unsigned int)content_length >= (content_buf_used + bytestocopy))) {
|
||||||
content_buf_len = content_length;
|
content_buf_len = content_length;
|
||||||
} else {
|
} else {
|
||||||
content_buf_len = content_buf_used + bytestocopy;
|
content_buf_len = content_buf_used + bytestocopy;
|
||||||
@ -309,14 +314,15 @@ getHTTPResponse(int s, int * size, int * status_code)
|
|||||||
{
|
{
|
||||||
/* not chunked */
|
/* not chunked */
|
||||||
if(content_length > 0
|
if(content_length > 0
|
||||||
&& (int)(content_buf_used + n) > content_length) {
|
&& (content_buf_used + n) > (unsigned int)content_length) {
|
||||||
/* skipping additional bytes */
|
/* skipping additional bytes */
|
||||||
n = content_length - content_buf_used;
|
n = content_length - content_buf_used;
|
||||||
}
|
}
|
||||||
if(content_buf_used + n > content_buf_len)
|
if(content_buf_used + n > content_buf_len)
|
||||||
{
|
{
|
||||||
char * tmp;
|
char * tmp;
|
||||||
if(content_length >= (int)(content_buf_used + n)) {
|
if(content_length >= 0
|
||||||
|
&& (unsigned int)content_length >= (content_buf_used + n)) {
|
||||||
content_buf_len = content_length;
|
content_buf_len = content_length;
|
||||||
} else {
|
} else {
|
||||||
content_buf_len = content_buf_used + n;
|
content_buf_len = content_buf_used + n;
|
||||||
@ -336,7 +342,7 @@ getHTTPResponse(int s, int * size, int * status_code)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* use the Content-Length header value if available */
|
/* use the Content-Length header value if available */
|
||||||
if(content_length > 0 && (int)content_buf_used >= content_length)
|
if(content_length > 0 && content_buf_used >= (unsigned int)content_length)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("End of HTTP content\n");
|
printf("End of HTTP content\n");
|
||||||
|
4
external/miniupnpc/msvc/.gitignore
vendored
Normal file
4
external/miniupnpc/msvc/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
*.db
|
||||||
|
.vs
|
||||||
|
Debug/
|
||||||
|
Release/
|
111
external/miniupnpc/msvc/miniupnpc.vcxproj
vendored
Normal file
111
external/miniupnpc/msvc/miniupnpc.vcxproj
vendored
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{D28CE435-CB33-4BAE-8A52-C6EF915956F5}</ProjectGuid>
|
||||||
|
<RootNamespace>miniupnpc</RootNamespace>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<_ProjectFileVersion>14.0.25123.0</_ProjectFileVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MINIUPNP_STATICLIB;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
|
<PrecompiledHeader />
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MINIUPNP_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<PrecompiledHeader />
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\connecthostport.c" />
|
||||||
|
<ClCompile Include="..\igd_desc_parse.c" />
|
||||||
|
<ClCompile Include="..\minisoap.c" />
|
||||||
|
<ClCompile Include="..\minissdpc.c" />
|
||||||
|
<ClCompile Include="..\miniupnpc.c" />
|
||||||
|
<ClCompile Include="..\miniwget.c" />
|
||||||
|
<ClCompile Include="..\minixml.c" />
|
||||||
|
<ClCompile Include="..\portlistingparse.c" />
|
||||||
|
<ClCompile Include="..\receivedata.c" />
|
||||||
|
<ClCompile Include="..\upnpcommands.c" />
|
||||||
|
<ClCompile Include="..\upnpdev.c" />
|
||||||
|
<ClCompile Include="..\upnperrors.c" />
|
||||||
|
<ClCompile Include="..\upnpreplyparse.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\connecthostport.h" />
|
||||||
|
<ClInclude Include="..\declspec.h" />
|
||||||
|
<ClInclude Include="..\igd_desc_parse.h" />
|
||||||
|
<ClInclude Include="..\minisoap.h" />
|
||||||
|
<ClInclude Include="..\minissdpc.h" />
|
||||||
|
<ClInclude Include="..\miniupnpc.h" />
|
||||||
|
<ClInclude Include="..\miniupnpcstrings.h" />
|
||||||
|
<ClInclude Include="..\miniupnpctypes.h" />
|
||||||
|
<ClInclude Include="..\miniwget.h" />
|
||||||
|
<ClInclude Include="..\minixml.h" />
|
||||||
|
<ClInclude Include="..\portlistingparse.h" />
|
||||||
|
<ClInclude Include="..\receivedata.h" />
|
||||||
|
<ClInclude Include="..\upnpcommands.h" />
|
||||||
|
<ClInclude Include="..\upnpdev.h" />
|
||||||
|
<ClInclude Include="..\upnperrors.h" />
|
||||||
|
<ClInclude Include="..\upnpreplyparse.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
108
external/miniupnpc/msvc/miniupnpc.vcxproj.filters
vendored
Normal file
108
external/miniupnpc/msvc/miniupnpc.vcxproj.filters
vendored
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Fichiers sources">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Fichiers d%27en-tête">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Fichiers de ressources">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\connecthostport.c">
|
||||||
|
<Filter>Fichiers sources</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\igd_desc_parse.c">
|
||||||
|
<Filter>Fichiers sources</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\minisoap.c">
|
||||||
|
<Filter>Fichiers sources</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\minissdpc.c">
|
||||||
|
<Filter>Fichiers sources</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\miniupnpc.c">
|
||||||
|
<Filter>Fichiers sources</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\miniwget.c">
|
||||||
|
<Filter>Fichiers sources</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\minixml.c">
|
||||||
|
<Filter>Fichiers sources</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\portlistingparse.c">
|
||||||
|
<Filter>Fichiers sources</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\receivedata.c">
|
||||||
|
<Filter>Fichiers sources</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\upnpcommands.c">
|
||||||
|
<Filter>Fichiers sources</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\upnpdev.c">
|
||||||
|
<Filter>Fichiers sources</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\upnperrors.c">
|
||||||
|
<Filter>Fichiers sources</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\upnpreplyparse.c">
|
||||||
|
<Filter>Fichiers sources</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\connecthostport.h">
|
||||||
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\declspec.h">
|
||||||
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\igd_desc_parse.h">
|
||||||
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\minisoap.h">
|
||||||
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\minissdpc.h">
|
||||||
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\miniupnpc.h">
|
||||||
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\miniupnpcstrings.h">
|
||||||
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\miniupnpctypes.h">
|
||||||
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\miniwget.h">
|
||||||
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\minixml.h">
|
||||||
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\portlistingparse.h">
|
||||||
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\receivedata.h">
|
||||||
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\upnpcommands.h">
|
||||||
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\upnpdev.h">
|
||||||
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\upnperrors.h">
|
||||||
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\upnpreplyparse.h">
|
||||||
|
<Filter>Fichiers d%27en-tête</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
28
external/miniupnpc/msvc/miniupnpc_vs2015.sln
vendored
Normal file
28
external/miniupnpc/msvc/miniupnpc_vs2015.sln
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 14
|
||||||
|
VisualStudioVersion = 14.0.25123.0
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniupnpc", "miniupnpc.vcxproj", "{D28CE435-CB33-4BAE-8A52-C6EF915956F5}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "upnpc-static", "upnpc-static.vcxproj", "{469E1CF6-08A2-4B7B-A2AA-5BDB089857C1}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{D28CE435-CB33-4BAE-8A52-C6EF915956F5}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{D28CE435-CB33-4BAE-8A52-C6EF915956F5}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{D28CE435-CB33-4BAE-8A52-C6EF915956F5}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{D28CE435-CB33-4BAE-8A52-C6EF915956F5}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{469E1CF6-08A2-4B7B-A2AA-5BDB089857C1}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{469E1CF6-08A2-4B7B-A2AA-5BDB089857C1}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{469E1CF6-08A2-4B7B-A2AA-5BDB089857C1}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{469E1CF6-08A2-4B7B-A2AA-5BDB089857C1}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
103
external/miniupnpc/msvc/upnpc-static.vcxproj
vendored
Normal file
103
external/miniupnpc/msvc/upnpc-static.vcxproj
vendored
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{469E1CF6-08A2-4B7B-A2AA-5BDB089857C1}</ProjectGuid>
|
||||||
|
<RootNamespace>upnpcstatic</RootNamespace>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<_ProjectFileVersion>14.0.25123.0</_ProjectFileVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(Configuration)\</IntDir>
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(Configuration)\</IntDir>
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;MINIUPNP_STATICLIB;DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
|
<PrecompiledHeader />
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<AdditionalDependencies>ws2_32.lib;IPHlpApi.Lib;Debug\miniupnpc.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;MINIUPNP_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<PrecompiledHeader />
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<AdditionalDependencies>ws2_32.lib;IPHlpApi.Lib;Release\miniupnpc.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\upnpc.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="miniupnpc.vcxproj">
|
||||||
|
<Project>{d28ce435-cb33-4bae-8a52-c6ef915956f5}</Project>
|
||||||
|
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
22
external/miniupnpc/msvc/upnpc-static.vcxproj.filters
vendored
Normal file
22
external/miniupnpc/msvc/upnpc-static.vcxproj.filters
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Fichiers sources">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Fichiers d%27en-tête">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Fichiers de ressources">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\upnpc.c">
|
||||||
|
<Filter>Fichiers sources</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
4
external/miniupnpc/portlistingparse.c
vendored
4
external/miniupnpc/portlistingparse.c
vendored
@ -1,7 +1,7 @@
|
|||||||
/* $Id: portlistingparse.c,v 1.9 2015/07/15 12:41:13 nanard Exp $ */
|
/* $Id: portlistingparse.c,v 1.9 2015/07/15 12:41:13 nanard Exp $ */
|
||||||
/* MiniUPnP project
|
/* MiniUPnP project
|
||||||
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||||
* (c) 2011-2015 Thomas Bernard
|
* (c) 2011-2016 Thomas Bernard
|
||||||
* This software is subject to the conditions detailed
|
* This software is subject to the conditions detailed
|
||||||
* in the LICENCE file provided within the distribution */
|
* in the LICENCE file provided within the distribution */
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -55,7 +55,7 @@ startelt(void * d, const char * name, int l)
|
|||||||
pdata->curelt = PortMappingEltNone;
|
pdata->curelt = PortMappingEltNone;
|
||||||
for(i = 0; elements[i].str; i++)
|
for(i = 0; elements[i].str; i++)
|
||||||
{
|
{
|
||||||
if(memcmp(name, elements[i].str, l) == 0)
|
if(strlen(elements[i].str) == (size_t)l && memcmp(name, elements[i].str, l) == 0)
|
||||||
{
|
{
|
||||||
pdata->curelt = elements[i].code;
|
pdata->curelt = elements[i].code;
|
||||||
break;
|
break;
|
||||||
|
2
external/miniupnpc/receivedata.c
vendored
2
external/miniupnpc/receivedata.c
vendored
@ -28,7 +28,7 @@
|
|||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define PRINT_SOCKET_ERROR(x) printf("Socket error: %s, %d\n", x, WSAGetLastError());
|
#define PRINT_SOCKET_ERROR(x) fprintf(stderr, "Socket error: %s, %d\n", x, WSAGetLastError());
|
||||||
#else
|
#else
|
||||||
#define PRINT_SOCKET_ERROR(x) perror(x)
|
#define PRINT_SOCKET_ERROR(x) perror(x)
|
||||||
#endif
|
#endif
|
||||||
|
27
external/miniupnpc/setup.py
vendored
27
external/miniupnpc/setup.py
vendored
@ -1,19 +1,25 @@
|
|||||||
#! /usr/bin/python
|
#! /usr/bin/python
|
||||||
# vim: tabstop=8 shiftwidth=8 expandtab
|
# vim: tabstop=8 shiftwidth=8 expandtab
|
||||||
# $Id: setup.py,v 1.9 2012/05/23 08:50:10 nanard Exp $
|
# $Id: setup.py,v 1.9 2012/05/23 08:50:10 nanard Exp $
|
||||||
# the MiniUPnP Project (c) 2007-2014 Thomas Bernard
|
# the MiniUPnP Project (c) 2007-2017 Thomas Bernard
|
||||||
# http://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/
|
# http://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/
|
||||||
#
|
#
|
||||||
# python script to build the miniupnpc module under unix
|
# python script to build the miniupnpc module under unix
|
||||||
#
|
#
|
||||||
# replace libminiupnpc.a by libminiupnpc.so for shared library usage
|
# Uses MAKE environment variable (defaulting to 'make')
|
||||||
try:
|
|
||||||
from setuptools import setup, Extension
|
from setuptools import setup, Extension
|
||||||
except ImportError:
|
from setuptools.command import build_ext
|
||||||
from distutils.core import setup, Extension
|
import subprocess
|
||||||
from distutils import sysconfig
|
import os
|
||||||
sysconfig.get_config_vars()["OPT"] = ''
|
|
||||||
sysconfig.get_config_vars()["CFLAGS"] = ''
|
EXT = ['libminiupnpc.a']
|
||||||
|
|
||||||
|
class make_then_build_ext(build_ext.build_ext):
|
||||||
|
def run(self):
|
||||||
|
subprocess.check_call([os.environ.get('MAKE', 'make')] + EXT)
|
||||||
|
build_ext.build_ext.run(self)
|
||||||
|
|
||||||
setup(name="miniupnpc",
|
setup(name="miniupnpc",
|
||||||
version=open('VERSION').read().strip(),
|
version=open('VERSION').read().strip(),
|
||||||
author='Thomas BERNARD',
|
author='Thomas BERNARD',
|
||||||
@ -21,8 +27,9 @@ setup(name="miniupnpc",
|
|||||||
license=open('LICENSE').read(),
|
license=open('LICENSE').read(),
|
||||||
url='http://miniupnp.free.fr/',
|
url='http://miniupnp.free.fr/',
|
||||||
description='miniUPnP client',
|
description='miniUPnP client',
|
||||||
|
cmdclass={'build_ext': make_then_build_ext},
|
||||||
ext_modules=[
|
ext_modules=[
|
||||||
Extension(name="miniupnpc", sources=["miniupnpcmodule.c"],
|
Extension(name="miniupnpc", sources=["miniupnpcmodule.c"],
|
||||||
extra_objects=["libminiupnpc.a"])
|
extra_objects=EXT)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -87,4 +87,4 @@
|
|||||||
</device>
|
</device>
|
||||||
</deviceList>
|
</deviceList>
|
||||||
</device>
|
</device>
|
||||||
</root>
|
</root>
|
40
external/miniupnpc/testupnpigd.py
vendored
40
external/miniupnpc/testupnpigd.py
vendored
@ -8,7 +8,11 @@
|
|||||||
# import the python miniupnpc module
|
# import the python miniupnpc module
|
||||||
import miniupnpc
|
import miniupnpc
|
||||||
import socket
|
import socket
|
||||||
import BaseHTTPServer
|
|
||||||
|
try:
|
||||||
|
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||||
|
except ImportError:
|
||||||
|
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
||||||
|
|
||||||
# function definition
|
# function definition
|
||||||
def list_redirections():
|
def list_redirections():
|
||||||
@ -17,11 +21,11 @@ def list_redirections():
|
|||||||
p = u.getgenericportmapping(i)
|
p = u.getgenericportmapping(i)
|
||||||
if p==None:
|
if p==None:
|
||||||
break
|
break
|
||||||
print i, p
|
print(i, p)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
||||||
#define the handler class for HTTP connections
|
#define the handler class for HTTP connections
|
||||||
class handler_class(BaseHTTPServer.BaseHTTPRequestHandler):
|
class handler_class(BaseHTTPRequestHandler):
|
||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
@ -37,20 +41,20 @@ u = miniupnpc.UPnP()
|
|||||||
u.discoverdelay = 200;
|
u.discoverdelay = 200;
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print 'Discovering... delay=%ums' % u.discoverdelay
|
print('Discovering... delay=%ums' % u.discoverdelay)
|
||||||
ndevices = u.discover()
|
ndevices = u.discover()
|
||||||
print ndevices, 'device(s) detected'
|
print(ndevices, 'device(s) detected')
|
||||||
|
|
||||||
# select an igd
|
# select an igd
|
||||||
u.selectigd()
|
u.selectigd()
|
||||||
# display information about the IGD and the internet connection
|
# display information about the IGD and the internet connection
|
||||||
print 'local ip address :', u.lanaddr
|
print('local ip address :', u.lanaddr)
|
||||||
externalipaddress = u.externalipaddress()
|
externalipaddress = u.externalipaddress()
|
||||||
print 'external ip address :', externalipaddress
|
print('external ip address :', externalipaddress)
|
||||||
print u.statusinfo(), u.connectiontype()
|
print(u.statusinfo(), u.connectiontype())
|
||||||
|
|
||||||
#instanciate a HTTPd object. The port is assigned by the system.
|
#instanciate a HTTPd object. The port is assigned by the system.
|
||||||
httpd = BaseHTTPServer.HTTPServer((u.lanaddr, 0), handler_class)
|
httpd = HTTPServer((u.lanaddr, 0), handler_class)
|
||||||
eport = httpd.server_port
|
eport = httpd.server_port
|
||||||
|
|
||||||
# find a free port for the redirection
|
# find a free port for the redirection
|
||||||
@ -59,26 +63,26 @@ try:
|
|||||||
eport = eport + 1
|
eport = eport + 1
|
||||||
r = u.getspecificportmapping(eport, 'TCP')
|
r = u.getspecificportmapping(eport, 'TCP')
|
||||||
|
|
||||||
print 'trying to redirect %s port %u TCP => %s port %u TCP' % (externalipaddress, eport, u.lanaddr, httpd.server_port)
|
print('trying to redirect %s port %u TCP => %s port %u TCP' % (externalipaddress, eport, u.lanaddr, httpd.server_port))
|
||||||
|
|
||||||
b = u.addportmapping(eport, 'TCP', u.lanaddr, httpd.server_port,
|
b = u.addportmapping(eport, 'TCP', u.lanaddr, httpd.server_port,
|
||||||
'UPnP IGD Tester port %u' % eport, '')
|
'UPnP IGD Tester port %u' % eport, '')
|
||||||
if b:
|
if b:
|
||||||
print 'Success. Now waiting for some HTTP request on http://%s:%u' % (externalipaddress ,eport)
|
print('Success. Now waiting for some HTTP request on http://%s:%u' % (externalipaddress ,eport))
|
||||||
try:
|
try:
|
||||||
httpd.handle_request()
|
httpd.handle_request()
|
||||||
httpd.server_close()
|
httpd.server_close()
|
||||||
except KeyboardInterrupt, details:
|
except KeyboardInterrupt as details:
|
||||||
print "CTRL-C exception!", details
|
print("CTRL-C exception!", details)
|
||||||
b = u.deleteportmapping(eport, 'TCP')
|
b = u.deleteportmapping(eport, 'TCP')
|
||||||
if b:
|
if b:
|
||||||
print 'Successfully deleted port mapping'
|
print('Successfully deleted port mapping')
|
||||||
else:
|
else:
|
||||||
print 'Failed to remove port mapping'
|
print('Failed to remove port mapping')
|
||||||
else:
|
else:
|
||||||
print 'Failed'
|
print('Failed')
|
||||||
|
|
||||||
httpd.server_close()
|
httpd.server_close()
|
||||||
|
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print 'Exception :', e
|
print('Exception :', e)
|
||||||
|
82
external/miniupnpc/upnpc.c
vendored
82
external/miniupnpc/upnpc.c
vendored
@ -1,7 +1,7 @@
|
|||||||
/* $Id: upnpc.c,v 1.114 2016/01/22 15:04:23 nanard Exp $ */
|
/* $Id: upnpc.c,v 1.117 2017/05/26 15:26:55 nanard Exp $ */
|
||||||
/* Project : miniupnp
|
/* Project : miniupnp
|
||||||
* Author : Thomas Bernard
|
* Author : Thomas Bernard
|
||||||
* Copyright (c) 2005-2016 Thomas Bernard
|
* Copyright (c) 2005-2017 Thomas Bernard
|
||||||
* This software is subject to the conditions detailed in the
|
* This software is subject to the conditions detailed in the
|
||||||
* LICENCE file provided in this distribution. */
|
* LICENCE file provided in this distribution. */
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ static void NewListRedirections(struct UPNPUrls * urls,
|
|||||||
* 2 - get extenal ip address
|
* 2 - get extenal ip address
|
||||||
* 3 - Add port mapping
|
* 3 - Add port mapping
|
||||||
* 4 - get this port mapping from the IGD */
|
* 4 - get this port mapping from the IGD */
|
||||||
static void SetRedirectAndTest(struct UPNPUrls * urls,
|
static int SetRedirectAndTest(struct UPNPUrls * urls,
|
||||||
struct IGDdatas * data,
|
struct IGDdatas * data,
|
||||||
const char * iaddr,
|
const char * iaddr,
|
||||||
const char * iport,
|
const char * iport,
|
||||||
@ -262,13 +262,13 @@ static void SetRedirectAndTest(struct UPNPUrls * urls,
|
|||||||
if(!iaddr || !iport || !eport || !proto)
|
if(!iaddr || !iport || !eport || !proto)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Wrong arguments\n");
|
fprintf(stderr, "Wrong arguments\n");
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
proto = protofix(proto);
|
proto = protofix(proto);
|
||||||
if(!proto)
|
if(!proto)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "invalid protocol\n");
|
fprintf(stderr, "invalid protocol\n");
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = UPNP_GetExternalIPAddress(urls->controlURL,
|
r = UPNP_GetExternalIPAddress(urls->controlURL,
|
||||||
@ -292,9 +292,11 @@ static void SetRedirectAndTest(struct UPNPUrls * urls,
|
|||||||
r = UPNP_AddPortMapping(urls->controlURL, data->first.servicetype,
|
r = UPNP_AddPortMapping(urls->controlURL, data->first.servicetype,
|
||||||
eport, iport, iaddr, description,
|
eport, iport, iaddr, description,
|
||||||
proto, 0, leaseDuration);
|
proto, 0, leaseDuration);
|
||||||
if(r!=UPNPCOMMAND_SUCCESS)
|
if(r!=UPNPCOMMAND_SUCCESS) {
|
||||||
printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n",
|
printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n",
|
||||||
eport, iport, iaddr, r, strupnperror(r));
|
eport, iport, iaddr, r, strupnperror(r));
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
r = UPNP_GetSpecificPortMappingEntry(urls->controlURL,
|
r = UPNP_GetSpecificPortMappingEntry(urls->controlURL,
|
||||||
@ -302,17 +304,19 @@ static void SetRedirectAndTest(struct UPNPUrls * urls,
|
|||||||
eport, proto, NULL/*remoteHost*/,
|
eport, proto, NULL/*remoteHost*/,
|
||||||
intClient, intPort, NULL/*desc*/,
|
intClient, intPort, NULL/*desc*/,
|
||||||
NULL/*enabled*/, duration);
|
NULL/*enabled*/, duration);
|
||||||
if(r!=UPNPCOMMAND_SUCCESS)
|
if(r!=UPNPCOMMAND_SUCCESS) {
|
||||||
printf("GetSpecificPortMappingEntry() failed with code %d (%s)\n",
|
printf("GetSpecificPortMappingEntry() failed with code %d (%s)\n",
|
||||||
r, strupnperror(r));
|
r, strupnperror(r));
|
||||||
else {
|
return -2;
|
||||||
|
} else {
|
||||||
printf("InternalIP:Port = %s:%s\n", intClient, intPort);
|
printf("InternalIP:Port = %s:%s\n", intClient, intPort);
|
||||||
printf("external %s:%s %s is redirected to internal %s:%s (duration=%s)\n",
|
printf("external %s:%s %s is redirected to internal %s:%s (duration=%s)\n",
|
||||||
externalIPAddress, eport, proto, intClient, intPort, duration);
|
externalIPAddress, eport, proto, intClient, intPort, duration);
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
RemoveRedirect(struct UPNPUrls * urls,
|
RemoveRedirect(struct UPNPUrls * urls,
|
||||||
struct IGDdatas * data,
|
struct IGDdatas * data,
|
||||||
const char * eport,
|
const char * eport,
|
||||||
@ -323,19 +327,25 @@ RemoveRedirect(struct UPNPUrls * urls,
|
|||||||
if(!proto || !eport)
|
if(!proto || !eport)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "invalid arguments\n");
|
fprintf(stderr, "invalid arguments\n");
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
proto = protofix(proto);
|
proto = protofix(proto);
|
||||||
if(!proto)
|
if(!proto)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "protocol invalid\n");
|
fprintf(stderr, "protocol invalid\n");
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
r = UPNP_DeletePortMapping(urls->controlURL, data->first.servicetype, eport, proto, remoteHost);
|
r = UPNP_DeletePortMapping(urls->controlURL, data->first.servicetype, eport, proto, remoteHost);
|
||||||
printf("UPNP_DeletePortMapping() returned : %d\n", r);
|
if(r!=UPNPCOMMAND_SUCCESS) {
|
||||||
|
printf("UPNP_DeletePortMapping() failed with code : %d\n", r);
|
||||||
|
return -2;
|
||||||
|
}else {
|
||||||
|
printf("UPNP_DeletePortMapping() returned : %d\n", r);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
RemoveRedirectRange(struct UPNPUrls * urls,
|
RemoveRedirectRange(struct UPNPUrls * urls,
|
||||||
struct IGDdatas * data,
|
struct IGDdatas * data,
|
||||||
const char * ePortStart, char const * ePortEnd,
|
const char * ePortStart, char const * ePortEnd,
|
||||||
@ -349,16 +359,22 @@ RemoveRedirectRange(struct UPNPUrls * urls,
|
|||||||
if(!proto || !ePortStart || !ePortEnd)
|
if(!proto || !ePortStart || !ePortEnd)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "invalid arguments\n");
|
fprintf(stderr, "invalid arguments\n");
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
proto = protofix(proto);
|
proto = protofix(proto);
|
||||||
if(!proto)
|
if(!proto)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "protocol invalid\n");
|
fprintf(stderr, "protocol invalid\n");
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
r = UPNP_DeletePortMappingRange(urls->controlURL, data->first.servicetype, ePortStart, ePortEnd, proto, manage);
|
r = UPNP_DeletePortMappingRange(urls->controlURL, data->first.servicetype, ePortStart, ePortEnd, proto, manage);
|
||||||
printf("UPNP_DeletePortMappingRange() returned : %d\n", r);
|
if(r!=UPNPCOMMAND_SUCCESS) {
|
||||||
|
printf("UPNP_DeletePortMappingRange() failed with code : %d\n", r);
|
||||||
|
return -2;
|
||||||
|
}else {
|
||||||
|
printf("UPNP_DeletePortMappingRange() returned : %d\n", r);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IGD:2, functions for service WANIPv6FirewallControl:1 */
|
/* IGD:2, functions for service WANIPv6FirewallControl:1 */
|
||||||
@ -562,8 +578,8 @@ int main(int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
printf("upnpc : miniupnpc library test client, version %s.\n", MINIUPNPC_VERSION_STRING);
|
printf("upnpc : miniupnpc library test client, version %s.\n", MINIUPNPC_VERSION_STRING);
|
||||||
printf(" (c) 2005-2016 Thomas Bernard.\n");
|
printf(" (c) 2005-2017 Thomas Bernard.\n");
|
||||||
printf("Go to http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/\n"
|
printf("Go to http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/\n"
|
||||||
"for more information.\n");
|
"for more information.\n");
|
||||||
/* command line processing */
|
/* command line processing */
|
||||||
for(i=1; i<argc; i++)
|
for(i=1; i<argc; i++)
|
||||||
@ -711,29 +727,33 @@ int main(int argc, char ** argv)
|
|||||||
NewListRedirections(&urls, &data);
|
NewListRedirections(&urls, &data);
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
SetRedirectAndTest(&urls, &data,
|
if (SetRedirectAndTest(&urls, &data,
|
||||||
commandargv[0], commandargv[1],
|
commandargv[0], commandargv[1],
|
||||||
commandargv[2], commandargv[3],
|
commandargv[2], commandargv[3],
|
||||||
(commandargc > 4)?commandargv[4]:"0",
|
(commandargc > 4)?commandargv[4]:"0",
|
||||||
description, 0);
|
description, 0) < 0)
|
||||||
|
retcode = 2;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
RemoveRedirect(&urls, &data, commandargv[0], commandargv[1],
|
if (RemoveRedirect(&urls, &data, commandargv[0], commandargv[1],
|
||||||
commandargc > 2 ? commandargv[2] : NULL);
|
commandargc > 2 ? commandargv[2] : NULL) < 0)
|
||||||
|
retcode = 2;
|
||||||
break;
|
break;
|
||||||
case 'n': /* aNy */
|
case 'n': /* aNy */
|
||||||
SetRedirectAndTest(&urls, &data,
|
if (SetRedirectAndTest(&urls, &data,
|
||||||
commandargv[0], commandargv[1],
|
commandargv[0], commandargv[1],
|
||||||
commandargv[2], commandargv[3],
|
commandargv[2], commandargv[3],
|
||||||
(commandargc > 4)?commandargv[4]:"0",
|
(commandargc > 4)?commandargv[4]:"0",
|
||||||
description, 1);
|
description, 1) < 0)
|
||||||
|
retcode = 2;
|
||||||
break;
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
if (commandargc < 3)
|
if (commandargc < 3)
|
||||||
fprintf(stderr, "too few arguments\n");
|
fprintf(stderr, "too few arguments\n");
|
||||||
|
|
||||||
RemoveRedirectRange(&urls, &data, commandargv[0], commandargv[1], commandargv[2],
|
if (RemoveRedirectRange(&urls, &data, commandargv[0], commandargv[1], commandargv[2],
|
||||||
commandargc > 3 ? commandargv[3] : NULL);
|
commandargc > 3 ? commandargv[3] : NULL) < 0)
|
||||||
|
retcode = 2;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
GetConnectionStatus(&urls, &data);
|
GetConnectionStatus(&urls, &data);
|
||||||
@ -749,17 +769,19 @@ int main(int argc, char ** argv)
|
|||||||
break;
|
break;
|
||||||
} else if(is_int(commandargv[i+1])){
|
} else if(is_int(commandargv[i+1])){
|
||||||
/* 2nd parameter is an integer : <port> <external_port> <protocol> */
|
/* 2nd parameter is an integer : <port> <external_port> <protocol> */
|
||||||
SetRedirectAndTest(&urls, &data,
|
if (SetRedirectAndTest(&urls, &data,
|
||||||
lanaddr, commandargv[i],
|
lanaddr, commandargv[i],
|
||||||
commandargv[i+1], commandargv[i+2], "0",
|
commandargv[i+1], commandargv[i+2], "0",
|
||||||
description, 0);
|
description, 0) < 0)
|
||||||
|
retcode = 2;
|
||||||
i+=3; /* 3 parameters parsed */
|
i+=3; /* 3 parameters parsed */
|
||||||
} else {
|
} else {
|
||||||
/* 2nd parameter not an integer : <port> <protocol> */
|
/* 2nd parameter not an integer : <port> <protocol> */
|
||||||
SetRedirectAndTest(&urls, &data,
|
if (SetRedirectAndTest(&urls, &data,
|
||||||
lanaddr, commandargv[i],
|
lanaddr, commandargv[i],
|
||||||
commandargv[i], commandargv[i+1], "0",
|
commandargv[i], commandargv[i+1], "0",
|
||||||
description, 0);
|
description, 0) < 0)
|
||||||
|
retcode = 2;
|
||||||
i+=2; /* 2 parameters parsed */
|
i+=2; /* 2 parameters parsed */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
89
external/miniupnpc/upnpcommands.c
vendored
89
external/miniupnpc/upnpcommands.c
vendored
@ -1,7 +1,8 @@
|
|||||||
/* $Id: upnpcommands.c,v 1.46 2015/07/15 12:19:00 nanard Exp $ */
|
/* $Id: upnpcommands.c,v 1.46 2015/07/15 12:19:00 nanard Exp $ */
|
||||||
/* Project : miniupnp
|
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
||||||
|
* Project : miniupnp
|
||||||
* Author : Thomas Bernard
|
* Author : Thomas Bernard
|
||||||
* Copyright (c) 2005-2015 Thomas Bernard
|
* Copyright (c) 2005-2017 Thomas Bernard
|
||||||
* This software is subject to the conditions detailed in the
|
* This software is subject to the conditions detailed in the
|
||||||
* LICENCE file provided in this distribution.
|
* LICENCE file provided in this distribution.
|
||||||
* */
|
* */
|
||||||
@ -372,10 +373,11 @@ UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
|
|||||||
AddPortMappingArgs[6].val = desc?desc:"libminiupnpc";
|
AddPortMappingArgs[6].val = desc?desc:"libminiupnpc";
|
||||||
AddPortMappingArgs[7].elt = "NewLeaseDuration";
|
AddPortMappingArgs[7].elt = "NewLeaseDuration";
|
||||||
AddPortMappingArgs[7].val = leaseDuration?leaseDuration:"0";
|
AddPortMappingArgs[7].val = leaseDuration?leaseDuration:"0";
|
||||||
if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
||||||
"AddPortMapping", AddPortMappingArgs,
|
"AddPortMapping", AddPortMappingArgs,
|
||||||
&bufsize))) {
|
&bufsize);
|
||||||
free(AddPortMappingArgs);
|
free(AddPortMappingArgs);
|
||||||
|
if(!buffer) {
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
}
|
}
|
||||||
/*DisplayNameValueList(buffer, bufsize);*/
|
/*DisplayNameValueList(buffer, bufsize);*/
|
||||||
@ -392,7 +394,6 @@ UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
|
|||||||
ret = UPNPCOMMAND_SUCCESS;
|
ret = UPNPCOMMAND_SUCCESS;
|
||||||
}
|
}
|
||||||
ClearNameValueList(&pdata);
|
ClearNameValueList(&pdata);
|
||||||
free(AddPortMappingArgs);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,10 +437,11 @@ UPNP_AddAnyPortMapping(const char * controlURL, const char * servicetype,
|
|||||||
AddPortMappingArgs[6].val = desc?desc:"libminiupnpc";
|
AddPortMappingArgs[6].val = desc?desc:"libminiupnpc";
|
||||||
AddPortMappingArgs[7].elt = "NewLeaseDuration";
|
AddPortMappingArgs[7].elt = "NewLeaseDuration";
|
||||||
AddPortMappingArgs[7].val = leaseDuration?leaseDuration:"0";
|
AddPortMappingArgs[7].val = leaseDuration?leaseDuration:"0";
|
||||||
if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
||||||
"AddAnyPortMapping", AddPortMappingArgs,
|
"AddAnyPortMapping", AddPortMappingArgs,
|
||||||
&bufsize))) {
|
&bufsize);
|
||||||
free(AddPortMappingArgs);
|
free(AddPortMappingArgs);
|
||||||
|
if(!buffer) {
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
}
|
}
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
@ -461,7 +463,6 @@ UPNP_AddAnyPortMapping(const char * controlURL, const char * servicetype,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ClearNameValueList(&pdata);
|
ClearNameValueList(&pdata);
|
||||||
free(AddPortMappingArgs);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,10 +491,11 @@ UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
|
|||||||
DeletePortMappingArgs[1].val = extPort;
|
DeletePortMappingArgs[1].val = extPort;
|
||||||
DeletePortMappingArgs[2].elt = "NewProtocol";
|
DeletePortMappingArgs[2].elt = "NewProtocol";
|
||||||
DeletePortMappingArgs[2].val = proto;
|
DeletePortMappingArgs[2].val = proto;
|
||||||
if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
||||||
"DeletePortMapping",
|
"DeletePortMapping",
|
||||||
DeletePortMappingArgs, &bufsize))) {
|
DeletePortMappingArgs, &bufsize);
|
||||||
free(DeletePortMappingArgs);
|
free(DeletePortMappingArgs);
|
||||||
|
if(!buffer) {
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
}
|
}
|
||||||
/*DisplayNameValueList(buffer, bufsize);*/
|
/*DisplayNameValueList(buffer, bufsize);*/
|
||||||
@ -507,7 +509,6 @@ UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
|
|||||||
ret = UPNPCOMMAND_SUCCESS;
|
ret = UPNPCOMMAND_SUCCESS;
|
||||||
}
|
}
|
||||||
ClearNameValueList(&pdata);
|
ClearNameValueList(&pdata);
|
||||||
free(DeletePortMappingArgs);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -539,10 +540,11 @@ UPNP_DeletePortMappingRange(const char * controlURL, const char * servicetype,
|
|||||||
DeletePortMappingArgs[3].elt = "NewManage";
|
DeletePortMappingArgs[3].elt = "NewManage";
|
||||||
DeletePortMappingArgs[3].val = manage;
|
DeletePortMappingArgs[3].val = manage;
|
||||||
|
|
||||||
if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
||||||
"DeletePortMappingRange",
|
"DeletePortMappingRange",
|
||||||
DeletePortMappingArgs, &bufsize))) {
|
DeletePortMappingArgs, &bufsize);
|
||||||
free(DeletePortMappingArgs);
|
free(DeletePortMappingArgs);
|
||||||
|
if(!buffer) {
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
}
|
}
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
@ -555,7 +557,6 @@ UPNP_DeletePortMappingRange(const char * controlURL, const char * servicetype,
|
|||||||
ret = UPNPCOMMAND_SUCCESS;
|
ret = UPNPCOMMAND_SUCCESS;
|
||||||
}
|
}
|
||||||
ClearNameValueList(&pdata);
|
ClearNameValueList(&pdata);
|
||||||
free(DeletePortMappingArgs);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -587,10 +588,11 @@ UPNP_GetGenericPortMappingEntry(const char * controlURL,
|
|||||||
return UPNPCOMMAND_MEM_ALLOC_ERROR;
|
return UPNPCOMMAND_MEM_ALLOC_ERROR;
|
||||||
GetPortMappingArgs[0].elt = "NewPortMappingIndex";
|
GetPortMappingArgs[0].elt = "NewPortMappingIndex";
|
||||||
GetPortMappingArgs[0].val = index;
|
GetPortMappingArgs[0].val = index;
|
||||||
if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
||||||
"GetGenericPortMappingEntry",
|
"GetGenericPortMappingEntry",
|
||||||
GetPortMappingArgs, &bufsize))) {
|
GetPortMappingArgs, &bufsize);
|
||||||
free(GetPortMappingArgs);
|
free(GetPortMappingArgs);
|
||||||
|
if(!buffer) {
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
}
|
}
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
@ -652,7 +654,6 @@ UPNP_GetGenericPortMappingEntry(const char * controlURL,
|
|||||||
sscanf(p, "%d", &r);
|
sscanf(p, "%d", &r);
|
||||||
}
|
}
|
||||||
ClearNameValueList(&pdata);
|
ClearNameValueList(&pdata);
|
||||||
free(GetPortMappingArgs);
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -728,10 +729,11 @@ UPNP_GetSpecificPortMappingEntry(const char * controlURL,
|
|||||||
GetPortMappingArgs[1].val = extPort;
|
GetPortMappingArgs[1].val = extPort;
|
||||||
GetPortMappingArgs[2].elt = "NewProtocol";
|
GetPortMappingArgs[2].elt = "NewProtocol";
|
||||||
GetPortMappingArgs[2].val = proto;
|
GetPortMappingArgs[2].val = proto;
|
||||||
if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
||||||
"GetSpecificPortMappingEntry",
|
"GetSpecificPortMappingEntry",
|
||||||
GetPortMappingArgs, &bufsize))) {
|
GetPortMappingArgs, &bufsize);
|
||||||
free(GetPortMappingArgs);
|
free(GetPortMappingArgs);
|
||||||
|
if(!buffer) {
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
}
|
}
|
||||||
/*DisplayNameValueList(buffer, bufsize);*/
|
/*DisplayNameValueList(buffer, bufsize);*/
|
||||||
@ -779,7 +781,6 @@ UPNP_GetSpecificPortMappingEntry(const char * controlURL,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ClearNameValueList(&pdata);
|
ClearNameValueList(&pdata);
|
||||||
free(GetPortMappingArgs);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -824,13 +825,13 @@ UPNP_GetListOfPortMappings(const char * controlURL,
|
|||||||
GetListOfPortMappingsArgs[4].elt = "NewNumberOfPorts";
|
GetListOfPortMappingsArgs[4].elt = "NewNumberOfPorts";
|
||||||
GetListOfPortMappingsArgs[4].val = numberOfPorts?numberOfPorts:"1000";
|
GetListOfPortMappingsArgs[4].val = numberOfPorts?numberOfPorts:"1000";
|
||||||
|
|
||||||
if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
||||||
"GetListOfPortMappings",
|
"GetListOfPortMappings",
|
||||||
GetListOfPortMappingsArgs, &bufsize))) {
|
GetListOfPortMappingsArgs, &bufsize);
|
||||||
free(GetListOfPortMappingsArgs);
|
free(GetListOfPortMappingsArgs);
|
||||||
|
if(!buffer) {
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
}
|
}
|
||||||
free(GetListOfPortMappingsArgs);
|
|
||||||
|
|
||||||
/*DisplayNameValueList(buffer, bufsize);*/
|
/*DisplayNameValueList(buffer, bufsize);*/
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
@ -954,6 +955,7 @@ UPNP_GetOutboundPinholeTimeout(const char * controlURL, const char * servicetype
|
|||||||
GetOutboundPinholeTimeoutArgs[4].val = intClient;
|
GetOutboundPinholeTimeoutArgs[4].val = intClient;
|
||||||
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
||||||
"GetOutboundPinholeTimeout", GetOutboundPinholeTimeoutArgs, &bufsize);
|
"GetOutboundPinholeTimeout", GetOutboundPinholeTimeoutArgs, &bufsize);
|
||||||
|
free(GetOutboundPinholeTimeoutArgs);
|
||||||
if(!buffer)
|
if(!buffer)
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
@ -972,7 +974,6 @@ UPNP_GetOutboundPinholeTimeout(const char * controlURL, const char * servicetype
|
|||||||
*opTimeout = my_atoui(p);
|
*opTimeout = my_atoui(p);
|
||||||
}
|
}
|
||||||
ClearNameValueList(&pdata);
|
ClearNameValueList(&pdata);
|
||||||
free(GetOutboundPinholeTimeoutArgs);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1031,6 +1032,7 @@ UPNP_AddPinhole(const char * controlURL, const char * servicetype,
|
|||||||
AddPinholeArgs[5].val = leaseTime;
|
AddPinholeArgs[5].val = leaseTime;
|
||||||
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
||||||
"AddPinhole", AddPinholeArgs, &bufsize);
|
"AddPinhole", AddPinholeArgs, &bufsize);
|
||||||
|
free(AddPinholeArgs);
|
||||||
if(!buffer)
|
if(!buffer)
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
@ -1053,7 +1055,6 @@ UPNP_AddPinhole(const char * controlURL, const char * servicetype,
|
|||||||
ret = UPNPCOMMAND_SUCCESS;
|
ret = UPNPCOMMAND_SUCCESS;
|
||||||
}
|
}
|
||||||
ClearNameValueList(&pdata);
|
ClearNameValueList(&pdata);
|
||||||
free(AddPinholeArgs);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1081,6 +1082,7 @@ UPNP_UpdatePinhole(const char * controlURL, const char * servicetype,
|
|||||||
UpdatePinholeArgs[1].val = leaseTime;
|
UpdatePinholeArgs[1].val = leaseTime;
|
||||||
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
||||||
"UpdatePinhole", UpdatePinholeArgs, &bufsize);
|
"UpdatePinhole", UpdatePinholeArgs, &bufsize);
|
||||||
|
free(UpdatePinholeArgs);
|
||||||
if(!buffer)
|
if(!buffer)
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
@ -1097,7 +1099,6 @@ UPNP_UpdatePinhole(const char * controlURL, const char * servicetype,
|
|||||||
ret = UPNPCOMMAND_SUCCESS;
|
ret = UPNPCOMMAND_SUCCESS;
|
||||||
}
|
}
|
||||||
ClearNameValueList(&pdata);
|
ClearNameValueList(&pdata);
|
||||||
free(UpdatePinholeArgs);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1122,6 +1123,7 @@ UPNP_DeletePinhole(const char * controlURL, const char * servicetype, const char
|
|||||||
DeletePinholeArgs[0].val = uniqueID;
|
DeletePinholeArgs[0].val = uniqueID;
|
||||||
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
||||||
"DeletePinhole", DeletePinholeArgs, &bufsize);
|
"DeletePinhole", DeletePinholeArgs, &bufsize);
|
||||||
|
free(DeletePinholeArgs);
|
||||||
if(!buffer)
|
if(!buffer)
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
/*DisplayNameValueList(buffer, bufsize);*/
|
/*DisplayNameValueList(buffer, bufsize);*/
|
||||||
@ -1138,7 +1140,6 @@ UPNP_DeletePinhole(const char * controlURL, const char * servicetype, const char
|
|||||||
ret = UPNPCOMMAND_SUCCESS;
|
ret = UPNPCOMMAND_SUCCESS;
|
||||||
}
|
}
|
||||||
ClearNameValueList(&pdata);
|
ClearNameValueList(&pdata);
|
||||||
free(DeletePinholeArgs);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1163,8 +1164,11 @@ UPNP_CheckPinholeWorking(const char * controlURL, const char * servicetype,
|
|||||||
CheckPinholeWorkingArgs[0].val = uniqueID;
|
CheckPinholeWorkingArgs[0].val = uniqueID;
|
||||||
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
||||||
"CheckPinholeWorking", CheckPinholeWorkingArgs, &bufsize);
|
"CheckPinholeWorking", CheckPinholeWorkingArgs, &bufsize);
|
||||||
|
free(CheckPinholeWorkingArgs);
|
||||||
if(!buffer)
|
if(!buffer)
|
||||||
|
{
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
|
}
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
free(buffer); buffer = NULL;
|
free(buffer); buffer = NULL;
|
||||||
|
|
||||||
@ -1185,7 +1189,6 @@ UPNP_CheckPinholeWorking(const char * controlURL, const char * servicetype,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ClearNameValueList(&pdata);
|
ClearNameValueList(&pdata);
|
||||||
free(CheckPinholeWorkingArgs);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1210,6 +1213,7 @@ UPNP_GetPinholePackets(const char * controlURL, const char * servicetype,
|
|||||||
GetPinholePacketsArgs[0].val = uniqueID;
|
GetPinholePacketsArgs[0].val = uniqueID;
|
||||||
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
buffer = simpleUPnPcommand(-1, controlURL, servicetype,
|
||||||
"GetPinholePackets", GetPinholePacketsArgs, &bufsize);
|
"GetPinholePackets", GetPinholePacketsArgs, &bufsize);
|
||||||
|
free(GetPinholePacketsArgs);
|
||||||
if(!buffer)
|
if(!buffer)
|
||||||
return UPNPCOMMAND_HTTP_ERROR;
|
return UPNPCOMMAND_HTTP_ERROR;
|
||||||
ParseNameValue(buffer, bufsize, &pdata);
|
ParseNameValue(buffer, bufsize, &pdata);
|
||||||
@ -1230,7 +1234,6 @@ UPNP_GetPinholePackets(const char * controlURL, const char * servicetype,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ClearNameValueList(&pdata);
|
ClearNameValueList(&pdata);
|
||||||
free(GetPinholePacketsArgs);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user