miniupnpc 2.2.7__tar.gz → 2.3.0__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.2.7 → miniupnpc-2.3.0}/Makefile +1 -1
- miniupnpc-2.3.0/PKG-INFO +48 -0
- miniupnpc-2.3.0/VERSION +1 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/include/miniupnpc.h +15 -9
- miniupnpc-2.3.0/miniupnpc.egg-info/PKG-INFO +48 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/setup.py +2 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/setupmingw32.py +9 -1
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/minisoap.c +3 -4
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/minissdpc.c +5 -4
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/miniupnpc.c +17 -44
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/miniupnpcmodule.c +3 -3
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/miniwget.c +4 -40
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/upnpc.c +24 -17
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/upnpcommands.c +37 -37
- miniupnpc-2.2.7/PKG-INFO +0 -10
- miniupnpc-2.2.7/VERSION +0 -1
- miniupnpc-2.2.7/miniupnpc.egg-info/PKG-INFO +0 -10
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/LICENSE +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/MANIFEST.in +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/README +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/external-ip.sh +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/include/igd_desc_parse.h +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/include/miniupnpc_declspec.h +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/include/miniupnpctypes.h +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/include/miniwget.h +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/include/portlistingparse.h +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/include/upnpcommands.h +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/include/upnpdev.h +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/include/upnperrors.h +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/include/upnpreplyparse.h +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/miniupnpc.egg-info/SOURCES.txt +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/miniupnpc.egg-info/dependency_links.txt +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/miniupnpc.egg-info/top_level.txt +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/miniupnpcstrings.h.in +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/setup.cfg +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/addr_is_reserved.c +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/addr_is_reserved.h +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/codelength.h +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/connecthostport.c +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/connecthostport.h +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/igd_desc_parse.c +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/listdevices.c +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/minihttptestserver.c +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/minisoap.h +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/minissdpc.h +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/miniupnpc_socketdef.h +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/miniwget_private.h +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/minixml.c +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/minixml.h +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/minixmlvalid.c +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/portlistingparse.c +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/receivedata.c +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/receivedata.h +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/testaddr_is_reserved.c +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/testigddescparse.c +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/testminiwget.c +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/testminixml.c +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/testportlistingparse.c +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/testupnpreplyparse.c +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/upnpdev.c +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/upnperrors.c +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/upnpreplyparse.c +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/src/win32_snprintf.h +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/testminiwget.sh +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/testupnpreplyparse.sh +0 -0
- {miniupnpc-2.2.7 → miniupnpc-2.3.0}/updateminiupnpcstrings.sh +0 -0
miniupnpc-2.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: miniupnpc
|
|
3
|
+
Version: 2.3.0
|
|
4
|
+
Summary: MiniUPnP IGD client
|
|
5
|
+
Home-page: https://miniupnp.tuxfamily.org/
|
|
6
|
+
Author: Thomas BERNARD
|
|
7
|
+
Author-email: miniupnp@free.fr
|
|
8
|
+
License: BSD 3-Clause License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2005-2024, Thomas BERNARD
|
|
11
|
+
All rights reserved.
|
|
12
|
+
|
|
13
|
+
Redistribution and use in source and binary forms, with or without
|
|
14
|
+
modification, are permitted provided that the following conditions are met:
|
|
15
|
+
|
|
16
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
17
|
+
list of conditions and the following disclaimer.
|
|
18
|
+
|
|
19
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
20
|
+
this list of conditions and the following disclaimer in the documentation
|
|
21
|
+
and/or other materials provided with the distribution.
|
|
22
|
+
|
|
23
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
24
|
+
contributors may be used to endorse or promote products derived from
|
|
25
|
+
this software without specific prior written permission.
|
|
26
|
+
|
|
27
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
28
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
29
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
30
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
31
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
32
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
33
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
34
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
35
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
36
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
37
|
+
|
|
38
|
+
Platform: UNKNOWN
|
|
39
|
+
Description-Content-Type: text/plain
|
|
40
|
+
License-File: LICENSE
|
|
41
|
+
|
|
42
|
+
MiniUPnPc is a library enabling applications to access the services provided
|
|
43
|
+
by an UPnP "Internet Gateway Device" present on the network. In UPnP
|
|
44
|
+
terminology, MiniUPnPc is a UPnP Control Point.
|
|
45
|
+
|
|
46
|
+
MiniUPnPc is designed to have low footprint and the libc as unique
|
|
47
|
+
dependency.
|
|
48
|
+
|
miniupnpc-2.3.0/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.3.0
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/* $Id: miniupnpc.h,v 1.
|
|
1
|
+
/* $Id: miniupnpc.h,v 1.69 2025/01/10 23:19:30 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/
|
|
5
5
|
* Author: Thomas Bernard
|
|
6
|
-
* Copyright (c) 2005-
|
|
6
|
+
* Copyright (c) 2005-2025 Thomas Bernard
|
|
7
7
|
* This software is subjects to the conditions detailed
|
|
8
8
|
* in the LICENCE file provided within this distribution */
|
|
9
9
|
#ifndef MINIUPNPC_H_INCLUDED
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
#define UPNPDISCOVER_MEMORY_ERROR (-102)
|
|
21
21
|
|
|
22
22
|
/* versions : */
|
|
23
|
-
#define MINIUPNPC_VERSION "2.
|
|
24
|
-
#define MINIUPNPC_API_VERSION
|
|
23
|
+
#define MINIUPNPC_VERSION "2.3.0"
|
|
24
|
+
#define MINIUPNPC_API_VERSION 19
|
|
25
25
|
|
|
26
26
|
/* Source port:
|
|
27
27
|
Using "1" as an alias for 1900 for backwards compatibility
|
|
@@ -37,7 +37,7 @@ extern "C" {
|
|
|
37
37
|
struct UPNParg { const char * elt; const char * val; };
|
|
38
38
|
|
|
39
39
|
char *
|
|
40
|
-
simpleUPnPcommand(
|
|
40
|
+
simpleUPnPcommand(const char *, const char *,
|
|
41
41
|
const char *, struct UPNParg *,
|
|
42
42
|
int *);
|
|
43
43
|
|
|
@@ -104,15 +104,21 @@ struct UPNPUrls {
|
|
|
104
104
|
char * rootdescURL;
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
+
#define UPNP_NO_IGD (0)
|
|
108
|
+
#define UPNP_CONNECTED_IGD (1)
|
|
109
|
+
#define UPNP_PRIVATEIP_IGD (2)
|
|
110
|
+
#define UPNP_DISCONNECTED_IGD (3)
|
|
111
|
+
#define UPNP_UNKNOWN_DEVICE (4)
|
|
107
112
|
/* UPNP_GetValidIGD() :
|
|
108
113
|
* return values :
|
|
109
|
-
* 0 = NO IGD found
|
|
110
|
-
* 1 = A valid connected IGD has been found
|
|
114
|
+
* 0 = NO IGD found (UPNP_NO_IGD)
|
|
115
|
+
* 1 = A valid connected IGD has been found (UPNP_CONNECTED_IGD)
|
|
111
116
|
* 2 = A valid connected IGD has been found but its
|
|
112
|
-
* IP address is reserved (non routable)
|
|
117
|
+
* IP address is reserved (non routable) (UPNP_PRIVATEIP_IGD)
|
|
113
118
|
* 3 = A valid IGD has been found but it reported as
|
|
114
|
-
* not connected
|
|
119
|
+
* not connected (UPNP_DISCONNECTED_IGD)
|
|
115
120
|
* 4 = an UPnP device has been found but was not recognized as an IGD
|
|
121
|
+
* (UPNP_UNKNOWN_DEVICE)
|
|
116
122
|
*
|
|
117
123
|
* In any non zero return case, the urls and data structures
|
|
118
124
|
* passed as parameters are set. Donc forget to call FreeUPNPUrls(urls) to
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: miniupnpc
|
|
3
|
+
Version: 2.3.0
|
|
4
|
+
Summary: MiniUPnP IGD client
|
|
5
|
+
Home-page: https://miniupnp.tuxfamily.org/
|
|
6
|
+
Author: Thomas BERNARD
|
|
7
|
+
Author-email: miniupnp@free.fr
|
|
8
|
+
License: BSD 3-Clause License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2005-2024, Thomas BERNARD
|
|
11
|
+
All rights reserved.
|
|
12
|
+
|
|
13
|
+
Redistribution and use in source and binary forms, with or without
|
|
14
|
+
modification, are permitted provided that the following conditions are met:
|
|
15
|
+
|
|
16
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
17
|
+
list of conditions and the following disclaimer.
|
|
18
|
+
|
|
19
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
20
|
+
this list of conditions and the following disclaimer in the documentation
|
|
21
|
+
and/or other materials provided with the distribution.
|
|
22
|
+
|
|
23
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
24
|
+
contributors may be used to endorse or promote products derived from
|
|
25
|
+
this software without specific prior written permission.
|
|
26
|
+
|
|
27
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
28
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
29
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
30
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
31
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
32
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
33
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
34
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
35
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
36
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
37
|
+
|
|
38
|
+
Platform: UNKNOWN
|
|
39
|
+
Description-Content-Type: text/plain
|
|
40
|
+
License-File: LICENSE
|
|
41
|
+
|
|
42
|
+
MiniUPnPc is a library enabling applications to access the services provided
|
|
43
|
+
by an UPnP "Internet Gateway Device" present on the network. In UPnP
|
|
44
|
+
terminology, MiniUPnPc is a UPnP Control Point.
|
|
45
|
+
|
|
46
|
+
MiniUPnPc is designed to have low footprint and the libc as unique
|
|
47
|
+
dependency.
|
|
48
|
+
|
|
@@ -27,6 +27,8 @@ setup(name="miniupnpc",
|
|
|
27
27
|
license=open('LICENSE').read(),
|
|
28
28
|
url='https://miniupnp.tuxfamily.org/',
|
|
29
29
|
description='MiniUPnP IGD client',
|
|
30
|
+
long_description=open('DESCRIPTION').read().strip(),
|
|
31
|
+
long_description_content_type='text/plain',
|
|
30
32
|
cmdclass={'build_ext': make_then_build_ext},
|
|
31
33
|
ext_modules=[
|
|
32
34
|
Extension(name="miniupnpc", sources=["src/miniupnpcmodule.c"],
|
|
@@ -20,13 +20,21 @@ except ImportError:
|
|
|
20
20
|
from distutils import sysconfig
|
|
21
21
|
sysconfig.get_config_vars()["OPT"] = ''
|
|
22
22
|
sysconfig.get_config_vars()["CFLAGS"] = ''
|
|
23
|
+
|
|
24
|
+
lic = open('LICENSE').read()
|
|
25
|
+
# follow the symbolic link manually if needed
|
|
26
|
+
if lic.startswith('../'):
|
|
27
|
+
lic = open(lic).read()
|
|
28
|
+
|
|
23
29
|
setup(name="miniupnpc",
|
|
24
30
|
version=open('VERSION').read().strip(),
|
|
25
31
|
author='Thomas BERNARD',
|
|
26
32
|
author_email='miniupnp@free.fr',
|
|
27
|
-
license=
|
|
33
|
+
license=lic,
|
|
28
34
|
url='https://miniupnp.tuxfamily.org/',
|
|
29
35
|
description='MiniUPnP IGD client',
|
|
36
|
+
long_description=open('DESCRIPTION').read().strip(),
|
|
37
|
+
long_description_content_type='text/plain',
|
|
30
38
|
ext_modules=[
|
|
31
39
|
Extension(name="miniupnpc", sources=["src/miniupnpcmodule.c"],
|
|
32
40
|
libraries=["ws2_32", "iphlpapi"] + compat_lib,
|
|
@@ -2,7 +2,7 @@
|
|
|
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-2024 Thomas Bernard
|
|
6
6
|
* This software is subject to the conditions detailed in the
|
|
7
7
|
* LICENCE file provided in this distribution.
|
|
8
8
|
*
|
|
@@ -83,7 +83,7 @@ int soapPostSubmit(SOCKET fd,
|
|
|
83
83
|
* Using HTTP/1.1 means we need to support chunked transfer-encoding :
|
|
84
84
|
* When using HTTP/1.1, the router "BiPAC 7404VNOX" always use chunked
|
|
85
85
|
* transfer encoding. */
|
|
86
|
-
/* Connection:
|
|
86
|
+
/* Connection: close is normally there only in HTTP/1.1 but who knows */
|
|
87
87
|
portstr[0] = '\0';
|
|
88
88
|
if(port != 80)
|
|
89
89
|
snprintf(portstr, sizeof(portstr), ":%hu", port);
|
|
@@ -98,9 +98,8 @@ int soapPostSubmit(SOCKET fd,
|
|
|
98
98
|
"Content-Type: text/xml; charset=\"utf-8\"\r\n"
|
|
99
99
|
#endif
|
|
100
100
|
"SOAPAction: \"%s\"\r\n"
|
|
101
|
-
"Connection:
|
|
101
|
+
"Connection: close\r\n"
|
|
102
102
|
"Cache-Control: no-cache\r\n" /* ??? */
|
|
103
|
-
"Pragma: no-cache\r\n"
|
|
104
103
|
"\r\n",
|
|
105
104
|
url, httpversion, host, portstr, bodysize, action);
|
|
106
105
|
if ((unsigned int)headerssize >= sizeof(headerbuf))
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/* $Id: minissdpc.c,v 1.
|
|
1
|
+
/* $Id: minissdpc.c,v 1.51 2024/05/16 00:12:05 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/
|
|
5
5
|
* Author : Thomas BERNARD
|
|
6
|
-
* copyright (c) 2005-
|
|
6
|
+
* copyright (c) 2005-2024 Thomas Bernard
|
|
7
7
|
* This software is subjet to the conditions detailed in the
|
|
8
8
|
* provided LICENCE file. */
|
|
9
9
|
#include <stdio.h>
|
|
@@ -548,7 +548,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|
|
548
548
|
#ifdef _WIN32
|
|
549
549
|
unsigned long _ttl = (unsigned long)ttl;
|
|
550
550
|
#endif
|
|
551
|
-
int linklocal =
|
|
551
|
+
int linklocal = 0; /* try first with site-local multicast */
|
|
552
552
|
int sentok;
|
|
553
553
|
|
|
554
554
|
if(error)
|
|
@@ -1007,9 +1007,10 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|
|
1007
1007
|
/* switch linklocal flag */
|
|
1008
1008
|
if(linklocal) {
|
|
1009
1009
|
linklocal = 0;
|
|
1010
|
-
--deviceIndex;
|
|
1011
1010
|
} else {
|
|
1011
|
+
/* try again with linklocal multicast */
|
|
1012
1012
|
linklocal = 1;
|
|
1013
|
+
--deviceIndex;
|
|
1013
1014
|
}
|
|
1014
1015
|
}
|
|
1015
1016
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/* $Id: miniupnpc.c,v 1.
|
|
1
|
+
/* $Id: miniupnpc.c,v 1.165 2025/01/10 22:57:21 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/
|
|
5
5
|
* Author : Thomas BERNARD
|
|
6
|
-
* copyright (c) 2005-
|
|
6
|
+
* copyright (c) 2005-2025 Thomas Bernard
|
|
7
7
|
* This software is subjet to the conditions detailed in the
|
|
8
8
|
* provided LICENSE file. */
|
|
9
9
|
#include <stdlib.h>
|
|
@@ -92,15 +92,15 @@ MINIUPNP_LIBSPEC void parserootdesc(const char * buffer, int bufsize, struct IGD
|
|
|
92
92
|
#endif
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
/*
|
|
95
|
+
/* simpleUPnPcommand :
|
|
96
96
|
* not so simple !
|
|
97
97
|
* return values :
|
|
98
98
|
* pointer - OK
|
|
99
99
|
* NULL - error */
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
char *
|
|
101
|
+
simpleUPnPcommand(const char * url, const char * service,
|
|
102
|
+
const char * action, struct UPNParg * args,
|
|
103
|
+
int * bufsize)
|
|
104
104
|
{
|
|
105
105
|
char hostname[MAXHOSTNAMELEN+1];
|
|
106
106
|
unsigned short port = 0;
|
|
@@ -111,6 +111,7 @@ simpleUPnPcommand2(SOCKET s, const char * url, const char * service,
|
|
|
111
111
|
char * buf;
|
|
112
112
|
int n;
|
|
113
113
|
int status_code;
|
|
114
|
+
SOCKET s;
|
|
114
115
|
|
|
115
116
|
*bufsize = 0;
|
|
116
117
|
snprintf(soapact, sizeof(soapact), "%s#%s", service, action);
|
|
@@ -197,15 +198,13 @@ simpleUPnPcommand2(SOCKET s, const char * url, const char * service,
|
|
|
197
198
|
return NULL;
|
|
198
199
|
}
|
|
199
200
|
if(!parseURL(url, hostname, &port, &path, NULL)) return NULL;
|
|
201
|
+
s = connecthostport(hostname, port, 0);
|
|
200
202
|
if(ISINVALID(s)) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
/* failed to connect */
|
|
204
|
-
return NULL;
|
|
205
|
-
}
|
|
203
|
+
/* failed to connect */
|
|
204
|
+
return NULL;
|
|
206
205
|
}
|
|
207
206
|
|
|
208
|
-
n = soapPostSubmit(s, path, hostname, port, soapact, soapbody,
|
|
207
|
+
n = soapPostSubmit(s, path, hostname, port, soapact, soapbody, "1.1");
|
|
209
208
|
if(n<=0) {
|
|
210
209
|
#ifdef DEBUG
|
|
211
210
|
printf("Error sending SOAP request\n");
|
|
@@ -229,33 +228,6 @@ simpleUPnPcommand2(SOCKET s, const char * url, const char * service,
|
|
|
229
228
|
return buf;
|
|
230
229
|
}
|
|
231
230
|
|
|
232
|
-
/* simpleUPnPcommand :
|
|
233
|
-
* not so simple !
|
|
234
|
-
* return values :
|
|
235
|
-
* pointer - OK
|
|
236
|
-
* NULL - error */
|
|
237
|
-
char *
|
|
238
|
-
simpleUPnPcommand(int s, const char * url, const char * service,
|
|
239
|
-
const char * action, struct UPNParg * args,
|
|
240
|
-
int * bufsize)
|
|
241
|
-
{
|
|
242
|
-
char * buf;
|
|
243
|
-
|
|
244
|
-
#if 1
|
|
245
|
-
buf = simpleUPnPcommand2((SOCKET)s, url, service, action, args, bufsize, "1.1");
|
|
246
|
-
#else
|
|
247
|
-
buf = simpleUPnPcommand2((SOCKET)s, url, service, action, args, bufsize, "1.0");
|
|
248
|
-
if (!buf || *bufsize == 0)
|
|
249
|
-
{
|
|
250
|
-
#if DEBUG
|
|
251
|
-
printf("Error or no result from SOAP request; retrying with HTTP/1.1\n");
|
|
252
|
-
#endif
|
|
253
|
-
buf = simpleUPnPcommand2((SOCKET)s, url, service, action, args, bufsize, "1.1");
|
|
254
|
-
}
|
|
255
|
-
#endif
|
|
256
|
-
return buf;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
231
|
/* upnpDiscoverDevices() :
|
|
260
232
|
* return a chained list of all devices found or NULL if
|
|
261
233
|
* no devices was found.
|
|
@@ -532,13 +504,14 @@ UPNPIGD_IsConnected(struct UPNPUrls * urls, struct IGDdatas * data)
|
|
|
532
504
|
/* UPNP_GetValidIGD() :
|
|
533
505
|
* return values :
|
|
534
506
|
* -1 = Internal error
|
|
535
|
-
* 0 = NO IGD found
|
|
536
|
-
* 1 = A valid connected IGD has been found
|
|
507
|
+
* 0 = NO IGD found (UPNP_NO_IGD)
|
|
508
|
+
* 1 = A valid connected IGD has been found (UPNP_CONNECTED_IGD)
|
|
537
509
|
* 2 = A valid connected IGD has been found but its
|
|
538
|
-
* IP address is reserved (non routable)
|
|
510
|
+
* IP address is reserved (non routable) (UPNP_PRIVATEIP_IGD)
|
|
539
511
|
* 3 = A valid IGD has been found but it reported as
|
|
540
|
-
* not connected
|
|
512
|
+
* not connected (UPNP_DISCONNECTED_IGD)
|
|
541
513
|
* 4 = an UPnP device has been found but was not recognized as an IGD
|
|
514
|
+
* (UPNP_UNKNOWN_DEVICE)
|
|
542
515
|
*
|
|
543
516
|
* In any positive non zero return case, the urls and data structures
|
|
544
517
|
* passed as parameters are set. Don't forget to call FreeUPNPUrls(urls) to
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/* $Id: miniupnpcmodule.c,v 1.
|
|
1
|
+
/* $Id: miniupnpcmodule.c,v 1.40 2024/05/09 15:10:29 nanard Exp $*/
|
|
2
2
|
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
|
3
3
|
* Project : miniupnp
|
|
4
4
|
* Author : Thomas BERNARD
|
|
5
5
|
* website : https://miniupnp.tuxfamily.org/
|
|
6
|
-
* copyright (c) 2007-
|
|
6
|
+
* copyright (c) 2007-2024 Thomas Bernard
|
|
7
7
|
* This software is subjet to the conditions detailed in the
|
|
8
8
|
* provided LICENCE file. */
|
|
9
9
|
#include <Python.h>
|
|
@@ -58,7 +58,7 @@ static PyMemberDef UPnP_members[] = {
|
|
|
58
58
|
{"lanaddr", T_STRING_INPLACE, offsetof(UPnPObject, lanaddr),
|
|
59
59
|
READONLY, "ip address on the LAN"
|
|
60
60
|
},
|
|
61
|
-
{"wanaddr", T_STRING_INPLACE, offsetof(UPnPObject,
|
|
61
|
+
{"wanaddr", T_STRING_INPLACE, offsetof(UPnPObject, wanaddr),
|
|
62
62
|
READONLY, "public ip address on the WAN"
|
|
63
63
|
},
|
|
64
64
|
{"discoverdelay", T_UINT, offsetof(UPnPObject, discoverdelay),
|
|
@@ -2,7 +2,7 @@
|
|
|
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-2024 Thomas Bernard
|
|
6
6
|
* This software is subject to the conditions detailed in the
|
|
7
7
|
* LICENCE file provided in this distribution. */
|
|
8
8
|
|
|
@@ -443,9 +443,8 @@ miniwget3(const char * host,
|
|
|
443
443
|
len = snprintf(buf, sizeof(buf),
|
|
444
444
|
"GET %s HTTP/%s\r\n"
|
|
445
445
|
"Host: %s:%d\r\n"
|
|
446
|
-
"Connection:
|
|
446
|
+
"Connection: close\r\n"
|
|
447
447
|
"User-Agent: " OS_STRING " " UPNP_VERSION_STRING " MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n"
|
|
448
|
-
|
|
449
448
|
"\r\n",
|
|
450
449
|
path, httpversion, host, port);
|
|
451
450
|
if ((unsigned int)len >= sizeof(buf))
|
|
@@ -474,41 +473,6 @@ miniwget3(const char * host,
|
|
|
474
473
|
return content;
|
|
475
474
|
}
|
|
476
475
|
|
|
477
|
-
/* miniwget2() :
|
|
478
|
-
* Call miniwget3(); retry with HTTP/1.1 if 1.0 fails. */
|
|
479
|
-
static void *
|
|
480
|
-
miniwget2(const char * host,
|
|
481
|
-
unsigned short port, const char * path,
|
|
482
|
-
int * size, char * addr_str, int addr_str_len,
|
|
483
|
-
unsigned int scope_id, int * status_code)
|
|
484
|
-
{
|
|
485
|
-
char * respbuffer;
|
|
486
|
-
|
|
487
|
-
#if 1
|
|
488
|
-
respbuffer = miniwget3(host, port, path, size,
|
|
489
|
-
addr_str, addr_str_len, "1.1",
|
|
490
|
-
scope_id, status_code);
|
|
491
|
-
#else
|
|
492
|
-
respbuffer = miniwget3(host, port, path, size,
|
|
493
|
-
addr_str, addr_str_len, "1.0",
|
|
494
|
-
scope_id, status_code);
|
|
495
|
-
if (*size == 0)
|
|
496
|
-
{
|
|
497
|
-
#ifdef DEBUG
|
|
498
|
-
printf("Retrying with HTTP/1.1\n");
|
|
499
|
-
#endif
|
|
500
|
-
free(respbuffer);
|
|
501
|
-
respbuffer = miniwget3(host, port, path, size,
|
|
502
|
-
addr_str, addr_str_len, "1.1",
|
|
503
|
-
scope_id, status_code);
|
|
504
|
-
}
|
|
505
|
-
#endif
|
|
506
|
-
return respbuffer;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
476
|
/* parseURL()
|
|
513
477
|
* arguments :
|
|
514
478
|
* url : source string not modified
|
|
@@ -639,7 +603,7 @@ miniwget(const char * url, int * size,
|
|
|
639
603
|
printf("parsed url : hostname='%s' port=%hu path='%s' scope_id=%u\n",
|
|
640
604
|
hostname, port, path, scope_id);
|
|
641
605
|
#endif
|
|
642
|
-
return
|
|
606
|
+
return miniwget3(hostname, port, path, size, 0, 0, "1.1", scope_id, status_code);
|
|
643
607
|
}
|
|
644
608
|
|
|
645
609
|
void *
|
|
@@ -660,5 +624,5 @@ miniwget_getaddr(const char * url, int * size,
|
|
|
660
624
|
printf("parsed url : hostname='%s' port=%hu path='%s' scope_id=%u\n",
|
|
661
625
|
hostname, port, path, scope_id);
|
|
662
626
|
#endif
|
|
663
|
-
return
|
|
627
|
+
return miniwget3(hostname, port, path, size, addr, addrlen, "1.1", scope_id, status_code);
|
|
664
628
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* $Id: upnpc.c,v 1.
|
|
1
|
+
/* $Id: upnpc.c,v 1.146 2025/01/10 23:02:54 nanard Exp $ */
|
|
2
2
|
/* Project : miniupnp
|
|
3
3
|
* Author : Thomas Bernard
|
|
4
|
-
* Copyright (c) 2005-
|
|
4
|
+
* Copyright (c) 2005-2025 Thomas Bernard
|
|
5
5
|
* This software is subject to the conditions detailed in the
|
|
6
6
|
* LICENCE file provided in this distribution. */
|
|
7
7
|
|
|
@@ -403,7 +403,7 @@ static void GetFirewallStatus(struct UPNPUrls * urls, struct IGDdatas * data)
|
|
|
403
403
|
/* Test function
|
|
404
404
|
* 1 - Add pinhole
|
|
405
405
|
* 2 - Check if pinhole is working from the IGD side */
|
|
406
|
-
static
|
|
406
|
+
static int SetPinholeAndTest(struct UPNPUrls * urls, struct IGDdatas * data,
|
|
407
407
|
const char * remoteaddr, const char * eport,
|
|
408
408
|
const char * intaddr, const char * iport,
|
|
409
409
|
const char * proto, const char * lease_time)
|
|
@@ -416,7 +416,7 @@ static void SetPinholeAndTest(struct UPNPUrls * urls, struct IGDdatas * data,
|
|
|
416
416
|
if(!intaddr || !remoteaddr || !iport || !eport || !proto || !lease_time)
|
|
417
417
|
{
|
|
418
418
|
fprintf(stderr, "Wrong arguments\n");
|
|
419
|
-
return;
|
|
419
|
+
return -1;
|
|
420
420
|
}
|
|
421
421
|
if(atoi(proto) == 0)
|
|
422
422
|
{
|
|
@@ -435,13 +435,16 @@ static void SetPinholeAndTest(struct UPNPUrls * urls, struct IGDdatas * data,
|
|
|
435
435
|
else
|
|
436
436
|
{
|
|
437
437
|
fprintf(stderr, "invalid protocol\n");
|
|
438
|
-
return;
|
|
438
|
+
return -1;
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
r = UPNP_AddPinhole(urls->controlURL_6FC, data->IPv6FC.servicetype, remoteaddr, eport, intaddr, iport, proto, lease_time, uniqueID);
|
|
442
442
|
if(r!=UPNPCOMMAND_SUCCESS)
|
|
443
|
+
{
|
|
443
444
|
printf("AddPinhole([%s]:%s -> [%s]:%s) failed with code %d (%s)\n",
|
|
444
445
|
remoteaddr, eport, intaddr, iport, r, strupnperror(r));
|
|
446
|
+
return -2;
|
|
447
|
+
}
|
|
445
448
|
else
|
|
446
449
|
{
|
|
447
450
|
printf("AddPinhole: ([%s]:%s -> [%s]:%s) / Pinhole ID = %s\n",
|
|
@@ -451,6 +454,7 @@ static void SetPinholeAndTest(struct UPNPUrls * urls, struct IGDdatas * data,
|
|
|
451
454
|
printf("CheckPinholeWorking() failed with code %d (%s)\n", r, strupnperror(r));
|
|
452
455
|
printf("CheckPinholeWorking: Pinhole ID = %s / IsWorking = %s\n", uniqueID, (isWorking)? "Yes":"No");*/
|
|
453
456
|
}
|
|
457
|
+
return 0;
|
|
454
458
|
}
|
|
455
459
|
|
|
456
460
|
/* Test function
|
|
@@ -548,7 +552,7 @@ CheckPinhole(struct UPNPUrls * urls,
|
|
|
548
552
|
printf("CheckPinholeWorking: Pinhole ID = %s / IsWorking = %s\n", uniqueID, (isWorking)? "Yes":"No");
|
|
549
553
|
}
|
|
550
554
|
|
|
551
|
-
static
|
|
555
|
+
static int
|
|
552
556
|
RemovePinhole(struct UPNPUrls * urls,
|
|
553
557
|
struct IGDdatas * data, const char * uniqueID)
|
|
554
558
|
{
|
|
@@ -556,10 +560,11 @@ RemovePinhole(struct UPNPUrls * urls,
|
|
|
556
560
|
if(!uniqueID)
|
|
557
561
|
{
|
|
558
562
|
fprintf(stderr, "invalid arguments\n");
|
|
559
|
-
return;
|
|
563
|
+
return -1;
|
|
560
564
|
}
|
|
561
565
|
r = UPNP_DeletePinhole(urls->controlURL_6FC, data->IPv6FC.servicetype, uniqueID);
|
|
562
566
|
printf("UPNP_DeletePinhole() returned : %d\n", r);
|
|
567
|
+
return r;
|
|
563
568
|
}
|
|
564
569
|
|
|
565
570
|
static void usage(FILE * out, const char * argv0) {
|
|
@@ -604,7 +609,7 @@ int main(int argc, char ** argv)
|
|
|
604
609
|
int commandargc = 0;
|
|
605
610
|
struct UPNPDev * devlist = 0;
|
|
606
611
|
char lanaddr[64] = "unset"; /* my ip address on the LAN */
|
|
607
|
-
char wanaddr[64] = "
|
|
612
|
+
char wanaddr[64] = "unset"; /* up address of the IGD on the WAN */
|
|
608
613
|
int i;
|
|
609
614
|
const char * rootdescurl = 0;
|
|
610
615
|
const char * multicastif = 0;
|
|
@@ -627,7 +632,7 @@ int main(int argc, char ** argv)
|
|
|
627
632
|
}
|
|
628
633
|
#endif
|
|
629
634
|
printf("upnpc: miniupnpc library test client, version %s.\n", MINIUPNPC_VERSION_STRING);
|
|
630
|
-
printf(" (c) 2005-
|
|
635
|
+
printf(" (c) 2005-2025 Thomas Bernard.\n");
|
|
631
636
|
printf("More information at https://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/\n\n");
|
|
632
637
|
|
|
633
638
|
/* command line processing */
|
|
@@ -731,17 +736,17 @@ int main(int argc, char ** argv)
|
|
|
731
736
|
|| (i = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr), wanaddr, sizeof(wanaddr))))
|
|
732
737
|
{
|
|
733
738
|
switch(i) {
|
|
734
|
-
case
|
|
739
|
+
case UPNP_CONNECTED_IGD:
|
|
735
740
|
printf("Found valid IGD : %s\n", urls.controlURL);
|
|
736
741
|
break;
|
|
737
|
-
case
|
|
742
|
+
case UPNP_PRIVATEIP_IGD:
|
|
738
743
|
printf("Found an IGD with a reserved IP address (%s) : %s\n", wanaddr, urls.controlURL);
|
|
739
744
|
break;
|
|
740
|
-
case
|
|
745
|
+
case UPNP_DISCONNECTED_IGD:
|
|
741
746
|
printf("Found a (not connected?) IGD : %s\n", urls.controlURL);
|
|
742
747
|
if (ignore) printf("Trying to continue anyway\n");
|
|
743
748
|
break;
|
|
744
|
-
case
|
|
749
|
+
case UPNP_UNKNOWN_DEVICE:
|
|
745
750
|
printf("UPnP device found. Is it an IGD ? : %s\n", urls.controlURL);
|
|
746
751
|
if (ignore) printf("Trying to continue anyway\n");
|
|
747
752
|
break;
|
|
@@ -749,7 +754,7 @@ int main(int argc, char ** argv)
|
|
|
749
754
|
printf("Found device (igd ?) : %s\n", urls.controlURL);
|
|
750
755
|
if (ignore) printf("Trying to continue anyway\n");
|
|
751
756
|
}
|
|
752
|
-
if(i==
|
|
757
|
+
if(i==UPNP_CONNECTED_IGD || i==UPNP_PRIVATEIP_IGD || ignore) {
|
|
753
758
|
|
|
754
759
|
printf("Local LAN ip address : %s\n", lanaddr);
|
|
755
760
|
#if 0
|
|
@@ -863,10 +868,11 @@ int main(int argc, char ** argv)
|
|
|
863
868
|
}
|
|
864
869
|
break;
|
|
865
870
|
case 'A':
|
|
866
|
-
SetPinholeAndTest(&urls, &data,
|
|
871
|
+
if (SetPinholeAndTest(&urls, &data,
|
|
867
872
|
commandargv[0], commandargv[1],
|
|
868
873
|
commandargv[2], commandargv[3],
|
|
869
|
-
commandargv[4], commandargv[5])
|
|
874
|
+
commandargv[4], commandargv[5]) < 0)
|
|
875
|
+
retcode = 2;
|
|
870
876
|
break;
|
|
871
877
|
case 'U':
|
|
872
878
|
GetPinholeAndUpdate(&urls, &data,
|
|
@@ -887,7 +893,8 @@ int main(int argc, char ** argv)
|
|
|
887
893
|
case 'D':
|
|
888
894
|
for(i=0; i<commandargc; i++)
|
|
889
895
|
{
|
|
890
|
-
RemovePinhole(&urls, &data, commandargv[i])
|
|
896
|
+
if (RemovePinhole(&urls, &data, commandargv[i]) < 0)
|
|
897
|
+
retcode = 2;
|
|
891
898
|
}
|
|
892
899
|
break;
|
|
893
900
|
case 'S':
|
|
@@ -2,7 +2,7 @@
|
|
|
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
|
* */
|
|
@@ -31,7 +31,7 @@ UPNP_GetTotalBytesSent(const char * controlURL,
|
|
|
31
31
|
int bufsize;
|
|
32
32
|
unsigned int r = 0;
|
|
33
33
|
char * p;
|
|
34
|
-
if(!(buffer = simpleUPnPcommand(
|
|
34
|
+
if(!(buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
35
35
|
"GetTotalBytesSent", 0, &bufsize))) {
|
|
36
36
|
return (UNSIGNED_INTEGER)UPNPCOMMAND_HTTP_ERROR;
|
|
37
37
|
}
|
|
@@ -55,7 +55,7 @@ UPNP_GetTotalBytesReceived(const char * controlURL,
|
|
|
55
55
|
int bufsize;
|
|
56
56
|
unsigned int r = 0;
|
|
57
57
|
char * p;
|
|
58
|
-
if(!(buffer = simpleUPnPcommand(
|
|
58
|
+
if(!(buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
59
59
|
"GetTotalBytesReceived", 0, &bufsize))) {
|
|
60
60
|
return (UNSIGNED_INTEGER)UPNPCOMMAND_HTTP_ERROR;
|
|
61
61
|
}
|
|
@@ -79,7 +79,7 @@ UPNP_GetTotalPacketsSent(const char * controlURL,
|
|
|
79
79
|
int bufsize;
|
|
80
80
|
unsigned int r = 0;
|
|
81
81
|
char * p;
|
|
82
|
-
if(!(buffer = simpleUPnPcommand(
|
|
82
|
+
if(!(buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
83
83
|
"GetTotalPacketsSent", 0, &bufsize))) {
|
|
84
84
|
return (UNSIGNED_INTEGER)UPNPCOMMAND_HTTP_ERROR;
|
|
85
85
|
}
|
|
@@ -103,7 +103,7 @@ UPNP_GetTotalPacketsReceived(const char * controlURL,
|
|
|
103
103
|
int bufsize;
|
|
104
104
|
unsigned int r = 0;
|
|
105
105
|
char * p;
|
|
106
|
-
if(!(buffer = simpleUPnPcommand(
|
|
106
|
+
if(!(buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
107
107
|
"GetTotalPacketsReceived", 0, &bufsize))) {
|
|
108
108
|
return (UNSIGNED_INTEGER)UPNPCOMMAND_HTTP_ERROR;
|
|
109
109
|
}
|
|
@@ -136,7 +136,7 @@ UPNP_GetStatusInfo(const char * controlURL,
|
|
|
136
136
|
if(!status && !uptime)
|
|
137
137
|
return UPNPCOMMAND_INVALID_ARGS;
|
|
138
138
|
|
|
139
|
-
if(!(buffer = simpleUPnPcommand(
|
|
139
|
+
if(!(buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
140
140
|
"GetStatusInfo", 0, &bufsize))) {
|
|
141
141
|
return UPNPCOMMAND_HTTP_ERROR;
|
|
142
142
|
}
|
|
@@ -197,7 +197,7 @@ UPNP_GetConnectionTypeInfo(const char * controlURL,
|
|
|
197
197
|
if(!connectionType)
|
|
198
198
|
return UPNPCOMMAND_INVALID_ARGS;
|
|
199
199
|
|
|
200
|
-
if(!(buffer = simpleUPnPcommand(
|
|
200
|
+
if(!(buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
201
201
|
"GetConnectionTypeInfo", 0, &bufsize))) {
|
|
202
202
|
return UPNPCOMMAND_HTTP_ERROR;
|
|
203
203
|
}
|
|
@@ -244,7 +244,7 @@ UPNP_GetLinkLayerMaxBitRates(const char * controlURL,
|
|
|
244
244
|
return UPNPCOMMAND_INVALID_ARGS;
|
|
245
245
|
|
|
246
246
|
/* shouldn't we use GetCommonLinkProperties ? */
|
|
247
|
-
if(!(buffer = simpleUPnPcommand(
|
|
247
|
+
if(!(buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
248
248
|
"GetCommonLinkProperties", 0, &bufsize))) {
|
|
249
249
|
/*"GetLinkLayerMaxBitRates", 0, &bufsize);*/
|
|
250
250
|
return UPNPCOMMAND_HTTP_ERROR;
|
|
@@ -309,7 +309,7 @@ UPNP_GetExternalIPAddress(const char * controlURL,
|
|
|
309
309
|
if(!extIpAdd || !controlURL || !servicetype)
|
|
310
310
|
return UPNPCOMMAND_INVALID_ARGS;
|
|
311
311
|
|
|
312
|
-
if(!(buffer = simpleUPnPcommand(
|
|
312
|
+
if(!(buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
313
313
|
"GetExternalIPAddress", 0, &bufsize))) {
|
|
314
314
|
return UPNPCOMMAND_HTTP_ERROR;
|
|
315
315
|
}
|
|
@@ -374,7 +374,7 @@ UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
|
|
|
374
374
|
AddPortMappingArgs[6].val = desc?desc:"libminiupnpc";
|
|
375
375
|
AddPortMappingArgs[7].elt = "NewLeaseDuration";
|
|
376
376
|
AddPortMappingArgs[7].val = leaseDuration?leaseDuration:"0";
|
|
377
|
-
buffer = simpleUPnPcommand(
|
|
377
|
+
buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
378
378
|
"AddPortMapping", AddPortMappingArgs,
|
|
379
379
|
&bufsize);
|
|
380
380
|
free(AddPortMappingArgs);
|
|
@@ -438,7 +438,7 @@ UPNP_AddAnyPortMapping(const char * controlURL, const char * servicetype,
|
|
|
438
438
|
AddPortMappingArgs[6].val = desc?desc:"libminiupnpc";
|
|
439
439
|
AddPortMappingArgs[7].elt = "NewLeaseDuration";
|
|
440
440
|
AddPortMappingArgs[7].val = leaseDuration?leaseDuration:"0";
|
|
441
|
-
buffer = simpleUPnPcommand(
|
|
441
|
+
buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
442
442
|
"AddAnyPortMapping", AddPortMappingArgs,
|
|
443
443
|
&bufsize);
|
|
444
444
|
free(AddPortMappingArgs);
|
|
@@ -492,7 +492,7 @@ UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
|
|
|
492
492
|
DeletePortMappingArgs[1].val = extPort;
|
|
493
493
|
DeletePortMappingArgs[2].elt = "NewProtocol";
|
|
494
494
|
DeletePortMappingArgs[2].val = proto;
|
|
495
|
-
buffer = simpleUPnPcommand(
|
|
495
|
+
buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
496
496
|
"DeletePortMapping",
|
|
497
497
|
DeletePortMappingArgs, &bufsize);
|
|
498
498
|
free(DeletePortMappingArgs);
|
|
@@ -515,9 +515,9 @@ UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
|
|
|
515
515
|
|
|
516
516
|
MINIUPNP_LIBSPEC int
|
|
517
517
|
UPNP_DeletePortMappingRange(const char * controlURL, const char * servicetype,
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
518
|
+
const char * extPortStart, const char * extPortEnd,
|
|
519
|
+
const char * proto,
|
|
520
|
+
const char * manage)
|
|
521
521
|
{
|
|
522
522
|
struct UPNParg * DeletePortMappingArgs;
|
|
523
523
|
char * buffer;
|
|
@@ -541,7 +541,7 @@ UPNP_DeletePortMappingRange(const char * controlURL, const char * servicetype,
|
|
|
541
541
|
DeletePortMappingArgs[3].elt = "NewManage";
|
|
542
542
|
DeletePortMappingArgs[3].val = manage;
|
|
543
543
|
|
|
544
|
-
buffer = simpleUPnPcommand(
|
|
544
|
+
buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
545
545
|
"DeletePortMappingRange",
|
|
546
546
|
DeletePortMappingArgs, &bufsize);
|
|
547
547
|
free(DeletePortMappingArgs);
|
|
@@ -589,7 +589,7 @@ UPNP_GetGenericPortMappingEntry(const char * controlURL,
|
|
|
589
589
|
return UPNPCOMMAND_MEM_ALLOC_ERROR;
|
|
590
590
|
GetPortMappingArgs[0].elt = "NewPortMappingIndex";
|
|
591
591
|
GetPortMappingArgs[0].val = index;
|
|
592
|
-
buffer = simpleUPnPcommand(
|
|
592
|
+
buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
593
593
|
"GetGenericPortMappingEntry",
|
|
594
594
|
GetPortMappingArgs, &bufsize);
|
|
595
595
|
free(GetPortMappingArgs);
|
|
@@ -663,12 +663,12 @@ UPNP_GetPortMappingNumberOfEntries(const char * controlURL,
|
|
|
663
663
|
const char * servicetype,
|
|
664
664
|
unsigned int * numEntries)
|
|
665
665
|
{
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
666
|
+
struct NameValueParserData pdata;
|
|
667
|
+
char * buffer;
|
|
668
|
+
int bufsize;
|
|
669
|
+
char* p;
|
|
670
670
|
int ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
|
671
|
-
|
|
671
|
+
if(!(buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
672
672
|
"GetPortMappingNumberOfEntries", 0,
|
|
673
673
|
&bufsize))) {
|
|
674
674
|
return UPNPCOMMAND_HTTP_ERROR;
|
|
@@ -676,15 +676,15 @@ UPNP_GetPortMappingNumberOfEntries(const char * controlURL,
|
|
|
676
676
|
#ifdef DEBUG
|
|
677
677
|
DisplayNameValueList(buffer, bufsize);
|
|
678
678
|
#endif
|
|
679
|
-
|
|
679
|
+
ParseNameValue(buffer, bufsize, &pdata);
|
|
680
680
|
free(buffer);
|
|
681
681
|
|
|
682
|
-
|
|
683
|
-
|
|
682
|
+
p = GetValueFromNameValueList(&pdata, "NewPortMappingNumberOfEntries");
|
|
683
|
+
if(numEntries && p) {
|
|
684
684
|
*numEntries = 0;
|
|
685
|
-
|
|
685
|
+
sscanf(p, "%u", numEntries);
|
|
686
686
|
ret = UPNPCOMMAND_SUCCESS;
|
|
687
|
-
|
|
687
|
+
}
|
|
688
688
|
|
|
689
689
|
p = GetValueFromNameValueList(&pdata, "errorCode");
|
|
690
690
|
if(p) {
|
|
@@ -692,7 +692,7 @@ UPNP_GetPortMappingNumberOfEntries(const char * controlURL,
|
|
|
692
692
|
sscanf(p, "%d", &ret);
|
|
693
693
|
}
|
|
694
694
|
|
|
695
|
-
|
|
695
|
+
ClearNameValueList(&pdata);
|
|
696
696
|
return ret;
|
|
697
697
|
}
|
|
698
698
|
|
|
@@ -730,7 +730,7 @@ UPNP_GetSpecificPortMappingEntry(const char * controlURL,
|
|
|
730
730
|
GetPortMappingArgs[1].val = extPort;
|
|
731
731
|
GetPortMappingArgs[2].elt = "NewProtocol";
|
|
732
732
|
GetPortMappingArgs[2].val = proto;
|
|
733
|
-
buffer = simpleUPnPcommand(
|
|
733
|
+
buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
734
734
|
"GetSpecificPortMappingEntry",
|
|
735
735
|
GetPortMappingArgs, &bufsize);
|
|
736
736
|
free(GetPortMappingArgs);
|
|
@@ -826,7 +826,7 @@ UPNP_GetListOfPortMappings(const char * controlURL,
|
|
|
826
826
|
GetListOfPortMappingsArgs[4].elt = "NewNumberOfPorts";
|
|
827
827
|
GetListOfPortMappingsArgs[4].val = numberOfPorts?numberOfPorts:"1000";
|
|
828
828
|
|
|
829
|
-
buffer = simpleUPnPcommand(
|
|
829
|
+
buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
830
830
|
"GetListOfPortMappings",
|
|
831
831
|
GetListOfPortMappingsArgs, &bufsize);
|
|
832
832
|
free(GetListOfPortMappingsArgs);
|
|
@@ -892,7 +892,7 @@ UPNP_GetFirewallStatus(const char * controlURL,
|
|
|
892
892
|
if(!firewallEnabled || !inboundPinholeAllowed)
|
|
893
893
|
return UPNPCOMMAND_INVALID_ARGS;
|
|
894
894
|
|
|
895
|
-
buffer = simpleUPnPcommand(
|
|
895
|
+
buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
896
896
|
"GetFirewallStatus", 0, &bufsize);
|
|
897
897
|
if(!buffer) {
|
|
898
898
|
return UPNPCOMMAND_HTTP_ERROR;
|
|
@@ -953,7 +953,7 @@ UPNP_GetOutboundPinholeTimeout(const char * controlURL, const char * servicetype
|
|
|
953
953
|
GetOutboundPinholeTimeoutArgs[3].val = intPort;
|
|
954
954
|
GetOutboundPinholeTimeoutArgs[4].elt = "InternalClient";
|
|
955
955
|
GetOutboundPinholeTimeoutArgs[4].val = intClient;
|
|
956
|
-
buffer = simpleUPnPcommand(
|
|
956
|
+
buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
957
957
|
"GetOutboundPinholeTimeout", GetOutboundPinholeTimeoutArgs, &bufsize);
|
|
958
958
|
free(GetOutboundPinholeTimeoutArgs);
|
|
959
959
|
if(!buffer)
|
|
@@ -1030,7 +1030,7 @@ UPNP_AddPinhole(const char * controlURL, const char * servicetype,
|
|
|
1030
1030
|
}
|
|
1031
1031
|
AddPinholeArgs[5].elt = "LeaseTime";
|
|
1032
1032
|
AddPinholeArgs[5].val = leaseTime;
|
|
1033
|
-
buffer = simpleUPnPcommand(
|
|
1033
|
+
buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
1034
1034
|
"AddPinhole", AddPinholeArgs, &bufsize);
|
|
1035
1035
|
free(AddPinholeArgs);
|
|
1036
1036
|
if(!buffer)
|
|
@@ -1080,7 +1080,7 @@ UPNP_UpdatePinhole(const char * controlURL, const char * servicetype,
|
|
|
1080
1080
|
UpdatePinholeArgs[0].val = uniqueID;
|
|
1081
1081
|
UpdatePinholeArgs[1].elt = "NewLeaseTime";
|
|
1082
1082
|
UpdatePinholeArgs[1].val = leaseTime;
|
|
1083
|
-
buffer = simpleUPnPcommand(
|
|
1083
|
+
buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
1084
1084
|
"UpdatePinhole", UpdatePinholeArgs, &bufsize);
|
|
1085
1085
|
free(UpdatePinholeArgs);
|
|
1086
1086
|
if(!buffer)
|
|
@@ -1121,7 +1121,7 @@ UPNP_DeletePinhole(const char * controlURL, const char * servicetype, const char
|
|
|
1121
1121
|
return UPNPCOMMAND_MEM_ALLOC_ERROR;
|
|
1122
1122
|
DeletePinholeArgs[0].elt = "UniqueID";
|
|
1123
1123
|
DeletePinholeArgs[0].val = uniqueID;
|
|
1124
|
-
buffer = simpleUPnPcommand(
|
|
1124
|
+
buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
1125
1125
|
"DeletePinhole", DeletePinholeArgs, &bufsize);
|
|
1126
1126
|
free(DeletePinholeArgs);
|
|
1127
1127
|
if(!buffer)
|
|
@@ -1162,7 +1162,7 @@ UPNP_CheckPinholeWorking(const char * controlURL, const char * servicetype,
|
|
|
1162
1162
|
return UPNPCOMMAND_MEM_ALLOC_ERROR;
|
|
1163
1163
|
CheckPinholeWorkingArgs[0].elt = "UniqueID";
|
|
1164
1164
|
CheckPinholeWorkingArgs[0].val = uniqueID;
|
|
1165
|
-
buffer = simpleUPnPcommand(
|
|
1165
|
+
buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
1166
1166
|
"CheckPinholeWorking", CheckPinholeWorkingArgs, &bufsize);
|
|
1167
1167
|
free(CheckPinholeWorkingArgs);
|
|
1168
1168
|
if(!buffer)
|
|
@@ -1211,7 +1211,7 @@ UPNP_GetPinholePackets(const char * controlURL, const char * servicetype,
|
|
|
1211
1211
|
return UPNPCOMMAND_MEM_ALLOC_ERROR;
|
|
1212
1212
|
GetPinholePacketsArgs[0].elt = "UniqueID";
|
|
1213
1213
|
GetPinholePacketsArgs[0].val = uniqueID;
|
|
1214
|
-
buffer = simpleUPnPcommand(
|
|
1214
|
+
buffer = simpleUPnPcommand(controlURL, servicetype,
|
|
1215
1215
|
"GetPinholePackets", GetPinholePacketsArgs, &bufsize);
|
|
1216
1216
|
free(GetPinholePacketsArgs);
|
|
1217
1217
|
if(!buffer)
|
miniupnpc-2.2.7/PKG-INFO
DELETED
miniupnpc-2.2.7/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2.2.7
|
|
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
|
|
File without changes
|