R4SAS
6 years ago
32 changed files with 1110 additions and 2 deletions
@ -1,7 +1,7 @@ |
|||||||
Prebuilt MiniUPnP libraries |
Prebuilt MiniUPnP libraries |
||||||
==== |
==== |
||||||
MiniUPnPc 2.0 libraries. Built for arm, arm-v7a, x86. |
MiniUPnPc libraries. Built for armeabi, armeabi-v7a, aarch64, x86, x86_64. |
||||||
|
|
||||||
WARNING |
WARNING |
||||||
==== |
==== |
||||||
Built with Android NDK r11c using android-19 platform |
Built with Android NDK r14b using android-14 platform for armeabi, armeabi-v7a, x86, and android-21 (minimal) for aarch64, x86_64. |
||||||
|
@ -0,0 +1,6 @@ |
|||||||
|
LOCAL_PATH := $(call my-dir) |
||||||
|
|
||||||
|
include $(CLEAR_VARS) |
||||||
|
LOCAL_MODULE := libminiupnpc |
||||||
|
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/lib/libminiupnpc.a |
||||||
|
include $(PREBUILT_STATIC_LIBRARY) |
@ -0,0 +1,6 @@ |
|||||||
|
LOCAL_PATH := $(call my-dir) |
||||||
|
|
||||||
|
include $(CLEAR_VARS) |
||||||
|
LOCAL_MODULE := libminiupnpc |
||||||
|
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/lib/libminiupnpc.a |
||||||
|
include $(PREBUILT_STATIC_LIBRARY) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,54 @@ |
|||||||
|
/* $Id: codelength.h,v 1.3 2011/07/30 13:10:05 nanard Exp $ */ |
||||||
|
/* Project : miniupnp
|
||||||
|
* Author : Thomas BERNARD |
||||||
|
* copyright (c) 2005-2015 Thomas Bernard |
||||||
|
* This software is subjet to the conditions detailed in the |
||||||
|
* provided LICENCE file. */ |
||||||
|
#ifndef CODELENGTH_H_INCLUDED |
||||||
|
#define CODELENGTH_H_INCLUDED |
||||||
|
|
||||||
|
/* Encode length by using 7bit per Byte :
|
||||||
|
* Most significant bit of each byte specifies that the |
||||||
|
* following byte is part of the code */ |
||||||
|
|
||||||
|
/* n : unsigned
|
||||||
|
* p : unsigned char * |
||||||
|
*/ |
||||||
|
#define DECODELENGTH(n, p) n = 0; \ |
||||||
|
do { n = (n << 7) | (*p & 0x7f); } \ |
||||||
|
while((*(p++)&0x80) && (n<(1<<25))); |
||||||
|
|
||||||
|
/* n : unsigned
|
||||||
|
* READ : function/macro to read one byte (unsigned char) |
||||||
|
*/ |
||||||
|
#define DECODELENGTH_READ(n, READ) \ |
||||||
|
n = 0; \ |
||||||
|
do { \ |
||||||
|
unsigned char c; \ |
||||||
|
READ(c); \ |
||||||
|
n = (n << 7) | (c & 0x07f); \ |
||||||
|
if(!(c&0x80)) break; \ |
||||||
|
} while(n<(1<<25)); |
||||||
|
|
||||||
|
/* n : unsigned
|
||||||
|
* p : unsigned char * |
||||||
|
* p_limit : unsigned char * |
||||||
|
*/ |
||||||
|
#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))); |
||||||
|
|
||||||
|
|
||||||
|
/* n : unsigned
|
||||||
|
* p : unsigned char * |
||||||
|
*/ |
||||||
|
#define CODELENGTH(n, p) if(n>=268435456) *(p++) = (n >> 28) | 0x80; \ |
||||||
|
if(n>=2097152) *(p++) = (n >> 21) | 0x80; \ |
||||||
|
if(n>=16384) *(p++) = (n >> 14) | 0x80; \ |
||||||
|
if(n>=128) *(p++) = (n >> 7) | 0x80; \ |
||||||
|
*(p++) = n & 0x7f; |
||||||
|
|
||||||
|
#endif /* CODELENGTH_H_INCLUDED */ |
@ -0,0 +1,20 @@ |
|||||||
|
/* $Id: connecthostport.h,v 1.2 2012/06/23 22:32:33 nanard Exp $ */ |
||||||
|
/* Project: miniupnp
|
||||||
|
* http://miniupnp.free.fr/
|
||||||
|
* Author: Thomas Bernard |
||||||
|
* Copyright (c) 2010-2018 Thomas Bernard |
||||||
|
* This software is subjects to the conditions detailed |
||||||
|
* in the LICENCE file provided within this distribution */ |
||||||
|
#ifndef CONNECTHOSTPORT_H_INCLUDED |
||||||
|
#define CONNECTHOSTPORT_H_INCLUDED |
||||||
|
|
||||||
|
#include "miniupnpc_socketdef.h" |
||||||
|
|
||||||
|
/* connecthostport()
|
||||||
|
* return a socket connected (TCP) to the host and port |
||||||
|
* or INVALID_SOCKET in case of error */ |
||||||
|
SOCKET connecthostport(const char * host, unsigned short port, |
||||||
|
unsigned int scope_id); |
||||||
|
|
||||||
|
#endif |
||||||
|
|
@ -0,0 +1,49 @@ |
|||||||
|
/* $Id: igd_desc_parse.h,v 1.12 2014/11/17 17:19:13 nanard Exp $ */ |
||||||
|
/* Project : miniupnp
|
||||||
|
* http://miniupnp.free.fr/
|
||||||
|
* Author : Thomas Bernard |
||||||
|
* Copyright (c) 2005-2014 Thomas Bernard |
||||||
|
* This software is subject to the conditions detailed in the |
||||||
|
* LICENCE file provided in this distribution. |
||||||
|
* */ |
||||||
|
#ifndef IGD_DESC_PARSE_H_INCLUDED |
||||||
|
#define IGD_DESC_PARSE_H_INCLUDED |
||||||
|
|
||||||
|
/* Structure to store the result of the parsing of UPnP
|
||||||
|
* descriptions of Internet Gateway Devices */ |
||||||
|
#define MINIUPNPC_URL_MAXSIZE (128) |
||||||
|
struct IGDdatas_service { |
||||||
|
char controlurl[MINIUPNPC_URL_MAXSIZE]; |
||||||
|
char eventsuburl[MINIUPNPC_URL_MAXSIZE]; |
||||||
|
char scpdurl[MINIUPNPC_URL_MAXSIZE]; |
||||||
|
char servicetype[MINIUPNPC_URL_MAXSIZE]; |
||||||
|
/*char devicetype[MINIUPNPC_URL_MAXSIZE];*/ |
||||||
|
}; |
||||||
|
|
||||||
|
struct IGDdatas { |
||||||
|
char cureltname[MINIUPNPC_URL_MAXSIZE]; |
||||||
|
char urlbase[MINIUPNPC_URL_MAXSIZE]; |
||||||
|
char presentationurl[MINIUPNPC_URL_MAXSIZE]; |
||||||
|
int level; |
||||||
|
/*int state;*/ |
||||||
|
/* "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1" */ |
||||||
|
struct IGDdatas_service CIF; |
||||||
|
/* "urn:schemas-upnp-org:service:WANIPConnection:1"
|
||||||
|
* "urn:schemas-upnp-org:service:WANPPPConnection:1" */ |
||||||
|
struct IGDdatas_service first; |
||||||
|
/* if both WANIPConnection and WANPPPConnection are present */ |
||||||
|
struct IGDdatas_service second; |
||||||
|
/* "urn:schemas-upnp-org:service:WANIPv6FirewallControl:1" */ |
||||||
|
struct IGDdatas_service IPv6FC; |
||||||
|
/* tmp */ |
||||||
|
struct IGDdatas_service tmp; |
||||||
|
}; |
||||||
|
|
||||||
|
void IGDstartelt(void *, const char *, int); |
||||||
|
void IGDendelt(void *, const char *, int); |
||||||
|
void IGDdata(void *, const char *, int); |
||||||
|
#ifdef DEBUG |
||||||
|
void printIGD(struct IGDdatas *); |
||||||
|
#endif /* DEBUG */ |
||||||
|
|
||||||
|
#endif /* IGD_DESC_PARSE_H_INCLUDED */ |
@ -0,0 +1,17 @@ |
|||||||
|
/* $Id: minisoap.h,v 1.4 2010/04/12 20:39:41 nanard Exp $ */ |
||||||
|
/* Project : miniupnp
|
||||||
|
* Author : Thomas Bernard |
||||||
|
* Copyright (c) 2005-2018 Thomas Bernard |
||||||
|
* This software is subject to the conditions detailed in the |
||||||
|
* LICENCE file provided in this distribution. */ |
||||||
|
#ifndef MINISOAP_H_INCLUDED |
||||||
|
#define MINISOAP_H_INCLUDED |
||||||
|
|
||||||
|
#include "miniupnpc_socketdef.h" |
||||||
|
|
||||||
|
/*int httpWrite(int, const char *, int, const char *);*/ |
||||||
|
int soapPostSubmit(SOCKET, const char *, const char *, unsigned short, |
||||||
|
const char *, const char *, const char *); |
||||||
|
|
||||||
|
#endif |
||||||
|
|
@ -0,0 +1,58 @@ |
|||||||
|
/* $Id: minissdpc.h,v 1.6 2015/09/18 12:45:16 nanard Exp $ */ |
||||||
|
/* Project: miniupnp
|
||||||
|
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||||
|
* Author: Thomas Bernard |
||||||
|
* Copyright (c) 2005-2015 Thomas Bernard |
||||||
|
* This software is subjects to the conditions detailed |
||||||
|
* in the LICENCE file provided within this distribution */ |
||||||
|
#ifndef MINISSDPC_H_INCLUDED |
||||||
|
#define MINISSDPC_H_INCLUDED |
||||||
|
|
||||||
|
#include "miniupnpc_declspec.h" |
||||||
|
#include "upnpdev.h" |
||||||
|
|
||||||
|
/* error codes : */ |
||||||
|
#define MINISSDPC_SUCCESS (0) |
||||||
|
#define MINISSDPC_UNKNOWN_ERROR (-1) |
||||||
|
#define MINISSDPC_SOCKET_ERROR (-101) |
||||||
|
#define MINISSDPC_MEMORY_ERROR (-102) |
||||||
|
#define MINISSDPC_INVALID_INPUT (-103) |
||||||
|
#define MINISSDPC_INVALID_SERVER_REPLY (-104) |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
#if !(defined(_WIN32) || defined(__amigaos__) || defined(__amigaos4__)) |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC struct UPNPDev * |
||||||
|
getDevicesFromMiniSSDPD(const char * devtype, const char * socketpath, int * error); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
connectToMiniSSDPD(const char * socketpath); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
disconnectFromMiniSSDPD(int s); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
requestDevicesFromMiniSSDPD(int s, const char * devtype); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC struct UPNPDev * |
||||||
|
receiveDevicesFromMiniSSDPD(int s, int * error); |
||||||
|
|
||||||
|
#endif /* !(defined(_WIN32) || defined(__amigaos__) || defined(__amigaos4__)) */ |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC struct UPNPDev * |
||||||
|
ssdpDiscoverDevices(const char * const deviceTypes[], |
||||||
|
int delay, const char * multicastif, |
||||||
|
int localport, |
||||||
|
int ipv6, unsigned char ttl, |
||||||
|
int * error, |
||||||
|
int searchalltypes); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
|
||||||
|
#endif |
||||||
|
|
@ -0,0 +1,153 @@ |
|||||||
|
/* $Id: miniupnpc.h,v 1.53 2018/05/07 11:05:16 nanard Exp $ */ |
||||||
|
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
||||||
|
* Project: miniupnp |
||||||
|
* http://miniupnp.free.fr/
|
||||||
|
* Author: Thomas Bernard |
||||||
|
* Copyright (c) 2005-2018 Thomas Bernard |
||||||
|
* This software is subjects to the conditions detailed |
||||||
|
* in the LICENCE file provided within this distribution */ |
||||||
|
#ifndef MINIUPNPC_H_INCLUDED |
||||||
|
#define MINIUPNPC_H_INCLUDED |
||||||
|
|
||||||
|
#include "miniupnpc_declspec.h" |
||||||
|
#include "igd_desc_parse.h" |
||||||
|
#include "upnpdev.h" |
||||||
|
|
||||||
|
/* error codes : */ |
||||||
|
#define UPNPDISCOVER_SUCCESS (0) |
||||||
|
#define UPNPDISCOVER_UNKNOWN_ERROR (-1) |
||||||
|
#define UPNPDISCOVER_SOCKET_ERROR (-101) |
||||||
|
#define UPNPDISCOVER_MEMORY_ERROR (-102) |
||||||
|
|
||||||
|
/* versions : */ |
||||||
|
#define MINIUPNPC_VERSION "2.1" |
||||||
|
#define MINIUPNPC_API_VERSION 17 |
||||||
|
|
||||||
|
/* Source port:
|
||||||
|
Using "1" as an alias for 1900 for backwards compatibility |
||||||
|
(presuming one would have used that for the "sameport" parameter) */ |
||||||
|
#define UPNP_LOCAL_PORT_ANY 0 |
||||||
|
#define UPNP_LOCAL_PORT_SAME 1 |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/* Structures definitions : */ |
||||||
|
struct UPNParg { const char * elt; const char * val; }; |
||||||
|
|
||||||
|
char * |
||||||
|
simpleUPnPcommand(int, const char *, const char *, |
||||||
|
const char *, struct UPNParg *, |
||||||
|
int *); |
||||||
|
|
||||||
|
/* upnpDiscover()
|
||||||
|
* discover UPnP devices on the network. |
||||||
|
* The discovered devices are returned as a chained list. |
||||||
|
* It is up to the caller to free the list with freeUPNPDevlist(). |
||||||
|
* delay (in millisecond) is the maximum time for waiting any device |
||||||
|
* response. |
||||||
|
* If available, device list will be obtained from MiniSSDPd. |
||||||
|
* Default path for minissdpd socket will be used if minissdpdsock argument |
||||||
|
* is NULL. |
||||||
|
* If multicastif is not NULL, it will be used instead of the default |
||||||
|
* multicast interface for sending SSDP discover packets. |
||||||
|
* If localport is set to UPNP_LOCAL_PORT_SAME(1) SSDP packets will be sent |
||||||
|
* from the source port 1900 (same as destination port), if set to |
||||||
|
* UPNP_LOCAL_PORT_ANY(0) system assign a source port, any other value will |
||||||
|
* be attempted as the source port. |
||||||
|
* "searchalltypes" parameter is useful when searching several types, |
||||||
|
* if 0, the discovery will stop with the first type returning results. |
||||||
|
* TTL should default to 2. */ |
||||||
|
MINIUPNP_LIBSPEC struct UPNPDev * |
||||||
|
upnpDiscover(int delay, const char * multicastif, |
||||||
|
const char * minissdpdsock, int localport, |
||||||
|
int ipv6, unsigned char ttl, |
||||||
|
int * error); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC struct UPNPDev * |
||||||
|
upnpDiscoverAll(int delay, const char * multicastif, |
||||||
|
const char * minissdpdsock, int localport, |
||||||
|
int ipv6, unsigned char ttl, |
||||||
|
int * error); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC struct UPNPDev * |
||||||
|
upnpDiscoverDevice(const char * device, int delay, const char * multicastif, |
||||||
|
const char * minissdpdsock, int localport, |
||||||
|
int ipv6, unsigned char ttl, |
||||||
|
int * error); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC struct UPNPDev * |
||||||
|
upnpDiscoverDevices(const char * const deviceTypes[], |
||||||
|
int delay, const char * multicastif, |
||||||
|
const char * minissdpdsock, int localport, |
||||||
|
int ipv6, unsigned char ttl, |
||||||
|
int * error, |
||||||
|
int searchalltypes); |
||||||
|
|
||||||
|
/* parserootdesc() :
|
||||||
|
* parse root XML description of a UPnP device and fill the IGDdatas |
||||||
|
* structure. */ |
||||||
|
MINIUPNP_LIBSPEC void parserootdesc(const char *, int, struct IGDdatas *); |
||||||
|
|
||||||
|
/* structure used to get fast access to urls
|
||||||
|
* controlURL: controlURL of the WANIPConnection |
||||||
|
* ipcondescURL: url of the description of the WANIPConnection |
||||||
|
* controlURL_CIF: controlURL of the WANCommonInterfaceConfig |
||||||
|
* controlURL_6FC: controlURL of the WANIPv6FirewallControl |
||||||
|
*/ |
||||||
|
struct UPNPUrls { |
||||||
|
char * controlURL; |
||||||
|
char * ipcondescURL; |
||||||
|
char * controlURL_CIF; |
||||||
|
char * controlURL_6FC; |
||||||
|
char * rootdescURL; |
||||||
|
}; |
||||||
|
|
||||||
|
/* UPNP_GetValidIGD() :
|
||||||
|
* return values : |
||||||
|
* 0 = NO IGD found |
||||||
|
* 1 = A valid connected IGD has been found |
||||||
|
* 2 = A valid IGD has been found but it reported as |
||||||
|
* not connected |
||||||
|
* 3 = an UPnP device has been found but was not recognized as an IGD |
||||||
|
* |
||||||
|
* In any non zero return case, the urls and data structures |
||||||
|
* passed as parameters are set. Donc forget to call FreeUPNPUrls(urls) to |
||||||
|
* free allocated memory. |
||||||
|
*/ |
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_GetValidIGD(struct UPNPDev * devlist, |
||||||
|
struct UPNPUrls * urls, |
||||||
|
struct IGDdatas * data, |
||||||
|
char * lanaddr, int lanaddrlen); |
||||||
|
|
||||||
|
/* UPNP_GetIGDFromUrl()
|
||||||
|
* Used when skipping the discovery process. |
||||||
|
* When succeding, urls, data, and lanaddr arguments are set. |
||||||
|
* return value : |
||||||
|
* 0 - Not ok |
||||||
|
* 1 - OK */ |
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_GetIGDFromUrl(const char * rootdescurl, |
||||||
|
struct UPNPUrls * urls, |
||||||
|
struct IGDdatas * data, |
||||||
|
char * lanaddr, int lanaddrlen); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC void |
||||||
|
GetUPNPUrls(struct UPNPUrls *, struct IGDdatas *, |
||||||
|
const char *, unsigned int); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC void |
||||||
|
FreeUPNPUrls(struct UPNPUrls *); |
||||||
|
|
||||||
|
/* return 0 or 1 */ |
||||||
|
MINIUPNP_LIBSPEC int UPNPIGD_IsConnected(struct UPNPUrls *, struct IGDdatas *); |
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
|
||||||
|
#endif |
||||||
|
|
@ -0,0 +1,21 @@ |
|||||||
|
#ifndef MINIUPNPC_DECLSPEC_H_INCLUDED |
||||||
|
#define MINIUPNPC_DECLSPEC_H_INCLUDED |
||||||
|
|
||||||
|
#if defined(_WIN32) && !defined(MINIUPNP_STATICLIB) |
||||||
|
/* for windows dll */ |
||||||
|
#ifdef MINIUPNP_EXPORTS |
||||||
|
#define MINIUPNP_LIBSPEC __declspec(dllexport) |
||||||
|
#else |
||||||
|
#define MINIUPNP_LIBSPEC __declspec(dllimport) |
||||||
|
#endif |
||||||
|
#else |
||||||
|
#if defined(__GNUC__) && __GNUC__ >= 4 |
||||||
|
/* fix dynlib for OS X 10.9.2 and Apple LLVM version 5.0 */ |
||||||
|
#define MINIUPNP_LIBSPEC __attribute__ ((visibility ("default"))) |
||||||
|
#else |
||||||
|
#define MINIUPNP_LIBSPEC |
||||||
|
#endif |
||||||
|
#endif |
||||||
|
|
||||||
|
#endif /* MINIUPNPC_DECLSPEC_H_INCLUDED */ |
||||||
|
|
@ -0,0 +1,44 @@ |
|||||||
|
/* $Id: miniupnpc_socketdef.h,v 1.1 2018/03/13 23:44:10 nanard Exp $ */ |
||||||
|
/* Miniupnp project : http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
|
||||||
|
* Author : Thomas Bernard |
||||||
|
* Copyright (c) 2018 Thomas Bernard |
||||||
|
* This software is subject to the conditions detailed in the |
||||||
|
* LICENCE file provided within this distribution */ |
||||||
|
#ifndef MINIUPNPC_SOCKETDEF_H_INCLUDED |
||||||
|
#define MINIUPNPC_SOCKETDEF_H_INCLUDED |
||||||
|
|
||||||
|
#ifdef _MSC_VER |
||||||
|
|
||||||
|
#define ISINVALID(s) (INVALID_SOCKET==(s)) |
||||||
|
|
||||||
|
#else |
||||||
|
|
||||||
|
#ifndef SOCKET |
||||||
|
#define SOCKET int |
||||||
|
#endif |
||||||
|
#ifndef SSIZE_T |
||||||
|
#define SSIZE_T ssize_t |
||||||
|
#endif |
||||||
|
#ifndef INVALID_SOCKET |
||||||
|
#define INVALID_SOCKET (-1) |
||||||
|
#endif |
||||||
|
#ifndef ISINVALID |
||||||
|
#define ISINVALID(s) ((s)<0) |
||||||
|
#endif |
||||||
|
|
||||||
|
#endif |
||||||
|
|
||||||
|
#ifdef _MSC_VER |
||||||
|
#define MSC_CAST_INT (int) |
||||||
|
#else |
||||||
|
#define MSC_CAST_INT |
||||||
|
#endif |
||||||
|
|
||||||
|
/* definition of PRINT_SOCKET_ERROR */ |
||||||
|
#ifdef _WIN32 |
||||||
|
#define PRINT_SOCKET_ERROR(x) fprintf(stderr, "Socket error: %s, %d\n", x, WSAGetLastError()); |
||||||
|
#else |
||||||
|
#define PRINT_SOCKET_ERROR(x) perror(x) |
||||||
|
#endif |
||||||
|
|
||||||
|
#endif /* MINIUPNPC_SOCKETDEF_H_INCLUDED */ |
@ -0,0 +1,23 @@ |
|||||||
|
/* $Id: miniupnpcstrings.h.in,v 1.6 2014/11/04 22:31:55 nanard Exp $ */ |
||||||
|
/* Project: miniupnp
|
||||||
|
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||||
|
* Author: Thomas Bernard |
||||||
|
* Copyright (c) 2005-2014 Thomas Bernard |
||||||
|
* This software is subjects to the conditions detailed |
||||||
|
* in the LICENCE file provided within this distribution */ |
||||||
|
#ifndef MINIUPNPCSTRINGS_H_INCLUDED |
||||||
|
#define MINIUPNPCSTRINGS_H_INCLUDED |
||||||
|
|
||||||
|
#define OS_STRING "Debian/8.10" |
||||||
|
#define MINIUPNPC_VERSION_STRING "2.1" |
||||||
|
|
||||||
|
#if 0 |
||||||
|
/* according to "UPnP Device Architecture 1.0" */ |
||||||
|
#define UPNP_VERSION_STRING "UPnP/1.0" |
||||||
|
#else |
||||||
|
/* according to "UPnP Device Architecture 1.1" */ |
||||||
|
#define UPNP_VERSION_STRING "UPnP/1.1" |
||||||
|
#endif |
||||||
|
|
||||||
|
#endif |
||||||
|
|
@ -0,0 +1,19 @@ |
|||||||
|
/* $Id: miniupnpctypes.h,v 1.1 2011/02/15 11:10:40 nanard Exp $ */ |
||||||
|
/* Miniupnp project : http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org
|
||||||
|
* Author : Thomas Bernard |
||||||
|
* Copyright (c) 2011 Thomas Bernard |
||||||
|
* This software is subject to the conditions detailed in the |
||||||
|
* LICENCE file provided within this distribution */ |
||||||
|
#ifndef MINIUPNPCTYPES_H_INCLUDED |
||||||
|
#define MINIUPNPCTYPES_H_INCLUDED |
||||||
|
|
||||||
|
#if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) |
||||||
|
#define UNSIGNED_INTEGER unsigned long long |
||||||
|
#define STRTOUI strtoull |
||||||
|
#else |
||||||
|
#define UNSIGNED_INTEGER unsigned int |
||||||
|
#define STRTOUI strtoul |
||||||
|
#endif |
||||||
|
|
||||||
|
#endif |
||||||
|
|
@ -0,0 +1,27 @@ |
|||||||
|
/* $Id: miniwget.h,v 1.12 2016/01/24 17:24:36 nanard Exp $ */ |
||||||
|
/* Project : miniupnp
|
||||||
|
* Author : Thomas Bernard |
||||||
|
* Copyright (c) 2005-2016 Thomas Bernard |
||||||
|
* This software is subject to the conditions detailed in the |
||||||
|
* LICENCE file provided in this distribution. |
||||||
|
* */ |
||||||
|
#ifndef MINIWGET_H_INCLUDED |
||||||
|
#define MINIWGET_H_INCLUDED |
||||||
|
|
||||||
|
#include "miniupnpc_declspec.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC void * miniwget(const char *, int *, unsigned int, int *); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC void * miniwget_getaddr(const char *, int *, char *, int, unsigned int, int *); |
||||||
|
|
||||||
|
int parseURL(const char *, char *, unsigned short *, char * *, unsigned int *); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
|
||||||
|
#endif |
@ -0,0 +1,15 @@ |
|||||||
|
/* $Id: miniwget_private.h,v 1.1 2018/04/06 10:17:58 nanard Exp $ */ |
||||||
|
/* Project : miniupnp
|
||||||
|
* Author : Thomas Bernard |
||||||
|
* Copyright (c) 2018 Thomas Bernard |
||||||
|
* This software is subject to the conditions detailed in the |
||||||
|
* LICENCE file provided in this distribution. |
||||||
|
* */ |
||||||
|
#ifndef MINIWGET_INTERNAL_H_INCLUDED |
||||||
|
#define MINIWGET_INTERNAL_H_INCLUDED |
||||||
|
|
||||||
|
#include "miniupnpc_socketdef.h" |
||||||
|
|
||||||
|
void * getHTTPResponse(SOCKET s, int * size, int * status_code); |
||||||
|
|
||||||
|
#endif |
@ -0,0 +1,37 @@ |
|||||||
|
/* $Id: minixml.h,v 1.6 2006/11/30 11:47:21 nanard Exp $ */ |
||||||
|
/* minimal xml parser
|
||||||
|
* |
||||||
|
* Project : miniupnp |
||||||
|
* Website : http://miniupnp.free.fr/
|
||||||
|
* Author : Thomas Bernard |
||||||
|
* Copyright (c) 2005 Thomas Bernard |
||||||
|
* This software is subject to the conditions detailed in the |
||||||
|
* LICENCE file provided in this distribution. |
||||||
|
* */ |
||||||
|
#ifndef MINIXML_H_INCLUDED |
||||||
|
#define MINIXML_H_INCLUDED |
||||||
|
#define IS_WHITE_SPACE(c) ((c)==' ' || (c)=='\t' || (c)=='\r' || (c)=='\n') |
||||||
|
|
||||||
|
/* if a callback function pointer is set to NULL,
|
||||||
|
* the function is not called */ |
||||||
|
struct xmlparser { |
||||||
|
const char *xmlstart; |
||||||
|
const char *xmlend; |
||||||
|
const char *xml; /* pointer to current character */ |
||||||
|
int xmlsize; |
||||||
|
void * data; |
||||||
|
void (*starteltfunc) (void *, const char *, int); |
||||||
|
void (*endeltfunc) (void *, const char *, int); |
||||||
|
void (*datafunc) (void *, const char *, int); |
||||||
|
void (*attfunc) (void *, const char *, int, const char *, int); |
||||||
|
}; |
||||||
|
|
||||||
|
/* parsexml()
|
||||||
|
* the xmlparser structure must be initialized before the call |
||||||
|
* the following structure members have to be initialized : |
||||||
|
* xmlstart, xmlsize, data, *func |
||||||
|
* xml is for internal usage, xmlend is computed automatically */ |
||||||
|
void parsexml(struct xmlparser *); |
||||||
|
|
||||||
|
#endif |
||||||
|
|
@ -0,0 +1,65 @@ |
|||||||
|
/* $Id: portlistingparse.h,v 1.10 2014/11/01 10:37:32 nanard Exp $ */ |
||||||
|
/* MiniUPnP project
|
||||||
|
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||||
|
* (c) 2011-2015 Thomas Bernard |
||||||
|
* This software is subject to the conditions detailed |
||||||
|
* in the LICENCE file provided within the distribution */ |
||||||
|
#ifndef PORTLISTINGPARSE_H_INCLUDED |
||||||
|
#define PORTLISTINGPARSE_H_INCLUDED |
||||||
|
|
||||||
|
#include "miniupnpc_declspec.h" |
||||||
|
/* for the definition of UNSIGNED_INTEGER */ |
||||||
|
#include "miniupnpctypes.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/* sample of PortMappingEntry :
|
||||||
|
<p:PortMappingEntry> |
||||||
|
<p:NewRemoteHost>202.233.2.1</p:NewRemoteHost> |
||||||
|
<p:NewExternalPort>2345</p:NewExternalPort> |
||||||
|
<p:NewProtocol>TCP</p:NewProtocol> |
||||||
|
<p:NewInternalPort>2345</p:NewInternalPort> |
||||||
|
<p:NewInternalClient>192.168.1.137</p:NewInternalClient> |
||||||
|
<p:NewEnabled>1</p:NewEnabled> |
||||||
|
<p:NewDescription>dooom</p:NewDescription> |
||||||
|
<p:NewLeaseTime>345</p:NewLeaseTime> |
||||||
|
</p:PortMappingEntry> |
||||||
|
*/ |
||||||
|
typedef enum { PortMappingEltNone, |
||||||
|
PortMappingEntry, NewRemoteHost, |
||||||
|
NewExternalPort, NewProtocol, |
||||||
|
NewInternalPort, NewInternalClient, |
||||||
|
NewEnabled, NewDescription, |
||||||
|
NewLeaseTime } portMappingElt; |
||||||
|
|
||||||
|
struct PortMapping { |
||||||
|
struct PortMapping * l_next; /* list next element */ |
||||||
|
UNSIGNED_INTEGER leaseTime; |
||||||
|
unsigned short externalPort; |
||||||
|
unsigned short internalPort; |
||||||
|
char remoteHost[64]; |
||||||
|
char internalClient[64]; |
||||||
|
char description[64]; |
||||||
|
char protocol[4]; |
||||||
|
unsigned char enabled; |
||||||
|
}; |
||||||
|
|
||||||
|
struct PortMappingParserData { |
||||||
|
struct PortMapping * l_head; /* list head */ |
||||||
|
portMappingElt curelt; |
||||||
|
}; |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC void |
||||||
|
ParsePortListing(const char * buffer, int bufsize, |
||||||
|
struct PortMappingParserData * pdata); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC void |
||||||
|
FreePortListing(struct PortMappingParserData * pdata); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
|
||||||
|
#endif |
@ -0,0 +1,21 @@ |
|||||||
|
/* $Id: receivedata.h,v 1.3 2012/06/23 22:34:47 nanard Exp $ */ |
||||||
|
/* Project: miniupnp
|
||||||
|
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||||
|
* Author: Thomas Bernard |
||||||
|
* Copyright (c) 2011-2018 Thomas Bernard |
||||||
|
* This software is subjects to the conditions detailed |
||||||
|
* in the LICENCE file provided within this distribution */ |
||||||
|
#ifndef RECEIVEDATA_H_INCLUDED |
||||||
|
#define RECEIVEDATA_H_INCLUDED |
||||||
|
|
||||||
|
#include "miniupnpc_socketdef.h" |
||||||
|
|
||||||
|
/* 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(SOCKET socket, |
||||||
|
char * data, int length, |
||||||
|
int timeout, unsigned int * scope_id); |
||||||
|
|
||||||
|
#endif |
||||||
|
|
@ -0,0 +1,348 @@ |
|||||||
|
/* $Id: upnpcommands.h,v 1.32 2018/03/13 23:34:47 nanard Exp $ */ |
||||||
|
/* Miniupnp project : http://miniupnp.free.fr/
|
||||||
|
* Author : Thomas Bernard |
||||||
|
* Copyright (c) 2005-2018 Thomas Bernard |
||||||
|
* This software is subject to the conditions detailed in the |
||||||
|
* LICENCE file provided within this distribution */ |
||||||
|
#ifndef UPNPCOMMANDS_H_INCLUDED |
||||||
|
#define UPNPCOMMANDS_H_INCLUDED |
||||||
|
|
||||||
|
#include "miniupnpc_declspec.h" |
||||||
|
#include "miniupnpctypes.h" |
||||||
|
|
||||||
|
/* MiniUPnPc return codes : */ |
||||||
|
#define UPNPCOMMAND_SUCCESS (0) |
||||||
|
#define UPNPCOMMAND_UNKNOWN_ERROR (-1) |
||||||
|
#define UPNPCOMMAND_INVALID_ARGS (-2) |
||||||
|
#define UPNPCOMMAND_HTTP_ERROR (-3) |
||||||
|
#define UPNPCOMMAND_INVALID_RESPONSE (-4) |
||||||
|
#define UPNPCOMMAND_MEM_ALLOC_ERROR (-5) |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
struct PortMappingParserData; |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC UNSIGNED_INTEGER |
||||||
|
UPNP_GetTotalBytesSent(const char * controlURL, |
||||||
|
const char * servicetype); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC UNSIGNED_INTEGER |
||||||
|
UPNP_GetTotalBytesReceived(const char * controlURL, |
||||||
|
const char * servicetype); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC UNSIGNED_INTEGER |
||||||
|
UPNP_GetTotalPacketsSent(const char * controlURL, |
||||||
|
const char * servicetype); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC UNSIGNED_INTEGER |
||||||
|
UPNP_GetTotalPacketsReceived(const char * controlURL, |
||||||
|
const char * servicetype); |
||||||
|
|
||||||
|
/* UPNP_GetStatusInfo()
|
||||||
|
* status and lastconnerror are 64 byte buffers |
||||||
|
* Return values : |
||||||
|
* UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR |
||||||
|
* or a UPnP Error code */ |
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_GetStatusInfo(const char * controlURL, |
||||||
|
const char * servicetype, |
||||||
|
char * status, |
||||||
|
unsigned int * uptime, |
||||||
|
char * lastconnerror); |
||||||
|
|
||||||
|
/* UPNP_GetConnectionTypeInfo()
|
||||||
|
* argument connectionType is a 64 character buffer |
||||||
|
* Return Values : |
||||||
|
* UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR |
||||||
|
* or a UPnP Error code */ |
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_GetConnectionTypeInfo(const char * controlURL, |
||||||
|
const char * servicetype, |
||||||
|
char * connectionType); |
||||||
|
|
||||||
|
/* UPNP_GetExternalIPAddress() call the corresponding UPNP method.
|
||||||
|
* if the third arg is not null the value is copied to it. |
||||||
|
* at least 16 bytes must be available |
||||||
|
* |
||||||
|
* Return values : |
||||||
|
* 0 : SUCCESS |
||||||
|
* NON ZERO : ERROR Either an UPnP error code or an unknown error. |
||||||
|
* |
||||||
|
* possible UPnP Errors : |
||||||
|
* 402 Invalid Args - See UPnP Device Architecture section on Control. |
||||||
|
* 501 Action Failed - See UPnP Device Architecture section on Control. */ |
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_GetExternalIPAddress(const char * controlURL, |
||||||
|
const char * servicetype, |
||||||
|
char * extIpAdd); |
||||||
|
|
||||||
|
/* UPNP_GetLinkLayerMaxBitRates()
|
||||||
|
* call WANCommonInterfaceConfig:1#GetCommonLinkProperties |
||||||
|
* |
||||||
|
* return values : |
||||||
|
* UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR |
||||||
|
* or a UPnP Error Code. */ |
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_GetLinkLayerMaxBitRates(const char* controlURL, |
||||||
|
const char* servicetype, |
||||||
|
unsigned int * bitrateDown, |
||||||
|
unsigned int * bitrateUp); |
||||||
|
|
||||||
|
/* UPNP_AddPortMapping()
|
||||||
|
* if desc is NULL, it will be defaulted to "libminiupnpc" |
||||||
|
* remoteHost is usually NULL because IGD don't support it. |
||||||
|
* |
||||||
|
* Return values : |
||||||
|
* 0 : SUCCESS |
||||||
|
* NON ZERO : ERROR. Either an UPnP error code or an unknown error. |
||||||
|
* |
||||||
|
* List of possible UPnP errors for AddPortMapping : |
||||||
|
* errorCode errorDescription (short) - Description (long) |
||||||
|
* 402 Invalid Args - See UPnP Device Architecture section on Control. |
||||||
|
* 501 Action Failed - See UPnP Device Architecture section on Control. |
||||||
|
* 606 Action not authorized - The action requested REQUIRES authorization and |
||||||
|
* the sender was not authorized. |
||||||
|
* 715 WildCardNotPermittedInSrcIP - The source IP address cannot be |
||||||
|
* wild-carded |
||||||
|
* 716 WildCardNotPermittedInExtPort - The external port cannot be wild-carded |
||||||
|
* 718 ConflictInMappingEntry - The port mapping entry specified conflicts |
||||||
|
* with a mapping assigned previously to another client |
||||||
|
* 724 SamePortValuesRequired - Internal and External port values |
||||||
|
* must be the same |
||||||
|
* 725 OnlyPermanentLeasesSupported - The NAT implementation only supports |
||||||
|
* permanent lease times on port mappings |
||||||
|
* 726 RemoteHostOnlySupportsWildcard - RemoteHost must be a wildcard |
||||||
|
* and cannot be a specific IP address or DNS name |
||||||
|
* 727 ExternalPortOnlySupportsWildcard - ExternalPort must be a wildcard and |
||||||
|
* cannot be a specific port value |
||||||
|
* 728 NoPortMapsAvailable - There are not enough free ports available to |
||||||
|
* complete port mapping. |
||||||
|
* 729 ConflictWithOtherMechanisms - Attempted port mapping is not allowed |
||||||
|
* due to conflict with other mechanisms. |
||||||
|
* 732 WildCardNotPermittedInIntPort - The internal port cannot be wild-carded |
||||||
|
*/ |
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_AddPortMapping(const char * controlURL, const char * servicetype, |
||||||
|
const char * extPort, |
||||||
|
const char * inPort, |
||||||
|
const char * inClient, |
||||||
|
const char * desc, |
||||||
|
const char * proto, |
||||||
|
const char * remoteHost, |
||||||
|
const char * leaseDuration); |
||||||
|
|
||||||
|
/* UPNP_AddAnyPortMapping()
|
||||||
|
* if desc is NULL, it will be defaulted to "libminiupnpc" |
||||||
|
* remoteHost is usually NULL because IGD don't support it. |
||||||
|
* |
||||||
|
* Return values : |
||||||
|
* 0 : SUCCESS |
||||||
|
* NON ZERO : ERROR. Either an UPnP error code or an unknown error. |
||||||
|
* |
||||||
|
* List of possible UPnP errors for AddPortMapping : |
||||||
|
* errorCode errorDescription (short) - Description (long) |
||||||
|
* 402 Invalid Args - See UPnP Device Architecture section on Control. |
||||||
|
* 501 Action Failed - See UPnP Device Architecture section on Control. |
||||||
|
* 606 Action not authorized - The action requested REQUIRES authorization and |
||||||
|
* the sender was not authorized. |
||||||
|
* 715 WildCardNotPermittedInSrcIP - The source IP address cannot be |
||||||
|
* wild-carded |
||||||
|
* 716 WildCardNotPermittedInExtPort - The external port cannot be wild-carded |
||||||
|
* 728 NoPortMapsAvailable - There are not enough free ports available to |
||||||
|
* complete port mapping. |
||||||
|
* 729 ConflictWithOtherMechanisms - Attempted port mapping is not allowed |
||||||
|
* due to conflict with other mechanisms. |
||||||
|
* 732 WildCardNotPermittedInIntPort - The internal port cannot be wild-carded |
||||||
|
*/ |
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_AddAnyPortMapping(const char * controlURL, const char * servicetype, |
||||||
|
const char * extPort, |
||||||
|
const char * inPort, |
||||||
|
const char * inClient, |
||||||
|
const char * desc, |
||||||
|
const char * proto, |
||||||
|
const char * remoteHost, |
||||||
|
const char * leaseDuration, |
||||||
|
char * reservedPort); |
||||||
|
|
||||||
|
/* UPNP_DeletePortMapping()
|
||||||
|
* Use same argument values as what was used for AddPortMapping(). |
||||||
|
* remoteHost is usually NULL because IGD don't support it. |
||||||
|
* Return Values : |
||||||
|
* 0 : SUCCESS |
||||||
|
* NON ZERO : error. Either an UPnP error code or an undefined error. |
||||||
|
* |
||||||
|
* List of possible UPnP errors for DeletePortMapping : |
||||||
|
* 402 Invalid Args - See UPnP Device Architecture section on Control. |
||||||
|
* 606 Action not authorized - The action requested REQUIRES authorization |
||||||
|
* and the sender was not authorized. |
||||||
|
* 714 NoSuchEntryInArray - The specified value does not exist in the array */ |
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_DeletePortMapping(const char * controlURL, const char * servicetype, |
||||||
|
const char * extPort, const char * proto, |
||||||
|
const char * remoteHost); |
||||||
|
|
||||||
|
/* UPNP_DeletePortRangeMapping()
|
||||||
|
* Use same argument values as what was used for AddPortMapping(). |
||||||
|
* remoteHost is usually NULL because IGD don't support it. |
||||||
|
* Return Values : |
||||||
|
* 0 : SUCCESS |
||||||
|
* NON ZERO : error. Either an UPnP error code or an undefined error. |
||||||
|
* |
||||||
|
* List of possible UPnP errors for DeletePortMapping : |
||||||
|
* 606 Action not authorized - The action requested REQUIRES authorization |
||||||
|
* and the sender was not authorized. |
||||||
|
* 730 PortMappingNotFound - This error message is returned if no port |
||||||
|
* mapping is found in the specified range. |
||||||
|
* 733 InconsistentParameters - NewStartPort and NewEndPort values are not consistent. */ |
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_DeletePortMappingRange(const char * controlURL, const char * servicetype, |
||||||
|
const char * extPortStart, const char * extPortEnd, |
||||||
|
const char * proto, |
||||||
|
const char * manage); |
||||||
|
|
||||||
|
/* UPNP_GetPortMappingNumberOfEntries()
|
||||||
|
* not supported by all routers */ |
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_GetPortMappingNumberOfEntries(const char * controlURL, |
||||||
|
const char * servicetype, |
||||||
|
unsigned int * numEntries); |
||||||
|
|
||||||
|
/* UPNP_GetSpecificPortMappingEntry()
|
||||||
|
* retrieves an existing port mapping |
||||||
|
* params : |
||||||
|
* in extPort |
||||||
|
* in proto |
||||||
|
* in remoteHost |
||||||
|
* out intClient (16 bytes) |
||||||
|
* out intPort (6 bytes) |
||||||
|
* out desc (80 bytes) |
||||||
|
* out enabled (4 bytes) |
||||||
|
* out leaseDuration (16 bytes) |
||||||
|
* |
||||||
|
* return value : |
||||||
|
* UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR |
||||||
|
* or a UPnP Error Code. |
||||||
|
* |
||||||
|
* List of possible UPnP errors for _GetSpecificPortMappingEntry : |
||||||
|
* 402 Invalid Args - See UPnP Device Architecture section on Control. |
||||||
|
* 501 Action Failed - See UPnP Device Architecture section on Control. |
||||||
|
* 606 Action not authorized - The action requested REQUIRES authorization |
||||||
|
* and the sender was not authorized. |
||||||
|
* 714 NoSuchEntryInArray - The specified value does not exist in the array. |
||||||
|
*/ |
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_GetSpecificPortMappingEntry(const char * controlURL, |
||||||
|
const char * servicetype, |
||||||
|
const char * extPort, |
||||||
|
const char * proto, |
||||||
|
const char * remoteHost, |
||||||
|
char * intClient, |
||||||
|
char * intPort, |
||||||
|
char * desc, |
||||||
|
char * enabled, |
||||||
|
char * leaseDuration); |
||||||
|
|
||||||
|
/* UPNP_GetGenericPortMappingEntry()
|
||||||
|
* params : |
||||||
|
* in index |
||||||
|
* out extPort (6 bytes) |
||||||
|
* out intClient (16 bytes) |
||||||
|
* out intPort (6 bytes) |
||||||
|
* out protocol (4 bytes) |
||||||
|
* out desc (80 bytes) |
||||||
|
* out enabled (4 bytes) |
||||||
|
* out rHost (64 bytes) |
||||||
|
* out duration (16 bytes) |
||||||
|
* |
||||||
|
* return value : |
||||||
|
* UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR |
||||||
|
* or a UPnP Error Code. |
||||||
|
* |
||||||
|
* Possible UPNP Error codes : |
||||||
|
* 402 Invalid Args - See UPnP Device Architecture section on Control. |
||||||
|
* 606 Action not authorized - The action requested REQUIRES authorization |
||||||
|
* and the sender was not authorized. |
||||||
|
* 713 SpecifiedArrayIndexInvalid - The specified array index is out of bounds |
||||||
|
*/ |
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_GetGenericPortMappingEntry(const char * controlURL, |
||||||
|
const char * servicetype, |
||||||
|
const char * index, |
||||||
|
char * extPort, |
||||||
|
char * intClient, |
||||||
|
char * intPort, |
||||||
|
char * protocol, |
||||||
|
char * desc, |
||||||
|
char * enabled, |
||||||
|
char * rHost, |
||||||
|
char * duration); |
||||||
|
|
||||||
|
/* UPNP_GetListOfPortMappings() Available in IGD v2
|
||||||
|
* |
||||||
|
* |
||||||
|
* Possible UPNP Error codes : |
||||||
|
* 606 Action not Authorized |
||||||
|
* 730 PortMappingNotFound - no port mapping is found in the specified range. |
||||||
|
* 733 InconsistantParameters - NewStartPort and NewEndPort values are not |
||||||
|
* consistent. |
||||||
|
*/ |
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_GetListOfPortMappings(const char * controlURL, |
||||||
|
const char * servicetype, |
||||||
|
const char * startPort, |
||||||
|
const char * endPort, |
||||||
|
const char * protocol, |
||||||
|
const char * numberOfPorts, |
||||||
|
struct PortMappingParserData * data); |
||||||
|
|
||||||
|
/* IGD:2, functions for service WANIPv6FirewallControl:1 */ |
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_GetFirewallStatus(const char * controlURL, |
||||||
|
const char * servicetype, |
||||||
|
int * firewallEnabled, |
||||||
|
int * inboundPinholeAllowed); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_GetOutboundPinholeTimeout(const char * controlURL, const char * servicetype, |
||||||
|
const char * remoteHost, |
||||||
|
const char * remotePort, |
||||||
|
const char * intClient, |
||||||
|
const char * intPort, |
||||||
|
const char * proto, |
||||||
|
int * opTimeout); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_AddPinhole(const char * controlURL, const char * servicetype, |
||||||
|
const char * remoteHost, |
||||||
|
const char * remotePort, |
||||||
|
const char * intClient, |
||||||
|
const char * intPort, |
||||||
|
const char * proto, |
||||||
|
const char * leaseTime, |
||||||
|
char * uniqueID); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_UpdatePinhole(const char * controlURL, const char * servicetype, |
||||||
|
const char * uniqueID, |
||||||
|
const char * leaseTime); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_DeletePinhole(const char * controlURL, const char * servicetype, const char * uniqueID); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_CheckPinholeWorking(const char * controlURL, const char * servicetype, |
||||||
|
const char * uniqueID, int * isWorking); |
||||||
|
|
||||||
|
MINIUPNP_LIBSPEC int |
||||||
|
UPNP_GetPinholePackets(const char * controlURL, const char * servicetype, |
||||||
|
const char * uniqueID, int * packets); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
|
||||||
|
#endif |
||||||
|
|
@ -0,0 +1,36 @@ |
|||||||
|
/* $Id: upnpdev.h,v 1.1 2015/08/28 12:14:19 nanard Exp $ */ |
||||||
|
/* Project : miniupnp
|
||||||
|
* Web : http://miniupnp.free.fr/
|
||||||
|
* Author : Thomas BERNARD |
||||||
|
* copyright (c) 2005-2018 Thomas Bernard |
||||||
|
* This software is subjet to the conditions detailed in the |
||||||
|
* provided LICENSE file. */ |
||||||
|
#ifndef UPNPDEV_H_INCLUDED |
||||||
|
#define UPNPDEV_H_INCLUDED |
||||||
|
|
||||||
|
#include "miniupnpc_declspec.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
struct UPNPDev { |
||||||
|
struct UPNPDev * pNext; |
||||||
|
char * descURL; |
||||||
|
char * st; |
||||||
|
char * usn; |
||||||
|
unsigned int scope_id; |
||||||
|
char buffer[3]; |
||||||
|
}; |
||||||
|
|
||||||
|
/* freeUPNPDevlist()
|
||||||
|
* free list returned by upnpDiscover() */ |
||||||
|
MINIUPNP_LIBSPEC void freeUPNPDevlist(struct UPNPDev * devlist); |
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
|
||||||
|
|
||||||
|
#endif /* UPNPDEV_H_INCLUDED */ |
@ -0,0 +1,26 @@ |
|||||||
|
/* $Id: upnperrors.h,v 1.2 2008/07/02 23:31:15 nanard Exp $ */ |
||||||
|
/* (c) 2007-2015 Thomas Bernard
|
||||||
|
* All rights reserved. |
||||||
|
* MiniUPnP Project. |
||||||
|
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||||
|
* This software is subjet to the conditions detailed in the |
||||||
|
* provided LICENCE file. */ |
||||||
|
#ifndef UPNPERRORS_H_INCLUDED |
||||||
|
#define UPNPERRORS_H_INCLUDED |
||||||
|
|
||||||
|
#include "miniupnpc_declspec.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/* strupnperror()
|
||||||
|
* Return a string description of the UPnP error code |
||||||
|
* or NULL for undefinded errors */ |
||||||
|
MINIUPNP_LIBSPEC const char * strupnperror(int err); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
|
||||||
|
#endif |
@ -0,0 +1,63 @@ |
|||||||
|
/* $Id: upnpreplyparse.h,v 1.19 2014/10/27 16:33:19 nanard Exp $ */ |
||||||
|
/* MiniUPnP project
|
||||||
|
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||||
|
* (c) 2006-2013 Thomas Bernard |
||||||
|
* This software is subject to the conditions detailed |
||||||
|
* in the LICENCE file provided within the distribution */ |
||||||
|
|
||||||
|
#ifndef UPNPREPLYPARSE_H_INCLUDED |
||||||
|
#define UPNPREPLYPARSE_H_INCLUDED |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
struct NameValue { |
||||||
|
struct NameValue * l_next; |
||||||
|
char name[64]; |
||||||
|
char value[128]; |
||||||
|
}; |
||||||
|
|
||||||
|
struct NameValueParserData { |
||||||
|
struct NameValue * l_head; |
||||||
|
char curelt[64]; |
||||||
|
char * portListing; |
||||||
|
int portListingLength; |
||||||
|
int topelt; |
||||||
|
const char * cdata; |
||||||
|
int cdatalen; |
||||||
|
}; |
||||||
|
|
||||||
|
/* ParseNameValue() */ |
||||||
|
void |
||||||
|
ParseNameValue(const char * buffer, int bufsize, |
||||||
|
struct NameValueParserData * data); |
||||||
|
|
||||||
|
/* ClearNameValueList() */ |
||||||
|
void |
||||||
|
ClearNameValueList(struct NameValueParserData * pdata); |
||||||
|
|
||||||
|
/* GetValueFromNameValueList() */ |
||||||
|
char * |
||||||
|
GetValueFromNameValueList(struct NameValueParserData * pdata, |
||||||
|
const char * Name); |
||||||
|
|
||||||
|
#if 0 |
||||||
|
/* GetValueFromNameValueListIgnoreNS() */ |
||||||
|
char * |
||||||
|
GetValueFromNameValueListIgnoreNS(struct NameValueParserData * pdata, |
||||||
|
const char * Name); |
||||||
|
#endif |
||||||
|
|
||||||
|
/* DisplayNameValueList() */ |
||||||
|
#ifdef DEBUG |
||||||
|
void |
||||||
|
DisplayNameValueList(char * buffer, int bufsize); |
||||||
|
#endif |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
|
||||||
|
#endif |
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue