SRB2/libs/miniupnpc/include/upnpcommands.h

349 lines
13 KiB
C
Raw Normal View History

2023-12-30 16:35:35 +00:00
/* $Id: upnpcommands.h,v 1.33 2019/02/10 12:29:25 nanard Exp $ */
2014-03-15 16:59:03 +00:00
/* Miniupnp project : http://miniupnp.free.fr/
* Author : Thomas Bernard
2023-12-30 16:35:35 +00:00
* Copyright (c) 2005-2018 Thomas Bernard
2014-03-15 16:59:03 +00:00
* This software is subject to the conditions detailed in the
* LICENCE file provided within this distribution */
2023-12-30 16:35:35 +00:00
#ifndef UPNPCOMMANDS_H_INCLUDED
#define UPNPCOMMANDS_H_INCLUDED
2014-03-15 16:59:03 +00:00
2023-12-30 16:35:35 +00:00
#include "miniupnpc_declspec.h"
2014-03-15 16:59:03 +00:00
#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)
2023-12-30 16:35:35 +00:00
#define UPNPCOMMAND_INVALID_RESPONSE (-4)
#define UPNPCOMMAND_MEM_ALLOC_ERROR (-5)
2014-03-15 16:59:03 +00:00
#ifdef __cplusplus
extern "C" {
#endif
2023-12-30 16:35:35 +00:00
struct PortMappingParserData;
MINIUPNP_LIBSPEC UNSIGNED_INTEGER
2014-03-15 16:59:03 +00:00
UPNP_GetTotalBytesSent(const char * controlURL,
const char * servicetype);
2023-12-30 16:35:35 +00:00
MINIUPNP_LIBSPEC UNSIGNED_INTEGER
2014-03-15 16:59:03 +00:00
UPNP_GetTotalBytesReceived(const char * controlURL,
const char * servicetype);
2023-12-30 16:35:35 +00:00
MINIUPNP_LIBSPEC UNSIGNED_INTEGER
2014-03-15 16:59:03 +00:00
UPNP_GetTotalPacketsSent(const char * controlURL,
const char * servicetype);
2023-12-30 16:35:35 +00:00
MINIUPNP_LIBSPEC UNSIGNED_INTEGER
2014-03-15 16:59:03 +00:00
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 */
2023-12-30 16:35:35 +00:00
MINIUPNP_LIBSPEC int
2014-03-15 16:59:03 +00:00
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 */
2023-12-30 16:35:35 +00:00
MINIUPNP_LIBSPEC int
2014-03-15 16:59:03 +00:00
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.
2023-12-30 16:35:35 +00:00
* at least 16 bytes must be available
2014-03-15 16:59:03 +00:00
*
* Return values :
* 0 : SUCCESS
* NON ZERO : ERROR Either an UPnP error code or an unknown error.
2023-12-30 16:35:35 +00:00
*
2014-03-15 16:59:03 +00:00
* possible UPnP Errors :
* 402 Invalid Args - See UPnP Device Architecture section on Control.
* 501 Action Failed - See UPnP Device Architecture section on Control. */
2023-12-30 16:35:35 +00:00
MINIUPNP_LIBSPEC int
2014-03-15 16:59:03 +00:00
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. */
2023-12-30 16:35:35 +00:00
MINIUPNP_LIBSPEC int
2014-03-15 16:59:03 +00:00
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.
2023-12-30 16:35:35 +00:00
*
2014-03-15 16:59:03 +00:00
* 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.
2023-12-30 16:35:35 +00:00
* 606 Action not authorized - The action requested REQUIRES authorization and
* the sender was not authorized.
2014-03-15 16:59:03 +00:00
* 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
2023-12-30 16:35:35 +00:00
* must be the same
2014-03-15 16:59:03 +00:00
* 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
2023-12-30 16:35:35 +00:00
* 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
2014-03-15 16:59:03 +00:00
UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
2023-12-30 16:35:35 +00:00
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);
2014-03-15 16:59:03 +00:00
/* 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.
2023-12-30 16:35:35 +00:00
* 606 Action not authorized - The action requested REQUIRES authorization
* and the sender was not authorized.
2014-03-15 16:59:03 +00:00
* 714 NoSuchEntryInArray - The specified value does not exist in the array */
2023-12-30 16:35:35 +00:00
MINIUPNP_LIBSPEC int
2014-03-15 16:59:03 +00:00
UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
2023-12-30 16:35:35 +00:00
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);
2014-03-15 16:59:03 +00:00
/* UPNP_GetPortMappingNumberOfEntries()
* not supported by all routers */
2023-12-30 16:35:35 +00:00
MINIUPNP_LIBSPEC int
UPNP_GetPortMappingNumberOfEntries(const char * controlURL,
const char * servicetype,
unsigned int * numEntries);
2014-03-15 16:59:03 +00:00
/* UPNP_GetSpecificPortMappingEntry()
* retrieves an existing port mapping
* params :
* in extPort
* in proto
2023-12-30 16:35:35 +00:00
* in remoteHost
2014-03-15 16:59:03 +00:00
* 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
2023-12-30 16:35:35 +00:00
* 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
2014-03-15 16:59:03 +00:00
UPNP_GetSpecificPortMappingEntry(const char * controlURL,
const char * servicetype,
const char * extPort,
const char * proto,
2023-12-30 16:35:35 +00:00
const char * remoteHost,
2014-03-15 16:59:03 +00:00
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.
2023-12-30 16:35:35 +00:00
* 606 Action not authorized - The action requested REQUIRES authorization
* and the sender was not authorized.
2014-03-15 16:59:03 +00:00
* 713 SpecifiedArrayIndexInvalid - The specified array index is out of bounds
*/
2023-12-30 16:35:35 +00:00
MINIUPNP_LIBSPEC int
2014-03-15 16:59:03 +00:00
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.
*/
2023-12-30 16:35:35 +00:00
MINIUPNP_LIBSPEC int
2014-03-15 16:59:03 +00:00
UPNP_GetListOfPortMappings(const char * controlURL,
const char * servicetype,
const char * startPort,
const char * endPort,
const char * protocol,
const char * numberOfPorts,
struct PortMappingParserData * data);
2023-12-30 16:35:35 +00:00
/* IGD:2, functions for service WANIPv6FirewallControl:1 */
MINIUPNP_LIBSPEC int
2014-03-15 16:59:03 +00:00
UPNP_GetFirewallStatus(const char * controlURL,
const char * servicetype,
2023-12-30 16:35:35 +00:00
int * firewallEnabled,
2014-03-15 16:59:03 +00:00
int * inboundPinholeAllowed);
2023-12-30 16:35:35 +00:00
MINIUPNP_LIBSPEC int
2014-03-15 16:59:03 +00:00
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);
2023-12-30 16:35:35 +00:00
MINIUPNP_LIBSPEC int
2014-03-15 16:59:03 +00:00
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);
2023-12-30 16:35:35 +00:00
MINIUPNP_LIBSPEC int
2014-03-15 16:59:03 +00:00
UPNP_UpdatePinhole(const char * controlURL, const char * servicetype,
const char * uniqueID,
const char * leaseTime);
2023-12-30 16:35:35 +00:00
MINIUPNP_LIBSPEC int
2014-03-15 16:59:03 +00:00
UPNP_DeletePinhole(const char * controlURL, const char * servicetype, const char * uniqueID);
2023-12-30 16:35:35 +00:00
MINIUPNP_LIBSPEC int
2014-03-15 16:59:03 +00:00
UPNP_CheckPinholeWorking(const char * controlURL, const char * servicetype,
const char * uniqueID, int * isWorking);
2023-12-30 16:35:35 +00:00
MINIUPNP_LIBSPEC int
2014-03-15 16:59:03 +00:00
UPNP_GetPinholePackets(const char * controlURL, const char * servicetype,
const char * uniqueID, int * packets);
#ifdef __cplusplus
}
#endif
#endif