miniupnpc 2.0.1__tar.gz → 2.2.7__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.
Files changed (71) hide show
  1. miniupnpc-2.2.7/LICENSE +1 -0
  2. miniupnpc-2.2.7/MANIFEST.in +10 -0
  3. miniupnpc-2.2.7/Makefile +405 -0
  4. miniupnpc-2.2.7/PKG-INFO +10 -0
  5. {miniupnpc-2.0.1 → miniupnpc-2.2.7}/README +33 -5
  6. miniupnpc-2.2.7/VERSION +1 -0
  7. miniupnpc-2.2.7/external-ip.sh +4 -0
  8. {miniupnpc-2.0.1 → miniupnpc-2.2.7/include}/miniupnpc.h +15 -11
  9. {miniupnpc-2.0.1 → miniupnpc-2.2.7/include}/miniupnpctypes.h +4 -2
  10. {miniupnpc-2.0.1 → miniupnpc-2.2.7/include}/miniwget.h +0 -3
  11. {miniupnpc-2.0.1 → miniupnpc-2.2.7/include}/upnpcommands.h +7 -7
  12. {miniupnpc-2.0.1 → miniupnpc-2.2.7/include}/upnpdev.h +13 -5
  13. miniupnpc-2.2.7/miniupnpc.egg-info/PKG-INFO +10 -0
  14. miniupnpc-2.2.7/miniupnpc.egg-info/SOURCES.txt +61 -0
  15. miniupnpc-2.0.1/miniupnpcstrings.h → miniupnpc-2.2.7/miniupnpcstrings.h.in +7 -3
  16. {miniupnpc-2.0.1 → miniupnpc-2.2.7}/setup.cfg +4 -5
  17. miniupnpc-2.2.7/setup.py +35 -0
  18. miniupnpc-2.2.7/setupmingw32.py +35 -0
  19. miniupnpc-2.2.7/src/addr_is_reserved.c +86 -0
  20. miniupnpc-2.2.7/src/addr_is_reserved.h +14 -0
  21. miniupnpc-2.2.7/src/connecthostport.c +284 -0
  22. {miniupnpc-2.0.1 → miniupnpc-2.2.7/src}/connecthostport.h +6 -4
  23. miniupnpc-2.2.7/src/igd_desc_parse.c +123 -0
  24. miniupnpc-2.2.7/src/listdevices.c +198 -0
  25. miniupnpc-2.2.7/src/minihttptestserver.c +690 -0
  26. miniupnpc-2.2.7/src/minisoap.c +121 -0
  27. {miniupnpc-2.0.1 → miniupnpc-2.2.7/src}/minisoap.h +4 -2
  28. miniupnpc-2.2.7/src/minissdpc.c +1019 -0
  29. {miniupnpc-2.0.1 → miniupnpc-2.2.7/src}/minissdpc.h +3 -3
  30. miniupnpc-2.2.7/src/miniupnpc.c +710 -0
  31. miniupnpc-2.2.7/src/miniupnpc_socketdef.h +44 -0
  32. {miniupnpc-2.0.1 → miniupnpc-2.2.7/src}/miniupnpcmodule.c +74 -26
  33. miniupnpc-2.2.7/src/miniwget.c +664 -0
  34. miniupnpc-2.2.7/src/miniwget_private.h +15 -0
  35. miniupnpc-2.2.7/src/minixml.c +231 -0
  36. {miniupnpc-2.0.1 → miniupnpc-2.2.7/src}/minixml.h +1 -1
  37. miniupnpc-2.2.7/src/minixmlvalid.c +163 -0
  38. miniupnpc-2.2.7/src/portlistingparse.c +177 -0
  39. miniupnpc-2.2.7/src/receivedata.c +105 -0
  40. {miniupnpc-2.0.1 → miniupnpc-2.2.7/src}/receivedata.h +4 -2
  41. miniupnpc-2.2.7/src/testaddr_is_reserved.c +46 -0
  42. miniupnpc-2.2.7/src/testigddescparse.c +187 -0
  43. miniupnpc-2.2.7/src/testminiwget.c +56 -0
  44. miniupnpc-2.2.7/src/testminixml.c +89 -0
  45. miniupnpc-2.2.7/src/testportlistingparse.c +151 -0
  46. miniupnpc-2.2.7/src/testupnpreplyparse.c +115 -0
  47. miniupnpc-2.2.7/src/upnpc.c +937 -0
  48. miniupnpc-2.2.7/src/upnpcommands.c +1238 -0
  49. miniupnpc-2.2.7/src/upnpdev.c +23 -0
  50. miniupnpc-2.2.7/src/upnperrors.c +148 -0
  51. miniupnpc-2.2.7/src/upnpreplyparse.c +197 -0
  52. miniupnpc-2.2.7/src/win32_snprintf.h +71 -0
  53. miniupnpc-2.2.7/testminiwget.sh +133 -0
  54. miniupnpc-2.2.7/testupnpreplyparse.sh +17 -0
  55. miniupnpc-2.2.7/updateminiupnpcstrings.sh +67 -0
  56. miniupnpc-2.0.1/LICENSE +0 -27
  57. miniupnpc-2.0.1/MANIFEST.in +0 -7
  58. miniupnpc-2.0.1/PKG-INFO +0 -37
  59. miniupnpc-2.0.1/VERSION +0 -1
  60. miniupnpc-2.0.1/libminiupnpc.a +0 -0
  61. miniupnpc-2.0.1/miniupnpc.egg-info/PKG-INFO +0 -37
  62. miniupnpc-2.0.1/miniupnpc.egg-info/SOURCES.txt +0 -28
  63. miniupnpc-2.0.1/setup.py +0 -28
  64. {miniupnpc-2.0.1 → miniupnpc-2.2.7/include}/igd_desc_parse.h +0 -0
  65. {miniupnpc-2.0.1 → miniupnpc-2.2.7/include}/miniupnpc_declspec.h +0 -0
  66. {miniupnpc-2.0.1 → miniupnpc-2.2.7/include}/portlistingparse.h +0 -0
  67. {miniupnpc-2.0.1 → miniupnpc-2.2.7/include}/upnperrors.h +0 -0
  68. {miniupnpc-2.0.1 → miniupnpc-2.2.7/include}/upnpreplyparse.h +0 -0
  69. {miniupnpc-2.0.1 → miniupnpc-2.2.7}/miniupnpc.egg-info/dependency_links.txt +0 -0
  70. {miniupnpc-2.0.1 → miniupnpc-2.2.7}/miniupnpc.egg-info/top_level.txt +0 -0
  71. {miniupnpc-2.0.1 → miniupnpc-2.2.7/src}/codelength.h +0 -0
