miniupnpc 2.3.2__tar.gz → 2.3.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/Makefile +2 -2
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/PKG-INFO +1 -1
- miniupnpc-2.3.3/VERSION +1 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/include/miniupnpc.h +7 -5
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/include/upnpcommands.h +78 -1
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/include/upnpreplyparse.h +2 -2
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/miniupnpc.egg-info/PKG-INFO +1 -1
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/addr_is_reserved.c +1 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/connecthostport.c +16 -10
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/minisoap.c +3 -3
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/minissdpc.c +11 -8
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/miniupnpc.c +1 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/miniwget.c +3 -2
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/portlistingparse.c +4 -4
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/receivedata.c +3 -2
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/upnpcommands.c +77 -22
- miniupnpc-2.3.2/VERSION +0 -1
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/DESCRIPTION +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/LICENSE +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/MANIFEST.in +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/README +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/external-ip.sh +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/include/igd_desc_parse.h +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/include/miniupnpc_declspec.h +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/include/miniupnpctypes.h +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/include/miniwget.h +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/include/portlistingparse.h +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/include/upnpdev.h +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/include/upnperrors.h +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/miniupnpc.egg-info/SOURCES.txt +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/miniupnpc.egg-info/dependency_links.txt +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/miniupnpc.egg-info/top_level.txt +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/miniupnpcstrings.h.in +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/setup.cfg +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/setup.py +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/setupmingw32.py +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/addr_is_reserved.h +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/codelength.h +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/connecthostport.h +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/igd_desc_parse.c +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/listdevices.c +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/minihttptestserver.c +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/minisoap.h +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/minissdpc.h +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/miniupnpc_socketdef.h +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/miniupnpcmodule.c +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/miniwget_private.h +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/minixml.c +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/minixml.h +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/minixmlvalid.c +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/receivedata.h +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/testaddr_is_reserved.c +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/testigddescparse.c +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/testminiwget.c +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/testminixml.c +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/testportlistingparse.c +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/testupnpreplyparse.c +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/upnpc.c +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/upnpdev.c +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/upnperrors.c +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/upnpreplyparse.c +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/src/win32_snprintf.h +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/testminiwget.sh +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/testupnpreplyparse.sh +0 -0
- {miniupnpc-2.3.2 → miniupnpc-2.3.3}/updateminiupnpcstrings.sh +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# $Id: Makefile,v 1.
|
|
1
|
+
# $Id: Makefile,v 1.156 2025/03/18 23:40:14 nanard Exp $
|
|
2
2
|
# MiniUPnP Project
|
|
3
3
|
# http://miniupnp.free.fr/
|
|
4
4
|
# https://miniupnp.tuxfamily.org/
|
|
@@ -84,7 +84,7 @@ ifneq (, $(findstring sun, $(OS))$(findstring solaris, $(OS)))
|
|
|
84
84
|
endif
|
|
85
85
|
|
|
86
86
|
# APIVERSION is used to build SONAME
|
|
87
|
-
APIVERSION =
|
|
87
|
+
APIVERSION = 21
|
|
88
88
|
|
|
89
89
|
SRCS = $(wildcard $(SRCDIR)/*.c)
|
|
90
90
|
PRIVATE_HEADERS = $(wildcard $(SRCDIR)/*.h)
|
miniupnpc-2.3.3/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.3.3
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* $Id: miniupnpc.h,v 1.
|
|
1
|
+
/* $Id: miniupnpc.h,v 1.80 2025/05/26 22:56:40 nanard Exp $ */
|
|
2
2
|
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
|
3
3
|
* Project: miniupnp
|
|
4
4
|
* http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* MiniUPnPc (MiniUPnP client) is a library implementing a UPnP
|
|
20
20
|
* Internet Gateway Device (IGD) control point.
|
|
21
21
|
*
|
|
22
|
-
* It should be used by applications that
|
|
22
|
+
* It should be used by applications that need to listen to incoming
|
|
23
23
|
* traffic from the internet which are running on a LAN where a
|
|
24
24
|
* UPnP IGD is running on the router (or gateway).
|
|
25
25
|
*
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
#define UPNPDISCOVER_MEMORY_ERROR (-102)
|
|
43
43
|
|
|
44
44
|
/*! \brief software version */
|
|
45
|
-
#define MINIUPNPC_VERSION "2.3.
|
|
45
|
+
#define MINIUPNPC_VERSION "2.3.3"
|
|
46
46
|
/*! \brief C API version */
|
|
47
|
-
#define MINIUPNPC_API_VERSION
|
|
47
|
+
#define MINIUPNPC_API_VERSION 21
|
|
48
48
|
|
|
49
49
|
/*! \brief any (ie system chosen) port */
|
|
50
50
|
#define UPNP_LOCAL_PORT_ANY 0
|
|
@@ -68,6 +68,8 @@ struct UPNParg {
|
|
|
68
68
|
/*!
|
|
69
69
|
* \brief execute a UPnP method (SOAP action)
|
|
70
70
|
*
|
|
71
|
+
* \todo error reporting should be improved
|
|
72
|
+
*
|
|
71
73
|
* \param[in] url Control URL for the service
|
|
72
74
|
* \param[in] service service to use
|
|
73
75
|
* \param[in] action action to call
|
|
@@ -279,7 +281,7 @@ GetUPNPUrls(struct UPNPUrls * urls, struct IGDdatas * data,
|
|
|
279
281
|
* \brief free the members of a UPNPUrls struct
|
|
280
282
|
*
|
|
281
283
|
* All URLs buffers are freed and zeroed
|
|
282
|
-
* \param[out] urls
|
|
284
|
+
* \param[out] urls URL structure to free
|
|
283
285
|
*/
|
|
284
286
|
MINIUPNP_LIBSPEC void
|
|
285
287
|
FreeUPNPUrls(struct UPNPUrls * urls);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* $Id: upnpcommands.h,v 1.
|
|
1
|
+
/* $Id: upnpcommands.h,v 1.36 2025/03/18 23:40:15 nanard Exp $ */
|
|
2
2
|
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
|
3
3
|
* Project: miniupnp
|
|
4
4
|
* http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
|
|
@@ -360,6 +360,44 @@ UPNP_GetSpecificPortMappingEntry(const char * controlURL,
|
|
|
360
360
|
char * enabled,
|
|
361
361
|
char * leaseDuration);
|
|
362
362
|
|
|
363
|
+
/*! \brief retrieves an existing port mapping for a port:protocol
|
|
364
|
+
*
|
|
365
|
+
* List of possible UPnP errors for UPNP_GetSpecificPortMappingEntry() :
|
|
366
|
+
* errorCode errorDescription (short) | Description (long)
|
|
367
|
+
* ---------------------------------- | ------------------
|
|
368
|
+
* 402 Invalid Args | See UPnP Device Architecture section on Control.
|
|
369
|
+
* 501 Action Failed | See UPnP Device Architecture section on Control.
|
|
370
|
+
* 606 Action not authorized | The action requested REQUIRES authorization and the sender was not authorized.
|
|
371
|
+
* 714 NoSuchEntryInArray | The specified value does not exist in the array.
|
|
372
|
+
*
|
|
373
|
+
* \param[in] controlURL controlURL of the WANIPConnection of a WANConnectionDevice
|
|
374
|
+
* \param[in] servicetype urn:schemas-upnp-org:service:WANIPConnection:1
|
|
375
|
+
* \param[in] extPort External port
|
|
376
|
+
* \param[in] proto `TCP` or `UDP`
|
|
377
|
+
* \param[in] remoteHost IP or empty string for wildcard. Most IGD don't
|
|
378
|
+
* support it
|
|
379
|
+
* \param[out] intClient 16 bytes buffer
|
|
380
|
+
* \param[out] intPort 6 bytes buffer
|
|
381
|
+
* \param[out] desc desclen bytes buffer
|
|
382
|
+
* \param[in] desclen desc buffer length
|
|
383
|
+
* \param[out] enabled 4 bytes buffer
|
|
384
|
+
* \param[out] leaseDuration 16 bytes
|
|
385
|
+
* \return #UPNPCOMMAND_SUCCESS, #UPNPCOMMAND_INVALID_ARGS,
|
|
386
|
+
* #UPNPCOMMAND_UNKNOWN_ERROR or a UPnP Error Code.
|
|
387
|
+
*/
|
|
388
|
+
MINIUPNP_LIBSPEC int
|
|
389
|
+
UPNP_GetSpecificPortMappingEntryExt(const char * controlURL,
|
|
390
|
+
const char * servicetype,
|
|
391
|
+
const char * extPort,
|
|
392
|
+
const char * proto,
|
|
393
|
+
const char * remoteHost,
|
|
394
|
+
char * intClient,
|
|
395
|
+
char * intPort,
|
|
396
|
+
char * desc,
|
|
397
|
+
size_t desclen,
|
|
398
|
+
char * enabled,
|
|
399
|
+
char * leaseDuration);
|
|
400
|
+
|
|
363
401
|
/*! \brief WANIPConnection:GetGenericPortMappingEntry()
|
|
364
402
|
*
|
|
365
403
|
* errorCode errorDescription (short) | Description (long)
|
|
@@ -395,6 +433,45 @@ UPNP_GetGenericPortMappingEntry(const char * controlURL,
|
|
|
395
433
|
char * rHost,
|
|
396
434
|
char * duration);
|
|
397
435
|
|
|
436
|
+
/*! \brief WANIPConnection:GetGenericPortMappingEntry()
|
|
437
|
+
*
|
|
438
|
+
* errorCode errorDescription (short) | Description (long)
|
|
439
|
+
* ---------------------------------- | ------------------
|
|
440
|
+
* 402 Invalid Args | See UPnP Device Architecture section on Control.
|
|
441
|
+
* 606 Action not authorized | The action requested REQUIRES authorization and the sender was not authorized.
|
|
442
|
+
* 713 SpecifiedArrayIndexInvalid | The specified array index is out of bounds
|
|
443
|
+
*
|
|
444
|
+
* \param[in] controlURL controlURL of the WANIPConnection of a WANConnectionDevice
|
|
445
|
+
* \param[in] servicetype urn:schemas-upnp-org:service:WANIPConnection:1
|
|
446
|
+
* \param[in] index
|
|
447
|
+
* \param[out] extPort 6 bytes buffer
|
|
448
|
+
* \param[out] intClient 16 bytes buffer
|
|
449
|
+
* \param[out] intPort 6 bytes buffer
|
|
450
|
+
* \param[out] protocol 4 bytes buffer
|
|
451
|
+
* \param[out] desc desclen bytes buffer
|
|
452
|
+
* \param[in] desclen desc buffer length
|
|
453
|
+
* \param[out] enabled 4 bytes buffer
|
|
454
|
+
* \param[out] rHost desclen bytes buffer
|
|
455
|
+
* \param[in] rHostlen rHost buffer length
|
|
456
|
+
* \param[out] duration 16 bytes buffer
|
|
457
|
+
* \return #UPNPCOMMAND_SUCCESS, #UPNPCOMMAND_INVALID_ARGS,
|
|
458
|
+
* #UPNPCOMMAND_UNKNOWN_ERROR or a UPnP Error Code.
|
|
459
|
+
*/
|
|
460
|
+
MINIUPNP_LIBSPEC int
|
|
461
|
+
UPNP_GetGenericPortMappingEntryExt(const char * controlURL,
|
|
462
|
+
const char * servicetype,
|
|
463
|
+
const char * index,
|
|
464
|
+
char * extPort,
|
|
465
|
+
char * intClient,
|
|
466
|
+
char * intPort,
|
|
467
|
+
char * protocol,
|
|
468
|
+
char * desc,
|
|
469
|
+
size_t desclen,
|
|
470
|
+
char * enabled,
|
|
471
|
+
char * rHost,
|
|
472
|
+
size_t rHostlen,
|
|
473
|
+
char * duration);
|
|
474
|
+
|
|
398
475
|
/*! \brief retrieval of a list of existing port mappings
|
|
399
476
|
*
|
|
400
477
|
* Available in IGD v2 : WANIPConnection:GetListOfPortMappings()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* $Id: upnpreplyparse.h,v 1.
|
|
1
|
+
/* $Id: upnpreplyparse.h,v 1.22 2025/03/29 17:58:12 nanard Exp $ */
|
|
2
2
|
/* MiniUPnP project
|
|
3
3
|
* http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
|
|
4
4
|
* (c) 2006-2025 Thomas Bernard
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
extern "C" {
|
|
17
17
|
#endif
|
|
18
18
|
|
|
19
|
-
/*! \brief Name/Value linked list
|
|
19
|
+
/*! \brief Name/Value linked list
|
|
20
20
|
* not exposed in the public API
|
|
21
21
|
*/
|
|
22
22
|
struct NameValue;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/* $Id: connecthostport.c,v 1.
|
|
1
|
+
/* $Id: connecthostport.c,v 1.25 2025/05/24 15:59:08 nanard Exp $ */
|
|
2
2
|
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
|
3
3
|
* Project : miniupnp
|
|
4
|
+
* Web : http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
|
|
4
5
|
* Author : Thomas Bernard
|
|
5
|
-
* Copyright (c) 2010-
|
|
6
|
+
* Copyright (c) 2010-2025 Thomas Bernard
|
|
6
7
|
* This software is subject to the conditions detailed in the
|
|
7
8
|
* LICENCE file provided in this distribution. */
|
|
8
9
|
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
#include <string.h>
|
|
16
17
|
#include <stdio.h>
|
|
17
18
|
#ifdef _WIN32
|
|
19
|
+
#define WIN32_LEAN_AND_MEAN
|
|
18
20
|
#include <winsock2.h>
|
|
19
21
|
#include <ws2tcpip.h>
|
|
20
22
|
#include <io.h>
|
|
@@ -123,8 +125,12 @@ SOCKET connecthostport(const char * host, unsigned short port,
|
|
|
123
125
|
#else
|
|
124
126
|
n = select(s + 1, NULL, &wset, NULL, NULL);
|
|
125
127
|
#endif
|
|
126
|
-
if(n
|
|
127
|
-
|
|
128
|
+
if(n < 0) {
|
|
129
|
+
if (errno == EINTR)
|
|
130
|
+
continue; /* try again */
|
|
131
|
+
else
|
|
132
|
+
break; /* EBADF, EFAULT, EINVAL */
|
|
133
|
+
}
|
|
128
134
|
#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
|
|
129
135
|
if(n == 0) {
|
|
130
136
|
errno = ETIMEDOUT;
|
|
@@ -132,8 +138,6 @@ SOCKET connecthostport(const char * host, unsigned short port,
|
|
|
132
138
|
break;
|
|
133
139
|
}
|
|
134
140
|
#endif
|
|
135
|
-
/*len = 0;*/
|
|
136
|
-
/*n = getpeername(s, NULL, &len);*/
|
|
137
141
|
len = sizeof(err);
|
|
138
142
|
if(getsockopt(s, SOL_SOCKET, SO_ERROR, &err, &len) < 0) {
|
|
139
143
|
PRINT_SOCKET_ERROR("getsockopt");
|
|
@@ -240,8 +244,12 @@ SOCKET connecthostport(const char * host, unsigned short port,
|
|
|
240
244
|
#else
|
|
241
245
|
n = select(s + 1, NULL, &wset, NULL, NULL);
|
|
242
246
|
#endif
|
|
243
|
-
if(n
|
|
244
|
-
|
|
247
|
+
if(n < 0) {
|
|
248
|
+
if (errno == EINTR)
|
|
249
|
+
continue; /* try again */
|
|
250
|
+
else
|
|
251
|
+
break; /* EBADF, EFAULT, EINVAL */
|
|
252
|
+
}
|
|
245
253
|
#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
|
|
246
254
|
if(n == 0) {
|
|
247
255
|
errno = ETIMEDOUT;
|
|
@@ -249,8 +257,6 @@ SOCKET connecthostport(const char * host, unsigned short port,
|
|
|
249
257
|
break;
|
|
250
258
|
}
|
|
251
259
|
#endif
|
|
252
|
-
/*len = 0;*/
|
|
253
|
-
/*n = getpeername(s, NULL, &len);*/
|
|
254
260
|
len = sizeof(err);
|
|
255
261
|
if(getsockopt(s, SOL_SOCKET, SO_ERROR, &err, &len) < 0) {
|
|
256
262
|
PRINT_SOCKET_ERROR("getsockopt");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/* $Id: minisoap.c,v 1.
|
|
1
|
+
/* $Id: minisoap.c,v 1.35 2025/04/27 21:13:45 nanard Exp $ */
|
|
2
2
|
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
|
3
3
|
* Project : miniupnp
|
|
4
4
|
* Author : Thomas Bernard
|
|
5
|
-
* Copyright (c) 2005-
|
|
5
|
+
* Copyright (c) 2005-2025 Thomas Bernard
|
|
6
6
|
* This software is subject to the conditions detailed in the
|
|
7
7
|
* LICENCE file provided in this distribution.
|
|
8
8
|
*
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
#include <stdio.h>
|
|
12
12
|
#include <string.h>
|
|
13
13
|
#ifdef _WIN32
|
|
14
|
+
#define WIN32_LEAN_AND_MEAN
|
|
14
15
|
#include <io.h>
|
|
15
16
|
#include <winsock2.h>
|
|
16
17
|
#include "win32_snprintf.h"
|
|
@@ -99,7 +100,6 @@ int soapPostSubmit(SOCKET fd,
|
|
|
99
100
|
#endif
|
|
100
101
|
"SOAPAction: \"%s\"\r\n"
|
|
101
102
|
"Connection: close\r\n"
|
|
102
|
-
"Cache-Control: no-cache\r\n" /* ??? */
|
|
103
103
|
"\r\n",
|
|
104
104
|
url, httpversion, host, portstr, bodysize, action);
|
|
105
105
|
if ((unsigned int)headerssize >= sizeof(headerbuf))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* $Id: minissdpc.c,v 1.
|
|
1
|
+
/* $Id: minissdpc.c,v 1.54 2025/03/29 17:59:01 nanard Exp $ */
|
|
2
2
|
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
|
3
3
|
* Project : miniupnp
|
|
4
4
|
* Web : http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
#endif
|
|
17
17
|
#if defined(_WIN32) || defined(__amigaos__) || defined(__amigaos4__)
|
|
18
18
|
#ifdef _WIN32
|
|
19
|
+
#define WIN32_LEAN_AND_MEAN
|
|
19
20
|
#include <winsock2.h>
|
|
20
21
|
#include <ws2tcpip.h>
|
|
21
22
|
#include <io.h>
|
|
@@ -390,7 +391,7 @@ free_tmp_and_return:
|
|
|
390
391
|
* the last 4 arguments are filled during the parsing :
|
|
391
392
|
* - location/locationsize : "location:" field of the SSDP reply packet
|
|
392
393
|
* - st/stsize : "st:" field of the SSDP reply packet.
|
|
393
|
-
* - usn/usnsize : "usn:"
|
|
394
|
+
* - usn/usnsize : "usn:" field of the SSDP reply packet
|
|
394
395
|
* The strings are NOT null terminated */
|
|
395
396
|
static void
|
|
396
397
|
parseMSEARCHReply(const char * reply, int size,
|
|
@@ -542,10 +543,10 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|
|
542
543
|
int n;
|
|
543
544
|
struct sockaddr_storage sockudp_r;
|
|
544
545
|
unsigned int mx;
|
|
546
|
+
int rv;
|
|
545
547
|
#ifdef NO_GETADDRINFO
|
|
546
548
|
struct sockaddr_storage sockudp_w;
|
|
547
549
|
#else
|
|
548
|
-
int rv;
|
|
549
550
|
struct addrinfo hints, *servinfo;
|
|
550
551
|
#endif
|
|
551
552
|
#ifdef _WIN32
|
|
@@ -874,9 +875,9 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|
|
874
875
|
p->sin_port = htons(SSDP_PORT);
|
|
875
876
|
p->sin_addr.s_addr = inet_addr(UPNP_MCAST_ADDR);
|
|
876
877
|
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
if (
|
|
878
|
+
rv = sendto(sudp, bufr, n, 0, (struct sockaddr *)&sockudp_w,
|
|
879
|
+
ipv6 ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in));
|
|
880
|
+
if (rv < 0) {
|
|
880
881
|
if(error)
|
|
881
882
|
*error = MINISSDPC_SOCKET_ERROR;
|
|
882
883
|
PRINT_SOCKET_ERROR("sendto");
|
|
@@ -902,9 +903,11 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|
|
902
903
|
break;
|
|
903
904
|
} else {
|
|
904
905
|
struct addrinfo *p;
|
|
906
|
+
/* as getaddrinfo() returns a linked list, we are iterating it
|
|
907
|
+
* even thought it should only return one result here */
|
|
905
908
|
for(p = servinfo; p; p = p->ai_next) {
|
|
906
|
-
|
|
907
|
-
if (
|
|
909
|
+
rv = sendto(sudp, bufr, n, 0, p->ai_addr, MSC_CAST_INT p->ai_addrlen);
|
|
910
|
+
if (rv < 0) {
|
|
908
911
|
#ifdef DEBUG
|
|
909
912
|
char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
|
|
910
913
|
if (getnameinfo(p->ai_addr, (socklen_t)p->ai_addrlen, hbuf, sizeof(hbuf), sbuf,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/* $Id: miniwget.c,v 1.
|
|
1
|
+
/* $Id: miniwget.c,v 1.88 2025/05/25 21:56:49 nanard Exp $ */
|
|
2
2
|
/* Project : miniupnp
|
|
3
3
|
* Website : http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
|
|
4
4
|
* Author : Thomas Bernard
|
|
5
|
-
* Copyright (c) 2005-
|
|
5
|
+
* Copyright (c) 2005-2025 Thomas Bernard
|
|
6
6
|
* This software is subject to the conditions detailed in the
|
|
7
7
|
* LICENCE file provided in this distribution. */
|
|
8
8
|
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
#include <string.h>
|
|
12
12
|
#include <ctype.h>
|
|
13
13
|
#ifdef _WIN32
|
|
14
|
+
#define WIN32_LEAN_AND_MEAN
|
|
14
15
|
#include <winsock2.h>
|
|
15
16
|
#include <ws2tcpip.h>
|
|
16
17
|
#include <io.h>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* $Id: portlistingparse.c,v 1.
|
|
1
|
+
/* $Id: portlistingparse.c,v 1.12 2025/03/29 17:58:33 nanard Exp $ */
|
|
2
2
|
/* MiniUPnP project
|
|
3
|
-
* http://miniupnp.free.fr/ or
|
|
4
|
-
* (c) 2011-
|
|
3
|
+
* http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
|
|
4
|
+
* (c) 2011-2025 Thomas Bernard
|
|
5
5
|
* This software is subject to the conditions detailed
|
|
6
6
|
* in the LICENCE file provided within the distribution */
|
|
7
7
|
#include <string.h>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
#if defined(__HAIKU__)
|
|
16
16
|
/* rename our private function because Haiku already defines a atoui() function */
|
|
17
17
|
#define atoui atoui2
|
|
18
|
-
#endif
|
|
18
|
+
#endif
|
|
19
19
|
|
|
20
20
|
/* list of the elements */
|
|
21
21
|
static const struct {
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
/* $Id: receivedata.c,v 1.
|
|
1
|
+
/* $Id: receivedata.c,v 1.11 2025/05/25 21:56:49 nanard Exp $ */
|
|
2
2
|
/* Project : miniupnp
|
|
3
3
|
* Website : http://miniupnp.free.fr/
|
|
4
4
|
* Author : Thomas Bernard
|
|
5
|
-
* Copyright (c) 2011-
|
|
5
|
+
* Copyright (c) 2011-2025 Thomas Bernard
|
|
6
6
|
* This software is subject to the conditions detailed in the
|
|
7
7
|
* LICENCE file provided in this distribution. */
|
|
8
8
|
|
|
9
9
|
#include <stdio.h>
|
|
10
10
|
#include <string.h>
|
|
11
11
|
#ifdef _WIN32
|
|
12
|
+
#define WIN32_LEAN_AND_MEAN
|
|
12
13
|
#include <winsock2.h>
|
|
13
14
|
#include <ws2tcpip.h>
|
|
14
15
|
#else /* _WIN32 */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* $Id: upnpcommands.c,v 1.
|
|
1
|
+
/* $Id: upnpcommands.c,v 1.56 2025/03/29 18:08:59 nanard Exp $ */
|
|
2
2
|
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
|
3
3
|
* Project : miniupnp
|
|
4
4
|
* Author : Thomas Bernard
|
|
@@ -421,7 +421,7 @@ UPNP_AddAnyPortMapping(const char * controlURL, const char * servicetype,
|
|
|
421
421
|
const char * resVal;
|
|
422
422
|
int ret;
|
|
423
423
|
|
|
424
|
-
if(!inPort || !inClient || !proto || !extPort)
|
|
424
|
+
if(!inPort || !inClient || !proto || !extPort || !reservedPort)
|
|
425
425
|
return UPNPCOMMAND_INVALID_ARGS;
|
|
426
426
|
buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
427
427
|
"AddAnyPortMapping", AddAnyPortMappingArgs,
|
|
@@ -537,15 +537,36 @@ UPNP_DeletePortMappingRange(const char * controlURL, const char * servicetype,
|
|
|
537
537
|
MINIUPNP_LIBSPEC int
|
|
538
538
|
UPNP_GetGenericPortMappingEntry(const char * controlURL,
|
|
539
539
|
const char * servicetype,
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
540
|
+
const char * index,
|
|
541
|
+
char * extPort,
|
|
542
|
+
char * intClient,
|
|
543
|
+
char * intPort,
|
|
544
|
+
char * protocol,
|
|
545
|
+
char * desc,
|
|
546
|
+
char * enabled,
|
|
547
|
+
char * rHost,
|
|
548
|
+
char * duration)
|
|
549
|
+
{
|
|
550
|
+
return UPNP_GetGenericPortMappingEntryExt(controlURL, servicetype, index,
|
|
551
|
+
extPort, intClient, intPort,
|
|
552
|
+
protocol, desc, 80, enabled,
|
|
553
|
+
rHost, 64, duration);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
MINIUPNP_LIBSPEC int
|
|
557
|
+
UPNP_GetGenericPortMappingEntryExt(const char * controlURL,
|
|
558
|
+
const char * servicetype,
|
|
559
|
+
const char * index,
|
|
560
|
+
char * extPort,
|
|
561
|
+
char * intClient,
|
|
562
|
+
char * intPort,
|
|
563
|
+
char * protocol,
|
|
564
|
+
char * desc,
|
|
565
|
+
size_t desclen,
|
|
566
|
+
char * enabled,
|
|
567
|
+
char * rHost,
|
|
568
|
+
size_t rHostlen,
|
|
569
|
+
char * duration)
|
|
549
570
|
{
|
|
550
571
|
struct NameValueParserData pdata;
|
|
551
572
|
struct UPNParg GetPortMappingArgs[] = {
|
|
@@ -556,10 +577,8 @@ UPNP_GetGenericPortMappingEntry(const char * controlURL,
|
|
|
556
577
|
int bufsize;
|
|
557
578
|
char * p;
|
|
558
579
|
int ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
559
|
-
if(!index)
|
|
580
|
+
if(!index || !extPort || !intClient || !intPort || !protocol)
|
|
560
581
|
return UPNPCOMMAND_INVALID_ARGS;
|
|
561
|
-
intClient[0] = '\0';
|
|
562
|
-
intPort[0] = '\0';
|
|
563
582
|
buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
564
583
|
"GetGenericPortMappingEntry",
|
|
565
584
|
GetPortMappingArgs, &bufsize);
|
|
@@ -572,22 +591,30 @@ UPNP_GetGenericPortMappingEntry(const char * controlURL,
|
|
|
572
591
|
p = GetValueFromNameValueList(&pdata, "NewRemoteHost");
|
|
573
592
|
if(p && rHost)
|
|
574
593
|
{
|
|
575
|
-
strncpy(rHost, p,
|
|
576
|
-
rHost[
|
|
594
|
+
strncpy(rHost, p, rHostlen);
|
|
595
|
+
rHost[rHostlen-1] = '\0';
|
|
577
596
|
}
|
|
578
597
|
p = GetValueFromNameValueList(&pdata, "NewExternalPort");
|
|
579
|
-
if(p
|
|
598
|
+
if(p)
|
|
580
599
|
{
|
|
581
600
|
strncpy(extPort, p, 6);
|
|
582
601
|
extPort[5] = '\0';
|
|
583
602
|
ret = UPNPCOMMAND_SUCCESS;
|
|
584
603
|
}
|
|
604
|
+
else
|
|
605
|
+
{
|
|
606
|
+
extPort[0] = '\0';
|
|
607
|
+
}
|
|
585
608
|
p = GetValueFromNameValueList(&pdata, "NewProtocol");
|
|
586
|
-
if(p
|
|
609
|
+
if(p)
|
|
587
610
|
{
|
|
588
611
|
strncpy(protocol, p, 4);
|
|
589
612
|
protocol[3] = '\0';
|
|
590
613
|
}
|
|
614
|
+
else
|
|
615
|
+
{
|
|
616
|
+
protocol[0] = '\0';
|
|
617
|
+
}
|
|
591
618
|
p = GetValueFromNameValueList(&pdata, "NewInternalClient");
|
|
592
619
|
if(p)
|
|
593
620
|
{
|
|
@@ -595,12 +622,20 @@ UPNP_GetGenericPortMappingEntry(const char * controlURL,
|
|
|
595
622
|
intClient[15] = '\0';
|
|
596
623
|
ret = 0;
|
|
597
624
|
}
|
|
625
|
+
else
|
|
626
|
+
{
|
|
627
|
+
intClient[0] = '\0';
|
|
628
|
+
}
|
|
598
629
|
p = GetValueFromNameValueList(&pdata, "NewInternalPort");
|
|
599
630
|
if(p)
|
|
600
631
|
{
|
|
601
632
|
strncpy(intPort, p, 6);
|
|
602
633
|
intPort[5] = '\0';
|
|
603
634
|
}
|
|
635
|
+
else
|
|
636
|
+
{
|
|
637
|
+
intPort[0] = '\0';
|
|
638
|
+
}
|
|
604
639
|
p = GetValueFromNameValueList(&pdata, "NewEnabled");
|
|
605
640
|
if(p && enabled)
|
|
606
641
|
{
|
|
@@ -610,8 +645,8 @@ UPNP_GetGenericPortMappingEntry(const char * controlURL,
|
|
|
610
645
|
p = GetValueFromNameValueList(&pdata, "NewPortMappingDescription");
|
|
611
646
|
if(p && desc)
|
|
612
647
|
{
|
|
613
|
-
strncpy(desc, p,
|
|
614
|
-
desc[
|
|
648
|
+
strncpy(desc, p, desclen);
|
|
649
|
+
desc[desclen-1] = '\0';
|
|
615
650
|
}
|
|
616
651
|
p = GetValueFromNameValueList(&pdata, "NewLeaseDuration");
|
|
617
652
|
if(p && duration)
|
|
@@ -680,6 +715,26 @@ UPNP_GetSpecificPortMappingEntry(const char * controlURL,
|
|
|
680
715
|
char * desc,
|
|
681
716
|
char * enabled,
|
|
682
717
|
char * leaseDuration)
|
|
718
|
+
{
|
|
719
|
+
return UPNP_GetSpecificPortMappingEntryExt(controlURL, servicetype,
|
|
720
|
+
extPort, proto, remoteHost,
|
|
721
|
+
intClient, intPort,
|
|
722
|
+
desc, 80, enabled,
|
|
723
|
+
leaseDuration);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
MINIUPNP_LIBSPEC int
|
|
727
|
+
UPNP_GetSpecificPortMappingEntryExt(const char * controlURL,
|
|
728
|
+
const char * servicetype,
|
|
729
|
+
const char * extPort,
|
|
730
|
+
const char * proto,
|
|
731
|
+
const char * remoteHost,
|
|
732
|
+
char * intClient,
|
|
733
|
+
char * intPort,
|
|
734
|
+
char * desc,
|
|
735
|
+
size_t desclen,
|
|
736
|
+
char * enabled,
|
|
737
|
+
char * leaseDuration)
|
|
683
738
|
{
|
|
684
739
|
struct NameValueParserData pdata;
|
|
685
740
|
struct UPNParg GetPortMappingArgs[] = {
|
|
@@ -729,8 +784,8 @@ UPNP_GetSpecificPortMappingEntry(const char * controlURL,
|
|
|
729
784
|
|
|
730
785
|
p = GetValueFromNameValueList(&pdata, "NewPortMappingDescription");
|
|
731
786
|
if(p && desc) {
|
|
732
|
-
strncpy(desc, p,
|
|
733
|
-
desc[
|
|
787
|
+
strncpy(desc, p, desclen);
|
|
788
|
+
desc[desclen-1] = '\0';
|
|
734
789
|
}
|
|
735
790
|
|
|
736
791
|
p = GetValueFromNameValueList(&pdata, "NewLeaseDuration");
|
miniupnpc-2.3.2/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2.3.2
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|