upnpcommands.h

Go to the documentation of this file.
00001 /* $Id: upnpcommands.h,v 1.17 2009/04/17 21:21:19 nanard Exp $ */
00002 /* Miniupnp project : http://miniupnp.free.fr/
00003  * Author : Thomas Bernard
00004  * Copyright (c) 2005-2008 Thomas Bernard
00005  * This software is subject to the conditions detailed in the
00006  * LICENCE file provided within this distribution */
00007 #ifndef __UPNPCOMMANDS_H__
00008 #define __UPNPCOMMANDS_H__
00009 
00010 #include "upnpreplyparse.h"
00011 #include "declspec.h"
00012 
00013 /* MiniUPnPc return codes : */
00014 #define UPNPCOMMAND_SUCCESS (0)
00015 #define UPNPCOMMAND_UNKNOWN_ERROR (-1)
00016 #define UPNPCOMMAND_INVALID_ARGS (-2)
00017 
00018 #ifdef __cplusplus
00019 extern "C" {
00020 #endif
00021 
00022 #if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
00023 #define UNSIGNED_INTEGER unsigned long long
00024 #define STRTOUI strtoull
00025 #else
00026 #define UNSIGNED_INTEGER unsigned int
00027 #define STRTOUI strtoul
00028 #endif
00029 
00030 LIBSPEC UNSIGNED_INTEGER
00031 UPNP_GetTotalBytesSent(const char * controlURL,
00032                                         const char * servicetype);
00033 
00034 LIBSPEC UNSIGNED_INTEGER
00035 UPNP_GetTotalBytesReceived(const char * controlURL,
00036                                                 const char * servicetype);
00037 
00038 LIBSPEC UNSIGNED_INTEGER
00039 UPNP_GetTotalPacketsSent(const char * controlURL,
00040                                         const char * servicetype);
00041 
00042 LIBSPEC UNSIGNED_INTEGER
00043 UPNP_GetTotalPacketsReceived(const char * controlURL,
00044                                         const char * servicetype);
00045 
00046 /* UPNP_GetStatusInfo()
00047  * status and lastconnerror are 64 byte buffers
00048  * Return values :
00049  * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
00050  * or a UPnP Error code */
00051 LIBSPEC int
00052 UPNP_GetStatusInfo(const char * controlURL,
00053                                const char * servicetype,
00054                                    char * status,
00055                                    unsigned int * uptime,
00056                    char * lastconnerror);
00057 
00058 /* UPNP_GetConnectionTypeInfo()
00059  * argument connectionType is a 64 character buffer
00060  * Return Values :
00061  * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
00062  * or a UPnP Error code */
00063 LIBSPEC int
00064 UPNP_GetConnectionTypeInfo(const char * controlURL,
00065                            const char * servicetype,
00066                                                    char * connectionType);
00067 
00068 /* UPNP_GetExternalIPAddress() call the corresponding UPNP method.
00069  * if the third arg is not null the value is copied to it.
00070  * at least 16 bytes must be available 
00071  *
00072  * Return values :
00073  * 0 : SUCCESS
00074  * NON ZERO : ERROR Either an UPnP error code or an unknown error.
00075  * 
00076  * possible UPnP Errors :
00077  * 402 Invalid Args - See UPnP Device Architecture section on Control.
00078  * 501 Action Failed - See UPnP Device Architecture section on Control. */
00079 LIBSPEC int
00080 UPNP_GetExternalIPAddress(const char * controlURL,
00081                           const char * servicetype,
00082                           char * extIpAdd);
00083 
00084 /* UPNP_GetLinkLayerMaxBitRates()
00085  * call WANCommonInterfaceConfig:1#GetCommonLinkProperties
00086  *
00087  * return values :
00088  * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
00089  * or a UPnP Error Code. */
00090 LIBSPEC int
00091 UPNP_GetLinkLayerMaxBitRates(const char* controlURL,
00092                                                         const char* servicetype,
00093                                                         unsigned int * bitrateDown,
00094                                                         unsigned int * bitrateUp);
00095 
00096 /* UPNP_AddPortMapping()
00097  * if desc is NULL, it will be defaulted to "libminiupnpc"
00098  * remoteHost is usually NULL because IGD don't support it.
00099  *
00100  * Return values :
00101  * 0 : SUCCESS
00102  * NON ZERO : ERROR. Either an UPnP error code or an unknown error.
00103  * 
00104  * List of possible UPnP errors for AddPortMapping :
00105  * errorCode errorDescription (short) - Description (long)
00106  * 402 Invalid Args - See UPnP Device Architecture section on Control.
00107  * 501 Action Failed - See UPnP Device Architecture section on Control.
00108  * 715 WildCardNotPermittedInSrcIP - The source IP address cannot be
00109  *                                   wild-carded
00110  * 716 WildCardNotPermittedInExtPort - The external port cannot be wild-carded
00111  * 718 ConflictInMappingEntry - The port mapping entry specified conflicts
00112  *                     with a mapping assigned previously to another client
00113  * 724 SamePortValuesRequired - Internal and External port values
00114  *                              must be the same 
00115  * 725 OnlyPermanentLeasesSupported - The NAT implementation only supports
00116  *                  permanent lease times on port mappings
00117  * 726 RemoteHostOnlySupportsWildcard - RemoteHost must be a wildcard
00118  *                             and cannot be a specific IP address or DNS name
00119  * 727 ExternalPortOnlySupportsWildcard - ExternalPort must be a wildcard and
00120  *                                        cannot be a specific port value */
00121 LIBSPEC int
00122 UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
00123                     const char * extPort,
00124                                     const char * inPort,
00125                                         const char * inClient,
00126                                         const char * desc,
00127                     const char * proto,
00128                     const char * remoteHost);
00129 
00130 /* UPNP_DeletePortMapping()
00131  * Use same argument values as what was used for AddPortMapping().
00132  * remoteHost is usually NULL because IGD don't support it.
00133  * Return Values :
00134  * 0 : SUCCESS
00135  * NON ZERO : error. Either an UPnP error code or an undefined error.
00136  *
00137  * List of possible UPnP errors for DeletePortMapping :
00138  * 402 Invalid Args - See UPnP Device Architecture section on Control.
00139  * 714 NoSuchEntryInArray - The specified value does not exist in the array */
00140 LIBSPEC int
00141 UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
00142                        const char * extPort, const char * proto,
00143                        const char * remoteHost);
00144 
00145 /* UPNP_GetPortMappingNumberOfEntries()
00146  * not supported by all routers */
00147 LIBSPEC int
00148 UPNP_GetPortMappingNumberOfEntries(const char* controlURL, const char* servicetype, unsigned int * num);
00149 
00150 /* UPNP_GetSpecificPortMappingEntry retrieves an existing port mapping
00151  * the result is returned in the intClient and intPort strings
00152  * please provide 16 and 6 bytes of data
00153  *
00154  * return value :
00155  * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
00156  * or a UPnP Error Code. */
00157 LIBSPEC int
00158 UPNP_GetSpecificPortMappingEntry(const char * controlURL,
00159                                  const char * servicetype,
00160                                  const char * extPort,
00161                                  const char * proto,
00162                                  char * intClient,
00163                                  char * intPort);
00164 
00165 /* UPNP_GetGenericPortMappingEntry()
00166  *
00167  * return value :
00168  * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
00169  * or a UPnP Error Code.
00170  *
00171  * Possible UPNP Error codes :
00172  * 402 Invalid Args - See UPnP Device Architecture section on Control.
00173  * 713 SpecifiedArrayIndexInvalid - The specified array index is out of bounds
00174  */
00175 LIBSPEC int
00176 UPNP_GetGenericPortMappingEntry(const char * controlURL,
00177                                 const char * servicetype,
00178                                                                 const char * index,
00179                                                                 char * extPort,
00180                                                                 char * intClient,
00181                                                                 char * intPort,
00182                                                                 char * protocol,
00183                                                                 char * desc,
00184                                                                 char * enabled,
00185                                                                 char * rHost,
00186                                                                 char * duration);
00187 
00188 #ifdef __cplusplus
00189 }
00190 #endif
00191 
00192 #endif
00193 

Generated on 31 Mar 2010 for Vidalia by  doxygen 1.6.1