@@ -0,0 +1 @@
1
+ ../LICENSE
@@ -0,0 +1,10 @@
1
+ include README
2
+ include VERSION
3
+ include LICENSE
4
+ include src/miniupnpcmodule.c
5
+ include setup.py
6
+ include Makefile
7
+ include src/*.[ch]
8
+ include include/*.h
9
+ include *.h.in
10
+ include *.sh
@@ -0,0 +1,405 @@
1
+ # $Id: Makefile,v 1.150 2023/06/15 22:55:24 nanard Exp $
2
+ # MiniUPnP Project
3
+ # http://miniupnp.free.fr/
4
+ # https://miniupnp.tuxfamily.org/
5
+ # https://github.com/miniupnp/miniupnp
6
+ # (c) 2005-2024 Thomas Bernard
7
+ # to install use :
8
+ # $ make DESTDIR=/tmp/dummylocation install
9
+ # or
10
+ # $ INSTALLPREFIX=/usr/local make install
11
+ # or
12
+ # $ make install (default INSTALLPREFIX is /usr)
13
+ OS = $(shell $(CC) -dumpmachine)
14
+ VERSION = $(shell cat VERSION)
15
+
16
+ ifneq (, $(findstring darwin, $(OS)))
17
+ JARSUFFIX=mac
18
+ LIBTOOL ?= $(shell which libtool)
19
+ endif
20
+ ifneq (, $(findstring linux, $(OS)))
21
+ JARSUFFIX=linux
22
+ endif
23
+ ifneq (, $(findstring mingw, $(OS))$(findstring cygwin, $(OS))$(findstring msys, $(OS)))
24
+ JARSUFFIX=win32
25
+ endif
26
+
27
+ HAVE_IPV6 ?= yes
28
+ export HAVE_IPV6
29
+
30
+ # directories
31
+ INCDIR = include
32
+ SRCDIR = src
33
+ BUILD = build
34
+
35
+ CC ?= gcc
36
+ #AR = gar
37
+ #CFLAGS = -O -g
38
+ # to debug :
39
+ ASANFLAGS = -fsanitize=address -fsanitize=undefined -fsanitize=leak
40
+ #CFLAGS = -g -ggdb -O0 $(ASANFLAGS) -fno-omit-frame-pointer
41
+ #CPPFLAGS += -DDEBUG
42
+ #LDFLAGS += $(ASANFLAGS)
43
+ CFLAGS ?= -O
44
+ CFLAGS += -Wall
45
+ CFLAGS += -W -Wstrict-prototypes
46
+ CFLAGS += -fno-common
47
+ CPPFLAGS += -I$(BUILD)
48
+ CPPFLAGS += -DMINIUPNPC_SET_SOCKET_TIMEOUT
49
+ CPPFLAGS += -DMINIUPNPC_GET_SRC_ADDR
50
+ CPPFLAGS += -D_BSD_SOURCE
51
+ CPPFLAGS += -D_DEFAULT_SOURCE
52
+ ifneq (, $(findstring netbsd, $(OS)))
53
+ CPPFLAGS += -D_NETBSD_SOURCE
54
+ endif
55
+ ifeq (, $(findstring freebsd, $(OS))$(findstring darwin, $(OS)))
56
+ #CPPFLAGS += -D_POSIX_C_SOURCE=200112L
57
+ CPPFLAGS += -D_XOPEN_SOURCE=600
58
+ endif
59
+ #CFLAGS += -ansi
60
+ #CPPFLAGS += -DNO_GETADDRINFO
61
+
62
+ DEPFLAGS = -MM -MG
63
+
64
+ MKDIR = mkdir -p
65
+ INSTALL = install
66
+ SH = /bin/sh
67
+ JAVA = java
68
+ # see http://code.google.com/p/jnaerator/
69
+ #JNAERATOR = jnaerator-0.9.7.jar
70
+ #JNAERATOR = jnaerator-0.9.8-shaded.jar
71
+ #JNAERATORARGS = -library miniupnpc
72
+ #JNAERATOR = jnaerator-0.10-shaded.jar
73
+ #JNAERATOR = jnaerator-0.11-shaded.jar
74
+ # https://repo1.maven.org/maven2/com/nativelibs4java/jnaerator/0.12/jnaerator-0.12-shaded.jar
75
+ JNAERATOR = jnaerator-0.12-shaded.jar
76
+ JNAERATORARGS = -mode StandaloneJar -runtime JNAerator -library miniupnpc
77
+ #JNAERATORBASEURL = http://jnaerator.googlecode.com/files/
78
+ JNAERATORBASEURL = https://repo1.maven.org/maven2/com/nativelibs4java/jnaerator/0.12
79
+
80
+ ifneq (, $(findstring sun, $(OS))$(findstring solaris, $(OS)))
81
+ LDLIBS=-lsocket -lnsl -lresolv
82
+ CPPFLAGS += -D__EXTENSIONS__
83
+ CFLAGS += -std=c99
84
+ endif
85
+
86
+ # APIVERSION is used to build SONAME
87
+ APIVERSION = 18
88
+
89
+ SRCS = $(wildcard $(SRCDIR)/*.c)
90
+
91
+ LIBOBJS = $(addprefix $(BUILD)/,miniwget.o minixml.o igd_desc_parse.o minisoap.o \
92
+ miniupnpc.o upnpreplyparse.o upnpcommands.o upnperrors.o \
93
+ connecthostport.o portlistingparse.o receivedata.o upnpdev.o \
94
+ addr_is_reserved.o)
95
+
96
+ BUILDINCLUDES = $(addprefix $(BUILD)/, miniupnpcstrings.h)
97
+
98
+ OBJS = $(patsubst $(SRCDIR)/%.c,$(BUILD)/%.o,$(SRCS))
99
+ DEPS = $(patsubst $(SRCDIR)/%.c,$(BUILD)/%.d,$(SRCS))
100
+
101
+ # HEADERS to install
102
+ CPPFLAGS += -I$(INCDIR)
103
+ HEADERS = $(wildcard $(INCDIR)/*.h)
104
+
105
+ # library names
106
+ LIBRARY = $(BUILD)/libminiupnpc.a
107
+ ifneq (, $(findstring darwin, $(OS)))
108
+ SHAREDLIBRARY = $(BUILD)/libminiupnpc.dylib
109
+ SONAME = $(notdir $(basename $(SHAREDLIBRARY))).$(APIVERSION).dylib
110
+ CPPFLAGS += -D_DARWIN_C_SOURCE
111
+ else
112
+ ifeq ($(JARSUFFIX), win32)
113
+ SHAREDLIBRARY = $(BUILD)/miniupnpc.dll
114
+ else
115
+ # Linux/BSD/etc.
116
+ SHAREDLIBRARY = $(BUILD)/libminiupnpc.so
117
+ SONAME = $(notdir $(SHAREDLIBRARY)).$(APIVERSION)
118
+ endif
119
+ endif
120
+
121
+ EXECUTABLES = $(addprefix $(BUILD)/, upnpc-static upnp-listdevices-static)
122
+ EXECUTABLES_ADDTESTS = $(addprefix $(BUILD)/, testminixml minixmlvalid \
123
+ testupnpreplyparse testigddescparse testminiwget testportlistingparse)
124
+
125
+ TESTMINIXMLOBJS = $(addprefix $(BUILD)/, minixml.o igd_desc_parse.o testminixml.o)
126
+
127
+ TESTMINIWGETOBJS = $(addprefix $(BUILD)/, miniwget.o testminiwget.o connecthostport.o receivedata.o)
128
+
129
+ TESTUPNPREPLYPARSE = $(addprefix $(BUILD)/, testupnpreplyparse.o minixml.o upnpreplyparse.o)
130
+
131
+ TESTPORTLISTINGPARSE = $(addprefix $(BUILD)/, testportlistingparse.o minixml.o portlistingparse.o)
132
+
133
+ TESTADDR_IS_RESERVED = $(addprefix $(BUILD)/, testaddr_is_reserved.o addr_is_reserved.o)
134
+
135
+ TESTIGDDESCPARSE = $(addprefix $(BUILD)/, testigddescparse.o igd_desc_parse.o minixml.o \
136
+ miniupnpc.o miniwget.o upnpcommands.o upnpreplyparse.o \
137
+ minisoap.o connecthostport.o receivedata.o \
138
+ portlistingparse.o addr_is_reserved.o)
139
+
140
+ ifeq (, $(findstring amiga, $(OS)))
141
+ ifeq (, $(findstring mingw, $(OS))$(findstring cygwin, $(OS))$(findstring msys, $(OS)))
142
+ CFLAGS += -fPIC
143
+ endif
144
+ EXECUTABLES += $(BUILD)/upnpc-shared $(BUILD)/upnp-listdevices-shared
145
+ TESTMINIWGETOBJS += $(BUILD)/minissdpc.o
146
+ TESTIGDDESCPARSE += $(BUILD)/minissdpc.o
147
+ LIBOBJS += $(BUILD)/minissdpc.o
148
+ endif
149
+
150
+ LIBDIR ?= lib
151
+ # install directories
152
+ ifeq ($(strip $(PREFIX)),)
153
+ INSTALLPREFIX ?= /usr
154
+ else
155
+ INSTALLPREFIX ?= $(PREFIX)
156
+ endif
157
+ INSTALLDIRINC = $(INSTALLPREFIX)/include/miniupnpc
158
+ INSTALLDIRLIB = $(INSTALLPREFIX)/$(LIBDIR)
159
+ INSTALLDIRBIN = $(INSTALLPREFIX)/bin
160
+ INSTALLDIRMAN = $(INSTALLPREFIX)/share/man
161
+ PKGCONFIGDIR = $(INSTALLDIRLIB)/pkgconfig
162
+
163
+ FILESTOINSTALL = $(LIBRARY) $(EXECUTABLES)
164
+ ifeq (, $(findstring amiga, $(OS)))
165
+ FILESTOINSTALL += $(SHAREDLIBRARY) $(BUILD)/miniupnpc.pc
166
+ endif
167
+
168
+
169
+ .PHONY: install clean depend all check test everything \
170
+ installpythonmodule updateversion
171
+
172
+ all: $(LIBRARY) $(EXECUTABLES)
173
+
174
+ test: check
175
+
176
+ check: validateminixml validateminiwget validateupnpreplyparse \
177
+ validateportlistingparse validateigddescparse validateaddr_is_reserved
178
+
179
+ everything: all $(EXECUTABLES_ADDTESTS)
180
+
181
+ # note : the python module "wheel" is required for bdist_wheel
182
+ pythonmodule: $(LIBRARY) $(SRCDIR)/miniupnpcmodule.c setup.py
183
+ MAKE=$(MAKE) python setup.py build
184
+ MAKE=$(MAKE) python setup.py sdist
185
+ MAKE=$(MAKE) python setup.py bdist_wheel --skip-build
186
+ touch $@
187
+
188
+ installpythonmodule: pythonmodule
189
+ MAKE=$(MAKE) python setup.py install
190
+
191
+ pythonmodule3: $(LIBRARY) $(SRCDIR)/miniupnpcmodule.c setup.py
192
+ MAKE=$(MAKE) python3 setup.py build
193
+ touch $@
194
+
195
+ installpythonmodule3: pythonmodule3
196
+ MAKE=$(MAKE) python3 setup.py install
197
+
198
+ validateminixml: $(BUILD)/minixmlvalid
199
+ @echo "minixml validation test"
200
+ ./$<
201
+ touch $@
202
+
203
+ validateminiwget: testminiwget.sh $(BUILD)/testminiwget $(BUILD)/minihttptestserver
204
+ @echo "miniwget validation test"
205
+ ./$<
206
+ touch $@
207
+
208
+ validateupnpreplyparse: testupnpreplyparse.sh $(BUILD)/testupnpreplyparse
209
+ @echo "upnpreplyparse validation test"
210
+ ./$<
211
+ touch $@
212
+
213
+ validateportlistingparse: $(BUILD)/testportlistingparse
214
+ @echo "portlistingparse validation test"
215
+ ./$<
216
+ touch $@
217
+
218
+ validateigddescparse: $(BUILD)/testigddescparse
219
+ @echo "igd desc parse validation test"
220
+ ./$< testdesc/new_LiveBox_desc.xml testdesc/new_LiveBox_desc.values
221
+ ./$< testdesc/linksys_WAG200G_desc.xml testdesc/linksys_WAG200G_desc.values
222
+ touch $@
223
+
224
+ validateaddr_is_reserved: $(BUILD)/testaddr_is_reserved
225
+ @echo "addr_is_reserved() validation test"
226
+ ./$<
227
+ touch $@
228
+
229
+ clean:
230
+ $(RM) $(LIBRARY) $(SHAREDLIBRARY) $(EXECUTABLES) $(OBJS) $(BUILDINCLUDES)
231
+ $(RM) $(EXECUTABLES_ADDTESTS)
232
+ # clean python stuff
233
+ $(RM) pythonmodule pythonmodule3
234
+ $(RM) validateminixml validateminiwget validateupnpreplyparse
235
+ $(RM) validateigddescparse
236
+ $(RM) minihttptestserver
237
+ $(RM) testaddr_is_reserved
238
+ $(RM) -r build/ dist/
239
+ #python setup.py clean
240
+ # clean jnaerator stuff
241
+ $(RM) _jnaerator.* java/miniupnpc_$(OS).jar
242
+
243
+ distclean: clean
244
+ $(RM) $(JNAERATOR) java/*.jar java/*.class out.errors.txt
245
+
246
+ updateversion: include/miniupnpc.h
247
+ cp $< $<.bak
248
+ sed 's/\(.*MINIUPNPC_API_VERSION\s\+\)[0-9]\+/\1$(APIVERSION)/' < $<.bak > $<
249
+
250
+ install: updateversion $(FILESTOINSTALL)
251
+ $(INSTALL) -d $(DESTDIR)$(INSTALLDIRINC)
252
+ $(INSTALL) -m 644 $(HEADERS) $(DESTDIR)$(INSTALLDIRINC)
253
+ $(INSTALL) -d $(DESTDIR)$(INSTALLDIRLIB)
254
+ $(INSTALL) -m 644 $(LIBRARY) $(DESTDIR)$(INSTALLDIRLIB)
255
+ ifeq (, $(findstring amiga, $(OS)))
256
+ $(INSTALL) -m 644 $(SHAREDLIBRARY) $(DESTDIR)$(INSTALLDIRLIB)/$(SONAME)
257
+ ln -fs $(SONAME) $(DESTDIR)$(INSTALLDIRLIB)/$(notdir $(SHAREDLIBRARY))
258
+ $(INSTALL) -d $(DESTDIR)$(PKGCONFIGDIR)
259
+ $(INSTALL) -m 644 $(BUILD)/miniupnpc.pc $(DESTDIR)$(PKGCONFIGDIR)
260
+ endif
261
+ $(INSTALL) -d $(DESTDIR)$(INSTALLDIRBIN)
262
+ ifneq (, $(findstring amiga, $(OS)))
263
+ $(INSTALL) -m 755 $(BUILD)/upnpc-static $(DESTDIR)$(INSTALLDIRBIN)/upnpc
264
+ $(INSTALL) -m 755 $(BUILD)/upnp-listdevices-static $(DESTDIR)$(INSTALLDIRBIN)/upnp-listdevices
265
+ else
266
+ $(INSTALL) -m 755 $(BUILD)/upnpc-shared $(DESTDIR)$(INSTALLDIRBIN)/upnpc
267
+ $(INSTALL) -m 755 $(BUILD)/upnp-listdevices-shared $(DESTDIR)$(INSTALLDIRBIN)/upnp-listdevices
268
+ endif
269
+ $(INSTALL) -m 755 external-ip.sh $(DESTDIR)$(INSTALLDIRBIN)/external-ip
270
+ ifeq (, $(findstring amiga, $(OS)))
271
+ $(INSTALL) -d $(DESTDIR)$(INSTALLDIRMAN)/man3
272
+ $(INSTALL) -m 644 man3/miniupnpc.3 $(DESTDIR)$(INSTALLDIRMAN)/man3/miniupnpc.3
273
+ ifneq (, $(findstring linux, $(OS)))
274
+ gzip -f $(DESTDIR)$(INSTALLDIRMAN)/man3/miniupnpc.3
275
+ endif
276
+ endif
277
+
278
+ install-static: updateversion $(FILESTOINSTALL)
279
+ $(INSTALL) -d $(DESTDIR)$(INSTALLDIRINC)
280
+ $(INSTALL) -m 644 $(HEADERS) $(DESTDIR)$(INSTALLDIRINC)
281
+ $(INSTALL) -d $(DESTDIR)$(INSTALLDIRLIB)
282
+ $(INSTALL) -m 644 $(LIBRARY) $(DESTDIR)$(INSTALLDIRLIB)
283
+ $(INSTALL) -d $(DESTDIR)$(INSTALLDIRBIN)
284
+ $(INSTALL) -m 755 external-ip.sh $(DESTDIR)$(INSTALLDIRBIN)/external-ip
285
+
286
+ cleaninstall:
287
+ $(RM) -r $(DESTDIR)$(INSTALLDIRINC)
288
+ $(RM) $(DESTDIR)$(INSTALLDIRLIB)/$(LIBRARY)
289
+ $(RM) $(DESTDIR)$(INSTALLDIRLIB)/$(SHAREDLIBRARY)
290
+
291
+ $(BUILD)/miniupnpc.pc: VERSION
292
+ @$(MKDIR) $(@D)
293
+ $(RM) $@
294
+ echo "prefix=$(INSTALLPREFIX)" >> $@
295
+ echo "exec_prefix=\$${prefix}" >> $@
296
+ echo "libdir=\$${exec_prefix}/$(LIBDIR)" >> $@
297
+ echo "includedir=\$${prefix}/include" >> $@
298
+ echo "" >> $@
299
+ echo "Name: miniUPnPc" >> $@
300
+ echo "Description: UPnP IGD client lightweight library" >> $@
301
+ echo "URL: https://miniupnp.tuxfamily.org/" >> $@
302
+ echo "Version: $(VERSION)" >> $@
303
+ echo "Libs: -L\$${libdir} -lminiupnpc" >> $@
304
+ echo "Cflags: -I\$${includedir}" >> $@
305
+
306
+ depend: $(DEPS)
307
+
308
+ $(LIBRARY): $(LIBOBJS)
309
+ ifneq (, $(findstring darwin, $(OS)))
310
+ $(LIBTOOL) -static -o $@ $?
311
+ else
312
+ $(AR) crs $@ $?
313
+ endif
314
+
315
+ $(SHAREDLIBRARY): $(LIBOBJS)
316
+ ifneq (, $(findstring darwin, $(OS)))
317
+ # $(CC) -dynamiclib $(LDFLAGS) -Wl,-install_name,$(SONAME) -o $@ $^
318
+ $(CC) -dynamiclib $(LDFLAGS) -Wl,-install_name,$(INSTALLDIRLIB)/$(SONAME) -o $@ $^
319
+ else
320
+ $(CC) -shared $(LDFLAGS) -Wl,-soname,$(SONAME) -o $@ $^
321
+ endif
322
+
323
+ $(BUILD)/%.o: $(SRCDIR)/%.c $(BUILD)/%.d
324
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
325
+
326
+ $(DEPS): $(BUILDINCLUDES)
327
+
328
+ $(BUILD)/%.d: $(SRCDIR)/%.c
329
+ @$(MKDIR) $(@D)
330
+ $(CC) $(CPPFLAGS) $(DEPFLAGS) -MT $@ -o $@ $<
331
+
332
+ $(BUILD)/upnpc-static: $(BUILD)/upnpc.o $(LIBRARY)
333
+ $(CC) $(LDFLAGS) -o $@ $^ $(LOADLIBES) $(LDLIBS)
334
+
335
+ $(BUILD)/upnpc-shared: $(BUILD)/upnpc.o $(SHAREDLIBRARY)
336
+ $(CC) $(LDFLAGS) -o $@ $^ $(LOADLIBES) $(LDLIBS)
337
+
338
+ $(BUILD)/upnp-listdevices-static: $(BUILD)/listdevices.o $(LIBRARY)
339
+ $(CC) $(LDFLAGS) -o $@ $^ $(LOADLIBES) $(LDLIBS)
340
+
341
+ $(BUILD)/upnp-listdevices-shared: $(BUILD)/listdevices.o $(SHAREDLIBRARY)
342
+ $(CC) $(LDFLAGS) -o $@ $^ $(LOADLIBES) $(LDLIBS)
343
+
344
+ $(BUILD)/testminixml: $(TESTMINIXMLOBJS)
345
+
346
+ $(BUILD)/testminiwget: $(TESTMINIWGETOBJS)
347
+
348
+ $(BUILD)/minixmlvalid: $(addprefix $(BUILD)/, minixml.o minixmlvalid.o)
349
+
350
+ $(BUILD)/testupnpreplyparse: $(TESTUPNPREPLYPARSE)
351
+
352
+ $(BUILD)/testigddescparse: $(TESTIGDDESCPARSE)
353
+
354
+ $(BUILD)/testportlistingparse: $(TESTPORTLISTINGPARSE)
355
+
356
+ $(BUILD)/testaddr_is_reserved: $(TESTADDR_IS_RESERVED)
357
+
358
+ $(BUILD)/miniupnpcstrings.h: miniupnpcstrings.h.in updateminiupnpcstrings.sh VERSION
359
+ @$(MKDIR) $(@D)
360
+ $(SH) updateminiupnpcstrings.sh $@ $<
361
+
362
+ # ftp tool supplied with OpenBSD can download files from http.
363
+ jnaerator-%.jar:
364
+ wget $(JNAERATORBASEURL)/$@ || \
365
+ curl -o $@ $(JNAERATORBASEURL)/$@ || \
366
+ ftp $(JNAERATORBASEURL)/$@
367
+
368
+ jar: $(SHAREDLIBRARY) $(JNAERATOR)
369
+ $(JAVA) -jar $(JNAERATOR) $(JNAERATORARGS) \
370
+ miniupnpc.h miniupnpc_declspec.h upnpcommands.h upnpreplyparse.h \
371
+ igd_desc_parse.h miniwget.h upnperrors.h $(SHAREDLIBRARY) \
372
+ -package fr.free.miniupnp -o . -jar java/miniupnpc_$(JARSUFFIX).jar -v
373
+
374
+ mvn_install:
375
+ mvn install:install-file -Dfile=java/miniupnpc_$(JARSUFFIX).jar \
376
+ -DgroupId=com.github \
377
+ -DartifactId=miniupnp \
378
+ -Dversion=$(VERSION) \
379
+ -Dpackaging=jar \
380
+ -Dclassifier=$(JARSUFFIX) \
381
+ -DgeneratePom=true \
382
+ -DcreateChecksum=true
383
+
384
+ # make .deb packages
385
+ deb: /usr/share/pyshared/stdeb all
386
+ (python setup.py --command-packages=stdeb.command bdist_deb)
387
+
388
+ # install .deb packages
389
+ ideb:
390
+ (sudo dpkg -i deb_dist/*.deb)
391
+
392
+ /usr/share/pyshared/stdeb: /usr/share/doc/python-all-dev
393
+ (sudo apt-get install python-stdeb)
394
+
395
+ /usr/share/doc/python-all-dev:
396
+ (sudo apt-get install python-all-dev)
397
+
398
+ minihttptestserver: minihttptestserver.o
399
+
400
+ print-%:
401
+ @echo "$* = $($*)"
402
+
403
+ ifneq ($(MAKECMDGOALS),clean)
404
+ -include $(DEPS)
405
+ endif
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 1.0
2
+ Name: miniupnpc
3
+ Version: 2.2.7
4
+ Summary: MiniUPnP IGD client
5
+ Home-page: https://miniupnp.tuxfamily.org/
6
+ Author: Thomas BERNARD
7
+ Author-email: miniupnp@free.fr
8
+ License: ../LICENSE
9
+ Description: UNKNOWN
10
+ Platform: UNKNOWN
@@ -1,9 +1,8 @@
1
1
  Project: miniupnp
2
- Project web page: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
2
+ Project web page: http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
3
3
  github: https://github.com/miniupnp/miniupnp
4
- freecode: http://freecode.com/projects/miniupnp
5
4
  Author: Thomas Bernard
6
- Copyright (c) 2005-2016 Thomas Bernard
5
+ Copyright (c) 2005-2023 Thomas Bernard
7
6
  This software is subject to the conditions detailed in the
8
7
  LICENSE file provided within this distribution.
9
8
 
@@ -13,6 +12,8 @@ LICENSE file provided within this distribution.
13
12
  To compile, simply run 'gmake' (could be 'make' on your system).
14
13
  Under win32, to compile with MinGW, type "mingw32make.bat".
15
14
  MS Visual C solution and project files are supplied in the msvc/ subdirectory.
15
+ The miniupnpc library is available as a static library or as a DLL :
16
+ define MINIUPNP_STATICLIB if you want to link against the static library.
16
17
 
17
18
  The compilation is known to work under linux, FreeBSD,
18
19
  OpenBSD, MacOS X, AmigaOS and cygwin.
@@ -58,7 +59,34 @@ If you are using libminiupnpc in your application, please
58
59
  send me an email !
59
60
 
60
61
  For any question, you can use the web forum :
61
- http://miniupnp.tuxfamily.org/forum/
62
+ https://miniupnp.tuxfamily.org/forum/
62
63
 
63
- Bugs should be reported on github :
64
+ Bugs should be reported on GitHub :
64
65
  https://github.com/miniupnp/miniupnp/issues
66
+
67
+ * Linux firewall configuration for UPnP clients *
68
+
69
+ Due to how UPnP protocol is designed, unicast responses to UPnP multicast client
70
+ requests are not tracked by Linux netfilter. And therefore netfilter executes
71
+ default action for them (which is in most cases DROP response packet).
72
+
73
+ To workaround this limitation, custom ipset hash table can be used. It is
74
+ supported since Linux kernel >= 2.6.39.
75
+
76
+ Rules for IPv4:
77
+ $ ipset create upnp hash:ip,port timeout 3
78
+ $ iptables -A OUTPUT -d 239.255.255.250/32 -p udp -m udp --dport 1900 -j SET --add-set upnp src,src --exist
79
+ $ iptables -A INPUT -p udp -m set --match-set upnp dst,dst -j ACCEPT
80
+ $ iptables -A INPUT -d 239.255.255.250/32 -p udp -m udp --dport 1900 -j ACCEPT
81
+
82
+ Rules for IPv6:
83
+ $ ipset create upnp6 hash:ip,port timeout 3 family inet6
84
+ $ ip6tables -A OUTPUT -d ff02::c/128 -p udp -m udp --dport 1900 -j SET --add-set upnp6 src,src --exist
85
+ $ ip6tables -A OUTPUT -d ff05::c/128 -p udp -m udp --dport 1900 -j SET --add-set upnp6 src,src --exist
86
+ $ ip6tables -A INPUT -p udp -m set --match-set upnp6 dst,dst -j ACCEPT
87
+ $ ip6tables -A INPUT -d ff02::c/128 -p udp -m udp --dport 1900 -j ACCEPT
88
+ $ ip6tables -A INPUT -d ff05::c/128 -p udp -m udp --dport 1900 -j ACCEPT
89
+
90
+ Detailed description is available on:
91
+ https://serverfault.com/a/911286
92
+ https://unix.stackexchange.com/a/444804
@@ -0,0 +1 @@
1
+ 2.2.7
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ # $Id: external-ip.sh,v 1.1 2010/08/05 12:57:41 nanard Exp $
3
+ # (c) 2010 Reuben Hawkins
4
+ upnpc -s | sed -n -e 's/^ExternalIPAddress = \([0-9.]*\)$/\1/p'
@@ -1,8 +1,9 @@
1
- /* $Id: miniupnpc.h,v 1.50 2016/04/19 21:06:21 nanard Exp $ */
2
- /* Project: miniupnp
3
- * http://miniupnp.free.fr/
1
+ /* $Id: miniupnpc.h,v 1.64 2024/03/19 23:26:06 nanard Exp $ */
2
+ /* vim: tabstop=4 shiftwidth=4 noexpandtab
3
+ * Project: miniupnp
4
+ * http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
4
5
  * Author: Thomas Bernard
5
- * Copyright (c) 2005-2016 Thomas Bernard
6
+ * Copyright (c) 2005-2024 Thomas Bernard
6
7
  * This software is subjects to the conditions detailed
7
8
  * in the LICENCE file provided within this distribution */
