summaryrefslogtreecommitdiff
path: root/thirdparty/miniupnpc
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2019-06-30 17:31:51 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2019-06-30 17:49:40 +0200
commit78907d91f140dd047a2eebb2736ed1762897003d (patch)
treee37b710db8743d64e2ef774a889dec07fad7bbcb /thirdparty/miniupnpc
parente2bbf2cba3dc97998cff0be5cbda2d7e3b7151b0 (diff)
Update miniupnpc library to latest master
Diffstat (limited to 'thirdparty/miniupnpc')
-rw-r--r--thirdparty/miniupnpc/LICENSE4
-rw-r--r--thirdparty/miniupnpc/miniupnpc.def45
-rw-r--r--thirdparty/miniupnpc/miniupnpc.h153
-rw-r--r--thirdparty/miniupnpc/miniupnpc/codelength.h (renamed from thirdparty/miniupnpc/codelength.h)0
-rw-r--r--thirdparty/miniupnpc/miniupnpc/connecthostport.c (renamed from thirdparty/miniupnpc/connecthostport.c)62
-rw-r--r--thirdparty/miniupnpc/miniupnpc/connecthostport.h (renamed from thirdparty/miniupnpc/connecthostport.h)0
-rw-r--r--thirdparty/miniupnpc/miniupnpc/igd_desc_parse.c (renamed from thirdparty/miniupnpc/igd_desc_parse.c)0
-rw-r--r--thirdparty/miniupnpc/miniupnpc/igd_desc_parse.h (renamed from thirdparty/miniupnpc/igd_desc_parse.h)0
-rw-r--r--thirdparty/miniupnpc/miniupnpc/listdevices.c (renamed from thirdparty/miniupnpc/listdevices.c)0
-rw-r--r--thirdparty/miniupnpc/miniupnpc/minisoap.c (renamed from thirdparty/miniupnpc/minisoap.c)9
-rw-r--r--thirdparty/miniupnpc/miniupnpc/minisoap.h (renamed from thirdparty/miniupnpc/minisoap.h)0
-rw-r--r--thirdparty/miniupnpc/miniupnpc/minissdpc.c (renamed from thirdparty/miniupnpc/minissdpc.c)101
-rw-r--r--thirdparty/miniupnpc/miniupnpc/minissdpc.h (renamed from thirdparty/miniupnpc/minissdpc.h)6
-rw-r--r--thirdparty/miniupnpc/miniupnpc/miniupnpc.c (renamed from thirdparty/miniupnpc/miniupnpc.c)37
-rw-r--r--thirdparty/miniupnpc/miniupnpc/miniupnpc_declspec.h (renamed from thirdparty/miniupnpc/miniupnpc_declspec.h)0
-rw-r--r--thirdparty/miniupnpc/miniupnpc/miniupnpc_socketdef.h (renamed from thirdparty/miniupnpc/miniupnpc_socketdef.h)7
-rw-r--r--thirdparty/miniupnpc/miniupnpc/miniupnpcmodule.c (renamed from thirdparty/miniupnpc/miniupnpcmodule.c)34
-rw-r--r--thirdparty/miniupnpc/miniupnpc/miniupnpcstrings.h (renamed from thirdparty/miniupnpc/miniupnpcstrings.h)0
-rw-r--r--thirdparty/miniupnpc/miniupnpc/miniupnpctypes.h (renamed from thirdparty/miniupnpc/miniupnpctypes.h)0
-rw-r--r--thirdparty/miniupnpc/miniupnpc/miniwget.c (renamed from thirdparty/miniupnpc/miniwget.c)9
-rw-r--r--thirdparty/miniupnpc/miniupnpc/miniwget_private.h (renamed from thirdparty/miniupnpc/miniwget_private.h)0
-rw-r--r--thirdparty/miniupnpc/miniupnpc/minixml.c (renamed from thirdparty/miniupnpc/minixml.c)0
-rw-r--r--thirdparty/miniupnpc/miniupnpc/minixml.h (renamed from thirdparty/miniupnpc/minixml.h)2
-rw-r--r--thirdparty/miniupnpc/miniupnpc/minixmlvalid.c (renamed from thirdparty/miniupnpc/minixmlvalid.c)0
-rw-r--r--thirdparty/miniupnpc/miniupnpc/portlistingparse.c (renamed from thirdparty/miniupnpc/portlistingparse.c)0
-rw-r--r--thirdparty/miniupnpc/miniupnpc/portlistingparse.h (renamed from thirdparty/miniupnpc/portlistingparse.h)0
-rw-r--r--thirdparty/miniupnpc/miniupnpc/receivedata.c (renamed from thirdparty/miniupnpc/receivedata.c)0
-rw-r--r--thirdparty/miniupnpc/miniupnpc/receivedata.h (renamed from thirdparty/miniupnpc/receivedata.h)0
-rw-r--r--thirdparty/miniupnpc/miniupnpc/upnpc.c (renamed from thirdparty/miniupnpc/upnpc.c)4
-rw-r--r--thirdparty/miniupnpc/miniupnpc/upnpcommands.c (renamed from thirdparty/miniupnpc/upnpcommands.c)63
-rw-r--r--thirdparty/miniupnpc/miniupnpc/upnpcommands.h6
-rw-r--r--thirdparty/miniupnpc/miniupnpc/upnpdev.c (renamed from thirdparty/miniupnpc/upnpdev.c)0
-rw-r--r--thirdparty/miniupnpc/miniupnpc/upnpdev.h (renamed from thirdparty/miniupnpc/upnpdev.h)0
-rw-r--r--thirdparty/miniupnpc/miniupnpc/upnperrors.c (renamed from thirdparty/miniupnpc/upnperrors.c)8
-rw-r--r--thirdparty/miniupnpc/miniupnpc/upnperrors.h (renamed from thirdparty/miniupnpc/upnperrors.h)0
-rw-r--r--thirdparty/miniupnpc/miniupnpc/upnpreplyparse.c (renamed from thirdparty/miniupnpc/upnpreplyparse.c)5
-rw-r--r--thirdparty/miniupnpc/miniupnpc/upnpreplyparse.h (renamed from thirdparty/miniupnpc/upnpreplyparse.h)0
-rw-r--r--thirdparty/miniupnpc/miniwget.h27
-rw-r--r--thirdparty/miniupnpc/upnpcommands.h348
39 files changed, 189 insertions, 741 deletions
diff --git a/thirdparty/miniupnpc/LICENSE b/thirdparty/miniupnpc/LICENSE
index 0816733704..39e0345f8a 100644
--- a/thirdparty/miniupnpc/LICENSE
+++ b/thirdparty/miniupnpc/LICENSE
@@ -1,5 +1,5 @@
-MiniUPnPc
-Copyright (c) 2005-2016, Thomas BERNARD
+MiniUPnP Project
+Copyright (c) 2005-2019, Thomas BERNARD
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/thirdparty/miniupnpc/miniupnpc.def b/thirdparty/miniupnpc/miniupnpc.def
deleted file mode 100644
index 60e0bbe423..0000000000
--- a/thirdparty/miniupnpc/miniupnpc.def
+++ /dev/null
@@ -1,45 +0,0 @@
-LIBRARY
-; miniupnpc library
- miniupnpc
-
-EXPORTS
-; miniupnpc
- upnpDiscover
- freeUPNPDevlist
- parserootdesc
- UPNP_GetValidIGD
- UPNP_GetIGDFromUrl
- GetUPNPUrls
- FreeUPNPUrls
-; miniwget
- miniwget
- miniwget_getaddr
-; upnpcommands
- UPNP_GetTotalBytesSent
- UPNP_GetTotalBytesReceived
- UPNP_GetTotalPacketsSent
- UPNP_GetTotalPacketsReceived
- UPNP_GetStatusInfo
- UPNP_GetConnectionTypeInfo
- UPNP_GetExternalIPAddress
- UPNP_GetLinkLayerMaxBitRates
- UPNP_AddPortMapping
- UPNP_AddAnyPortMapping
- UPNP_DeletePortMapping
- UPNP_DeletePortMappingRange
- UPNP_GetPortMappingNumberOfEntries
- UPNP_GetSpecificPortMappingEntry
- UPNP_GetGenericPortMappingEntry
- UPNP_GetListOfPortMappings
- UPNP_AddPinhole
- UPNP_CheckPinholeWorking
- UPNP_UpdatePinhole
- UPNP_GetPinholePackets
- UPNP_DeletePinhole
- UPNP_GetFirewallStatus
- UPNP_GetOutboundPinholeTimeout
-; upnperrors
- strupnperror
-; portlistingparse
- ParsePortListing
- FreePortListing
diff --git a/thirdparty/miniupnpc/miniupnpc.h b/thirdparty/miniupnpc/miniupnpc.h
deleted file mode 100644
index 8ddc282bd1..0000000000
--- a/thirdparty/miniupnpc/miniupnpc.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/* $Id: miniupnpc.h,v 1.53 2018/05/07 11:05:16 nanard Exp $ */
-/* vim: tabstop=4 shiftwidth=4 noexpandtab
- * Project: miniupnp
- * http://miniupnp.free.fr/
- * Author: Thomas Bernard
- * Copyright (c) 2005-2018 Thomas Bernard
- * This software is subjects to the conditions detailed
- * in the LICENCE file provided within this distribution */
-#ifndef MINIUPNPC_H_INCLUDED
-#define MINIUPNPC_H_INCLUDED
-
-#include "miniupnpc_declspec.h"
-#include "igd_desc_parse.h"
-#include "upnpdev.h"
-
-/* error codes : */
-#define UPNPDISCOVER_SUCCESS (0)
-#define UPNPDISCOVER_UNKNOWN_ERROR (-1)
-#define UPNPDISCOVER_SOCKET_ERROR (-101)
-#define UPNPDISCOVER_MEMORY_ERROR (-102)
-
-/* versions : */
-#define MINIUPNPC_VERSION "2.1"
-#define MINIUPNPC_API_VERSION 17
-
-/* Source port:
- Using "1" as an alias for 1900 for backwards compatibility
- (presuming one would have used that for the "sameport" parameter) */
-#define UPNP_LOCAL_PORT_ANY 0
-#define UPNP_LOCAL_PORT_SAME 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Structures definitions : */
-struct UPNParg { const char * elt; const char * val; };
-
-char *
-simpleUPnPcommand(int, const char *, const char *,
- const char *, struct UPNParg *,
- int *);
-
-/* upnpDiscover()
- * discover UPnP devices on the network.
- * The discovered devices are returned as a chained list.
- * It is up to the caller to free the list with freeUPNPDevlist().
- * delay (in millisecond) is the maximum time for waiting any device
- * response.
- * If available, device list will be obtained from MiniSSDPd.
- * Default path for minissdpd socket will be used if minissdpdsock argument
- * is NULL.
- * If multicastif is not NULL, it will be used instead of the default
- * multicast interface for sending SSDP discover packets.
- * If localport is set to UPNP_LOCAL_PORT_SAME(1) SSDP packets will be sent
- * from the source port 1900 (same as destination port), if set to
- * UPNP_LOCAL_PORT_ANY(0) system assign a source port, any other value will
- * be attempted as the source port.
- * "searchalltypes" parameter is useful when searching several types,
- * if 0, the discovery will stop with the first type returning results.
- * TTL should default to 2. */
-MINIUPNP_LIBSPEC struct UPNPDev *
-upnpDiscover(int delay, const char * multicastif,
- const char * minissdpdsock, int localport,
- int ipv6, unsigned char ttl,
- int * error);
-
-MINIUPNP_LIBSPEC struct UPNPDev *
-upnpDiscoverAll(int delay, const char * multicastif,
- const char * minissdpdsock, int localport,
- int ipv6, unsigned char ttl,
- int * error);
-
-MINIUPNP_LIBSPEC struct UPNPDev *
-upnpDiscoverDevice(const char * device, int delay, const char * multicastif,
- const char * minissdpdsock, int localport,
- int ipv6, unsigned char ttl,
- int * error);
-
-MINIUPNP_LIBSPEC struct UPNPDev *
-upnpDiscoverDevices(const char * const deviceTypes[],
- int delay, const char * multicastif,
- const char * minissdpdsock, int localport,
- int ipv6, unsigned char ttl,
- int * error,
- int searchalltypes);
-
-/* parserootdesc() :
- * parse root XML description of a UPnP device and fill the IGDdatas
- * structure. */
-MINIUPNP_LIBSPEC void parserootdesc(const char *, int, struct IGDdatas *);
-
-/* structure used to get fast access to urls
- * controlURL: controlURL of the WANIPConnection
- * ipcondescURL: url of the description of the WANIPConnection
- * controlURL_CIF: controlURL of the WANCommonInterfaceConfig
- * controlURL_6FC: controlURL of the WANIPv6FirewallControl
- */
-struct UPNPUrls {
- char * controlURL;
- char * ipcondescURL;
- char * controlURL_CIF;
- char * controlURL_6FC;
- char * rootdescURL;
-};
-
-/* UPNP_GetValidIGD() :
- * return values :
- * 0 = NO IGD found
- * 1 = A valid connected IGD has been found
- * 2 = A valid IGD has been found but it reported as
- * not connected
- * 3 = an UPnP device has been found but was not recognized as an IGD
- *
- * In any non zero return case, the urls and data structures
- * passed as parameters are set. Donc forget to call FreeUPNPUrls(urls) to
- * free allocated memory.
- */
-MINIUPNP_LIBSPEC int
-UPNP_GetValidIGD(struct UPNPDev * devlist,
- struct UPNPUrls * urls,
- struct IGDdatas * data,
- char * lanaddr, int lanaddrlen);
-
-/* UPNP_GetIGDFromUrl()
- * Used when skipping the discovery process.
- * When succeding, urls, data, and lanaddr arguments are set.
- * return value :
- * 0 - Not ok
- * 1 - OK */
-MINIUPNP_LIBSPEC int
-UPNP_GetIGDFromUrl(const char * rootdescurl,
- struct UPNPUrls * urls,
- struct IGDdatas * data,
- char * lanaddr, int lanaddrlen);
-
-MINIUPNP_LIBSPEC void
-GetUPNPUrls(struct UPNPUrls *, struct IGDdatas *,
- const char *, unsigned int);
-
-MINIUPNP_LIBSPEC void
-FreeUPNPUrls(struct UPNPUrls *);
-
-/* return 0 or 1 */
-MINIUPNP_LIBSPEC int UPNPIGD_IsConnected(struct UPNPUrls *, struct IGDdatas *);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/thirdparty/miniupnpc/codelength.h b/thirdparty/miniupnpc/miniupnpc/codelength.h
index ea0b005ffe..ea0b005ffe 100644
--- a/thirdparty/miniupnpc/codelength.h
+++ b/thirdparty/miniupnpc/miniupnpc/codelength.h
diff --git a/thirdparty/miniupnpc/connecthostport.c b/thirdparty/miniupnpc/miniupnpc/connecthostport.c
index ea6e4e5943..a59dc82437 100644
--- a/thirdparty/miniupnpc/connecthostport.c
+++ b/thirdparty/miniupnpc/miniupnpc/connecthostport.c
@@ -1,8 +1,8 @@
-/* $Id: connecthostport.c,v 1.15 2015/10/09 16:26:19 nanard Exp $ */
+/* $Id: connecthostport.c,v 1.21 2019/04/23 12:11:08 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab
* Project : miniupnp
* Author : Thomas Bernard
- * Copyright (c) 2010-2018 Thomas Bernard
+ * Copyright (c) 2010-2019 Thomas Bernard
* This software is subject to the conditions detailed in the
* LICENCE file provided in this distribution. */
@@ -41,13 +41,6 @@
#include <sys/select.h>
#endif /* #else _WIN32 */
-/* definition of PRINT_SOCKET_ERROR */
-#ifdef _WIN32
-#define PRINT_SOCKET_ERROR(x) fprintf(stderr, "Socket error: %s, %d\n", x, WSAGetLastError());
-#else
-#define PRINT_SOCKET_ERROR(x) perror(x)
-#endif
-
#if defined(__amigaos__) || defined(__amigaos4__)
#define herror(A) printf("%s\n", A)
#endif
@@ -123,8 +116,22 @@ SOCKET connecthostport(const char * host, unsigned short port,
int err;
FD_ZERO(&wset);
FD_SET(s, &wset);
- if((n = select(s + 1, NULL, &wset, NULL, NULL)) == -1 && errno == EINTR)
+#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
+ timeout.tv_sec = 3;
+ timeout.tv_usec = 0;
+ n = select(s + 1, NULL, &wset, NULL, &timeout);
+#else
+ n = select(s + 1, NULL, &wset, NULL, NULL);
+#endif
+ if(n == -1 && errno == EINTR)
continue;
+#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
+ if(n == 0) {
+ errno = ETIMEDOUT;
+ n = -1;
+ break;
+ }
+#endif
/*len = 0;*/
/*n = getpeername(s, NULL, &len);*/
len = sizeof(err);
@@ -163,7 +170,7 @@ SOCKET connecthostport(const char * host, unsigned short port,
for(i = 0, j = 1; host[j] && (host[j] != ']') && i < MAXHOSTNAMELEN; i++, j++)
{
tmp_host[i] = host[j];
- if(0 == memcmp(host+j, "%25", 3)) /* %25 is just url encoding for '%' */
+ if(0 == strncmp(host+j, "%25", 3)) /* %25 is just url encoding for '%' */
j+=2; /* skip "25" */
}
tmp_host[i] = '\0';
@@ -183,9 +190,11 @@ SOCKET connecthostport(const char * host, unsigned short port,
#endif
return INVALID_SOCKET;
}
- s = -1;
+ s = INVALID_SOCKET;
for(p = ai; p; p = p->ai_next)
{
+ if(!ISINVALID(s))
+ closesocket(s);
s = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
if(ISINVALID(s))
continue;
@@ -208,7 +217,7 @@ SOCKET connecthostport(const char * host, unsigned short port,
PRINT_SOCKET_ERROR("setsockopt");
}
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
- n = connect(s, p->ai_addr, p->ai_addrlen);
+ n = connect(s, p->ai_addr, MSC_CAST_INT p->ai_addrlen);
#ifdef MINIUPNPC_IGNORE_EINTR
/* EINTR The system call was interrupted by a signal that was caught
* EINPROGRESS The socket is nonblocking and the connection cannot
@@ -220,8 +229,22 @@ SOCKET connecthostport(const char * host, unsigned short port,
int err;
FD_ZERO(&wset);
FD_SET(s, &wset);
- if((n = select(s + 1, NULL, &wset, NULL, NULL)) == -1 && errno == EINTR)
+#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
+ timeout.tv_sec = 3;
+ timeout.tv_usec = 0;
+ n = select(s + 1, NULL, &wset, NULL, &timeout);
+#else
+ n = select(s + 1, NULL, &wset, NULL, NULL);
+#endif
+ if(n == -1 && errno == EINTR)
continue;
+#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
+ if(n == 0) {
+ errno = ETIMEDOUT;
+ n = -1;
+ break;
+ }
+#endif
/*len = 0;*/
/*n = getpeername(s, NULL, &len);*/
len = sizeof(err);
@@ -237,15 +260,8 @@ SOCKET connecthostport(const char * host, unsigned short port,
}
}
#endif /* #ifdef MINIUPNPC_IGNORE_EINTR */
- if(n < 0)
- {
- closesocket(s);
- continue;
- }
- else
- {
+ if(n >= 0) /* connect() was successful */
break;
- }
}
freeaddrinfo(ai);
if(ISINVALID(s))
@@ -256,9 +272,9 @@ SOCKET connecthostport(const char * host, unsigned short port,
if(n < 0)
{
PRINT_SOCKET_ERROR("connect");
+ closesocket(s);
return INVALID_SOCKET;
}
#endif /* #ifdef USE_GETHOSTBYNAME */
return s;
}
-
diff --git a/thirdparty/miniupnpc/connecthostport.h b/thirdparty/miniupnpc/miniupnpc/connecthostport.h
index 701816b5b6..701816b5b6 100644
--- a/thirdparty/miniupnpc/connecthostport.h
+++ b/thirdparty/miniupnpc/miniupnpc/connecthostport.h
diff --git a/thirdparty/miniupnpc/igd_desc_parse.c b/thirdparty/miniupnpc/miniupnpc/igd_desc_parse.c
index d2999ad011..d2999ad011 100644
--- a/thirdparty/miniupnpc/igd_desc_parse.c
+++ b/thirdparty/miniupnpc/miniupnpc/igd_desc_parse.c
diff --git a/thirdparty/miniupnpc/igd_desc_parse.h b/thirdparty/miniupnpc/miniupnpc/igd_desc_parse.h
index 0de546b697..0de546b697 100644
--- a/thirdparty/miniupnpc/igd_desc_parse.h
+++ b/thirdparty/miniupnpc/miniupnpc/igd_desc_parse.h
diff --git a/thirdparty/miniupnpc/listdevices.c b/thirdparty/miniupnpc/miniupnpc/listdevices.c
index bd9ba57efc..bd9ba57efc 100644
--- a/thirdparty/miniupnpc/listdevices.c
+++ b/thirdparty/miniupnpc/miniupnpc/listdevices.c
diff --git a/thirdparty/miniupnpc/minisoap.c b/thirdparty/miniupnpc/miniupnpc/minisoap.c
index 520c9302e8..f92b36ce89 100644
--- a/thirdparty/miniupnpc/minisoap.c
+++ b/thirdparty/miniupnpc/miniupnpc/minisoap.c
@@ -25,12 +25,6 @@
/* only for malloc */
#include <stdlib.h>
-#ifdef _WIN32
-#define PRINT_SOCKET_ERROR(x) fprintf(stderr, "Socket error: %s, %d\n", x, WSAGetLastError());
-#else
-#define PRINT_SOCKET_ERROR(x) perror(x)
-#endif
-
/* httpWrite sends the headers and the body to the socket
* and returns the number of bytes sent */
static int
@@ -79,11 +73,10 @@ int soapPostSubmit(SOCKET fd,
const char * body,
const char * httpversion)
{
- int bodysize;
char headerbuf[512];
int headerssize;
char portstr[8];
- bodysize = (int)strlen(body);
+ int bodysize = (int)strlen(body);
/* We are not using keep-alive HTTP connections.
* HTTP/1.1 needs the header Connection: close to do that.
* This is the default with HTTP/1.0
diff --git a/thirdparty/miniupnpc/minisoap.h b/thirdparty/miniupnpc/miniupnpc/minisoap.h
index d6a45d03ba..d6a45d03ba 100644
--- a/thirdparty/miniupnpc/minisoap.h
+++ b/thirdparty/miniupnpc/miniupnpc/minisoap.h
diff --git a/thirdparty/miniupnpc/minissdpc.c b/thirdparty/miniupnpc/miniupnpc/minissdpc.c
index 1d29b4ba5b..29f8110155 100644
--- a/thirdparty/miniupnpc/minissdpc.c
+++ b/thirdparty/miniupnpc/miniupnpc/minissdpc.c
@@ -1,9 +1,9 @@
-/* $Id: minissdpc.c,v 1.32 2016/10/07 09:04:36 nanard Exp $ */
+/* $Id: minissdpc.c,v 1.40 2019/04/23 12:12:55 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab
* Project : miniupnp
* Web : http://miniupnp.free.fr/
* Author : Thomas BERNARD
- * copyright (c) 2005-2018 Thomas Bernard
+ * copyright (c) 2005-2019 Thomas Bernard
* This software is subjet to the conditions detailed in the
* provided LICENCE file. */
/*#include <syslog.h>*/
@@ -381,6 +381,7 @@ free_tmp_and_return:
* the last 4 arguments are filled during the parsing :
* - location/locationsize : "location:" field of the SSDP reply packet
* - st/stsize : "st:" field of the SSDP reply packet.
+ * - usn/usnsize : "usn:" filed of the SSDP reply packet
* The strings are NOT null terminated */
static void
parseMSEARCHReply(const char * reply, int size,
@@ -418,17 +419,17 @@ parseMSEARCHReply(const char * reply, int size,
putchar('\n');*/
/* skip the colon and white spaces */
do { b++; } while(reply[b]==' ');
- if(0==strncasecmp(reply+a, "location", 8))
+ if(0==strncasecmp(reply+a, "location:", 9))
{
*location = reply+b;
*locationsize = i-b;
}
- else if(0==strncasecmp(reply+a, "st", 2))
+ else if(0==strncasecmp(reply+a, "st:", 3))
{
*st = reply+b;
*stsize = i-b;
}
- else if(0==strncasecmp(reply+a, "usn", 3))
+ else if(0==strncasecmp(reply+a, "usn:", 4))
{
*usn = reply+b;
*usnsize = i-b;
@@ -471,7 +472,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
int searchalltypes)
{
struct UPNPDev * tmp;
- struct UPNPDev * devlist = 0;
+ struct UPNPDev * devlist = NULL;
unsigned int scope_id = 0;
int opt = 1;
static const char MSearchMsgFmt[] =
@@ -491,7 +492,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
struct sockaddr_storage sockudp_w;
#else
int rv;
- struct addrinfo hints, *servinfo, *p;
+ struct addrinfo hints, *servinfo;
#endif
#ifdef _WIN32
unsigned long _ttl = (unsigned long)ttl;
@@ -545,51 +546,42 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
destAddr.sin_addr.s_addr = inet_addr("223.255.255.255");
destAddr.sin_port = 0;
if (GetBestInterfaceEx((struct sockaddr *)&destAddr, &ifbestidx) == NO_ERROR) {
- DWORD dwSize = 0;
- DWORD dwRetVal = 0;
- unsigned int i = 0;
- ULONG flags = GAA_FLAG_INCLUDE_PREFIX;
- ULONG family = AF_INET;
- LPVOID lpMsgBuf = NULL;
+ DWORD dwRetVal = NO_ERROR;
PIP_ADAPTER_ADDRESSES pAddresses = NULL;
- ULONG outBufLen = 0;
- ULONG Iterations = 0;
+ ULONG outBufLen = 15360;
+ int Iterations;
PIP_ADAPTER_ADDRESSES pCurrAddresses = NULL;
PIP_ADAPTER_UNICAST_ADDRESS pUnicast = NULL;
- PIP_ADAPTER_ANYCAST_ADDRESS pAnycast = NULL;
- PIP_ADAPTER_MULTICAST_ADDRESS pMulticast = NULL;
- IP_ADAPTER_DNS_SERVER_ADDRESS *pDnServer = NULL;
- IP_ADAPTER_PREFIX *pPrefix = NULL;
- outBufLen = 15360;
- do {
+ for (Iterations = 0; Iterations < 3; Iterations++) {
pAddresses = (IP_ADAPTER_ADDRESSES *) HeapAlloc(GetProcessHeap(), 0, outBufLen);
if (pAddresses == NULL) {
break;
}
- dwRetVal = GetAdaptersAddresses(family, flags, NULL, pAddresses, &outBufLen);
+ dwRetVal = GetAdaptersAddresses(AF_INET, GAA_FLAG_INCLUDE_PREFIX, NULL, pAddresses, &outBufLen);
- if (dwRetVal == ERROR_BUFFER_OVERFLOW) {
- HeapFree(GetProcessHeap(), 0, pAddresses);
- pAddresses = NULL;
- } else {
+ if (dwRetVal != ERROR_BUFFER_OVERFLOW) {
break;
}
- Iterations++;
- } while ((dwRetVal == ERROR_BUFFER_OVERFLOW) && (Iterations < 3));
+ HeapFree(GetProcessHeap(), 0, pAddresses);
+ pAddresses = NULL;
+ }
if (dwRetVal == NO_ERROR) {
pCurrAddresses = pAddresses;
while (pCurrAddresses) {
#ifdef DEBUG
+ int i;
+ PIP_ADAPTER_MULTICAST_ADDRESS pMulticast = NULL;
+ PIP_ADAPTER_ANYCAST_ADDRESS pAnycast = NULL;
+
printf("\tIfIndex (IPv4 interface): %u\n", pCurrAddresses->IfIndex);
printf("\tAdapter name: %s\n", pCurrAddresses->AdapterName);
pUnicast = pCurrAddresses->FirstUnicastAddress;
if (pUnicast != NULL) {
for (i = 0; pUnicast != NULL; i++) {
- IPAddr.S_un.S_addr = (u_long) pUnicast->Address;
- printf("\tIP Address[%d]: \t%s\n", i, inet_ntoa(IPAddr) );
+ printf("\tIP Address[%d]: \t%s\n", i, inet_ntoa(((PSOCKADDR_IN)pUnicast->Address.lpSockaddr)->sin_addr) );
pUnicast = pUnicast->Next;
}
printf("\tNumber of Unicast Addresses: %d\n", i);
@@ -597,8 +589,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
pAnycast = pCurrAddresses->FirstAnycastAddress;
if (pAnycast) {
for (i = 0; pAnycast != NULL; i++) {
- IPAddr.S_un.S_addr = (u_long) pAnyCast->Address;
- printf("\tAnycast Address[%d]: \t%s\n", i, inet_ntoa(IPAddr) );
+ printf("\tAnycast Address[%d]: \t%s\n", i, inet_ntoa(((PSOCKADDR_IN)pAnycast->Address.lpSockaddr)->sin_addr) );
pAnycast = pAnycast->Next;
}
printf("\tNumber of Anycast Addresses: %d\n", i);
@@ -606,8 +597,8 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
pMulticast = pCurrAddresses->FirstMulticastAddress;
if (pMulticast) {
for (i = 0; pMulticast != NULL; i++) {
- IPAddr.S_un.S_addr = (u_long) pMultiCast->Address;
- printf("\tMulticast Address[%d]: \t%s\n", i, inet_ntoa(IPAddr) );
+ printf("\tMulticast Address[%d]: \t%s\n", i, inet_ntoa(((PSOCKADDR_IN)pMulticast->Address.lpSockaddr)->sin_addr) );
+ pMulticast = pMulticast->Next;
}
}
printf("\n");
@@ -647,7 +638,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
if(error)
*error = MINISSDPC_SOCKET_ERROR;
PRINT_SOCKET_ERROR("setsockopt(SO_REUSEADDR,...)");
- return NULL;
+ goto error;
}
if(ipv6) {
@@ -692,7 +683,11 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
#endif
} else {
struct in_addr mc_if;
+#if defined(_WIN32) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
+ InetPtonA(AF_INET, multicastif, &mc_if);
+#else
mc_if.s_addr = inet_addr(multicastif); /* ex: 192.168.x.x */
+#endif
if(mc_if.s_addr != INADDR_NONE)
{
((struct sockaddr_in *)&sockudp_r)->sin_addr.s_addr = mc_if.s_addr;
@@ -819,24 +814,26 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
#endif
break;
- }
- for(p = servinfo; p; p = p->ai_next) {
- n = sendto(sudp, bufr, n, 0, p->ai_addr, p->ai_addrlen);
- if (n < 0) {
+ } else {
+ struct addrinfo *p;
+ for(p = servinfo; p; p = p->ai_next) {
+ n = sendto(sudp, bufr, n, 0, p->ai_addr, MSC_CAST_INT p->ai_addrlen);
+ if (n < 0) {
#ifdef DEBUG
- char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
- if (getnameinfo(p->ai_addr, p->ai_addrlen, hbuf, sizeof(hbuf), sbuf,
- sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV) == 0) {
- fprintf(stderr, "host:%s port:%s\n", hbuf, sbuf);
- }
+ char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
+ if (getnameinfo(p->ai_addr, (socklen_t)p->ai_addrlen, hbuf, sizeof(hbuf), sbuf,
+ sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV) == 0) {
+ fprintf(stderr, "host:%s port:%s\n", hbuf, sbuf);
+ }
#endif
- PRINT_SOCKET_ERROR("sendto");
- continue;
- } else {
- sentok = 1;
+ PRINT_SOCKET_ERROR("sendto");
+ continue;
+ } else {
+ sentok = 1;
+ }
}
+ freeaddrinfo(servinfo);
}
- freeaddrinfo(servinfo);
if(!sentok) {
if(error)
*error = MINISSDPC_SOCKET_ERROR;
@@ -877,11 +874,11 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
stsize, st, usnsize, (usn?usn:""), urlsize, descURL);
#endif /* DEBUG */
for(tmp=devlist; tmp; tmp = tmp->pNext) {
- if(memcmp(tmp->descURL, descURL, urlsize) == 0 &&
+ if(strncmp(tmp->descURL, descURL, urlsize) == 0 &&
tmp->descURL[urlsize] == '\0' &&
- memcmp(tmp->st, st, stsize) == 0 &&
+ strncmp(tmp->st, st, stsize) == 0 &&
tmp->st[stsize] == '\0' &&
- (usnsize == 0 || memcmp(tmp->usn, usn, usnsize) == 0) &&
+ (usnsize == 0 || strncmp(tmp->usn, usn, usnsize) == 0) &&
tmp->usn[usnsize] == '\0')
break;
}
diff --git a/thirdparty/miniupnpc/minissdpc.h b/thirdparty/miniupnpc/miniupnpc/minissdpc.h
index 167d897cb6..c99f929b9e 100644
--- a/thirdparty/miniupnpc/minissdpc.h
+++ b/thirdparty/miniupnpc/miniupnpc/minissdpc.h
@@ -32,13 +32,13 @@ MINIUPNP_LIBSPEC int
connectToMiniSSDPD(const char * socketpath);
MINIUPNP_LIBSPEC int
-disconnectFromMiniSSDPD(int fd);
+disconnectFromMiniSSDPD(int s);
MINIUPNP_LIBSPEC int
-requestDevicesFromMiniSSDPD(int fd, const char * devtype);
+requestDevicesFromMiniSSDPD(int s, const char * devtype);
MINIUPNP_LIBSPEC struct UPNPDev *
-receiveDevicesFromMiniSSDPD(int fd, int * error);
+receiveDevicesFromMiniSSDPD(int s, int * error);
#endif /* !(defined(_WIN32) || defined(__amigaos__) || defined(__amigaos4__)) */
diff --git a/thirdparty/miniupnpc/miniupnpc.c b/thirdparty/miniupnpc/miniupnpc/miniupnpc.c
index 5d93ef9933..3181d10eb6 100644
--- a/thirdparty/miniupnpc/miniupnpc.c
+++ b/thirdparty/miniupnpc/miniupnpc/miniupnpc.c
@@ -1,9 +1,9 @@
-/* $Id: miniupnpc.c,v 1.149 2016/02/09 09:50:46 nanard Exp $ */
+/* $Id: miniupnpc.c,v 1.154 2019/04/23 12:12:13 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab
* Project : miniupnp
* Web : http://miniupnp.free.fr/
* Author : Thomas BERNARD
- * copyright (c) 2005-2018 Thomas Bernard
+ * copyright (c) 2005-2019 Thomas Bernard
* This software is subjet to the conditions detailed in the
* provided LICENSE file. */
#include <stdlib.h>
@@ -63,7 +63,7 @@
#include "connecthostport.h"
/* compare the beginning of a string with a constant string */
-#define COMPARE(str, cstr) (0==memcmp(str, cstr, sizeof(cstr) - 1))
+#define COMPARE(str, cstr) (0==strncmp(str, cstr, sizeof(cstr) - 1))
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 64
@@ -85,8 +85,7 @@ static int is_rfc1918addr(const char * addr)
return 1;
/* 172.16.0.0 - 172.31.255.255 (172.16/12 prefix) */
if(COMPARE(addr, "172.")) {
- int i = atoi(addr + 4);
- if((16 <= i) && (i <= 31))
+ if((atoi(addr + 4) | 0x0f) == 0x1f)
return 1;
}
return 0;
@@ -416,7 +415,7 @@ static char *
build_absolute_url(const char * baseurl, const char * descURL,
const char * url, unsigned int scope_id)
{
- int l, n;
+ size_t l, n;
char * s;
const char * base;
char * p;
@@ -459,7 +458,7 @@ build_absolute_url(const char * baseurl, const char * descURL,
memcpy(s, base, n);
if(scope_id != 0) {
s[n] = '\0';
- if(0 == memcmp(s, "http://[fe80:", 13)) {
+ if(n > 13 && 0 == memcmp(s, "http://[fe80:", 13)) {
/* this is a linklocal IPv6 address */
p = strchr(s, ']');
if(p) {
@@ -573,7 +572,6 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
int ndev = 0;
int i;
int state = -1; /* state 1 : IGD connected. State 2 : IGD. State 3 : anything */
- int n_igd = 0;
char extIpAddr[16];
char myLanAddr[40];
int status_code = -1;
@@ -588,12 +586,10 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
/* counting total number of devices in the list */
for(dev = devlist; dev; dev = dev->pNext)
ndev++;
- if(ndev > 0)
- {
- desc = calloc(ndev, sizeof(struct xml_desc));
- if(!desc)
- return -1; /* memory allocation error */
- }
+ /* ndev is always > 0 */
+ desc = calloc(ndev, sizeof(struct xml_desc));
+ if(!desc)
+ return -1; /* memory allocation error */
/* Step 1 : downloading descriptions and testing type */
for(dev = devlist, i = 0; dev; dev = dev->pNext, i++)
{
@@ -617,7 +613,6 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
"urn:schemas-upnp-org:service:WANCommonInterfaceConfig:"))
{
desc[i].is_igd = 1;
- n_igd++;
if(lanaddr)
strncpy(lanaddr, myLanAddr, lanaddrlen);
}
@@ -685,14 +680,9 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
}
state = 0;
free_and_return:
- if(desc) {
- for(i = 0; i < ndev; i++) {
- if(desc[i].xml) {
- free(desc[i].xml);
- }
- }
- free(desc);
- }
+ for(i = 0; i < ndev; i++)
+ free(desc[i].xml);
+ free(desc);
return state;
}
@@ -717,7 +707,6 @@ UPNP_GetIGDFromUrl(const char * rootdescurl,
memset(urls, 0, sizeof(struct UPNPUrls));
parserootdesc(descXML, descXMLsize, data);
free(descXML);
- descXML = NULL;
GetUPNPUrls(urls, data, rootdescurl, 0);
return 1;
} else {
diff --git a/thirdparty/miniupnpc/miniupnpc_declspec.h b/thirdparty/miniupnpc/miniupnpc/miniupnpc_declspec.h
index 40adb922ec..40adb922ec 100644
--- a/thirdparty/miniupnpc/miniupnpc_declspec.h
+++ b/thirdparty/miniupnpc/miniupnpc/miniupnpc_declspec.h
diff --git a/thirdparty/miniupnpc/miniupnpc_socketdef.h b/thirdparty/miniupnpc/miniupnpc/miniupnpc_socketdef.h
index 965d9151b9..d4f79a7bd6 100644
--- a/thirdparty/miniupnpc/miniupnpc_socketdef.h
+++ b/thirdparty/miniupnpc/miniupnpc/miniupnpc_socketdef.h
@@ -28,6 +28,13 @@
#endif
+#ifdef _MSC_VER
+#define MSC_CAST_INT (int)
+#else
+#define MSC_CAST_INT
+#endif
+
+/* definition of PRINT_SOCKET_ERROR */
#ifdef _WIN32
#define PRINT_SOCKET_ERROR(x) fprintf(stderr, "Socket error: %s, %d\n", x, WSAGetLastError());
#else
diff --git a/thirdparty/miniupnpc/miniupnpcmodule.c b/thirdparty/miniupnpc/miniupnpc/miniupnpcmodule.c
index 8657a0e002..d9341ab5bf 100644
--- a/thirdparty/miniupnpc/miniupnpcmodule.c
+++ b/thirdparty/miniupnpc/miniupnpc/miniupnpcmodule.c
@@ -1,8 +1,9 @@
-/* $Id: miniupnpcmodule.c,v 1.24 2014/06/10 09:48:11 nanard Exp $*/
-/* Project : miniupnp
+/* $Id: miniupnpcmodule.c,v 1.34 2019/05/20 19:07:16 nanard Exp $*/
+/* vim: tabstop=4 shiftwidth=4 noexpandtab
+ * Project : miniupnp
* Author : Thomas BERNARD
* website : https://miniupnp.tuxfamily.org/
- * copyright (c) 2007-2018 Thomas Bernard
+ * copyright (c) 2007-2019 Thomas Bernard
* This software is subjet to the conditions detailed in the
* provided LICENCE file. */
#include <Python.h>
@@ -292,7 +293,7 @@ Py_END_ALLOW_THREADS
}
/* AddPortMapping(externalPort, protocol, internalHost, internalPort, desc,
- * remoteHost)
+ * remoteHost, leaseDuration)
* protocol is 'UDP' or 'TCP' */
static PyObject *
UPnP_addportmapping(UPnPObject *self, PyObject *args)
@@ -305,17 +306,24 @@ UPnP_addportmapping(UPnPObject *self, PyObject *args)
const char * host;
const char * desc;
const char * remoteHost;
- const char * leaseDuration = "0";
+ unsigned int intLeaseDuration = 0;
+ char strLeaseDuration[12];
int r;
- if (!PyArg_ParseTuple(args, "HssHzz", &ePort, &proto,
- &host, &iPort, &desc, &remoteHost))
+#if (PY_MAJOR_VERSION >= 3) || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 3)
+ if (!PyArg_ParseTuple(args, "HssHzz|I", &ePort, &proto,
+ &host, &iPort, &desc, &remoteHost, &intLeaseDuration))
+#else
+ if (!PyArg_ParseTuple(args, "HssHzz|i", &ePort, &proto,
+ &host, &iPort, &desc, &remoteHost, (int *)&intLeaseDuration))
+#endif
return NULL;
Py_BEGIN_ALLOW_THREADS
sprintf(extPort, "%hu", ePort);
sprintf(inPort, "%hu", iPort);
+ sprintf(strLeaseDuration, "%u", intLeaseDuration);
r = UPNP_AddPortMapping(self->urls.controlURL, self->data.first.servicetype,
extPort, inPort, host, desc, proto,
- remoteHost, leaseDuration);
+ remoteHost, strLeaseDuration);
Py_END_ALLOW_THREADS
if(r==UPNPCOMMAND_SUCCESS)
{
@@ -676,6 +684,16 @@ initminiupnpc(void)
/* initialize Winsock. */
WSADATA wsaData;
int nResult = WSAStartup(MAKEWORD(2,2), &wsaData);
+ if (nResult != 0)
+ {
+ /* error code could be WSASYSNOTREADY WSASYSNOTREADY
+ * WSASYSNOTREADY WSASYSNOTREADY WSASYSNOTREADY */
+#if PY_MAJOR_VERSION >= 3
+ return 0;
+#else
+ return;
+#endif
+ }
UPnPType.tp_new = PyType_GenericNew;
#endif
diff --git a/thirdparty/miniupnpc/miniupnpcstrings.h b/thirdparty/miniupnpc/miniupnpc/miniupnpcstrings.h
index a718cc7bbf..a718cc7bbf 100644
--- a/thirdparty/miniupnpc/miniupnpcstrings.h
+++ b/thirdparty/miniupnpc/miniupnpc/miniupnpcstrings.h
diff --git a/thirdparty/miniupnpc/miniupnpctypes.h b/thirdparty/miniupnpc/miniupnpc/miniupnpctypes.h
index 307ce39699..307ce39699 100644
--- a/thirdparty/miniupnpc/miniupnpctypes.h
+++ b/thirdparty/miniupnpc/miniupnpc/miniupnpctypes.h
diff --git a/thirdparty/miniupnpc/miniwget.c b/thirdparty/miniupnpc/miniupnpc/miniwget.c
index a46ba76022..5c135f4efd 100644
--- a/thirdparty/miniupnpc/miniwget.c
+++ b/thirdparty/miniupnpc/miniupnpc/miniwget.c
@@ -243,7 +243,7 @@ getHTTPResponse(SOCKET s, int * size, int * status_code)
/* reading chunk size */
if(chunksize_buf_index == 0) {
/* skipping any leading CR LF */
- if(i<n && buf[i] == '\r') i++;
+ if(buf[i] == '\r') i++;
if(i<n && buf[i] == '\n') i++;
}
while(i<n && isxdigit(buf[i])
@@ -350,7 +350,7 @@ getHTTPResponse(SOCKET s, int * size, int * status_code)
}
}
end_of_stream:
- free(header_buf); header_buf = NULL;
+ free(header_buf);
*size = content_buf_used;
if(content_buf_used == 0)
{
@@ -371,7 +371,7 @@ miniwget3(const char * host,
int * status_code)
{
char buf[2048];
- SOCKET s;
+ SOCKET s;
int n;
int len;
int sent;
@@ -559,7 +559,7 @@ parseURL(const char * url,
#else
/* under windows, scope is numerical */
char tmp[8];
- int l;
+ size_t l;
scope++;
/* "%25" is just '%' in URL encoding */
if(scope[0] == '2' && scope[1] == '5')
@@ -659,4 +659,3 @@ miniwget_getaddr(const char * url, int * size,
#endif
return miniwget2(hostname, port, path, size, addr, addrlen, scope_id, status_code);
}
-
diff --git a/thirdparty/miniupnpc/miniwget_private.h b/thirdparty/miniupnpc/miniupnpc/miniwget_private.h
index e4eaac8085..e4eaac8085 100644
--- a/thirdparty/miniupnpc/miniwget_private.h
+++ b/thirdparty/miniupnpc/miniupnpc/miniwget_private.h
diff --git a/thirdparty/miniupnpc/minixml.c b/thirdparty/miniupnpc/miniupnpc/minixml.c
index ed2d3c759c..ed2d3c759c 100644
--- a/thirdparty/miniupnpc/minixml.c
+++ b/thirdparty/miniupnpc/miniupnpc/minixml.c
diff --git a/thirdparty/miniupnpc/minixml.h b/thirdparty/miniupnpc/miniupnpc/minixml.h
index 19e6f513bf..2e60397388 100644
--- a/thirdparty/miniupnpc/minixml.h
+++ b/thirdparty/miniupnpc/miniupnpc/minixml.h
@@ -10,7 +10,7 @@
* */
#ifndef MINIXML_H_INCLUDED
#define MINIXML_H_INCLUDED
-#define IS_WHITE_SPACE(c) ((c==' ') || (c=='\t') || (c=='\r') || (c=='\n'))
+#define IS_WHITE_SPACE(c) ((c)==' ' || (c)=='\t' || (c)=='\r' || (c)=='\n')
/* if a callback function pointer is set to NULL,
* the function is not called */
diff --git a/thirdparty/miniupnpc/minixmlvalid.c b/thirdparty/miniupnpc/miniupnpc/minixmlvalid.c
index dad1488122..dad1488122 100644
--- a/thirdparty/miniupnpc/minixmlvalid.c
+++ b/thirdparty/miniupnpc/miniupnpc/minixmlvalid.c
diff --git a/thirdparty/miniupnpc/portlistingparse.c b/thirdparty/miniupnpc/miniupnpc/portlistingparse.c
index 55859f2714..55859f2714 100644
--- a/thirdparty/miniupnpc/portlistingparse.c
+++ b/thirdparty/miniupnpc/miniupnpc/portlistingparse.c
diff --git a/thirdparty/miniupnpc/portlistingparse.h b/thirdparty/miniupnpc/miniupnpc/portlistingparse.h
index e3957a3f4c..e3957a3f4c 100644
--- a/thirdparty/miniupnpc/portlistingparse.h
+++ b/thirdparty/miniupnpc/miniupnpc/portlistingparse.h
diff --git a/thirdparty/miniupnpc/receivedata.c b/thirdparty/miniupnpc/miniupnpc/receivedata.c
index 7b9cc5b778..7b9cc5b778 100644
--- a/thirdparty/miniupnpc/receivedata.c
+++ b/thirdparty/miniupnpc/miniupnpc/receivedata.c
diff --git a/thirdparty/miniupnpc/receivedata.h b/thirdparty/miniupnpc/miniupnpc/receivedata.h
index c9fdc561f8..c9fdc561f8 100644
--- a/thirdparty/miniupnpc/receivedata.h
+++ b/thirdparty/miniupnpc/miniupnpc/receivedata.h
diff --git a/thirdparty/miniupnpc/upnpc.c b/thirdparty/miniupnpc/miniupnpc/upnpc.c
index 0c65cbe8c0..674c89beb0 100644
--- a/thirdparty/miniupnpc/upnpc.c
+++ b/thirdparty/miniupnpc/miniupnpc/upnpc.c
@@ -1,7 +1,7 @@
/* $Id: upnpc.c,v 1.119 2018/03/13 23:34:46 nanard Exp $ */
/* Project : miniupnp
* Author : Thomas Bernard
- * Copyright (c) 2005-2018 Thomas Bernard
+ * Copyright (c) 2005-2019 Thomas Bernard
* This software is subject to the conditions detailed in the
* LICENCE file provided in this distribution. */
@@ -579,7 +579,7 @@ int main(int argc, char ** argv)
}
#endif
printf("upnpc : miniupnpc library test client, version %s.\n", MINIUPNPC_VERSION_STRING);
- printf(" (c) 2005-2018 Thomas Bernard.\n");
+ printf(" (c) 2005-2019 Thomas Bernard.\n");
printf("Go to http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/\n"
"for more information.\n");
/* command line processing */
diff --git a/thirdparty/miniupnpc/upnpcommands.c b/thirdparty/miniupnpc/miniupnpc/upnpcommands.c
index b6a693a93a..1e1ee6786f 100644
--- a/thirdparty/miniupnpc/upnpcommands.c
+++ b/thirdparty/miniupnpc/miniupnpc/upnpcommands.c
@@ -1,4 +1,4 @@
-/* $Id: upnpcommands.c,v 1.49 2018/03/13 23:34:47 nanard Exp $ */
+/* $Id: upnpcommands.c,v 1.51 2019/04/23 11:45:15 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab
* Project : miniupnp
* Author : Thomas Bernard
@@ -33,11 +33,11 @@ UPNP_GetTotalBytesSent(const char * controlURL,
char * p;
if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
"GetTotalBytesSent", 0, &bufsize))) {
- return UPNPCOMMAND_HTTP_ERROR;
+ return (UNSIGNED_INTEGER)UPNPCOMMAND_HTTP_ERROR;
}
ParseNameValue(buffer, bufsize, &pdata);
/*DisplayNameValueList(buffer, bufsize);*/
- free(buffer); buffer = NULL;
+ free(buffer);
p = GetValueFromNameValueList(&pdata, "NewTotalBytesSent");
r = my_atoui(p);
ClearNameValueList(&pdata);
@@ -57,11 +57,11 @@ UPNP_GetTotalBytesReceived(const char * controlURL,
char * p;
if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
"GetTotalBytesReceived", 0, &bufsize))) {
- return UPNPCOMMAND_HTTP_ERROR;
+ return (UNSIGNED_INTEGER)UPNPCOMMAND_HTTP_ERROR;
}
ParseNameValue(buffer, bufsize, &pdata);
/*DisplayNameValueList(buffer, bufsize);*/
- free(buffer); buffer = NULL;
+ free(buffer);
p = GetValueFromNameValueList(&pdata, "NewTotalBytesReceived");
r = my_atoui(p);
ClearNameValueList(&pdata);
@@ -81,11 +81,11 @@ UPNP_GetTotalPacketsSent(const char * controlURL,
char * p;
if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
"GetTotalPacketsSent", 0, &bufsize))) {
- return UPNPCOMMAND_HTTP_ERROR;
+ return (UNSIGNED_INTEGER)UPNPCOMMAND_HTTP_ERROR;
}
ParseNameValue(buffer, bufsize, &pdata);
/*DisplayNameValueList(buffer, bufsize);*/
- free(buffer); buffer = NULL;
+ free(buffer);
p = GetValueFromNameValueList(&pdata, "NewTotalPacketsSent");
r = my_atoui(p);
ClearNameValueList(&pdata);
@@ -105,11 +105,11 @@ UPNP_GetTotalPacketsReceived(const char * controlURL,
char * p;
if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
"GetTotalPacketsReceived", 0, &bufsize))) {
- return UPNPCOMMAND_HTTP_ERROR;
+ return (UNSIGNED_INTEGER)UPNPCOMMAND_HTTP_ERROR;
}
ParseNameValue(buffer, bufsize, &pdata);
/*DisplayNameValueList(buffer, bufsize);*/
- free(buffer); buffer = NULL;
+ free(buffer);
p = GetValueFromNameValueList(&pdata, "NewTotalPacketsReceived");
r = my_atoui(p);
ClearNameValueList(&pdata);
@@ -142,7 +142,7 @@ UPNP_GetStatusInfo(const char * controlURL,
}
ParseNameValue(buffer, bufsize, &pdata);
/*DisplayNameValueList(buffer, bufsize);*/
- free(buffer); buffer = NULL;
+ free(buffer);
up = GetValueFromNameValueList(&pdata, "NewUptime");
p = GetValueFromNameValueList(&pdata, "NewConnectionStatus");
err = GetValueFromNameValueList(&pdata, "NewLastConnectionError");
@@ -202,7 +202,7 @@ UPNP_GetConnectionTypeInfo(const char * controlURL,
return UPNPCOMMAND_HTTP_ERROR;
}
ParseNameValue(buffer, bufsize, &pdata);
- free(buffer); buffer = NULL;
+ free(buffer);
p = GetValueFromNameValueList(&pdata, "NewConnectionType");
/*p = GetValueFromNameValueList(&pdata, "NewPossibleConnectionTypes");*/
/* PossibleConnectionTypes will have several values.... */
@@ -251,7 +251,7 @@ UPNP_GetLinkLayerMaxBitRates(const char * controlURL,
}
/*DisplayNameValueList(buffer, bufsize);*/
ParseNameValue(buffer, bufsize, &pdata);
- free(buffer); buffer = NULL;
+ free(buffer);
/*down = GetValueFromNameValueList(&pdata, "NewDownstreamMaxBitRate");*/
/*up = GetValueFromNameValueList(&pdata, "NewUpstreamMaxBitRate");*/
down = GetValueFromNameValueList(&pdata, "NewLayer1DownstreamMaxBitRate");
@@ -315,7 +315,7 @@ UPNP_GetExternalIPAddress(const char * controlURL,
}
/*DisplayNameValueList(buffer, bufsize);*/
ParseNameValue(buffer, bufsize, &pdata);
- free(buffer); buffer = NULL;
+ free(buffer);
/*printf("external ip = %s\n", GetValueFromNameValueList(&pdata, "NewExternalIPAddress") );*/
p = GetValueFromNameValueList(&pdata, "NewExternalIPAddress");
if(p) {
@@ -385,7 +385,7 @@ UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
/*buffer[bufsize] = '\0';*/
/*puts(buffer);*/
ParseNameValue(buffer, bufsize, &pdata);
- free(buffer); buffer = NULL;
+ free(buffer);
resVal = GetValueFromNameValueList(&pdata, "errorCode");
if(resVal) {
/*printf("AddPortMapping errorCode = '%s'\n", resVal); */
@@ -446,7 +446,7 @@ UPNP_AddAnyPortMapping(const char * controlURL, const char * servicetype,
return UPNPCOMMAND_HTTP_ERROR;
}
ParseNameValue(buffer, bufsize, &pdata);
- free(buffer); buffer = NULL;
+ free(buffer);
resVal = GetValueFromNameValueList(&pdata, "errorCode");
if(resVal) {
ret = UPNPCOMMAND_UNKNOWN_ERROR;
@@ -501,7 +501,7 @@ UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
}
/*DisplayNameValueList(buffer, bufsize);*/
ParseNameValue(buffer, bufsize, &pdata);
- free(buffer); buffer = NULL;
+ free(buffer);
resVal = GetValueFromNameValueList(&pdata, "errorCode");
if(resVal) {
ret = UPNPCOMMAND_UNKNOWN_ERROR;
@@ -549,7 +549,7 @@ UPNP_DeletePortMappingRange(const char * controlURL, const char * servicetype,
return UPNPCOMMAND_HTTP_ERROR;
}
ParseNameValue(buffer, bufsize, &pdata);
- free(buffer); buffer = NULL;
+ free(buffer);
resVal = GetValueFromNameValueList(&pdata, "errorCode");
if(resVal) {
ret = UPNPCOMMAND_UNKNOWN_ERROR;
@@ -597,7 +597,7 @@ UPNP_GetGenericPortMappingEntry(const char * controlURL,
return UPNPCOMMAND_HTTP_ERROR;
}
ParseNameValue(buffer, bufsize, &pdata);
- free(buffer); buffer = NULL;
+ free(buffer);
p = GetValueFromNameValueList(&pdata, "NewRemoteHost");
if(p && rHost)
@@ -677,7 +677,7 @@ UPNP_GetPortMappingNumberOfEntries(const char * controlURL,
DisplayNameValueList(buffer, bufsize);
#endif
ParseNameValue(buffer, bufsize, &pdata);
- free(buffer); buffer = NULL;
+ free(buffer);
p = GetValueFromNameValueList(&pdata, "NewPortMappingNumberOfEntries");
if(numEntries && p) {
@@ -739,7 +739,7 @@ UPNP_GetSpecificPortMappingEntry(const char * controlURL,
}
/*DisplayNameValueList(buffer, bufsize);*/
ParseNameValue(buffer, bufsize, &pdata);
- free(buffer); buffer = NULL;
+ free(buffer);
p = GetValueFromNameValueList(&pdata, "NewInternalClient");
if(p) {
@@ -836,7 +836,7 @@ UPNP_GetListOfPortMappings(const char * controlURL,
/*DisplayNameValueList(buffer, bufsize);*/
ParseNameValue(buffer, bufsize, &pdata);
- free(buffer); buffer = NULL;
+ free(buffer);
/*p = GetValueFromNameValueList(&pdata, "NewPortListing");*/
/*if(p) {
@@ -898,7 +898,7 @@ UPNP_GetFirewallStatus(const char * controlURL,
return UPNPCOMMAND_HTTP_ERROR;
}
ParseNameValue(buffer, bufsize, &pdata);
- free(buffer); buffer = NULL;
+ free(buffer);
fe = GetValueFromNameValueList(&pdata, "FirewallEnabled");
ipa = GetValueFromNameValueList(&pdata, "InboundPinholeAllowed");
if(ipa && fe)
@@ -935,7 +935,6 @@ UPNP_GetOutboundPinholeTimeout(const char * controlURL, const char * servicetype
int bufsize;
struct NameValueParserData pdata;
const char * resVal;
- char * p;
int ret;
if(!intPort || !intClient || !proto || !remotePort || !remoteHost)
@@ -960,7 +959,7 @@ UPNP_GetOutboundPinholeTimeout(const char * controlURL, const char * servicetype
if(!buffer)
return UPNPCOMMAND_HTTP_ERROR;
ParseNameValue(buffer, bufsize, &pdata);
- free(buffer); buffer = NULL;
+ free(buffer);
resVal = GetValueFromNameValueList(&pdata, "errorCode");
if(resVal)
{
@@ -969,10 +968,10 @@ UPNP_GetOutboundPinholeTimeout(const char * controlURL, const char * servicetype
}
else
{
- ret = UPNPCOMMAND_SUCCESS;
- p = GetValueFromNameValueList(&pdata, "OutboundPinholeTimeout");
+ const char * p = GetValueFromNameValueList(&pdata, "OutboundPinholeTimeout");
if(p)
*opTimeout = my_atoui(p);
+ ret = UPNPCOMMAND_SUCCESS;
}
ClearNameValueList(&pdata);
return ret;
@@ -1037,7 +1036,7 @@ UPNP_AddPinhole(const char * controlURL, const char * servicetype,
if(!buffer)
return UPNPCOMMAND_HTTP_ERROR;
ParseNameValue(buffer, bufsize, &pdata);
- free(buffer); buffer = NULL;
+ free(buffer);
p = GetValueFromNameValueList(&pdata, "UniqueID");
if(p)
{
@@ -1087,7 +1086,7 @@ UPNP_UpdatePinhole(const char * controlURL, const char * servicetype,
if(!buffer)
return UPNPCOMMAND_HTTP_ERROR;
ParseNameValue(buffer, bufsize, &pdata);
- free(buffer); buffer = NULL;
+ free(buffer);
resVal = GetValueFromNameValueList(&pdata, "errorCode");
if(resVal)
{
@@ -1129,7 +1128,7 @@ UPNP_DeletePinhole(const char * controlURL, const char * servicetype, const char
return UPNPCOMMAND_HTTP_ERROR;
/*DisplayNameValueList(buffer, bufsize);*/
ParseNameValue(buffer, bufsize, &pdata);
- free(buffer); buffer = NULL;
+ free(buffer);
resVal = GetValueFromNameValueList(&pdata, "errorCode");
if(resVal)
{
@@ -1171,7 +1170,7 @@ UPNP_CheckPinholeWorking(const char * controlURL, const char * servicetype,
return UPNPCOMMAND_HTTP_ERROR;
}
ParseNameValue(buffer, bufsize, &pdata);
- free(buffer); buffer = NULL;
+ free(buffer);
p = GetValueFromNameValueList(&pdata, "IsWorking");
if(p)
@@ -1218,7 +1217,7 @@ UPNP_GetPinholePackets(const char * controlURL, const char * servicetype,
if(!buffer)
return UPNPCOMMAND_HTTP_ERROR;
ParseNameValue(buffer, bufsize, &pdata);
- free(buffer); buffer = NULL;
+ free(buffer);
p = GetValueFromNameValueList(&pdata, "PinholePackets");
if(p)
@@ -1237,5 +1236,3 @@ UPNP_GetPinholePackets(const char * controlURL, const char * servicetype,
ClearNameValueList(&pdata);
return ret;
}
-
-
diff --git a/thirdparty/miniupnpc/miniupnpc/upnpcommands.h b/thirdparty/miniupnpc/miniupnpc/upnpcommands.h
index 0c6d501666..1b6d447732 100644
--- a/thirdparty/miniupnpc/miniupnpc/upnpcommands.h
+++ b/thirdparty/miniupnpc/miniupnpc/upnpcommands.h
@@ -206,9 +206,9 @@ UPNP_DeletePortMappingRange(const char * controlURL, const char * servicetype,
/* UPNP_GetPortMappingNumberOfEntries()
* not supported by all routers */
MINIUPNP_LIBSPEC int
-UPNP_GetPortMappingNumberOfEntries(const char* controlURL,
- const char* servicetype,
- unsigned int * num);
+UPNP_GetPortMappingNumberOfEntries(const char * controlURL,
+ const char * servicetype,
+ unsigned int * numEntries);
/* UPNP_GetSpecificPortMappingEntry()
* retrieves an existing port mapping
diff --git a/thirdparty/miniupnpc/upnpdev.c b/thirdparty/miniupnpc/miniupnpc/upnpdev.c
index d89a9934c3..d89a9934c3 100644
--- a/thirdparty/miniupnpc/upnpdev.c
+++ b/thirdparty/miniupnpc/miniupnpc/upnpdev.c
diff --git a/thirdparty/miniupnpc/upnpdev.h b/thirdparty/miniupnpc/miniupnpc/upnpdev.h
index f4ae174426..f4ae174426 100644
--- a/thirdparty/miniupnpc/upnpdev.h
+++ b/thirdparty/miniupnpc/miniupnpc/upnpdev.h
diff --git a/thirdparty/miniupnpc/upnperrors.c b/thirdparty/miniupnpc/miniupnpc/upnperrors.c
index 40a2e7857f..650af42557 100644
--- a/thirdparty/miniupnpc/upnperrors.c
+++ b/thirdparty/miniupnpc/miniupnpc/upnperrors.c
@@ -1,7 +1,7 @@
-/* $Id: upnperrors.c,v 1.5 2011/04/10 11:19:36 nanard Exp $ */
+/* $Id: upnperrors.c,v 1.9 2019/06/25 21:15:46 nanard Exp $ */
/* Project : miniupnp
* Author : Thomas BERNARD
- * copyright (c) 2007 Thomas Bernard
+ * copyright (c) 2007-2019 Thomas Bernard
* All Right reserved.
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* This software is subjet to the conditions detailed in the
@@ -27,10 +27,14 @@ const char * strupnperror(int err)
case UPNPCOMMAND_INVALID_RESPONSE:
s = "Miniupnpc Invalid response";
break;
+ case UPNPCOMMAND_HTTP_ERROR:
+ s = "Miniupnpc HTTP error";
+ break;
case UPNPDISCOVER_SOCKET_ERROR:
s = "Miniupnpc Socket error";
break;
case UPNPDISCOVER_MEMORY_ERROR:
+ case UPNPCOMMAND_MEM_ALLOC_ERROR:
s = "Miniupnpc Memory allocation error";
break;
case 401:
diff --git a/thirdparty/miniupnpc/upnperrors.h b/thirdparty/miniupnpc/miniupnpc/upnperrors.h
index 8499d9a1c9..8499d9a1c9 100644
--- a/thirdparty/miniupnpc/upnperrors.h
+++ b/thirdparty/miniupnpc/miniupnpc/upnperrors.h
diff --git a/thirdparty/miniupnpc/upnpreplyparse.c b/thirdparty/miniupnpc/miniupnpc/upnpreplyparse.c
index 68a47c0278..4d06f0585d 100644
--- a/thirdparty/miniupnpc/upnpreplyparse.c
+++ b/thirdparty/miniupnpc/miniupnpc/upnpreplyparse.c
@@ -1,8 +1,8 @@
-/* $Id: upnpreplyparse.c,v 1.19 2015/07/15 10:29:11 nanard Exp $ */
+/* $Id: upnpreplyparse.c,v 1.20 2017/12/12 11:26:25 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab
* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
- * (c) 2006-2017 Thomas Bernard
+ * (c) 2006-2019 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
@@ -78,6 +78,7 @@ NameValueParserGetData(void * d, const char * datas, int l)
if(strcmp(data->curelt, "NewPortListing") == 0)
{
/* specific case for NewPortListing which is a XML Document */
+ free(data->portListing);
data->portListing = malloc(l + 1);
if(!data->portListing)
{
diff --git a/thirdparty/miniupnpc/upnpreplyparse.h b/thirdparty/miniupnpc/miniupnpc/upnpreplyparse.h
index 6badd15b26..6badd15b26 100644
--- a/thirdparty/miniupnpc/upnpreplyparse.h
+++ b/thirdparty/miniupnpc/miniupnpc/upnpreplyparse.h
diff --git a/thirdparty/miniupnpc/miniwget.h b/thirdparty/miniupnpc/miniwget.h
deleted file mode 100644
index f5572c2544..0000000000
--- a/thirdparty/miniupnpc/miniwget.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* $Id: miniwget.h,v 1.12 2016/01/24 17:24:36 nanard Exp $ */
-/* Project : miniupnp
- * Author : Thomas Bernard
- * Copyright (c) 2005-2016 Thomas Bernard
- * This software is subject to the conditions detailed in the
- * LICENCE file provided in this distribution.
- * */
-#ifndef MINIWGET_H_INCLUDED
-#define MINIWGET_H_INCLUDED
-
-#include "miniupnpc_declspec.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-MINIUPNP_LIBSPEC void * miniwget(const char *, int *, unsigned int, int *);
-
-MINIUPNP_LIBSPEC void * miniwget_getaddr(const char *, int *, char *, int, unsigned int, int *);
-
-int parseURL(const char *, char *, unsigned short *, char * *, unsigned int *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/thirdparty/miniupnpc/upnpcommands.h b/thirdparty/miniupnpc/upnpcommands.h
deleted file mode 100644
index 0c6d501666..0000000000
--- a/thirdparty/miniupnpc/upnpcommands.h
+++ /dev/null
@@ -1,348 +0,0 @@
-/* $Id: upnpcommands.h,v 1.32 2018/03/13 23:34:47 nanard Exp $ */
-/* Miniupnp project : http://miniupnp.free.fr/
- * Author : Thomas Bernard
- * Copyright (c) 2005-2018 Thomas Bernard
- * This software is subject to the conditions detailed in the
- * LICENCE file provided within this distribution */
-#ifndef UPNPCOMMANDS_H_INCLUDED
-#define UPNPCOMMANDS_H_INCLUDED
-
-#include "miniupnpc_declspec.h"
-#include "miniupnpctypes.h"
-
-/* MiniUPnPc return codes : */
-#define UPNPCOMMAND_SUCCESS (0)
-#define UPNPCOMMAND_UNKNOWN_ERROR (-1)
-#define UPNPCOMMAND_INVALID_ARGS (-2)
-#define UPNPCOMMAND_HTTP_ERROR (-3)
-#define UPNPCOMMAND_INVALID_RESPONSE (-4)
-#define UPNPCOMMAND_MEM_ALLOC_ERROR (-5)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct PortMappingParserData;
-
-MINIUPNP_LIBSPEC UNSIGNED_INTEGER
-UPNP_GetTotalBytesSent(const char * controlURL,
- const char * servicetype);
-
-MINIUPNP_LIBSPEC UNSIGNED_INTEGER
-UPNP_GetTotalBytesReceived(const char * controlURL,
- const char * servicetype);
-
-MINIUPNP_LIBSPEC UNSIGNED_INTEGER
-UPNP_GetTotalPacketsSent(const char * controlURL,
- const char * servicetype);
-
-MINIUPNP_LIBSPEC UNSIGNED_INTEGER
-UPNP_GetTotalPacketsReceived(const char * controlURL,
- const char * servicetype);
-
-/* UPNP_GetStatusInfo()
- * status and lastconnerror are 64 byte buffers
- * Return values :
- * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
- * or a UPnP Error code */
-MINIUPNP_LIBSPEC int
-UPNP_GetStatusInfo(const char * controlURL,
- const char * servicetype,
- char * status,
- unsigned int * uptime,
- char * lastconnerror);
-
-/* UPNP_GetConnectionTypeInfo()
- * argument connectionType is a 64 character buffer
- * Return Values :
- * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
- * or a UPnP Error code */
-MINIUPNP_LIBSPEC int
-UPNP_GetConnectionTypeInfo(const char * controlURL,
- const char * servicetype,
- char * connectionType);
-
-/* UPNP_GetExternalIPAddress() call the corresponding UPNP method.
- * if the third arg is not null the value is copied to it.
- * at least 16 bytes must be available
- *
- * Return values :
- * 0 : SUCCESS
- * NON ZERO : ERROR Either an UPnP error code or an unknown error.
- *
- * possible UPnP Errors :
- * 402 Invalid Args - See UPnP Device Architecture section on Control.
- * 501 Action Failed - See UPnP Device Architecture section on Control. */
-MINIUPNP_LIBSPEC int
-UPNP_GetExternalIPAddress(const char * controlURL,
- const char * servicetype,
- char * extIpAdd);
-
-/* UPNP_GetLinkLayerMaxBitRates()
- * call WANCommonInterfaceConfig:1#GetCommonLinkProperties
- *
- * return values :
- * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
- * or a UPnP Error Code. */
-MINIUPNP_LIBSPEC int
-UPNP_GetLinkLayerMaxBitRates(const char* controlURL,
- const char* servicetype,
- unsigned int * bitrateDown,
- unsigned int * bitrateUp);
-
-/* UPNP_AddPortMapping()
- * if desc is NULL, it will be defaulted to "libminiupnpc"
- * remoteHost is usually NULL because IGD don't support it.
- *
- * Return values :
- * 0 : SUCCESS
- * NON ZERO : ERROR. Either an UPnP error code or an unknown error.
- *
- * List of possible UPnP errors for AddPortMapping :
- * errorCode errorDescription (short) - Description (long)
- * 402 Invalid Args - See UPnP Device Architecture section on Control.
- * 501 Action Failed - See UPnP Device Architecture section on Control.
- * 606 Action not authorized - The action requested REQUIRES authorization and
- * the sender was not authorized.
- * 715 WildCardNotPermittedInSrcIP - The source IP address cannot be
- * wild-carded
- * 716 WildCardNotPermittedInExtPort - The external port cannot be wild-carded
- * 718 ConflictInMappingEntry - The port mapping entry specified conflicts
- * with a mapping assigned previously to another client
- * 724 SamePortValuesRequired - Internal and External port values
- * must be the same
- * 725 OnlyPermanentLeasesSupported - The NAT implementation only supports
- * permanent lease times on port mappings
- * 726 RemoteHostOnlySupportsWildcard - RemoteHost must be a wildcard
- * and cannot be a specific IP address or DNS name
- * 727 ExternalPortOnlySupportsWildcard - ExternalPort must be a wildcard and
- * cannot be a specific port value
- * 728 NoPortMapsAvailable - There are not enough free ports available to
- * complete port mapping.
- * 729 ConflictWithOtherMechanisms - Attempted port mapping is not allowed
- * due to conflict with other mechanisms.
- * 732 WildCardNotPermittedInIntPort - The internal port cannot be wild-carded
- */
-MINIUPNP_LIBSPEC int
-UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
- const char * extPort,
- const char * inPort,
- const char * inClient,
- const char * desc,
- const char * proto,
- const char * remoteHost,
- const char * leaseDuration);
-
-/* UPNP_AddAnyPortMapping()
- * if desc is NULL, it will be defaulted to "libminiupnpc"
- * remoteHost is usually NULL because IGD don't support it.
- *
- * Return values :
- * 0 : SUCCESS
- * NON ZERO : ERROR. Either an UPnP error code or an unknown error.
- *
- * List of possible UPnP errors for AddPortMapping :
- * errorCode errorDescription (short) - Description (long)
- * 402 Invalid Args - See UPnP Device Architecture section on Control.
- * 501 Action Failed - See UPnP Device Architecture section on Control.
- * 606 Action not authorized - The action requested REQUIRES authorization and
- * the sender was not authorized.
- * 715 WildCardNotPermittedInSrcIP - The source IP address cannot be
- * wild-carded
- * 716 WildCardNotPermittedInExtPort - The external port cannot be wild-carded
- * 728 NoPortMapsAvailable - There are not enough free ports available to
- * complete port mapping.
- * 729 ConflictWithOtherMechanisms - Attempted port mapping is not allowed
- * due to conflict with other mechanisms.
- * 732 WildCardNotPermittedInIntPort - The internal port cannot be wild-carded
- */
-MINIUPNP_LIBSPEC int
-UPNP_AddAnyPortMapping(const char * controlURL, const char * servicetype,
- const char * extPort,
- const char * inPort,
- const char * inClient,
- const char * desc,
- const char * proto,
- const char * remoteHost,
- const char * leaseDuration,
- char * reservedPort);
-
-/* UPNP_DeletePortMapping()
- * Use same argument values as what was used for AddPortMapping().
- * remoteHost is usually NULL because IGD don't support it.
- * Return Values :
- * 0 : SUCCESS
- * NON ZERO : error. Either an UPnP error code or an undefined error.
- *
- * List of possible UPnP errors for DeletePortMapping :
- * 402 Invalid Args - See UPnP Device Architecture section on Control.
- * 606 Action not authorized - The action requested REQUIRES authorization
- * and the sender was not authorized.
- * 714 NoSuchEntryInArray - The specified value does not exist in the array */
-MINIUPNP_LIBSPEC int
-UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
- const char * extPort, const char * proto,
- const char * remoteHost);
-
-/* UPNP_DeletePortRangeMapping()
- * Use same argument values as what was used for AddPortMapping().
- * remoteHost is usually NULL because IGD don't support it.
- * Return Values :
- * 0 : SUCCESS
- * NON ZERO : error. Either an UPnP error code or an undefined error.
- *
- * List of possible UPnP errors for DeletePortMapping :
- * 606 Action not authorized - The action requested REQUIRES authorization
- * and the sender was not authorized.
- * 730 PortMappingNotFound - This error message is returned if no port
- * mapping is found in the specified range.
- * 733 InconsistentParameters - NewStartPort and NewEndPort values are not consistent. */
-MINIUPNP_LIBSPEC int
-UPNP_DeletePortMappingRange(const char * controlURL, const char * servicetype,
- const char * extPortStart, const char * extPortEnd,
- const char * proto,
- const char * manage);
-
-/* UPNP_GetPortMappingNumberOfEntries()
- * not supported by all routers */
-MINIUPNP_LIBSPEC int
-UPNP_GetPortMappingNumberOfEntries(const char* controlURL,
- const char* servicetype,
- unsigned int * num);
-
-/* UPNP_GetSpecificPortMappingEntry()
- * retrieves an existing port mapping
- * params :
- * in extPort
- * in proto
- * in remoteHost
- * out intClient (16 bytes)
- * out intPort (6 bytes)
- * out desc (80 bytes)
- * out enabled (4 bytes)
- * out leaseDuration (16 bytes)
- *
- * return value :
- * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
- * or a UPnP Error Code.
- *
- * List of possible UPnP errors for _GetSpecificPortMappingEntry :
- * 402 Invalid Args - See UPnP Device Architecture section on Control.
- * 501 Action Failed - See UPnP Device Architecture section on Control.
- * 606 Action not authorized - The action requested REQUIRES authorization
- * and the sender was not authorized.
- * 714 NoSuchEntryInArray - The specified value does not exist in the array.
- */
-MINIUPNP_LIBSPEC int
-UPNP_GetSpecificPortMappingEntry(const char * controlURL,
- const char * servicetype,
- const char * extPort,
- const char * proto,
- const char * remoteHost,
- char * intClient,
- char * intPort,
- char * desc,
- char * enabled,
- char * leaseDuration);
-
-/* UPNP_GetGenericPortMappingEntry()
- * params :
- * in index
- * out extPort (6 bytes)
- * out intClient (16 bytes)
- * out intPort (6 bytes)
- * out protocol (4 bytes)
- * out desc (80 bytes)
- * out enabled (4 bytes)
- * out rHost (64 bytes)
- * out duration (16 bytes)
- *
- * return value :
- * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
- * or a UPnP Error Code.
- *
- * Possible UPNP Error codes :
- * 402 Invalid Args - See UPnP Device Architecture section on Control.
- * 606 Action not authorized - The action requested REQUIRES authorization
- * and the sender was not authorized.
- * 713 SpecifiedArrayIndexInvalid - The specified array index is out of bounds
- */
-MINIUPNP_LIBSPEC int
-UPNP_GetGenericPortMappingEntry(const char * controlURL,
- const char * servicetype,
- const char * index,
- char * extPort,
- char * intClient,
- char * intPort,
- char * protocol,
- char * desc,
- char * enabled,
- char * rHost,
- char * duration);
-
-/* UPNP_GetListOfPortMappings() Available in IGD v2
- *
- *
- * Possible UPNP Error codes :
- * 606 Action not Authorized
- * 730 PortMappingNotFound - no port mapping is found in the specified range.
- * 733 InconsistantParameters - NewStartPort and NewEndPort values are not
- * consistent.
- */
-MINIUPNP_LIBSPEC int
-UPNP_GetListOfPortMappings(const char * controlURL,
- const char * servicetype,
- const char * startPort,
- const char * endPort,
- const char * protocol,
- const char * numberOfPorts,
- struct PortMappingParserData * data);
-
-/* IGD:2, functions for service WANIPv6FirewallControl:1 */
-MINIUPNP_LIBSPEC int
-UPNP_GetFirewallStatus(const char * controlURL,
- const char * servicetype,
- int * firewallEnabled,
- int * inboundPinholeAllowed);
-
-MINIUPNP_LIBSPEC int
-UPNP_GetOutboundPinholeTimeout(const char * controlURL, const char * servicetype,
- const char * remoteHost,
- const char * remotePort,
- const char * intClient,
- const char * intPort,
- const char * proto,
- int * opTimeout);
-
-MINIUPNP_LIBSPEC int
-UPNP_AddPinhole(const char * controlURL, const char * servicetype,
- const char * remoteHost,
- const char * remotePort,
- const char * intClient,
- const char * intPort,
- const char * proto,
- const char * leaseTime,
- char * uniqueID);
-
-MINIUPNP_LIBSPEC int
-UPNP_UpdatePinhole(const char * controlURL, const char * servicetype,
- const char * uniqueID,
- const char * leaseTime);
-
-MINIUPNP_LIBSPEC int
-UPNP_DeletePinhole(const char * controlURL, const char * servicetype, const char * uniqueID);
-
-MINIUPNP_LIBSPEC int
-UPNP_CheckPinholeWorking(const char * controlURL, const char * servicetype,
- const char * uniqueID, int * isWorking);
-
-MINIUPNP_LIBSPEC int
-UPNP_GetPinholePackets(const char * controlURL, const char * servicetype,
- const char * uniqueID, int * packets);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-