mirror of
https://github.com/odamex/odamex
synced 2026-08-19 02:23:09 -04:00
- Update MiniUPNP to 1.6.20120502
- Regenerate odasrv.cfg SVN r3122 (0.6-dev)
This commit is contained in:
parent
a1adef0d73
commit
b7c8a0ec7f
36 changed files with 629 additions and 382 deletions
|
|
@ -1,6 +1,54 @@
|
|||
$Id: Changelog.txt,v 1.152 2011/07/25 18:02:11 nanard Exp $
|
||||
$Id: Changelog.txt,v 1.168 2012/05/01 16:16:51 nanard Exp $
|
||||
miniUPnP client Changelog.
|
||||
|
||||
2012/05/01:
|
||||
Cleanup settings of CFLAGS in Makefile
|
||||
Fix signed/unsigned integer comparaisons
|
||||
|
||||
2012/04/20:
|
||||
Allow to specify protocol with TCP or UDP for -A option
|
||||
|
||||
2012/04/09:
|
||||
Only try to fetch XML description once in UPNP_GetValidIGD()
|
||||
Added -ansi flag to compilation, and fixed C++ comments to ANSI C comments.
|
||||
|
||||
2012/04/05:
|
||||
minor improvements to minihttptestserver.c
|
||||
|
||||
2012/03/15:
|
||||
upnperrors.c returns valid error string for unrecognized error codes
|
||||
|
||||
2012/03/08:
|
||||
make minihttptestserver listen on loopback interface instead of 0.0.0.0
|
||||
|
||||
2012/01/25:
|
||||
Maven installation thanks to Alexey Kuznetsov
|
||||
|
||||
2012/01/21:
|
||||
Replace WIN32 macro by _WIN32
|
||||
|
||||
2012/01/19:
|
||||
Fixes in java wrappers thanks to Alexey Kuznetsov :
|
||||
https://github.com/axet/miniupnp/tree/fix-javatest/miniupnpc
|
||||
Make and install .deb packages (python) thanks to Alexey Kuznetsov :
|
||||
https://github.com/axet/miniupnp/tree/feature-debbuild/miniupnpc
|
||||
|
||||
2012/01/07:
|
||||
The multicast interface can now be specified by name with IPv4.
|
||||
|
||||
2012/01/02:
|
||||
Install man page
|
||||
|
||||
2011/11/25:
|
||||
added header to Port Mappings list in upnpc.c
|
||||
|
||||
2011/10/09:
|
||||
Makefile : make clean now removes jnaerator generated files.
|
||||
MINIUPNPC_VERSION in miniupnpc.h (updated by make)
|
||||
|
||||
2011/09/12:
|
||||
added rootdescURL to UPNPUrls structure.
|
||||
|
||||
VERSION 1.6 : released 2011/07/25
|
||||
|
||||
2011/07/25:
|
||||
|
|
@ -236,7 +284,7 @@ VERSION 1.2 :
|
|||
small modif to make Clang happy :)
|
||||
|
||||
2008/07/17:
|
||||
#define SOAPPREFIX "s" in miniupnpc.c in order to remove SOAP-ENV...
|
||||
#define SOAPPREFIX "s" in miniupnpc.c in order to remove SOAP-ENV...
|
||||
|
||||
2008/07/14:
|
||||
include declspec.h in installation (to /usr/include/miniupnpc)
|
||||
|
|
@ -258,7 +306,7 @@ VERSION 1.1 :
|
|||
improved python module error/exception reporting.
|
||||
|
||||
2008/04/23:
|
||||
Completely rewrite igd_desc_parse.c in order to be compatible with
|
||||
Completely rewrite igd_desc_parse.c in order to be compatible with
|
||||
Linksys WAG200G
|
||||
Added testigddescparse
|
||||
updated python module
|
||||
|
|
@ -281,7 +329,7 @@ VERSION 1.0 :
|
|||
improved make install :)
|
||||
|
||||
2007/12/22:
|
||||
Adding upnperrors.c/h to provide a strupnperror() function
|
||||
Adding upnperrors.c/h to provide a strupnperror() function
|
||||
used to translate UPnP error codes to string.
|
||||
|
||||
2007/12/19:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
MiniUPnPc
|
||||
Copyright (c) 2005-2011, Thomas BERNARD
|
||||
Copyright (c) 2005-2011, Thomas BERNARD
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: Makefile,v 1.81 2011/06/21 15:24:14 nanard Exp $
|
||||
# $Id: Makefile,v 1.95 2012/05/01 16:16:50 nanard Exp $
|
||||
# MiniUPnP Project
|
||||
# http://miniupnp.free.fr/
|
||||
# (c) 2005-2011 Thomas Bernard
|
||||
|
|
@ -6,19 +6,35 @@
|
|||
# $ PREFIX=/tmp/dummylocation make install
|
||||
# or
|
||||
# $ INSTALLPREFIX=/usr/local make install
|
||||
# or
|
||||
# or
|
||||
# make install (will go to /usr/bin, /usr/lib, etc...)
|
||||
OS = $(shell uname -s)
|
||||
VERSION = $(shell cat VERSION)
|
||||
|
||||
ifeq ($(OS), Darwin)
|
||||
JARSUFFIX=mac
|
||||
endif
|
||||
ifeq ($(OS), Linux)
|
||||
JARSUFFIX=linux
|
||||
endif
|
||||
|
||||
CC ?= gcc
|
||||
#AR = gar
|
||||
#CFLAGS = -O -Wall -g -DDEBUG
|
||||
CFLAGS ?= -O -Wall -DNDEBUG -DMINIUPNPC_SET_SOCKET_TIMEOUT -Wstrict-prototypes
|
||||
#CFLAGS = -O -g -DDEBUG
|
||||
CFLAGS ?= -O
|
||||
CFLAGS += -Wall
|
||||
CFLAGS += -W -Wstrict-prototypes
|
||||
CFLAGS += -fno-common
|
||||
CFLAGS += -DMINIUPNPC_SET_SOCKET_TIMEOUT
|
||||
CFLAGS += -D_BSD_SOURCE -D_POSIX_C_SOURCE=1
|
||||
CFLAGS += -ansi
|
||||
# -DNO_GETADDRINFO
|
||||
INSTALL = install
|
||||
SH = /bin/sh
|
||||
JAVA = java
|
||||
# see http://code.google.com/p/jnaerator/
|
||||
JNAERATOR = jnaerator-0.9.3.jar
|
||||
JNAERATOR = jnaerator-0.9.7.jar
|
||||
JNAERATORBASEURL = http://jnaerator.googlecode.com/files/
|
||||
#following libs are needed on Solaris
|
||||
#LDLIBS=-lsocket -lnsl -lresolv
|
||||
|
||||
|
|
@ -54,7 +70,7 @@ ifeq ($(OS), Darwin)
|
|||
SHAREDLIBRARY = libminiupnpc.dylib
|
||||
SONAME = $(basename $(SHAREDLIBRARY)).$(APIVERSION).dylib
|
||||
CFLAGS := -DMACOSX -D_DARWIN_C_SOURCE $(CFLAGS)
|
||||
else
|
||||
else
|
||||
SHAREDLIBRARY = libminiupnpc.so
|
||||
SONAME = $(SHAREDLIBRARY).$(APIVERSION)
|
||||
endif
|
||||
|
|
@ -85,6 +101,7 @@ INSTALLPREFIX ?= $(PREFIX)/usr
|
|||
INSTALLDIRINC = $(INSTALLPREFIX)/include/miniupnpc
|
||||
INSTALLDIRLIB = $(INSTALLPREFIX)/lib
|
||||
INSTALLDIRBIN = $(INSTALLPREFIX)/bin
|
||||
INSTALLDIRMAN = $(INSTALLPREFIX)/share/man
|
||||
|
||||
FILESTOINSTALL = $(LIBRARY) $(EXECUTABLES)
|
||||
ifneq ($(OS), AmigaOS)
|
||||
|
|
@ -92,12 +109,14 @@ FILESTOINSTALL := $(FILESTOINSTALL) $(SHAREDLIBRARY)
|
|||
endif
|
||||
|
||||
|
||||
.PHONY: install clean depend all check everything \
|
||||
installpythonmodule
|
||||
.PHONY: install clean depend all check test everything \
|
||||
installpythonmodule updateversion
|
||||
# validateminixml validateminiwget
|
||||
|
||||
all: $(LIBRARY) $(EXECUTABLES)
|
||||
|
||||
test: check
|
||||
|
||||
check: validateminixml validateminiwget
|
||||
|
||||
everything: all $(EXECUTABLES_ADDTESTS)
|
||||
|
|
@ -125,8 +144,14 @@ clean:
|
|||
$(RM) pythonmodule validateminixml
|
||||
$(RM) -r build/ dist/
|
||||
#python setup.py clean
|
||||
# clean jnaerator stuff
|
||||
$(RM) _jnaerator.* java/miniupnpc_$(OS).jar
|
||||
|
||||
install: $(FILESTOINSTALL)
|
||||
updateversion: miniupnpc.h
|
||||
cp miniupnpc.h miniupnpc.h.bak
|
||||
sed 's/\(.*MINIUPNPC_API_VERSION\s\+\)[0-9]\+/\1$(APIVERSION)/' < miniupnpc.h.bak > miniupnpc.h
|
||||
|
||||
install: updateversion $(FILESTOINSTALL)
|
||||
$(INSTALL) -d $(INSTALLDIRINC)
|
||||
$(INSTALL) -m 644 $(HEADERS) $(INSTALLDIRINC)
|
||||
$(INSTALL) -d $(INSTALLDIRLIB)
|
||||
|
|
@ -142,6 +167,11 @@ else
|
|||
$(INSTALL) -m 755 upnpc-shared $(INSTALLDIRBIN)/upnpc
|
||||
endif
|
||||
$(INSTALL) -m 755 external-ip.sh $(INSTALLDIRBIN)/external-ip
|
||||
ifneq ($(OS), AmigaOS)
|
||||
$(INSTALL) -d $(INSTALLDIRMAN)/man3
|
||||
$(INSTALL) man3/miniupnpc.3 $(INSTALLDIRMAN)/man3/miniupnpc.3
|
||||
endif
|
||||
|
||||
|
||||
cleaninstall:
|
||||
$(RM) -r $(INSTALLDIRINC)
|
||||
|
|
@ -156,7 +186,8 @@ $(LIBRARY): $(LIBOBJS)
|
|||
|
||||
$(SHAREDLIBRARY): $(LIBOBJS)
|
||||
ifeq ($(OS), Darwin)
|
||||
$(CC) -dynamiclib $(LDFLAGS) -Wl,-install_name,$(SONAME) -o $@ $^
|
||||
# $(CC) -dynamiclib $(LDFLAGS) -Wl,-install_name,$(SONAME) -o $@ $^
|
||||
$(CC) -dynamiclib $(LDFLAGS) -Wl,-install_name,$(INSTALLDIRLIB)/$(SONAME) -o $@ $^
|
||||
else
|
||||
$(CC) -shared $(LDFLAGS) -Wl,-soname,$(SONAME) -o $@ $^
|
||||
endif
|
||||
|
|
@ -177,11 +208,47 @@ testupnpreplyparse: $(TESTUPNPREPLYPARSE)
|
|||
|
||||
testigddescparse: $(TESTIGDDESCPARSE)
|
||||
|
||||
miniupnpcstrings.h: miniupnpcstrings.h.in updateminiupnpcstrings.sh
|
||||
miniupnpcstrings.h: miniupnpcstrings.h.in updateminiupnpcstrings.sh VERSION
|
||||
$(SH) updateminiupnpcstrings.sh
|
||||
|
||||
jar: $(SHAREDLIBRARY)
|
||||
$(JAVA) -jar $(JNAERATOR) -library miniupnpc miniupnpc.h declspec.h upnpcommands.h upnpreplyparse.h igd_desc_parse.h miniwget.h upnperrors.h $(SHAREDLIBRARY) -package fr.free.miniupnp -o . -jar java/miniupnpc_$(OS).jar -v
|
||||
jnaerator-0.9.8-shaded.jar:
|
||||
wget $(JNAERATORBASEURL)/$@ || curl -o $@ $(JNAERATORBASEURL)/$@
|
||||
|
||||
jnaerator-0.9.7.jar:
|
||||
wget $(JNAERATORBASEURL)/$@ || curl -o $@ $(JNAERATORBASEURL)/$@
|
||||
|
||||
jnaerator-0.9.3.jar:
|
||||
wget $(JNAERATORBASEURL)/$@ || curl -o $@ $(JNAERATORBASEURL)/$@
|
||||
|
||||
jar: $(SHAREDLIBRARY) $(JNAERATOR)
|
||||
$(JAVA) -jar $(JNAERATOR) -library miniupnpc \
|
||||
miniupnpc.h declspec.h upnpcommands.h upnpreplyparse.h \
|
||||
igd_desc_parse.h miniwget.h upnperrors.h $(SHAREDLIBRARY) \
|
||||
-package fr.free.miniupnp -o . -jar java/miniupnpc_$(JARSUFFIX).jar -v
|
||||
|
||||
mvn_install:
|
||||
mvn install:install-file -Dfile=java/miniupnpc_$(JARSUFFIX).jar \
|
||||
-DgroupId=com.github \
|
||||
-DartifactId=miniupnp \
|
||||
-Dversion=$(VERSION) \
|
||||
-Dpackaging=jar \
|
||||
-Dclassifier=$(JARSUFFIX) \
|
||||
-DgeneratePom=true \
|
||||
-DcreateChecksum=true
|
||||
|
||||
# make .deb packages
|
||||
deb: /usr/share/pyshared/stdeb all
|
||||
(python setup.py --command-packages=stdeb.command bdist_deb)
|
||||
|
||||
# install .deb packages
|
||||
ideb:
|
||||
(sudo dpkg -i deb_dist/*.deb)
|
||||
|
||||
/usr/share/pyshared/stdeb: /usr/share/doc/python-all-dev
|
||||
(sudo apt-get install python-stdeb)
|
||||
|
||||
/usr/share/doc/python-all-dev:
|
||||
(sudo apt-get install python-all-dev)
|
||||
|
||||
minihttptestserver: minihttptestserver.o
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ Discovery process is speeded up when MiniSSDPd is running on the machine.
|
|||
|
||||
* Python module *
|
||||
|
||||
you can build a python module with 'make pythonmodule'
|
||||
you can build a python module with 'make pythonmodule'
|
||||
and install it with 'make installpythonmodule'.
|
||||
setup.py (and setupmingw32.py) are included in the distribution.
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
#define _SYS_QUEUE_H_
|
||||
|
||||
/*
|
||||
* This file defines five types of data structures: singly-linked lists,
|
||||
* This file defines five types of data structures: singly-linked lists,
|
||||
* lists, simple queues, tail queues, and circular queues.
|
||||
*
|
||||
*
|
||||
|
|
@ -95,7 +95,7 @@
|
|||
struct name { \
|
||||
struct type *slh_first; /* first element */ \
|
||||
}
|
||||
|
||||
|
||||
#define SLIST_HEAD_INITIALIZER(head) \
|
||||
{ NULL }
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ struct name { \
|
|||
struct { \
|
||||
struct type *sle_next; /* next element */ \
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Singly-linked List access methods.
|
||||
*/
|
||||
|
|
@ -322,8 +322,8 @@ struct { \
|
|||
struct type **tqe_prev; /* address of previous next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* tail queue access methods
|
||||
/*
|
||||
* tail queue access methods
|
||||
*/
|
||||
#define TAILQ_FIRST(head) ((head)->tqh_first)
|
||||
#define TAILQ_END(head) NULL
|
||||
|
|
@ -430,7 +430,7 @@ struct { \
|
|||
}
|
||||
|
||||
/*
|
||||
* Circular queue access methods
|
||||
* Circular queue access methods
|
||||
*/
|
||||
#define CIRCLEQ_FIRST(head) ((head)->cqh_first)
|
||||
#define CIRCLEQ_LAST(head) ((head)->cqh_last)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $Id: codelength.h,v 1.1 2008/10/06 22:04:06 nanard Exp $ */
|
||||
/* $Id: codelength.h,v 1.3 2011/07/30 13:10:05 nanard Exp $ */
|
||||
/* Project : miniupnp
|
||||
* Author : Thomas BERNARD
|
||||
* copyright (c) 2005-2008 Thomas Bernard
|
||||
* copyright (c) 2005-2011 Thomas Bernard
|
||||
* This software is subjet to the conditions detailed in the
|
||||
* provided LICENCE file. */
|
||||
#ifndef __CODELENGTH_H__
|
||||
|
|
@ -12,7 +12,14 @@
|
|||
* following byte is part of the code */
|
||||
#define DECODELENGTH(n, p) n = 0; \
|
||||
do { n = (n << 7) | (*p & 0x7f); } \
|
||||
while(*(p++)&0x80);
|
||||
while((*(p++)&0x80) && (n<(1<<25)));
|
||||
|
||||
#define DECODELENGTH_CHECKLIMIT(n, p, p_limit) \
|
||||
n = 0; \
|
||||
do { \
|
||||
if((p) >= (p_limit)) break; \
|
||||
n = (n << 7) | (*(p) & 0x7f); \
|
||||
} while((*((p)++)&0x80) && (n<(1<<25)));
|
||||
|
||||
#define CODELENGTH(n, p) if(n>=268435456) *(p++) = (n >> 28) | 0x80; \
|
||||
if(n>=2097152) *(p++) = (n >> 21) | 0x80; \
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $Id: connecthostport.c,v 1.5 2011/04/09 08:49:50 nanard Exp $ */
|
||||
/* $Id: connecthostport.c,v 1.7 2012/03/05 19:42:46 nanard Exp $ */
|
||||
/* Project : miniupnp
|
||||
* Author : Thomas Bernard
|
||||
* Copyright (c) 2010-2011 Thomas Bernard
|
||||
* Copyright (c) 2010-2012 Thomas Bernard
|
||||
* This software is subject to the conditions detailed in the
|
||||
* LICENCE file provided in this distribution. */
|
||||
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <io.h>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
#define snprintf _snprintf
|
||||
#define herror
|
||||
#define socklen_t int
|
||||
#else /* #ifdef WIN32 */
|
||||
#else /* #ifdef _WIN32 */
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#include <errno.h>
|
||||
|
|
@ -34,10 +34,10 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#endif /* #ifndef USE_GETHOSTBYNAME */
|
||||
#endif /* #else WIN32 */
|
||||
#endif /* #else _WIN32 */
|
||||
|
||||
/* definition of PRINT_SOCKET_ERROR */
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#define PRINT_SOCKET_ERROR(x) printf("Socket error: %s, %d\n", x, WSAGetLastError());
|
||||
#else
|
||||
#define PRINT_SOCKET_ERROR(x) perror(x)
|
||||
|
|
@ -67,7 +67,7 @@ int connecthostport(const char * host, unsigned short port)
|
|||
#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
|
||||
struct timeval timeout;
|
||||
#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
|
||||
|
||||
|
||||
#ifdef USE_GETHOSTBYNAME
|
||||
hp = gethostbyname(host);
|
||||
if(hp == NULL)
|
||||
|
|
@ -160,7 +160,7 @@ int connecthostport(const char * host, unsigned short port)
|
|||
n = getaddrinfo(tmp_host, port_str, &hints, &ai);
|
||||
if(n != 0)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
fprintf(stderr, "getaddrinfo() error : %d\n", n);
|
||||
#else
|
||||
fprintf(stderr, "getaddrinfo() error : %s\n", gai_strerror(n));
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __DECLSPEC_H__
|
||||
#define __DECLSPEC_H__
|
||||
|
||||
#if defined(WIN32) && !defined(STATICLIB)
|
||||
#if defined(_WIN32) && !defined(STATICLIB)
|
||||
#ifdef MINIUPNP_EXPORTS
|
||||
#define LIBSPEC __declspec(dllexport)
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
import fr.free.miniupnp.*;
|
||||
|
||||
/**
|
||||
|
|
@ -27,7 +29,7 @@ public class JavaBridgeTest {
|
|||
return;
|
||||
}
|
||||
|
||||
devlist = miniupnpc.upnpDiscover(UPNP_DELAY, (String) null, (String) null, 0, null);
|
||||
devlist = miniupnpc.upnpDiscover(UPNP_DELAY, (String) null, (String) null, 0, 0, IntBuffer.allocate(1));
|
||||
if (devlist != null) {
|
||||
System.out.println("List of UPNP devices found on the network :");
|
||||
for (UPNPDev device = devlist; device != null; device = device.pNext) {
|
||||
|
|
@ -75,7 +77,7 @@ public class JavaBridgeTest {
|
|||
if (ret != MiniupnpcLibrary.UPNPCOMMAND_SUCCESS)
|
||||
System.out.println("GetSpecificPortMappingEntry() failed with code " + ret);
|
||||
System.out.println("InternalIP:Port = " +
|
||||
new String(intClient.array()) + ":" + new String(intPort.array()) +
|
||||
new String(intClient.array()) + ":" + new String(intPort.array()) +
|
||||
" (" + new String(desc.array()) + ")");
|
||||
ret = miniupnpc.UPNP_DeletePortMapping(
|
||||
urls.controlURL.getString(0),
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#! /bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
JAVA=java
|
||||
JAVAC=javac
|
||||
CP=$(for i in *.jar; do echo -n $i:; done).
|
||||
|
||||
$JAVAC -cp miniupnpc_Linux.jar JavaBridgeTest.java
|
||||
$JAVA -cp miniupnpc_Linux.jar:. JavaBridgeTest 12345 UDP
|
||||
|
||||
$JAVAC -cp $CP JavaBridgeTest.java || exit 1
|
||||
$JAVA -cp $CP JavaBridgeTest 12345 UDP || exit 1
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: minihttptestserver.c,v 1.6 2011/05/09 08:53:15 nanard Exp $ */
|
||||
/* $Id: minihttptestserver.c,v 1.10 2012/05/01 16:24:36 nanard Exp $ */
|
||||
/* Project : miniUPnP
|
||||
* Author : Thomas Bernard
|
||||
* Copyright (c) 2011 Thomas Bernard
|
||||
|
|
@ -190,7 +190,7 @@ void handle_http_connection(int c)
|
|||
int content_length = 16*1024;
|
||||
|
||||
/* read the request */
|
||||
while(request_len < sizeof(request_buffer) && !headers_found) {
|
||||
while(request_len < (int)sizeof(request_buffer) && !headers_found) {
|
||||
n = read(c,
|
||||
request_buffer + request_len,
|
||||
sizeof(request_buffer) - request_len);
|
||||
|
|
@ -218,7 +218,7 @@ void handle_http_connection(int c)
|
|||
printf("headers :\n%.*s", request_len, request_buffer);
|
||||
/* the request have been received, now parse the request line */
|
||||
p = request_buffer;
|
||||
for(i = 0; i < sizeof(request_method) - 1; i++) {
|
||||
for(i = 0; i < (int)sizeof(request_method) - 1; i++) {
|
||||
if(*p == ' ' || *p == '\r')
|
||||
break;
|
||||
request_method[i] = *p;
|
||||
|
|
@ -227,7 +227,7 @@ void handle_http_connection(int c)
|
|||
request_method[i] = '\0';
|
||||
while(*p == ' ')
|
||||
p++;
|
||||
for(i = 0; i < sizeof(request_uri) - 1; i++) {
|
||||
for(i = 0; i < (int)sizeof(request_uri) - 1; i++) {
|
||||
if(*p == ' ' || *p == '\r')
|
||||
break;
|
||||
request_uri[i] = *p;
|
||||
|
|
@ -236,7 +236,7 @@ void handle_http_connection(int c)
|
|||
request_uri[i] = '\0';
|
||||
while(*p == ' ')
|
||||
p++;
|
||||
for(i = 0; i < sizeof(http_version) - 1; i++) {
|
||||
for(i = 0; i < (int)sizeof(http_version) - 1; i++) {
|
||||
if(*p == ' ' || *p == '\r')
|
||||
break;
|
||||
http_version[i] = *p;
|
||||
|
|
@ -249,10 +249,21 @@ void handle_http_connection(int c)
|
|||
if(0 != strcmp(request_method, "GET")) {
|
||||
const char response405[] = "HTTP/1.1 405 Method Not Allowed\r\n"
|
||||
"Allow: GET\r\n\r\n";
|
||||
const char * pc;
|
||||
/* 405 Method Not Allowed */
|
||||
/* The response MUST include an Allow header containing a list
|
||||
* of valid methods for the requested resource. */
|
||||
write(c, response405, sizeof(response405) - 1);
|
||||
n = sizeof(response405) - 1;
|
||||
pc = response405;
|
||||
while(n > 0) {
|
||||
i = write(c, pc, n);
|
||||
if(i<0) {
|
||||
perror("write");
|
||||
return;
|
||||
}
|
||||
n -= i;
|
||||
pc += i;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -360,12 +371,12 @@ int main(int argc, char * * argv) {
|
|||
struct sockaddr_in6 * addr = (struct sockaddr_in6 *)&server_addr;
|
||||
addr->sin6_family = AF_INET6;
|
||||
addr->sin6_port = htons(port);
|
||||
addr->sin6_addr = in6addr_any;
|
||||
addr->sin6_addr = in6addr_loopback;
|
||||
} else {
|
||||
struct sockaddr_in * addr = (struct sockaddr_in *)&server_addr;
|
||||
addr->sin_family = AF_INET;
|
||||
addr->sin_port = htons(port);
|
||||
addr->sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
addr->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
||||
}
|
||||
if(bind(s, (struct sockaddr *)&server_addr,
|
||||
ipv6 ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in)) < 0) {
|
||||
|
|
@ -400,9 +411,14 @@ int main(int argc, char * * argv) {
|
|||
char * buffer;
|
||||
buffer = malloc(16*1024);
|
||||
build_content(buffer, 16*1024);
|
||||
fwrite(buffer, 1, 16*1024, f);
|
||||
i = fwrite(buffer, 1, 16*1024, f);
|
||||
if(i != 16*1024) {
|
||||
fprintf(stderr, "error writing to file %s : %dbytes written (out of %d)\n", expected_file_name, i, 16*1024);
|
||||
}
|
||||
free(buffer);
|
||||
fclose(f);
|
||||
} else {
|
||||
fprintf(stderr, "error opening file %s for writing\n", expected_file_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $Id: minisoap.c,v 1.21 2011/03/22 19:15:35 nanard Exp $ */
|
||||
/* $Id: minisoap.c,v 1.22 2012/01/21 13:30:31 nanard Exp $ */
|
||||
/* Project : miniupnp
|
||||
* Author : Thomas Bernard
|
||||
* Copyright (c) 2005-2009 Thomas Bernard
|
||||
* Copyright (c) 2005-2012 Thomas Bernard
|
||||
* This software is subject to the conditions detailed in the
|
||||
* LICENCE file provided in this distribution.
|
||||
*
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#include <winsock2.h>
|
||||
#define snprintf _snprintf
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
/* only for malloc */
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#define PRINT_SOCKET_ERROR(x) printf("Socket error: %s, %d\n", x, WSAGetLastError());
|
||||
#else
|
||||
#define PRINT_SOCKET_ERROR(x) perror(x)
|
||||
|
|
@ -57,7 +57,7 @@ httpWrite(int fd, const char * body, int bodysize,
|
|||
/* disable send on the socket */
|
||||
/* draytek routers dont seems to like that... */
|
||||
#if 0
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
if(shutdown(fd, SD_SEND)<0) {
|
||||
#else
|
||||
if(shutdown(fd, SHUT_WR)<0) { /*SD_SEND*/
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
/* $Id: minissdpc.c,v 1.14 2010/11/25 09:57:25 nanard Exp $ */
|
||||
/* $Id: minissdpc.c,v 1.16 2012/03/05 19:42:46 nanard Exp $ */
|
||||
/* Project : miniupnp
|
||||
* Web : http://miniupnp.free.fr/
|
||||
* Author : Thomas BERNARD
|
||||
* copyright (c) 2005-2009 Thomas Bernard
|
||||
* copyright (c) 2005-2012 Thomas Bernard
|
||||
* This software is subjet to the conditions detailed in the
|
||||
* provided LICENCE file. */
|
||||
/*#include <syslog.h>*/
|
||||
|
|
@ -10,8 +11,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#if defined(WIN32) || defined(__amigaos__) || defined(__amigaos4__)
|
||||
#ifdef WIN32
|
||||
#if defined(_WIN32) || defined(__amigaos__) || defined(__amigaos4__)
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <io.h>
|
||||
|
|
@ -119,7 +120,7 @@ getDevicesFromMiniSSDPD(const char * devtype, const char * socketpath)
|
|||
p += stsize;
|
||||
tmp->buffer[urlsize+1+stsize] = '\0';
|
||||
devlist = tmp;
|
||||
/* added for compatibility with recent versions of MiniSSDPd
|
||||
/* added for compatibility with recent versions of MiniSSDPd
|
||||
* >= 2007/12/19 */
|
||||
DECODELENGTH(usnsize, p);
|
||||
p += usnsize;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
/* $Id: miniupnpc.c,v 1.95 2011/05/15 21:42:26 nanard Exp $ */
|
||||
/* $Id: miniupnpc.c,v 1.105 2012/04/11 05:50:53 nanard Exp $ */
|
||||
/* Project : miniupnp
|
||||
* Web : http://miniupnp.free.fr/
|
||||
* Author : Thomas BERNARD
|
||||
* copyright (c) 2005-2011 Thomas Bernard
|
||||
* copyright (c) 2005-2012 Thomas Bernard
|
||||
* This software is subjet to the conditions detailed in the
|
||||
* provided LICENSE file. */
|
||||
#define __EXTENSIONS__ 1
|
||||
|
|
@ -16,10 +17,14 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(MACOSX) && !defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#define HAS_IP_MREQN
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
/* Win32 Specific includes and defines */
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
|
|
@ -34,7 +39,7 @@
|
|||
#endif /* defined(_MSC_VER) && (_MSC_VER >= 1400) */
|
||||
#endif /* #ifndef strncasecmp */
|
||||
#define MAXHOSTNAMELEN 64
|
||||
#else /* #ifdef WIN32 */
|
||||
#else /* #ifdef _WIN32 */
|
||||
/* Standard POSIX includes */
|
||||
#include <unistd.h>
|
||||
#if defined(__amigaos__) && !defined(__amigaos4__)
|
||||
|
|
@ -56,7 +61,7 @@
|
|||
#include <strings.h>
|
||||
#include <errno.h>
|
||||
#define closesocket close
|
||||
#endif /* #else WIN32 */
|
||||
#endif /* #else _WIN32 */
|
||||
#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
|
@ -74,7 +79,7 @@
|
|||
#include "connecthostport.h"
|
||||
#include "receivedata.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#define PRINT_SOCKET_ERROR(x) printf("Socket error: %s, %d\n", x, WSAGetLastError());
|
||||
#else
|
||||
#define PRINT_SOCKET_ERROR(x) perror(x)
|
||||
|
|
@ -323,7 +328,7 @@ upnpDiscover(int delay, const char * multicastif,
|
|||
struct UPNPDev * tmp;
|
||||
struct UPNPDev * devlist = 0;
|
||||
int opt = 1;
|
||||
static const char MSearchMsgFmt[] =
|
||||
static const char MSearchMsgFmt[] =
|
||||
"M-SEARCH * HTTP/1.1\r\n"
|
||||
"HOST: %s:" XSTR(PORT) "\r\n"
|
||||
"ST: %s\r\n"
|
||||
|
|
@ -353,14 +358,14 @@ upnpDiscover(int delay, const char * multicastif,
|
|||
int rv;
|
||||
struct addrinfo hints, *servinfo, *p;
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
MIB_IPFORWARDROW ip_forward;
|
||||
#endif
|
||||
int linklocal = 1;
|
||||
|
||||
if(error)
|
||||
*error = UPNPDISCOVER_UNKNOWN_ERROR;
|
||||
#if !defined(WIN32) && !defined(__amigaos__) && !defined(__amigaos4__)
|
||||
#if !defined(_WIN32) && !defined(__amigaos__) && !defined(__amigaos4__)
|
||||
/* first try to get infos from minissdpd ! */
|
||||
if(!minissdpdsock)
|
||||
minissdpdsock = "/var/run/minissdpd.sock";
|
||||
|
|
@ -378,7 +383,7 @@ upnpDiscover(int delay, const char * multicastif,
|
|||
deviceIndex = 0;
|
||||
#endif
|
||||
/* fallback to direct discovery */
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
sudp = socket(ipv6 ? PF_INET6 : PF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
#else
|
||||
sudp = socket(ipv6 ? PF_INET6 : PF_INET, SOCK_DGRAM, 0);
|
||||
|
|
@ -405,8 +410,8 @@ upnpDiscover(int delay, const char * multicastif,
|
|||
p->sin_port = htons(PORT);
|
||||
p->sin_addr.s_addr = INADDR_ANY;
|
||||
}
|
||||
#ifdef WIN32
|
||||
/* This code could help us to use the right Network interface for
|
||||
#ifdef _WIN32
|
||||
/* This code could help us to use the right Network interface for
|
||||
* SSDP multicast traffic */
|
||||
/* Get IP associated with the index given in the ip_forward struct
|
||||
* in order to give this ip to setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF) */
|
||||
|
|
@ -465,7 +470,7 @@ upnpDiscover(int delay, const char * multicastif,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
if (setsockopt(sudp, SOL_SOCKET, SO_REUSEADDR, (const char *)&opt, sizeof (opt)) < 0)
|
||||
#else
|
||||
if (setsockopt(sudp, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof (opt)) < 0)
|
||||
|
|
@ -480,7 +485,7 @@ upnpDiscover(int delay, const char * multicastif,
|
|||
if(multicastif)
|
||||
{
|
||||
if(ipv6) {
|
||||
#if !defined(WIN32)
|
||||
#if !defined(_WIN32)
|
||||
/* according to MSDN, if_nametoindex() is supported since
|
||||
* MS Windows Vista and MS Windows Server 2008.
|
||||
* http://msdn.microsoft.com/en-us/library/bb408409%28v=vs.85%29.aspx */
|
||||
|
|
@ -497,10 +502,28 @@ upnpDiscover(int delay, const char * multicastif,
|
|||
} else {
|
||||
struct in_addr mc_if;
|
||||
mc_if.s_addr = inet_addr(multicastif); /* ex: 192.168.x.x */
|
||||
((struct sockaddr_in *)&sockudp_r)->sin_addr.s_addr = mc_if.s_addr;
|
||||
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&mc_if, sizeof(mc_if)) < 0)
|
||||
if(mc_if.s_addr != INADDR_NONE)
|
||||
{
|
||||
PRINT_SOCKET_ERROR("setsockopt");
|
||||
((struct sockaddr_in *)&sockudp_r)->sin_addr.s_addr = mc_if.s_addr;
|
||||
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&mc_if, sizeof(mc_if)) < 0)
|
||||
{
|
||||
PRINT_SOCKET_ERROR("setsockopt");
|
||||
}
|
||||
} else {
|
||||
#ifdef HAS_IP_MREQN
|
||||
/* was not an ip address, try with an interface name */
|
||||
struct ip_mreqn reqn; /* only defined with -D_BSD_SOURCE or -D_GNU_SOURCE */
|
||||
memset(&reqn, 0, sizeof(struct ip_mreqn));
|
||||
reqn.imr_ifindex = if_nametoindex(multicastif);
|
||||
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&reqn, sizeof(reqn)) < 0)
|
||||
{
|
||||
PRINT_SOCKET_ERROR("setsockopt");
|
||||
}
|
||||
#else
|
||||
#ifdef DEBUG
|
||||
printf("Setting of multicast interface not supported with interface name.\n");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -563,7 +586,7 @@ upnpDiscover(int delay, const char * multicastif,
|
|||
}
|
||||
#else /* #ifdef NO_GETADDRINFO */
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = AF_UNSPEC; // AF_INET6 or AF_INET
|
||||
hints.ai_family = AF_UNSPEC; /* AF_INET6 or AF_INET */
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
/*hints.ai_flags = */
|
||||
if ((rv = getaddrinfo(ipv6
|
||||
|
|
@ -572,7 +595,7 @@ upnpDiscover(int delay, const char * multicastif,
|
|||
XSTR(PORT), &hints, &servinfo)) != 0) {
|
||||
if(error)
|
||||
*error = UPNPDISCOVER_SOCKET_ERROR;
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
fprintf(stderr, "getaddrinfo() failed: %d\n", rv);
|
||||
#else
|
||||
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
|
||||
|
|
@ -582,6 +605,13 @@ upnpDiscover(int delay, const char * multicastif,
|
|||
for(p = servinfo; p; p = p->ai_next) {
|
||||
n = sendto(sudp, bufr, n, 0, p->ai_addr, p->ai_addrlen);
|
||||
if (n < 0) {
|
||||
#ifdef DEBUG
|
||||
char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
|
||||
if (getnameinfo(p->ai_addr, p->ai_addrlen, hbuf, sizeof(hbuf), sbuf,
|
||||
sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV) == 0) {
|
||||
fprintf(stderr, "host:%s port:%s\n", hbuf, sbuf);
|
||||
}
|
||||
#endif
|
||||
PRINT_SOCKET_ERROR("sendto");
|
||||
continue;
|
||||
}
|
||||
|
|
@ -706,6 +736,7 @@ LIBSPEC void GetUPNPUrls(struct UPNPUrls * urls, struct IGDdatas * data,
|
|||
{
|
||||
char * p;
|
||||
int n1, n2, n3, n4;
|
||||
|
||||
n1 = strlen(data->urlbase);
|
||||
if(n1==0)
|
||||
n1 = strlen(descURL);
|
||||
|
|
@ -716,11 +747,16 @@ LIBSPEC void GetUPNPUrls(struct UPNPUrls * urls, struct IGDdatas * data,
|
|||
n3 += strlen(data->CIF.controlurl);
|
||||
n4 += strlen(data->IPv6FC.controlurl);
|
||||
|
||||
/* allocate memory to store URLs */
|
||||
urls->ipcondescURL = (char *)malloc(n1);
|
||||
urls->controlURL = (char *)malloc(n2);
|
||||
urls->controlURL_CIF = (char *)malloc(n3);
|
||||
urls->controlURL_6FC = (char *)malloc(n4);
|
||||
/* maintenant on chope la desc du WANIPConnection */
|
||||
|
||||
/* strdup descURL */
|
||||
urls->rootdescURL = strdup(descURL);
|
||||
|
||||
/* get description of WANIPConnection */
|
||||
if(data->urlbase[0] != '\0')
|
||||
strncpy(urls->ipcondescURL, data->urlbase, n1);
|
||||
else
|
||||
|
|
@ -730,7 +766,7 @@ LIBSPEC void GetUPNPUrls(struct UPNPUrls * urls, struct IGDdatas * data,
|
|||
strncpy(urls->controlURL, urls->ipcondescURL, n2);
|
||||
strncpy(urls->controlURL_CIF, urls->ipcondescURL, n3);
|
||||
strncpy(urls->controlURL_6FC, urls->ipcondescURL, n4);
|
||||
|
||||
|
||||
url_cpy_or_cat(urls->ipcondescURL, data->first.scpdurl, n1);
|
||||
|
||||
url_cpy_or_cat(urls->controlURL, data->first.controlurl, n2);
|
||||
|
|
@ -764,6 +800,8 @@ FreeUPNPUrls(struct UPNPUrls * urls)
|
|||
urls->controlURL_CIF = 0;
|
||||
free(urls->controlURL_6FC);
|
||||
urls->controlURL_6FC = 0;
|
||||
free(urls->rootdescURL);
|
||||
urls->rootdescURL = 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -785,6 +823,7 @@ UPNPIGD_IsConnected(struct UPNPUrls * urls, struct IGDdatas * data)
|
|||
|
||||
/* UPNP_GetValidIGD() :
|
||||
* return values :
|
||||
* -1 = Internal error
|
||||
* 0 = NO IGD found
|
||||
* 1 = A valid connected IGD has been found
|
||||
* 2 = A valid IGD has been found but it reported as
|
||||
|
|
@ -801,11 +840,14 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
|
|||
struct IGDdatas * data,
|
||||
char * lanaddr, int lanaddrlen)
|
||||
{
|
||||
char * descXML;
|
||||
int descXMLsize = 0;
|
||||
struct xml_desc {
|
||||
char * xml;
|
||||
int size;
|
||||
} * desc = NULL;
|
||||
struct UPNPDev * dev;
|
||||
int ndev = 0;
|
||||
int state; /* state 1 : IGD connected. State 2 : IGD. State 3 : anything */
|
||||
int i;
|
||||
int state = -1; /* state 1 : IGD connected. State 2 : IGD. State 3 : anything */
|
||||
if(!devlist)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
|
|
@ -813,22 +855,36 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
|
|||
#endif
|
||||
return 0;
|
||||
}
|
||||
for(dev = devlist; dev; dev = dev->pNext)
|
||||
ndev++;
|
||||
if(ndev > 0)
|
||||
{
|
||||
desc = calloc(ndev, sizeof(struct xml_desc));
|
||||
if(!desc)
|
||||
return -1; /* memory allocation error */
|
||||
}
|
||||
for(state = 1; state <= 3; state++)
|
||||
{
|
||||
for(dev = devlist; dev; dev = dev->pNext)
|
||||
for(dev = devlist, i = 0; dev; dev = dev->pNext, i++)
|
||||
{
|
||||
/* we should choose an internet gateway device.
|
||||
* with st == urn:schemas-upnp-org:device:InternetGatewayDevice:1 */
|
||||
descXML = miniwget_getaddr(dev->descURL, &descXMLsize,
|
||||
lanaddr, lanaddrlen);
|
||||
if(descXML)
|
||||
if(state == 1)
|
||||
{
|
||||
desc[i].xml = miniwget_getaddr(dev->descURL, &(desc[i].size),
|
||||
lanaddr, lanaddrlen);
|
||||
#ifdef DEBUG
|
||||
if(!desc[i].xml)
|
||||
{
|
||||
printf("error getting XML description %s\n", dev->descURL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if(desc[i].xml)
|
||||
{
|
||||
ndev++;
|
||||
memset(data, 0, sizeof(struct IGDdatas));
|
||||
memset(urls, 0, sizeof(struct UPNPUrls));
|
||||
parserootdesc(descXML, descXMLsize, data);
|
||||
free(descXML);
|
||||
descXML = NULL;
|
||||
parserootdesc(desc[i].xml, desc[i].size, data);
|
||||
if(0==strcmp(data->CIF.servicetype,
|
||||
"urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1")
|
||||
|| state >= 3 )
|
||||
|
|
@ -841,7 +897,7 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
|
|||
UPNPIGD_IsConnected(urls, data));
|
||||
#endif
|
||||
if((state >= 2) || UPNPIGD_IsConnected(urls, data))
|
||||
return state;
|
||||
goto free_and_return;
|
||||
FreeUPNPUrls(urls);
|
||||
if(data->second.servicetype[0] != '\0') {
|
||||
#ifdef DEBUG
|
||||
|
|
@ -859,21 +915,18 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
|
|||
UPNPIGD_IsConnected(urls, data));
|
||||
#endif
|
||||
if((state >= 2) || UPNPIGD_IsConnected(urls, data))
|
||||
return state;
|
||||
goto free_and_return;
|
||||
FreeUPNPUrls(urls);
|
||||
}
|
||||
}
|
||||
memset(data, 0, sizeof(struct IGDdatas));
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else
|
||||
{
|
||||
printf("error getting XML description %s\n", dev->descURL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
state = 0;
|
||||
free_and_return:
|
||||
free(desc);
|
||||
return state;
|
||||
}
|
||||
|
||||
/* UPNP_GetIGDFromUrl()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: miniupnpc.h,v 1.23 2011/04/11 08:21:46 nanard Exp $ */
|
||||
/* $Id: miniupnpc.h,v 1.25 2011/10/09 16:17:29 nanard Exp $ */
|
||||
/* Project: miniupnp
|
||||
* http://miniupnp.free.fr/
|
||||
* Author: Thomas Bernard
|
||||
|
|
@ -17,6 +17,10 @@
|
|||
#define UPNPDISCOVER_SOCKET_ERROR (-101)
|
||||
#define UPNPDISCOVER_MEMORY_ERROR (-102)
|
||||
|
||||
/* versions : */
|
||||
#define MINIUPNPC_VERSION "1.6.20120502"
|
||||
#define MINIUPNPC_API_VERSION 8
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
@ -74,6 +78,7 @@ struct UPNPUrls {
|
|||
char * ipcondescURL;
|
||||
char * controlURL_CIF;
|
||||
char * controlURL_6FC;
|
||||
char * rootdescURL;
|
||||
};
|
||||
|
||||
/* UPNP_GetValidIGD() :
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
/* $Id: miniupnpcmodule.c,v 1.18 2011/04/10 11:21:23 nanard Exp $*/
|
||||
/* $Id: miniupnpcmodule.c,v 1.20 2012/03/05 19:42:47 nanard Exp $*/
|
||||
/* Project : miniupnp
|
||||
* Author : Thomas BERNARD
|
||||
* website : http://miniupnp.tuxfamily.org/
|
||||
* copyright (c) 2007-2009 Thomas Bernard
|
||||
* copyright (c) 2007-2012 Thomas Bernard
|
||||
* This software is subjet to the conditions detailed in the
|
||||
* provided LICENCE file. */
|
||||
#include <Python.h>
|
||||
|
|
@ -72,7 +72,7 @@ UPnP_discover(UPnPObject *self)
|
|||
{
|
||||
freeUPNPDevlist(self->devlist);
|
||||
self->devlist = 0;
|
||||
}
|
||||
}
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
self->devlist = upnpDiscover((int)self->discoverdelay/*timeout in ms*/,
|
||||
0/* multicast if*/,
|
||||
|
|
@ -215,7 +215,7 @@ Py_END_ALLOW_THREADS
|
|||
}
|
||||
|
||||
/* AddPortMapping(externalPort, protocol, internalHost, internalPort, desc,
|
||||
* remoteHost)
|
||||
* remoteHost)
|
||||
* protocol is 'UDP' or 'TCP' */
|
||||
static PyObject *
|
||||
UPnP_addportmapping(UPnPObject *self, PyObject *args)
|
||||
|
|
@ -300,7 +300,7 @@ Py_END_ALLOW_THREADS
|
|||
}
|
||||
}
|
||||
|
||||
/* GetSpecificPortMapping(ePort, proto)
|
||||
/* GetSpecificPortMapping(ePort, proto)
|
||||
* proto = 'UDP' or 'TCP' */
|
||||
static PyObject *
|
||||
UPnP_getspecificportmapping(UPnPObject *self, PyObject *args)
|
||||
|
|
@ -472,7 +472,7 @@ static PyTypeObject UPnPType = {
|
|||
0, /* tp_dictoffset */
|
||||
0,/*(initproc)UPnP_init,*/ /* tp_init */
|
||||
0, /* tp_alloc */
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
PyType_GenericNew,/*UPnP_new,*/ /* tp_new */
|
||||
#else
|
||||
0,
|
||||
|
|
@ -488,11 +488,11 @@ static PyMethodDef miniupnpc_methods[] = {
|
|||
#define PyMODINIT_FUNC void
|
||||
#endif
|
||||
PyMODINIT_FUNC
|
||||
initminiupnpc(void)
|
||||
initminiupnpc(void)
|
||||
{
|
||||
PyObject* m;
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
UPnPType.tp_new = PyType_GenericNew;
|
||||
#endif
|
||||
if (PyType_Ready(&UPnPType) < 0)
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
/* $Id: miniwget.c,v 1.52 2011/06/17 22:59:42 nanard Exp $ */
|
||||
/* $Id: miniwget.c,v 1.56 2012/05/01 16:16:08 nanard Exp $ */
|
||||
/* Project : miniupnp
|
||||
* Website : http://miniupnp.free.fr/
|
||||
* Author : Thomas Bernard
|
||||
* Copyright (c) 2005-2011 Thomas Bernard
|
||||
* Copyright (c) 2005-2012 Thomas Bernard
|
||||
* This software is subject to the conditions detailed in the
|
||||
* LICENCE file provided in this distribution. */
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <io.h>
|
||||
|
|
@ -24,7 +25,7 @@
|
|||
#define strncasecmp memicmp
|
||||
#endif /* defined(_MSC_VER) && (_MSC_VER >= 1400) */
|
||||
#endif /* #ifndef strncasecmp */
|
||||
#else /* #ifdef WIN32 */
|
||||
#else /* #ifdef _WIN32 */
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#if defined(__amigaos__) && !defined(__amigaos4__)
|
||||
|
|
@ -33,13 +34,14 @@
|
|||
#include <sys/select.h>
|
||||
#endif /* #else defined(__amigaos__) && !defined(__amigaos4__) */
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#define closesocket close
|
||||
/* defining MINIUPNPC_IGNORE_EINTR enable the ignore of interruptions
|
||||
* during the connect() call */
|
||||
#define MINIUPNPC_IGNORE_EINTR
|
||||
#endif /* #else WIN32 */
|
||||
#endif /* #else _WIN32 */
|
||||
#if defined(__sun) || defined(sun)
|
||||
#define MIN(x,y) (((x)<(y))?(x):(y))
|
||||
#endif
|
||||
|
|
@ -67,13 +69,13 @@ getHTTPResponse(int s, int * size)
|
|||
unsigned int bytestocopy = 0;
|
||||
/* buffers : */
|
||||
char * header_buf;
|
||||
int header_buf_len = 2048;
|
||||
int header_buf_used = 0;
|
||||
unsigned int header_buf_len = 2048;
|
||||
unsigned int header_buf_used = 0;
|
||||
char * content_buf;
|
||||
int content_buf_len = 2048;
|
||||
int content_buf_used = 0;
|
||||
unsigned int content_buf_len = 2048;
|
||||
unsigned int content_buf_used = 0;
|
||||
char chunksize_buf[32];
|
||||
int chunksize_buf_index;
|
||||
unsigned int chunksize_buf_index;
|
||||
|
||||
header_buf = malloc(header_buf_len);
|
||||
content_buf = malloc(content_buf_len);
|
||||
|
|
@ -97,14 +99,14 @@ getHTTPResponse(int s, int * size)
|
|||
/* search for CR LF CR LF (end of headers)
|
||||
* recognize also LF LF */
|
||||
i = 0;
|
||||
while(i < (header_buf_used-1) && (endofheaders == 0)) {
|
||||
while(i < ((int)header_buf_used-1) && (endofheaders == 0)) {
|
||||
if(header_buf[i] == '\r') {
|
||||
i++;
|
||||
if(header_buf[i] == '\n') {
|
||||
i++;
|
||||
if(i < header_buf_used && header_buf[i] == '\r') {
|
||||
if(i < (int)header_buf_used && header_buf[i] == '\r') {
|
||||
i++;
|
||||
if(i < header_buf_used && header_buf[i] == '\n') {
|
||||
if(i < (int)header_buf_used && header_buf[i] == '\n') {
|
||||
endofheaders = i+1;
|
||||
}
|
||||
}
|
||||
|
|
@ -160,7 +162,7 @@ getHTTPResponse(int s, int * size)
|
|||
linestart = i;
|
||||
colon = linestart;
|
||||
valuestart = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* copy the remaining of the received data back to buf */
|
||||
n = header_buf_used - endofheaders;
|
||||
|
|
@ -194,7 +196,7 @@ getHTTPResponse(int s, int * size)
|
|||
i++; /* discarding chunk-extension */
|
||||
if(i<n && buf[i] == '\r') i++;
|
||||
if(i<n && buf[i] == '\n') {
|
||||
int j;
|
||||
unsigned int j;
|
||||
for(j = 0; j < chunksize_buf_index; j++) {
|
||||
if(chunksize_buf[j] >= '0'
|
||||
&& chunksize_buf[j] <= '9')
|
||||
|
|
@ -221,15 +223,15 @@ getHTTPResponse(int s, int * size)
|
|||
goto end_of_stream;
|
||||
}
|
||||
}
|
||||
bytestocopy = ((int)chunksize < n - i)?chunksize:(n - i);
|
||||
if((int)(content_buf_used + bytestocopy) > content_buf_len)
|
||||
bytestocopy = ((int)chunksize < (n - i))?chunksize:(unsigned int)(n - i);
|
||||
if((content_buf_used + bytestocopy) > content_buf_len)
|
||||
{
|
||||
if(content_length >= content_buf_used + (int)bytestocopy) {
|
||||
if(content_length >= (int)(content_buf_used + bytestocopy)) {
|
||||
content_buf_len = content_length;
|
||||
} else {
|
||||
content_buf_len = content_buf_used + (int)bytestocopy;
|
||||
content_buf_len = content_buf_used + bytestocopy;
|
||||
}
|
||||
content_buf = (char *)realloc((void *)content_buf,
|
||||
content_buf = (char *)realloc((void *)content_buf,
|
||||
content_buf_len);
|
||||
}
|
||||
memcpy(content_buf + content_buf_used, buf + i, bytestocopy);
|
||||
|
|
@ -242,18 +244,18 @@ getHTTPResponse(int s, int * size)
|
|||
{
|
||||
/* not chunked */
|
||||
if(content_length > 0
|
||||
&& (content_buf_used + n) > content_length) {
|
||||
&& (int)(content_buf_used + n) > content_length) {
|
||||
/* skipping additional bytes */
|
||||
n = content_length - content_buf_used;
|
||||
}
|
||||
if(content_buf_used + n > content_buf_len)
|
||||
{
|
||||
if(content_length >= content_buf_used + n) {
|
||||
if(content_length >= (int)(content_buf_used + n)) {
|
||||
content_buf_len = content_length;
|
||||
} else {
|
||||
content_buf_len = content_buf_used + n;
|
||||
}
|
||||
content_buf = (char *)realloc((void *)content_buf,
|
||||
content_buf = (char *)realloc((void *)content_buf,
|
||||
content_buf_len);
|
||||
}
|
||||
memcpy(content_buf + content_buf_used, buf, n);
|
||||
|
|
@ -261,7 +263,7 @@ getHTTPResponse(int s, int * size)
|
|||
}
|
||||
}
|
||||
/* use the Content-Length header value if available */
|
||||
if(content_length > 0 && content_buf_used >= content_length)
|
||||
if(content_length > 0 && (int)content_buf_used >= content_length)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("End of HTTP content\n");
|
||||
|
|
@ -284,7 +286,7 @@ end_of_stream:
|
|||
* do all the work.
|
||||
* Return NULL if something failed. */
|
||||
static void *
|
||||
miniwget3(const char * url, const char * host,
|
||||
miniwget3(const char * host,
|
||||
unsigned short port, const char * path,
|
||||
int * size, char * addr_str, int addr_str_len,
|
||||
const char * httpversion)
|
||||
|
|
@ -343,7 +345,7 @@ miniwget3(const char * url, const char * host,
|
|||
NULL, 0,
|
||||
NI_NUMERICHOST | NI_NUMERICSERV);
|
||||
if(n != 0) {
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
fprintf(stderr, "getnameinfo() failed : %d\n", n);
|
||||
#else
|
||||
fprintf(stderr, "getnameinfo() failed : %s\n", gai_strerror(n));
|
||||
|
|
@ -388,22 +390,22 @@ miniwget3(const char * url, const char * host,
|
|||
/* miniwget2() :
|
||||
* Call miniwget3(); retry with HTTP/1.1 if 1.0 fails. */
|
||||
static void *
|
||||
miniwget2(const char * url, const char * host,
|
||||
miniwget2(const char * host,
|
||||
unsigned short port, const char * path,
|
||||
int * size, char * addr_str, int addr_str_len)
|
||||
{
|
||||
char * respbuffer;
|
||||
|
||||
respbuffer = miniwget3(url, host, port, path, size, addr_str, addr_str_len, "1.1");
|
||||
respbuffer = miniwget3(host, port, path, size, addr_str, addr_str_len, "1.1");
|
||||
/*
|
||||
respbuffer = miniwget3(url, host, port, path, size, addr_str, addr_str_len, "1.0");
|
||||
respbuffer = miniwget3(host, port, path, size, addr_str, addr_str_len, "1.0");
|
||||
if (*size == 0)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("Retrying with HTTP/1.1\n");
|
||||
#endif
|
||||
free(respbuffer);
|
||||
respbuffer = miniwget3(url, host, port, path, size, addr_str, addr_str_len, "1.1");
|
||||
respbuffer = miniwget3(host, port, path, size, addr_str, addr_str_len, "1.1");
|
||||
}
|
||||
*/
|
||||
return respbuffer;
|
||||
|
|
@ -417,7 +419,7 @@ miniwget2(const char * url, const char * host,
|
|||
* url : source string not modified
|
||||
* hostname : hostname destination string (size of MAXHOSTNAMELEN+1)
|
||||
* port : port (destination)
|
||||
* path : pointer to the path part of the URL
|
||||
* path : pointer to the path part of the URL
|
||||
*
|
||||
* Return values :
|
||||
* 0 - Failure
|
||||
|
|
@ -500,14 +502,14 @@ void * miniwget(const char * url, int * size)
|
|||
#ifdef DEBUG
|
||||
printf("parsed url : hostname='%s' port=%hu path='%s'\n", hostname, port, path);
|
||||
#endif
|
||||
return miniwget2(url, hostname, port, path, size, 0, 0);
|
||||
return miniwget2(hostname, port, path, size, 0, 0);
|
||||
}
|
||||
|
||||
void * miniwget_getaddr(const char * url, int * size, char * addr, int addrlen)
|
||||
{
|
||||
unsigned short port;
|
||||
char * path;
|
||||
/* protocol://host:port/chemin */
|
||||
/* protocol://host:port/path */
|
||||
char hostname[MAXHOSTNAMELEN+1];
|
||||
*size = 0;
|
||||
if(addr)
|
||||
|
|
@ -517,6 +519,6 @@ void * miniwget_getaddr(const char * url, int * size, char * addr, int addrlen)
|
|||
#ifdef DEBUG
|
||||
printf("parsed url : hostname='%s' port=%hu path='%s'\n", hostname, port, path);
|
||||
#endif
|
||||
return miniwget2(url, hostname, port, path, size, addr, addrlen);
|
||||
return miniwget2(hostname, port, path, size, addr, addrlen);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id: minixml.c,v 1.9 2011/02/07 13:44:57 nanard Exp $ */
|
||||
/* $Id: minixml.c,v 1.10 2012/03/05 19:42:47 nanard Exp $ */
|
||||
/* minixml.c : the minimum size a xml parser can be ! */
|
||||
/* Project : miniupnp
|
||||
* webpage: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||
* Author : Thomas Bernard
|
||||
|
||||
Copyright (c) 2005-2011, Thomas BERNARD
|
||||
Copyright (c) 2005-2011, Thomas BERNARD
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -149,7 +149,7 @@ static void parseelt(struct xmlparser * p)
|
|||
return;
|
||||
}
|
||||
if(memcmp(p->xml, "<![CDATA[", 9) == 0)
|
||||
{
|
||||
{
|
||||
/* CDATA handling */
|
||||
p->xml += 9;
|
||||
data = p->xml;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: minixmlvalid.c,v 1.4 2011/02/07 13:44:57 nanard Exp $ */
|
||||
/* $Id: minixmlvalid.c,v 1.6 2012/05/01 16:24:07 nanard Exp $ */
|
||||
/* MiniUPnP Project
|
||||
* http://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/
|
||||
* minixmlvalid.c :
|
||||
|
|
@ -32,7 +32,7 @@ int evtlistcmp(struct eventlist * a, struct eventlist * b)
|
|||
if(a->n != b->n)
|
||||
{
|
||||
printf("event number not matching : %d != %d\n", a->n, b->n);
|
||||
//return 1;
|
||||
/*return 1;*/
|
||||
}
|
||||
for(i=0; i<a->n; i++)
|
||||
{
|
||||
|
|
@ -82,7 +82,7 @@ static const struct event evtref[] =
|
|||
{ELTEND, "elt2b", 5},
|
||||
{ELTEND, "elt2a", 5},
|
||||
{ELTEND, "xmlroot", 7}
|
||||
};
|
||||
};
|
||||
|
||||
void startelt(void * data, const char * p, int l)
|
||||
{
|
||||
|
|
@ -148,6 +148,8 @@ int testxmlparser(const char * xml, int size)
|
|||
int main(int argc, char * * argv)
|
||||
{
|
||||
int r;
|
||||
(void)argc; (void)argv;
|
||||
|
||||
r = testxmlparser(xmldata, sizeof(xmldata)-1);
|
||||
if(r)
|
||||
printf("minixml validation test failed\n");
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $Id: portlistingparse.c,v 1.4 2011/03/18 11:02:17 nanard Exp $ */
|
||||
/* $Id: portlistingparse.c,v 1.5 2012/03/05 19:42:47 nanard Exp $ */
|
||||
/* MiniUPnP project
|
||||
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||
* (c) 2011 Thomas Bernard
|
||||
* (c) 2011 Thomas Bernard
|
||||
* This software is subject to the conditions detailed
|
||||
* in the LICENCE file provided within the distribution */
|
||||
#include <string.h>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $Id: portlistingparse.h,v 1.4 2011/02/15 23:03:56 nanard Exp $ */
|
||||
/* $Id: portlistingparse.h,v 1.6 2012/03/05 19:42:47 nanard Exp $ */
|
||||
/* MiniUPnP project
|
||||
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||
* (c) 2011 Thomas Bernard
|
||||
* (c) 2011-2012 Thomas Bernard
|
||||
* This software is subject to the conditions detailed
|
||||
* in the LICENCE file provided within the distribution */
|
||||
#ifndef __PORTLISTINGPARSE_H__
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
/* for the definition of UNSIGNED_INTEGER */
|
||||
#include "miniupnpctypes.h"
|
||||
|
||||
#if defined(NO_SYS_QUEUE_H) || defined(WIN32) || defined(__HAIKU__)
|
||||
#if defined(NO_SYS_QUEUE_H) || defined(_WIN32) || defined(__HAIKU__)
|
||||
#include "bsdqueue.h"
|
||||
#else
|
||||
#include <sys/queue.h>
|
||||
|
|
@ -37,7 +37,7 @@ typedef enum { PortMappingEltNone,
|
|||
PortMappingEntry, NewRemoteHost,
|
||||
NewExternalPort, NewProtocol,
|
||||
NewInternalPort, NewInternalClient,
|
||||
NewEnabled, NewDescription,
|
||||
NewEnabled, NewDescription,
|
||||
NewLeaseTime } portMappingElt;
|
||||
|
||||
struct PortMapping {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
/* $Id: receivedata.c,v 1.1 2011/04/11 08:21:47 nanard Exp $ */
|
||||
/* $Id: receivedata.c,v 1.3 2012/03/05 19:42:47 nanard Exp $ */
|
||||
/* Project : miniupnp
|
||||
* Website : http://miniupnp.free.fr/
|
||||
* Author : Thomas Bernard
|
||||
* Copyright (c) 2011 Thomas Bernard
|
||||
* Copyright (c) 2011-2012 Thomas Bernard
|
||||
* This software is subject to the conditions detailed in the
|
||||
* LICENCE file provided in this distribution. */
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#else
|
||||
|
|
@ -24,7 +25,7 @@
|
|||
#define MINIUPNPC_IGNORE_EINTR
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#define PRINT_SOCKET_ERROR(x) printf("Socket error: %s, %d\n", x, WSAGetLastError());
|
||||
#else
|
||||
#define PRINT_SOCKET_ERROR(x) perror(x)
|
||||
|
|
@ -36,7 +37,7 @@ int
|
|||
receivedata(int socket, char * data, int length, int timeout)
|
||||
{
|
||||
int n;
|
||||
#if !defined(WIN32) && !defined(__amigaos__) && !defined(__amigaos4__)
|
||||
#if !defined(_WIN32) && !defined(__amigaos__) && !defined(__amigaos4__)
|
||||
/* using poll */
|
||||
struct pollfd fds[1]; /* for the poll */
|
||||
#ifdef MINIUPNPC_IGNORE_EINTR
|
||||
|
|
@ -55,8 +56,8 @@ receivedata(int socket, char * data, int length, int timeout)
|
|||
/* timeout */
|
||||
return 0;
|
||||
}
|
||||
#else /* !defined(WIN32) && !defined(__amigaos__) && !defined(__amigaos4__) */
|
||||
/* using select under WIN32 and amigaos */
|
||||
#else /* !defined(_WIN32) && !defined(__amigaos__) && !defined(__amigaos4__) */
|
||||
/* using select under _WIN32 and amigaos */
|
||||
fd_set socketSet;
|
||||
TIMEVAL timeval;
|
||||
FD_ZERO(&socketSet);
|
||||
|
|
@ -69,7 +70,7 @@ receivedata(int socket, char * data, int length, int timeout)
|
|||
return -1;
|
||||
} else if(n == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
n = recv(socket, data, length, 0);
|
||||
if(n<0) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: receivedata.h,v 1.1 2011/04/11 08:21:47 nanard Exp $ */
|
||||
/* $Id: receivedata.h,v 1.2 2012/03/05 19:42:47 nanard Exp $ */
|
||||
/* Project: miniupnp
|
||||
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||
* Author: Thomas Bernard
|
||||
|
|
@ -8,8 +8,8 @@
|
|||
#ifndef __RECEIVEDATA_H__
|
||||
#define __RECEIVEDATA_H__
|
||||
|
||||
/* Reads data from the specified socket.
|
||||
* Returns the number of bytes read if successful, zero if no bytes were
|
||||
/* Reads data from the specified socket.
|
||||
* Returns the number of bytes read if successful, zero if no bytes were
|
||||
* read or if we timed out. Returns negative if there was an error. */
|
||||
int receivedata(int socket, char * data, int length, int timeout);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,16 @@
|
|||
#! /usr/bin/python
|
||||
# $Id: setup.py,v 1.6 2011/01/04 09:46:08 nanard Exp $
|
||||
# the MiniUPnP Project (c) 2007-2011 Thomas Bernard
|
||||
# $Id: setup.py,v 1.8 2012/03/05 04:54:00 nanard Exp $
|
||||
# the MiniUPnP Project (c) 2007-2012 Thomas Bernard
|
||||
# http://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/
|
||||
#
|
||||
# python script to build the miniupnpc module under unix
|
||||
#
|
||||
# replace libminiupnpc.a by libminiupnpc.so for shared library usage
|
||||
from distutils.core import setup, Extension
|
||||
setup(name="miniupnpc", version="1.5",
|
||||
from distutils import sysconfig
|
||||
sysconfig.get_config_vars()["OPT"] = ''
|
||||
sysconfig.get_config_vars()["CFLAGS"] = ''
|
||||
setup(name="miniupnpc", version="1.6",
|
||||
ext_modules=[
|
||||
Extension(name="miniupnpc", sources=["miniupnpcmodule.c"],
|
||||
extra_objects=["libminiupnpc.a"])
|
||||
|
|
|
|||
|
|
@ -1,12 +1,15 @@
|
|||
#! /usr/bin/python
|
||||
# $Id: setupmingw32.py,v 1.5 2011/05/15 21:18:43 nanard Exp $
|
||||
# the MiniUPnP Project (c) 2007-2011 Thomas Bernard
|
||||
# $Id: setupmingw32.py,v 1.7 2012/03/05 04:54:00 nanard Exp $
|
||||
# the MiniUPnP Project (c) 2007-2012 Thomas Bernard
|
||||
# http://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/
|
||||
#
|
||||
# python script to build the miniupnpc module under windows (using mingw32)
|
||||
#
|
||||
from distutils.core import setup, Extension
|
||||
setup(name="miniupnpc", version="1.5",
|
||||
from distutils import sysconfig
|
||||
sysconfig.get_config_vars()["OPT"] = ''
|
||||
sysconfig.get_config_vars()["CFLAGS"] = ''
|
||||
setup(name="miniupnpc", version="1.6",
|
||||
ext_modules=[
|
||||
Extension(name="miniupnpc", sources=["miniupnpcmodule.c"],
|
||||
libraries=["ws2_32", "iphlpapi"],
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: testigddescparse.c,v 1.2 2009/12/03 13:50:06 nanard Exp $ */
|
||||
/* $Id: testigddescparse.c,v 1.3 2012/03/05 19:42:47 nanard Exp $ */
|
||||
/* Project : miniupnp
|
||||
* http://miniupnp.free.fr/
|
||||
* Author : Thomas Bernard
|
||||
|
|
@ -25,7 +25,7 @@ int test_igd_desc_parse(char * buffer, int len)
|
|||
parser.data = &igd;
|
||||
parser.starteltfunc = IGDstartelt;
|
||||
parser.endeltfunc = IGDendelt;
|
||||
parser.datafunc = IGDdata;
|
||||
parser.datafunc = IGDdata;
|
||||
parsexml(&parser);
|
||||
printIGD(&igd);
|
||||
GetUPNPUrls(&urls, &igd, "http://fake/desc/url/file.xml");
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
/* $Id: testminixml.c,v 1.6 2006/11/19 22:32:35 nanard Exp $
|
||||
/* $Id: testminixml.c,v 1.8 2012/03/05 19:42:47 nanard Exp $
|
||||
* MiniUPnP project
|
||||
* Website : http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||
* Author : Thomas Bernard.
|
||||
* Copyright (c) 2005-2012 Thomas Bernard
|
||||
*
|
||||
* testminixml.c
|
||||
* test program for the "minixml" functions.
|
||||
* Author : Thomas Bernard.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
|
@ -9,14 +13,6 @@
|
|||
#include "minixml.h"
|
||||
#include "igd_desc_parse.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#define NO_BZERO
|
||||
#endif
|
||||
|
||||
#ifdef NO_BZERO
|
||||
#define bzero(p, n) memset(p, 0, n)
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
void printeltname1(void * d, const char * name, int l)
|
||||
{
|
||||
|
|
@ -47,7 +43,7 @@ void burptest(const char * buffer, int bufsize)
|
|||
struct IGDdatas data;
|
||||
struct xmlparser parser;
|
||||
/*objet IGDdatas */
|
||||
bzero(&data, sizeof(struct IGDdatas));
|
||||
memset(&data, 0, sizeof(struct IGDdatas));
|
||||
/* objet xmlparser */
|
||||
parser.xmlstart = buffer;
|
||||
parser.xmlsize = bufsize;
|
||||
|
|
@ -57,7 +53,7 @@ void burptest(const char * buffer, int bufsize)
|
|||
parser.datafunc = printdata; */
|
||||
parser.starteltfunc = IGDstartelt;
|
||||
parser.endeltfunc = IGDendelt;
|
||||
parser.datafunc = IGDdata;
|
||||
parser.datafunc = IGDdata;
|
||||
parsexml(&parser);
|
||||
printIGD(&data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $Id: upnpc.c,v 1.88 2011/06/17 23:31:01 nanard Exp $ */
|
||||
/* $Id: upnpc.c,v 1.94 2012/04/20 14:13:10 nanard Exp $ */
|
||||
/* Project : miniupnp
|
||||
* Author : Thomas Bernard
|
||||
* Copyright (c) 2005-2011 Thomas Bernard
|
||||
* Copyright (c) 2005-2012 Thomas Bernard
|
||||
* This software is subject to the conditions detailed in the
|
||||
* LICENCE file provided in this distribution. */
|
||||
|
||||
|
|
@ -9,16 +9,19 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#define snprintf _snprintf
|
||||
#else
|
||||
/* for IPPROTO_TCP / IPPROTO_UDP */
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#include "miniwget.h"
|
||||
#include "miniupnpc.h"
|
||||
#include "upnpcommands.h"
|
||||
#include "upnperrors.h"
|
||||
|
||||
/* protofix() checks if protocol is "UDP" or "TCP"
|
||||
/* protofix() checks if protocol is "UDP" or "TCP"
|
||||
* returns NULL if not */
|
||||
const char * protofix(const char * proto)
|
||||
{
|
||||
|
|
@ -26,7 +29,7 @@ const char * protofix(const char * proto)
|
|||
static const char proto_udp[4] = { 'U', 'D', 'P', 0};
|
||||
int i, b;
|
||||
for(i=0, b=1; i<4; i++)
|
||||
b = b && ( (proto[i] == proto_tcp[i])
|
||||
b = b && ( (proto[i] == proto_tcp[i])
|
||||
|| (proto[i] == (proto_tcp[i] | 32)) );
|
||||
if(b)
|
||||
return proto_tcp;
|
||||
|
|
@ -119,6 +122,7 @@ static void ListRedirections(struct UPNPUrls * urls,
|
|||
/*unsigned int num=0;
|
||||
UPNP_GetPortMappingNumberOfEntries(urls->controlURL, data->servicetype, &num);
|
||||
printf("PortMappingNumberOfEntries : %u\n", num);*/
|
||||
printf(" i protocol exPort->inAddr:inPort description remoteHost leaseTime\n");
|
||||
do {
|
||||
snprintf(index, 6, "%d", i);
|
||||
rHost[0] = '\0'; enabled[0] = '\0';
|
||||
|
|
@ -166,6 +170,7 @@ static void NewListRedirections(struct UPNPUrls * urls,
|
|||
&pdata);
|
||||
if(r == UPNPCOMMAND_SUCCESS)
|
||||
{
|
||||
printf(" i protocol exPort->inAddr:inPort description remoteHost leaseTime\n");
|
||||
for(pm = pdata.head.lh_first; pm != NULL; pm = pm->entries.le_next)
|
||||
{
|
||||
printf("%2d %s %5hu->%s:%-5hu '%s' '%s' %u\n",
|
||||
|
|
@ -209,7 +214,7 @@ static void NewListRedirections(struct UPNPUrls * urls,
|
|||
}
|
||||
}
|
||||
|
||||
/* Test function
|
||||
/* Test function
|
||||
* 1 - get connection type
|
||||
* 2 - get extenal ip address
|
||||
* 3 - Add port mapping
|
||||
|
|
@ -239,7 +244,7 @@ static void SetRedirectAndTest(struct UPNPUrls * urls,
|
|||
fprintf(stderr, "invalid protocol\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
UPNP_GetExternalIPAddress(urls->controlURL,
|
||||
data->first.servicetype,
|
||||
externalIPAddress);
|
||||
|
|
@ -247,7 +252,7 @@ static void SetRedirectAndTest(struct UPNPUrls * urls,
|
|||
printf("ExternalIPAddress = %s\n", externalIPAddress);
|
||||
else
|
||||
printf("GetExternalIPAddress failed.\n");
|
||||
|
||||
|
||||
r = UPNP_AddPortMapping(urls->controlURL, data->first.servicetype,
|
||||
eport, iport, iaddr, 0, proto, 0, leaseDuration);
|
||||
if(r!=UPNPCOMMAND_SUCCESS)
|
||||
|
|
@ -262,7 +267,7 @@ static void SetRedirectAndTest(struct UPNPUrls * urls,
|
|||
if(r!=UPNPCOMMAND_SUCCESS)
|
||||
printf("GetSpecificPortMappingEntry() failed with code %d (%s)\n",
|
||||
r, strupnperror(r));
|
||||
|
||||
|
||||
if(intClient[0]) {
|
||||
printf("InternalIP:Port = %s:%s\n", intClient, intPort);
|
||||
printf("external %s:%s %s is redirected to internal %s:%s (duration=%s)\n",
|
||||
|
|
@ -301,7 +306,7 @@ static void GetFirewallStatus(struct UPNPUrls * urls, struct IGDdatas * data)
|
|||
UPNP_GetFirewallStatus(urls->controlURL_6FC, data->IPv6FC.servicetype, &firewallEnabled, &inboundPinholeAllowed);
|
||||
printf("FirewallEnabled: %d & Inbound Pinhole Allowed: %d\n", firewallEnabled, inboundPinholeAllowed);
|
||||
printf("GetFirewallStatus:\n Firewall Enabled: %s\n Inbound Pinhole Allowed: %s\n", (firewallEnabled)? "Yes":"No", (inboundPinholeAllowed)? "Yes":"No");
|
||||
|
||||
|
||||
bytessent = UPNP_GetTotalBytesSent(urls->controlURL_CIF, data->CIF.servicetype);
|
||||
bytesreceived = UPNP_GetTotalBytesReceived(urls->controlURL_CIF, data->CIF.servicetype);
|
||||
packetssent = UPNP_GetTotalPacketsSent(urls->controlURL_CIF, data->CIF.servicetype);
|
||||
|
|
@ -310,7 +315,7 @@ static void GetFirewallStatus(struct UPNPUrls * urls, struct IGDdatas * data)
|
|||
printf("Packets: Sent: %8u\tRecv: %8u\n", packetssent, packetsreceived);
|
||||
}
|
||||
|
||||
/* Test function
|
||||
/* Test function
|
||||
* 1 - Add pinhole
|
||||
* 2 - Check if pinhole is working from the IGD side */
|
||||
static void SetPinholeAndTest(struct UPNPUrls * urls, struct IGDdatas * data,
|
||||
|
|
@ -319,27 +324,41 @@ static void SetPinholeAndTest(struct UPNPUrls * urls, struct IGDdatas * data,
|
|||
const char * proto, const char * lease_time)
|
||||
{
|
||||
char uniqueID[8];
|
||||
//int isWorking = 0;
|
||||
/*int isWorking = 0;*/
|
||||
int r;
|
||||
char proto_tmp[8];
|
||||
|
||||
if(!intaddr || !remoteaddr || !iport || !eport || !proto || !lease_time)
|
||||
{
|
||||
fprintf(stderr, "Wrong arguments\n");
|
||||
return;
|
||||
}
|
||||
/*proto = protofix(proto);
|
||||
if(!proto)
|
||||
if(atoi(proto) == 0)
|
||||
{
|
||||
fprintf(stderr, "invalid protocol\n");
|
||||
return;
|
||||
}*/
|
||||
if(strcmp("TCP", protofix(proto)) == 0)
|
||||
{
|
||||
snprintf(proto_tmp, sizeof(proto_tmp), "%d", IPPROTO_TCP);
|
||||
proto = proto_tmp;
|
||||
}
|
||||
else if(strcmp("UDP", protofix(proto)) == 0)
|
||||
{
|
||||
snprintf(proto_tmp, sizeof(proto_tmp), "%d", IPPROTO_UDP);
|
||||
proto = proto_tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "invalid protocol\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
r = UPNP_AddPinhole(urls->controlURL_6FC, data->IPv6FC.servicetype, remoteaddr, eport, intaddr, iport, proto, lease_time, uniqueID);
|
||||
if(r!=UPNPCOMMAND_SUCCESS)
|
||||
printf("AddPinhole([%s]:%s -> [%s]:%s) failed with code %d (%s)\n",
|
||||
intaddr, iport, remoteaddr, eport, r, strupnperror(r));
|
||||
remoteaddr, eport, intaddr, iport, r, strupnperror(r));
|
||||
else
|
||||
{
|
||||
printf("AddPinhole: ([%s]:%s -> [%s]:%s) / Pinhole ID = %s\n", intaddr, iport, remoteaddr, eport, uniqueID);
|
||||
printf("AddPinhole: ([%s]:%s -> [%s]:%s) / Pinhole ID = %s\n",
|
||||
remoteaddr, eport, intaddr, iport, uniqueID);
|
||||
/*r = UPNP_CheckPinholeWorking(urls->controlURL_6FC, data->servicetype_6FC, uniqueID, &isWorking);
|
||||
if(r!=UPNPCOMMAND_SUCCESS)
|
||||
printf("CheckPinholeWorking() failed with code %d (%s)\n", r, strupnperror(r));
|
||||
|
|
@ -374,7 +393,7 @@ static void GetPinholeAndUpdate(struct UPNPUrls * urls, struct IGDdatas * data,
|
|||
}
|
||||
}
|
||||
|
||||
/* Test function
|
||||
/* Test function
|
||||
* Get pinhole timeout
|
||||
*/
|
||||
static void GetPinholeOutboundTimeout(struct UPNPUrls * urls, struct IGDdatas * data,
|
||||
|
|
@ -464,7 +483,7 @@ int main(int argc, char ** argv)
|
|||
int error = 0;
|
||||
int ipv6 = 0;
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
WSADATA wsaData;
|
||||
int nResult = WSAStartup(MAKEWORD(2,2), &wsaData);
|
||||
if(nResult != NO_ERROR)
|
||||
|
|
@ -529,7 +548,7 @@ int main(int argc, char ** argv)
|
|||
fprintf(stderr, "Options:\n");
|
||||
fprintf(stderr, " -6 : use ip v6 instead of ip v4.\n");
|
||||
fprintf(stderr, " -u url : bypass discovery process by providing the XML root description url.\n");
|
||||
fprintf(stderr, " -m address/interface : provide ip address (ip v4) or interface name (ip v6) to use for sending SSDP multicast packets.\n");
|
||||
fprintf(stderr, " -m address/interface : provide ip address (ip v4) or interface name (ip v4 or v6) to use for sending SSDP multicast packets.\n");
|
||||
fprintf(stderr, " -p path : use this path for MiniSSDPd socket.\n");
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: upnpcommands.c,v 1.37 2011/06/04 15:56:23 nanard Exp $ */
|
||||
/* $Id: upnpcommands.c,v 1.39 2012/04/09 12:49:27 nanard Exp $ */
|
||||
/* Project : miniupnp
|
||||
* Author : Thomas Bernard
|
||||
* Copyright (c) 2005-2011 Thomas Bernard
|
||||
|
|
@ -119,7 +119,7 @@ UPNP_GetTotalPacketsReceived(const char * controlURL,
|
|||
LIBSPEC int
|
||||
UPNP_GetStatusInfo(const char * controlURL,
|
||||
const char * servicetype,
|
||||
char * status,
|
||||
char * status,
|
||||
unsigned int * uptime,
|
||||
char * lastconnerror)
|
||||
{
|
||||
|
|
@ -221,8 +221,8 @@ UPNP_GetConnectionTypeInfo(const char * controlURL,
|
|||
|
||||
/* UPNP_GetLinkLayerMaxBitRate() call the corresponding UPNP method.
|
||||
* Returns 2 values: Downloadlink bandwidth and Uplink bandwidth.
|
||||
* One of the values can be null
|
||||
* Note : GetLinkLayerMaxBitRates belongs to WANPPPConnection:1 only
|
||||
* One of the values can be null
|
||||
* Note : GetLinkLayerMaxBitRates belongs to WANPPPConnection:1 only
|
||||
* We can use the GetCommonLinkProperties from WANCommonInterfaceConfig:1 */
|
||||
LIBSPEC int
|
||||
UPNP_GetLinkLayerMaxBitRates(const char * controlURL,
|
||||
|
|
@ -285,7 +285,7 @@ UPNP_GetLinkLayerMaxBitRates(const char * controlURL,
|
|||
/* UPNP_GetExternalIPAddress() call the corresponding UPNP method.
|
||||
* if the third arg is not null the value is copied to it.
|
||||
* at least 16 bytes must be available
|
||||
*
|
||||
*
|
||||
* Return values :
|
||||
* 0 : SUCCESS
|
||||
* NON ZERO : ERROR Either an UPnP error code or an unknown error.
|
||||
|
|
@ -741,16 +741,16 @@ UPNP_GetListOfPortMappings(const char * controlURL,
|
|||
}
|
||||
ClearNameValueList(&pdata);
|
||||
|
||||
//printf("%.*s", bufsize, buffer);
|
||||
/*printf("%.*s", bufsize, buffer);*/
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* IGD:2, functions for service WANIPv6FirewallControl:1 */
|
||||
/* IGD:2, functions for service WANIPv6FirewallControl:1 */
|
||||
LIBSPEC int
|
||||
UPNP_GetFirewallStatus(const char * controlURL,
|
||||
const char * servicetype,
|
||||
int * firewallEnabled,
|
||||
int * firewallEnabled,
|
||||
int * inboundPinholeAllowed)
|
||||
{
|
||||
struct NameValueParserData pdata;
|
||||
|
|
@ -868,7 +868,7 @@ UPNP_AddPinhole(const char * controlURL, const char * servicetype,
|
|||
return UPNPCOMMAND_INVALID_ARGS;
|
||||
|
||||
AddPinholeArgs = calloc(7, sizeof(struct UPNParg));
|
||||
// RemoteHost can be wilcarded
|
||||
/* RemoteHost can be wilcarded */
|
||||
if(strncmp(remoteHost, "empty", 5)==0)
|
||||
{
|
||||
AddPinholeArgs[0].elt = "RemoteHost";
|
||||
|
|
@ -912,7 +912,7 @@ UPNP_AddPinhole(const char * controlURL, const char * servicetype,
|
|||
resVal = GetValueFromNameValueList(&pdata, "errorCode");
|
||||
if(resVal)
|
||||
{
|
||||
//printf("AddPortMapping errorCode = '%s'\n", resVal);
|
||||
/*printf("AddPortMapping errorCode = '%s'\n", resVal);*/
|
||||
ret = UPNPCOMMAND_UNKNOWN_ERROR;
|
||||
sscanf(resVal, "%d", &ret);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: upnpcommands.h,v 1.23 2011/04/11 09:14:00 nanard Exp $ */
|
||||
/* $Id: upnpcommands.h,v 1.24 2012/03/05 19:42:47 nanard Exp $ */
|
||||
/* Miniupnp project : http://miniupnp.free.fr/
|
||||
* Author : Thomas Bernard
|
||||
* Copyright (c) 2005-2011 Thomas Bernard
|
||||
|
|
@ -62,12 +62,12 @@ UPNP_GetConnectionTypeInfo(const char * controlURL,
|
|||
|
||||
/* UPNP_GetExternalIPAddress() call the corresponding UPNP method.
|
||||
* if the third arg is not null the value is copied to it.
|
||||
* at least 16 bytes must be available
|
||||
* at least 16 bytes must be available
|
||||
*
|
||||
* Return values :
|
||||
* 0 : SUCCESS
|
||||
* NON ZERO : ERROR Either an UPnP error code or an unknown error.
|
||||
*
|
||||
*
|
||||
* possible UPnP Errors :
|
||||
* 402 Invalid Args - See UPnP Device Architecture section on Control.
|
||||
* 501 Action Failed - See UPnP Device Architecture section on Control. */
|
||||
|
|
@ -95,7 +95,7 @@ UPNP_GetLinkLayerMaxBitRates(const char* controlURL,
|
|||
* Return values :
|
||||
* 0 : SUCCESS
|
||||
* NON ZERO : ERROR. Either an UPnP error code or an unknown error.
|
||||
*
|
||||
*
|
||||
* List of possible UPnP errors for AddPortMapping :
|
||||
* errorCode errorDescription (short) - Description (long)
|
||||
* 402 Invalid Args - See UPnP Device Architecture section on Control.
|
||||
|
|
@ -106,7 +106,7 @@ UPNP_GetLinkLayerMaxBitRates(const char* controlURL,
|
|||
* 718 ConflictInMappingEntry - The port mapping entry specified conflicts
|
||||
* with a mapping assigned previously to another client
|
||||
* 724 SamePortValuesRequired - Internal and External port values
|
||||
* must be the same
|
||||
* must be the same
|
||||
* 725 OnlyPermanentLeasesSupported - The NAT implementation only supports
|
||||
* permanent lease times on port mappings
|
||||
* 726 RemoteHostOnlySupportsWildcard - RemoteHost must be a wildcard
|
||||
|
|
@ -221,11 +221,11 @@ UPNP_GetListOfPortMappings(const char * controlURL,
|
|||
const char * numberOfPorts,
|
||||
struct PortMappingParserData * data);
|
||||
|
||||
/* IGD:2, functions for service WANIPv6FirewallControl:1 */
|
||||
/* IGD:2, functions for service WANIPv6FirewallControl:1 */
|
||||
LIBSPEC int
|
||||
UPNP_GetFirewallStatus(const char * controlURL,
|
||||
const char * servicetype,
|
||||
int * firewallEnabled,
|
||||
int * firewallEnabled,
|
||||
int * inboundPinholeAllowed);
|
||||
|
||||
LIBSPEC int
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: upnperrors.c,v 1.5 2011/04/10 11:19:36 nanard Exp $ */
|
||||
/* $Id: upnperrors.c,v 1.6 2012/03/15 01:02:03 nanard Exp $ */
|
||||
/* Project : miniupnp
|
||||
* Author : Thomas BERNARD
|
||||
* copyright (c) 2007 Thomas Bernard
|
||||
|
|
@ -97,7 +97,8 @@ const char * strupnperror(int err)
|
|||
s = "ExternalPortOnlySupportsWildcard";
|
||||
break;
|
||||
default:
|
||||
s = NULL;
|
||||
s = "UnknownError";
|
||||
break;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: upnperrors.h,v 1.2 2008/07/02 23:31:15 nanard Exp $ */
|
||||
/* $Id: upnperrors.h,v 1.3 2012/03/05 19:42:47 nanard Exp $ */
|
||||
/* (c) 2007 Thomas Bernard
|
||||
* All rights reserved.
|
||||
* MiniUPnP Project.
|
||||
|
|
@ -15,7 +15,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/* strupnperror()
|
||||
* Return a string description of the UPnP error code
|
||||
* Return a string description of the UPnP error code
|
||||
* or NULL for undefinded errors */
|
||||
LIBSPEC const char * strupnperror(int err);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $Id: upnpreplyparse.c,v 1.11 2011/02/07 16:17:06 nanard Exp $ */
|
||||
/* $Id: upnpreplyparse.c,v 1.12 2012/03/05 19:42:48 nanard Exp $ */
|
||||
/* MiniUPnP project
|
||||
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||
* (c) 2006-2011 Thomas Bernard
|
||||
* (c) 2006-2011 Thomas Bernard
|
||||
* This software is subject to the conditions detailed
|
||||
* in the LICENCE file provided within the distribution */
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ ClearNameValueList(struct NameValueParserData * pdata)
|
|||
}
|
||||
}
|
||||
|
||||
char *
|
||||
char *
|
||||
GetValueFromNameValueList(struct NameValueParserData * pdata,
|
||||
const char * Name)
|
||||
{
|
||||
|
|
@ -131,7 +131,7 @@ GetValueFromNameValueListIgnoreNS(struct NameValueParserData * pdata,
|
|||
}
|
||||
#endif
|
||||
|
||||
/* debug all-in-one function
|
||||
/* debug all-in-one function
|
||||
* do parsing then display to stdout */
|
||||
#ifdef DEBUG
|
||||
void
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
/* $Id: upnpreplyparse.h,v 1.11 2011/02/07 16:17:06 nanard Exp $ */
|
||||
/* $Id: upnpreplyparse.h,v 1.13 2012/03/05 19:42:48 nanard Exp $ */
|
||||
/* MiniUPnP project
|
||||
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||
* (c) 2006-2011 Thomas Bernard
|
||||
* (c) 2006-2012 Thomas Bernard
|
||||
* This software is subject to the conditions detailed
|
||||
* in the LICENCE file provided within the distribution */
|
||||
|
||||
#ifndef __UPNPREPLYPARSE_H__
|
||||
#define __UPNPREPLYPARSE_H__
|
||||
|
||||
#if defined(NO_SYS_QUEUE_H) || defined(WIN32) || defined(__HAIKU__)
|
||||
#if defined(NO_SYS_QUEUE_H) || defined(_WIN32) || defined(__HAIKU__)
|
||||
#include "bsdqueue.h"
|
||||
#else
|
||||
#include <sys/queue.h>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: wingenminiupnpcstrings.c,v 1.2 2011/01/11 15:31:13 nanard Exp $ */
|
||||
/* $Id: wingenminiupnpcstrings.c,v 1.3 2012/03/05 19:42:48 nanard Exp $ */
|
||||
/* Project: miniupnp
|
||||
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||
* Author: Thomas Bernard
|
||||
|
|
@ -26,7 +26,7 @@ int main(int argc, char * * argv) {
|
|||
dwBuildNumber :
|
||||
The build number of the operating system.
|
||||
dwPlatformId
|
||||
The operating system platform. This member can be the following value.
|
||||
The operating system platform. This member can be the following value.
|
||||
szCSDVersion
|
||||
A null-terminated string, such as "Service Pack 3", that indicates the
|
||||
latest Service Pack installed on the system. If no Service Pack has
|
||||
|
|
|
|||
301
odasrv.cfg
301
odasrv.cfg
|
|
@ -1,15 +1,168 @@
|
|||
// Generated by Odasrv 0.5.6
|
||||
// Generated by Odasrv 0.6.0
|
||||
|
||||
// --- Console variables ---
|
||||
|
||||
//
|
||||
set configver "60"
|
||||
|
||||
// Experimental: Does not progress the game when there are no players
|
||||
set sv_emptyfreeze "0"
|
||||
|
||||
// Clients can vote a new timelimit.
|
||||
set sv_callvote_timelimit "0"
|
||||
|
||||
// Clients can vote a new scorelimit.
|
||||
set sv_callvote_scorelimit "0"
|
||||
|
||||
// Clients can vote a new fraglimit.
|
||||
set sv_callvote_fraglimit "0"
|
||||
|
||||
// Clients can vote to reload the current map.
|
||||
set sv_callvote_restart "0"
|
||||
|
||||
// Clients can vote to force the server to pick a certian number of players from the pool of ingame players and force-spectate everyone else.
|
||||
set sv_callvote_randpickup "0"
|
||||
|
||||
// Clients can vote to force the server to pick two players from the pool of ingame players and force-spectate everyone else.
|
||||
set sv_callvote_randcaps "0"
|
||||
|
||||
// Clients can vote to switch to a random map from the server's maplist.
|
||||
set sv_callvote_randmap "0"
|
||||
|
||||
// Clients can vote on progressing to the next map.
|
||||
set sv_callvote_nextmap "0"
|
||||
|
||||
// Clients can vote to switch to a specific map from the server's maplist.
|
||||
set sv_callvote_map "0"
|
||||
|
||||
// Clients can vote to force a player to spectate.
|
||||
set sv_callvote_forcespec "0"
|
||||
|
||||
// Clients can votekick other players.
|
||||
set sv_callvote_kick "0"
|
||||
|
||||
// Clients can flip a coin.
|
||||
set sv_callvote_coinflip "0"
|
||||
|
||||
// Timeout between votes in seconds.
|
||||
set sv_vote_timeout "60"
|
||||
|
||||
// Amount of time a vote takes in seconds.
|
||||
set sv_vote_timelimit "30"
|
||||
|
||||
// Ratio of yes votes needed for vote to pass.
|
||||
set sv_vote_majority "0.5"
|
||||
|
||||
// Buffer controller input from players experiencing sudden latency spikes for smoother movement
|
||||
set sv_ticbuffer "1"
|
||||
|
||||
// Time for a dropped flag to be returned automatically to its home base
|
||||
set ctf_flagtimeout "10"
|
||||
|
||||
// Team flag must be at home pedestal for any captures of an enemy flag returned to said pedestal to count as a point
|
||||
set ctf_flagathometoscore "1"
|
||||
|
||||
// Flags dropped must be returned manually
|
||||
set ctf_manualreturn "0"
|
||||
|
||||
// Teams that are enabled
|
||||
set sv_teamsinplay "2"
|
||||
|
||||
// Router-side description of port mapping
|
||||
set sv_upnp_description "Odasrv (192.168.1.100:10666)"
|
||||
|
||||
// UPnP Router discovery timeout
|
||||
set sv_upnp_discovertimeout "2000"
|
||||
|
||||
// UPnP support
|
||||
set sv_upnp "1"
|
||||
|
||||
// Forces clients to be on or below this rate
|
||||
set sv_maxrate "200"
|
||||
|
||||
// Flood protection time
|
||||
set sv_flooddelay "1.5"
|
||||
|
||||
// NAT firewall workaround, this is a port number
|
||||
set sv_natport "0"
|
||||
|
||||
// Network compression
|
||||
set sv_networkcompression "1"
|
||||
|
||||
// Randomly shuffle the maplist
|
||||
set sv_shufflemaplist "0"
|
||||
|
||||
// Determines whether Doom 1 episodes carry over
|
||||
set sv_loopepisode "0"
|
||||
|
||||
// Script to run at start of each map (e.g. to override cvars)
|
||||
set sv_startmapscript ""
|
||||
|
||||
// Script to run at end of each map (e.g. to choose next map)
|
||||
set sv_endmapscript ""
|
||||
|
||||
// Advertise on master servers
|
||||
set sv_usemasters "1"
|
||||
|
||||
// Remote console password
|
||||
set rcon_password ""
|
||||
|
||||
//
|
||||
set spectate_password ""
|
||||
|
||||
// Clients can connect if they have this password
|
||||
set join_password ""
|
||||
|
||||
// Maximum players that can join the game, the rest are spectators
|
||||
set sv_maxplayers "4"
|
||||
|
||||
// Maximum clients that can connect to a server
|
||||
set sv_maxclients "4"
|
||||
|
||||
// Experimental anti-wallkhack code
|
||||
set sv_antiwallhack "0"
|
||||
|
||||
// Maximum corpses to appear on map
|
||||
set sv_maxcorpses "200"
|
||||
|
||||
// Players can see spectator chat
|
||||
set sv_globalspectatorchat "1"
|
||||
|
||||
// Reloads the current map when all players leave
|
||||
set sv_emptyreset "0"
|
||||
|
||||
// Cap wad file downloading to a specific rate
|
||||
set sv_waddownloadcap "200"
|
||||
|
||||
// Allow downloading of WAD files from this server
|
||||
set sv_waddownload "0"
|
||||
|
||||
// Server or Admin website
|
||||
set sv_website "http://odamex.net/"
|
||||
|
||||
// Administrator email address
|
||||
set sv_email "email@domain.com"
|
||||
|
||||
// Message Of The Day
|
||||
set sv_motd "Welcome to Odamex"
|
||||
|
||||
// Extended timestamp info (dd/mm/yyyy hh:mm:ss)
|
||||
set log_fulltimestamps "0"
|
||||
|
||||
// Experimental anti-speedhack code
|
||||
set sv_speedhackfix "0"
|
||||
|
||||
// Server name to appear on masters, clients and launchers
|
||||
set sv_hostname "Untitled Odamex Server"
|
||||
|
||||
// Allow custom WAD directories to be specified
|
||||
set waddirs ""
|
||||
|
||||
// Allows players to walk through other players
|
||||
set sv_unblockplayers "0"
|
||||
|
||||
//
|
||||
set filecompression "1"
|
||||
// Rocket explosion thrust effect?
|
||||
set sv_splashfactor "1.0"
|
||||
|
||||
// How much control the player has in the air
|
||||
set sv_aircontrol "0.00390625"
|
||||
|
|
@ -26,6 +179,9 @@ set sv_forcerespawn "0"
|
|||
// Rocket trails on/off (currently unused)
|
||||
set cl_rockettrails "0"
|
||||
|
||||
// Predict weapon pickups
|
||||
set cl_predictpickup "1"
|
||||
|
||||
// Dead player's view follows the actor who killed them
|
||||
set cl_deathcam "1"
|
||||
|
||||
|
|
@ -62,8 +218,8 @@ set sv_allowpwo "0"
|
|||
// Allow clients to adjust amount of red pain screen intensity
|
||||
set sv_allowredscreen "0"
|
||||
|
||||
// Allow weapon bob changing
|
||||
set sv_allownobob "0"
|
||||
// Allow weapon & view bob changing
|
||||
set sv_allowmovebob "0"
|
||||
|
||||
// Allow reconciliation for players on lagged connections
|
||||
set sv_unlag "1"
|
||||
|
|
@ -71,9 +227,6 @@ set sv_unlag "1"
|
|||
// Weapons stay after pickup
|
||||
set sv_weaponstay "1"
|
||||
|
||||
//
|
||||
set sv_speedhackfix "0"
|
||||
|
||||
// Sets the time limit for the intermission to end, 0 disables (defaults to 10 seconds)
|
||||
set sv_intermissionlimit "10"
|
||||
|
||||
|
|
@ -150,141 +303,9 @@ set sv_friendlyfire "1"
|
|||
// 3 = Capture The Flag
|
||||
set sv_gametype "0"
|
||||
|
||||
//
|
||||
set configver "56"
|
||||
|
||||
//
|
||||
set language "0"
|
||||
|
||||
// Clients can vote a new timelimit.
|
||||
set sv_callvote_timelimit "1"
|
||||
|
||||
// Clients can vote a new scorelimit.
|
||||
set sv_callvote_scorelimit "1"
|
||||
|
||||
// Clients can vote a new fraglimit.
|
||||
set sv_callvote_fraglimit "1"
|
||||
|
||||
// Clients can vote on a new map.
|
||||
set sv_callvote_map "1"
|
||||
|
||||
// Clients can votekick other players.
|
||||
set sv_callvote_kick "1"
|
||||
|
||||
// Timeout between votes in seconds.
|
||||
set sv_vote_timeout "60"
|
||||
|
||||
// Amount of time a vote takes in seconds.
|
||||
set sv_vote_timelimit "30"
|
||||
|
||||
// Ratio of yes votes needed for vote to pass.
|
||||
set sv_vote_majority "0.5"
|
||||
|
||||
// Buffer controller input from players experiencing sudden latency spikes for smoother movement
|
||||
set sv_ticbuffer "1"
|
||||
|
||||
// Time for a dropped flag to be returned automatically to its home base
|
||||
set ctf_flagtimeout "10"
|
||||
|
||||
// Team flag must be at home pedestal for any captures of an enemy flag returned to said pedestal to count as a point
|
||||
set ctf_flagathometoscore "1"
|
||||
|
||||
// Flags dropped must be returned manually
|
||||
set ctf_manualreturn "0"
|
||||
|
||||
// Teams that are enabled
|
||||
set sv_teamsinplay "2"
|
||||
|
||||
// Router-side description of port mapping
|
||||
set sv_upnp_description ""
|
||||
|
||||
// UPnP Router discovery timeout
|
||||
set sv_upnp_discovertimeout "2000"
|
||||
|
||||
// UPnP support
|
||||
set sv_upnp "1"
|
||||
|
||||
// Forces clients to be on or below this rate
|
||||
set sv_maxrate "200"
|
||||
|
||||
// Randomly shuffle the maplist
|
||||
set sv_shufflemaplist "0"
|
||||
|
||||
// Flood protection time
|
||||
set sv_flooddelay "1.5"
|
||||
|
||||
// NAT firewall workaround, this is a port number
|
||||
set sv_natport "0"
|
||||
|
||||
// Experimental network compression
|
||||
set sv_networkcompression "0"
|
||||
|
||||
// Determines whether Doom 1 episodes carry over
|
||||
set sv_loopepisode "0"
|
||||
|
||||
// Script to run at start of each map (e.g. to override cvars)
|
||||
set sv_startmapscript ""
|
||||
|
||||
// Script to run at end of each map (e.g. to choose next map)
|
||||
set sv_endmapscript ""
|
||||
|
||||
// Advertise on master servers
|
||||
set sv_usemasters "1"
|
||||
|
||||
// Remote console password
|
||||
set rcon_password ""
|
||||
|
||||
//
|
||||
set spectate_password ""
|
||||
|
||||
// Clients can connect if they have this password
|
||||
set join_password ""
|
||||
|
||||
// Maximum players that can join the game, the rest are spectators
|
||||
set sv_maxplayers "4"
|
||||
|
||||
// Maximum clients that can connect to a server
|
||||
set sv_maxclients "4"
|
||||
|
||||
// Experimental anti-wallkhack code
|
||||
set sv_antiwallhack "0"
|
||||
|
||||
// Maximum corpses to appear on map
|
||||
set sv_maxcorpses "200"
|
||||
|
||||
// Players can see spectator chat
|
||||
set sv_globalspectatorchat "1"
|
||||
|
||||
// Does not progress the game when there are no players
|
||||
set sv_emptyfreeze "0"
|
||||
|
||||
// Reloads the current map when all players leave
|
||||
set sv_emptyreset "0"
|
||||
|
||||
// Cap wad file downloading to a specific rate
|
||||
set sv_waddownloadcap "200"
|
||||
|
||||
// Allow downloading of WAD files from this server
|
||||
set sv_waddownload "0"
|
||||
|
||||
// Server or Admin website
|
||||
set sv_website "http://odamex.net/"
|
||||
|
||||
// Administrator email address
|
||||
set sv_email "email@domain.com"
|
||||
|
||||
// Server name to appear on masters, clients and launchers
|
||||
set sv_hostname "Untitled Odamex Server"
|
||||
|
||||
// Message Of The Day
|
||||
set sv_motd "Welcome to Odamex"
|
||||
|
||||
// Extended timestamp info (dd/mm/yyyy hh:mm:ss)
|
||||
set log_fulltimestamps "0"
|
||||
|
||||
//
|
||||
set sv_splashfactor "1.0"
|
||||
|
||||
|
||||
// --- Aliases ---
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue