2008-02-23 15:31:39 +00:00
|
|
|
/* $Id: upnpcommands.h,v 1.13 2008/02/18 13:27:24 nanard Exp $ */
|
2007-11-06 16:02:50 +00:00
|
|
|
/* Miniupnp project : http://miniupnp.free.fr/
|
|
|
|
* Author : Thomas Bernard
|
|
|
|
* Copyright (c) 2005-2006 Thomas Bernard
|
|
|
|
* This software is subject to the conditions detailed in the
|
|
|
|
* LICENCE file provided within this distribution */
|
|
|
|
#ifndef __UPNPCOMMANDS_H__
|
|
|
|
#define __UPNPCOMMANDS_H__
|
|
|
|
|
|
|
|
#include "upnpreplyparse.h"
|
|
|
|
#include "declspec.h"
|
|
|
|
|
2007-12-20 20:18:22 +00:00
|
|
|
/* MiniUPnPc return codes : */
|
|
|
|
#define UPNPCOMMAND_SUCCESS (0)
|
|
|
|
#define UPNPCOMMAND_UNKNOWN_ERROR (-1)
|
|
|
|
#define UPNPCOMMAND_INVALID_ARGS (-2)
|
|
|
|
|
2007-11-06 16:02:50 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
LIBSPEC unsigned int
|
|
|
|
UPNP_GetTotalBytesSent(const char * controlURL,
|
|
|
|
const char * servicetype);
|
|
|
|
|
|
|
|
LIBSPEC unsigned int
|
|
|
|
UPNP_GetTotalBytesReceived(const char * controlURL,
|
|
|
|
const char * servicetype);
|
|
|
|
|
|
|
|
LIBSPEC unsigned int
|
|
|
|
UPNP_GetTotalPacketsSent(const char * controlURL,
|
|
|
|
const char * servicetype);
|
|
|
|
|
|
|
|
LIBSPEC unsigned int
|
|
|
|
UPNP_GetTotalPacketsReceived(const char * controlURL,
|
|
|
|
const char * servicetype);
|
|
|
|
|
2008-02-23 15:31:39 +00:00
|
|
|
/* UPNP_GetStatusInfo()
|
|
|
|
* status and lastconnerror are 64 byte buffers
|
|
|
|
* Return values :
|
|
|
|
* UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
|
|
|
|
* or a UPnP Error code */
|
|
|
|
LIBSPEC int
|
2007-11-06 16:02:50 +00:00
|
|
|
UPNP_GetStatusInfo(const char * controlURL,
|
|
|
|
const char * servicetype,
|
|
|
|
char * status,
|
2008-02-23 15:31:39 +00:00
|
|
|
unsigned int * uptime,
|
|
|
|
char * lastconnerror);
|
2007-11-06 16:02:50 +00:00
|
|
|
|
2008-02-23 15:31:39 +00:00
|
|
|
/* UPNP_GetConnectionTypeInfo()
|
|
|
|
* argument connectionType is a 64 character buffer
|
|
|
|
* Return Values :
|
|
|
|
* UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
|
|
|
|
* or a UPnP Error code */
|
|
|
|
LIBSPEC int
|
2007-11-06 16:02:50 +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.
|
2007-12-20 20:18:22 +00:00
|
|
|
* 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. */
|
|
|
|
LIBSPEC int
|
2007-11-06 16:02:50 +00:00
|
|
|
UPNP_GetExternalIPAddress(const char * controlURL,
|
|
|
|
const char * servicetype,
|
|
|
|
char * extIpAdd);
|
|
|
|
|
2008-02-23 15:31:39 +00:00
|
|
|
/* UPNP_GetLinkLayerMaxBitRates()
|
|
|
|
* call WANCommonInterfaceConfig:1#GetCommonLinkProperties
|
|
|
|
*
|
|
|
|
* return values :
|
|
|
|
* UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
|
|
|
|
* or a UPnP Error Code. */
|
|
|
|
LIBSPEC int
|
2007-11-06 16:02:50 +00:00
|
|
|
UPNP_GetLinkLayerMaxBitRates(const char* controlURL,
|
|
|
|
const char* servicetype,
|
|
|
|
unsigned int * bitrateDown,
|
|
|
|
unsigned int * bitrateUp);
|
|
|
|
|
2007-12-20 20:18:22 +00:00
|
|
|
/* UPNP_AddPortMapping()
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
* 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 */
|
2007-11-06 16:02:50 +00:00
|
|
|
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);
|
|
|
|
|
2007-12-20 20:18:22 +00:00
|
|
|
/* UPNP_DeletePortMapping()
|
|
|
|
* 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.
|
|
|
|
* 714 NoSuchEntryInArray - The specified value does not exist in the array */
|
|
|
|
LIBSPEC int
|
2007-11-06 16:02:50 +00:00
|
|
|
UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
|
|
|
|
const char * extPort, const char * proto);
|
|
|
|
|
2008-02-23 15:31:39 +00:00
|
|
|
/* UPNP_GetPortMappingNumberOfEntries()
|
|
|
|
* not supported by all routers */
|
2007-12-20 20:18:22 +00:00
|
|
|
LIBSPEC int
|
2007-11-06 16:02:50 +00:00
|
|
|
UPNP_GetPortMappingNumberOfEntries(const char* controlURL, const char* servicetype, unsigned int * num);
|
|
|
|
|
|
|
|
/* UPNP_GetSpecificPortMappingEntry retrieves an existing port mapping
|
|
|
|
* the result is returned in the intClient and intPort strings
|
2008-02-23 15:31:39 +00:00
|
|
|
* please provide 16 and 6 bytes of data
|
|
|
|
*
|
|
|
|
* return value :
|
|
|
|
* UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
|
|
|
|
* or a UPnP Error Code. */
|
2007-12-20 20:18:22 +00:00
|
|
|
LIBSPEC int
|
2007-11-06 16:02:50 +00:00
|
|
|
UPNP_GetSpecificPortMappingEntry(const char * controlURL,
|
|
|
|
const char * servicetype,
|
|
|
|
const char * extPort,
|
|
|
|
const char * proto,
|
|
|
|
char * intClient,
|
|
|
|
char * intPort);
|
|
|
|
|
2007-12-20 20:18:22 +00:00
|
|
|
/* UPNP_GetGenericPortMappingEntry()
|
2008-02-23 15:31:39 +00:00
|
|
|
*
|
|
|
|
* return value :
|
|
|
|
* UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
|
|
|
|
* or a UPnP Error Code.
|
2007-12-20 20:18:22 +00:00
|
|
|
*
|
|
|
|
* Possible UPNP Error codes :
|
|
|
|
* 402 Invalid Args - See UPnP Device Architecture section on Control.
|
|
|
|
* 713 SpecifiedArrayIndexInvalid - The specified array index is out of bounds
|
|
|
|
*/
|
2007-11-06 16:02:50 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|