8
9
  #ifndef MINIUPNPC_H_INCLUDED
@@ -19,11 +20,11 @@
19
20
  #define UPNPDISCOVER_MEMORY_ERROR (-102)
20
21
 
21
22
  /* versions : */
22
- #define MINIUPNPC_VERSION "2.0"
23
- #define MINIUPNPC_API_VERSION 16
23
+ #define MINIUPNPC_VERSION "2.2.7"
24
+ #define MINIUPNPC_API_VERSION 18
24
25
 
25
26
  /* Source port:
26
- Using "1" as an alias for 1900 for backwards compatability
27
+ Using "1" as an alias for 1900 for backwards compatibility
27
28
  (presuming one would have used that for the "sameport" parameter) */
28
29
  #define UPNP_LOCAL_PORT_ANY 0
29
30
  #define UPNP_LOCAL_PORT_SAME 1
@@ -107,9 +108,11 @@ struct UPNPUrls {
107
108
  * return values :
108
109
  * 0 = NO IGD found
109
110
  * 1 = A valid connected IGD has been found
110
- * 2 = A valid IGD has been found but it reported as
111
+ * 2 = A valid connected IGD has been found but its
112
+ * IP address is reserved (non routable)
113
+ * 3 = A valid IGD has been found but it reported as
111
114
  * not connected
112
- * 3 = an UPnP device has been found but was not recognized as an IGD
115
+ * 4 = an UPnP device has been found but was not recognized as an IGD
113
116
  *
114
117
  * In any non zero return case, the urls and data structures
115
118
  * passed as parameters are set. Donc forget to call FreeUPNPUrls(urls) to
@@ -118,8 +121,9 @@ struct UPNPUrls {
118
121
  MINIUPNP_LIBSPEC int
119
122
  UPNP_GetValidIGD(struct UPNPDev * devlist,
120
123
  struct UPNPUrls * urls,
121
- struct IGDdatas * data,
122
- char * lanaddr, int lanaddrlen);
124
+ struct IGDdatas * data,
125
+ char * lanaddr, int lanaddrlen,
126
+ char * wanaddr, int wanaddrlen);
123
127
 
124
128
  /* UPNP_GetIGDFromUrl()
125
129
  * Used when skipping the discovery process.
@@ -1,13 +1,15 @@
1
1
  /* $Id: miniupnpctypes.h,v 1.1 2011/02/15 11:10:40 nanard Exp $ */
2
2
  /* Miniupnp project : http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org
3
3
  * Author : Thomas Bernard
4
- * Copyright (c) 2011 Thomas Bernard
4
+ * Copyright (c) 2021 Thomas Bernard
5
5
  * This software is subject to the conditions detailed in the
6
6
  * LICENCE file provided within this distribution */
7
7
  #ifndef MINIUPNPCTYPES_H_INCLUDED
8
8
  #define MINIUPNPCTYPES_H_INCLUDED
9
9
 
10
- #if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
10
+ /* Use unsigned long long when available :
11
+ * strtoull is C99 */
12
+ #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
11
13
  #define UNSIGNED_INTEGER unsigned long long
12
14
  #define STRTOUI strtoull
13
15
  #else
@@ -14,8 +14,6 @@
14
14
  extern "C" {
15
15
  #endif
16
16
 
17
- MINIUPNP_LIBSPEC void * getHTTPResponse(int s, int * size, int * status_code);
18
-
19
17
  MINIUPNP_LIBSPEC void * miniwget(const char *, int *, unsigned int, int *);
20
18
 
21
19
  MINIUPNP_LIBSPEC void * miniwget_getaddr(const char *, int *, char *, int, unsigned int, int *);
@@ -27,4 +25,3 @@ int parseURL(const char *, char *, unsigned short *, char * *, unsigned int *);
27
25
  #endif
28
26
 
29
27
  #endif
30
-
@@ -1,14 +1,12 @@
1
- /* $Id: upnpcommands.h,v 1.30 2015/07/15 12:21:28 nanard Exp $ */
1
+ /* $Id: upnpcommands.h,v 1.32 2018/03/13 23:34:47 nanard Exp $ */
2
2
  /* Miniupnp project : http://miniupnp.free.fr/
3
3
  * Author : Thomas Bernard
4
- * Copyright (c) 2005-2015 Thomas Bernard
4
+ * Copyright (c) 2005-2018 Thomas Bernard
5
5
  * This software is subject to the conditions detailed in the
6
6
  * LICENCE file provided within this distribution */
7
7
  #ifndef UPNPCOMMANDS_H_INCLUDED
8
8
  #define UPNPCOMMANDS_H_INCLUDED
9
9
 
10
- #include "upnpreplyparse.h"
11
- #include "portlistingparse.h"
12
10
  #include "miniupnpc_declspec.h"
13
11
  #include "miniupnpctypes.h"
14
12
 
@@ -24,6 +22,8 @@
24
22
  extern "C" {
25
23
  #endif
26
24
 
25
+ struct PortMappingParserData;
26
+
27
27
  MINIUPNP_LIBSPEC UNSIGNED_INTEGER
28
28
  UPNP_GetTotalBytesSent(const char * controlURL,
29
29
  const char * servicetype);
@@ -206,9 +206,9 @@ UPNP_DeletePortMappingRange(const char * controlURL, const char * servicetype,
206
206
  /* UPNP_GetPortMappingNumberOfEntries()
207
207
  * not supported by all routers */
208
208
  MINIUPNP_LIBSPEC int
209
- UPNP_GetPortMappingNumberOfEntries(const char* controlURL,
210
- const char* servicetype,
211
- unsigned int * num);
209
+ UPNP_GetPortMappingNumberOfEntries(const char * controlURL,
210
+ const char * servicetype,
211
+ unsigned int * numEntries);
212
212
 
213
213
  /* UPNP_GetSpecificPortMappingEntry()
214
214
  * retrieves an existing port mapping
@@ -1,8 +1,8 @@
1
- /* $Id: upnpdev.h,v 1.1 2015/08/28 12:14:19 nanard Exp $ */
1
+ /* $Id: upnpdev.h,v 1.4 2021/08/21 09:45:01 nanard Exp $ */
2
2
  /* Project : miniupnp
3
- * Web : http://miniupnp.free.fr/
3
+ * Web : http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
4
4
  * Author : Thomas BERNARD
5
- * copyright (c) 2005-2015 Thomas Bernard
5
+ * copyright (c) 2005-2021 Thomas Bernard
6
6
  * This software is subjet to the conditions detailed in the
7
7
  * provided LICENSE file. */
8
8
  #ifndef UPNPDEV_H_INCLUDED
@@ -18,9 +18,17 @@ struct UPNPDev {
18
18
  struct UPNPDev * pNext;
19
19
  char * descURL;
20
20
  char * st;
21
- unsigned int scope_id;
22
21
  char * usn;
23
- char buffer[3];
22
+ unsigned int scope_id;
23
+ #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
24
+ /* C99 flexible array member */
25
+ char buffer[];
26
+ #elif defined(__GNUC__)
27
+ char buffer[0];
28
+ #else
29
+ /* Fallback to a hack */
30
+ char buffer[1];
31
+ #endif
24
32
  };
25
33
 
26
34
  /* freeUPNPDevlist()
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 1.0
2
+ Name: miniupnpc
3
+ Version: 2.2.7
4
+ Summary: MiniUPnP IGD client
5
+ Home-page: https://miniupnp.tuxfamily.org/
6
+ Author: Thomas BERNARD
7
+ Author-email: miniupnp@free.fr
8
+ License: ../LICENSE
9
+ Description: UNKNOWN
10
+ Platform: UNKNOWN