Annotation of embedaddon/miniupnpc/include/upnpcommands.h, revision 1.1
1.1 ! misho 1: /* $Id: upnpcommands.h,v 1.33 2019/02/10 12:29:25 nanard Exp $ */
! 2: /* Miniupnp project : http://miniupnp.free.fr/
! 3: * Author : Thomas Bernard
! 4: * Copyright (c) 2005-2018 Thomas Bernard
! 5: * This software is subject to the conditions detailed in the
! 6: * LICENCE file provided within this distribution */
! 7: #ifndef UPNPCOMMANDS_H_INCLUDED
! 8: #define UPNPCOMMANDS_H_INCLUDED
! 9:
! 10: #include "miniupnpc_declspec.h"
! 11: #include "miniupnpctypes.h"
! 12:
! 13: /* MiniUPnPc return codes : */
! 14: #define UPNPCOMMAND_SUCCESS (0)
! 15: #define UPNPCOMMAND_UNKNOWN_ERROR (-1)
! 16: #define UPNPCOMMAND_INVALID_ARGS (-2)
! 17: #define UPNPCOMMAND_HTTP_ERROR (-3)
! 18: #define UPNPCOMMAND_INVALID_RESPONSE (-4)
! 19: #define UPNPCOMMAND_MEM_ALLOC_ERROR (-5)
! 20:
! 21: #ifdef __cplusplus
! 22: extern "C" {
! 23: #endif
! 24:
! 25: struct PortMappingParserData;
! 26:
! 27: MINIUPNP_LIBSPEC UNSIGNED_INTEGER
! 28: UPNP_GetTotalBytesSent(const char * controlURL,
! 29: const char * servicetype);
! 30:
! 31: MINIUPNP_LIBSPEC UNSIGNED_INTEGER
! 32: UPNP_GetTotalBytesReceived(const char * controlURL,
! 33: const char * servicetype);
! 34:
! 35: MINIUPNP_LIBSPEC UNSIGNED_INTEGER
! 36: UPNP_GetTotalPacketsSent(const char * controlURL,
! 37: const char * servicetype);
! 38:
! 39: MINIUPNP_LIBSPEC UNSIGNED_INTEGER
! 40: UPNP_GetTotalPacketsReceived(const char * controlURL,
! 41: const char * servicetype);
! 42:
! 43: /* UPNP_GetStatusInfo()
! 44: * status and lastconnerror are 64 byte buffers
! 45: * Return values :
! 46: * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
! 47: * or a UPnP Error code */
! 48: MINIUPNP_LIBSPEC int
! 49: UPNP_GetStatusInfo(const char * controlURL,
! 50: const char * servicetype,
! 51: char * status,
! 52: unsigned int * uptime,
! 53: char * lastconnerror);
! 54:
! 55: /* UPNP_GetConnectionTypeInfo()
! 56: * argument connectionType is a 64 character buffer
! 57: * Return Values :
! 58: * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
! 59: * or a UPnP Error code */
! 60: MINIUPNP_LIBSPEC int
! 61: UPNP_GetConnectionTypeInfo(const char * controlURL,
! 62: const char * servicetype,
! 63: char * connectionType);
! 64:
! 65: /* UPNP_GetExternalIPAddress() call the corresponding UPNP method.
! 66: * if the third arg is not null the value is copied to it.
! 67: * at least 16 bytes must be available
! 68: *
! 69: * Return values :
! 70: * 0 : SUCCESS
! 71: * NON ZERO : ERROR Either an UPnP error code or an unknown error.
! 72: *
! 73: * possible UPnP Errors :
! 74: * 402 Invalid Args - See UPnP Device Architecture section on Control.
! 75: * 501 Action Failed - See UPnP Device Architecture section on Control. */
! 76: MINIUPNP_LIBSPEC int
! 77: UPNP_GetExternalIPAddress(const char * controlURL,
! 78: const char * servicetype,
! 79: char * extIpAdd);
! 80:
! 81: /* UPNP_GetLinkLayerMaxBitRates()
! 82: * call WANCommonInterfaceConfig:1#GetCommonLinkProperties
! 83: *
! 84: * return values :
! 85: * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
! 86: * or a UPnP Error Code. */
! 87: MINIUPNP_LIBSPEC int
! 88: UPNP_GetLinkLayerMaxBitRates(const char* controlURL,
! 89: const char* servicetype,
! 90: unsigned int * bitrateDown,
! 91: unsigned int * bitrateUp);
! 92:
! 93: /* UPNP_AddPortMapping()
! 94: * if desc is NULL, it will be defaulted to "libminiupnpc"
! 95: * remoteHost is usually NULL because IGD don't support it.
! 96: *
! 97: * Return values :
! 98: * 0 : SUCCESS
! 99: * NON ZERO : ERROR. Either an UPnP error code or an unknown error.
! 100: *
! 101: * List of possible UPnP errors for AddPortMapping :
! 102: * errorCode errorDescription (short) - Description (long)
! 103: * 402 Invalid Args - See UPnP Device Architecture section on Control.
! 104: * 501 Action Failed - See UPnP Device Architecture section on Control.
! 105: * 606 Action not authorized - The action requested REQUIRES authorization and
! 106: * the sender was not authorized.
! 107: * 715 WildCardNotPermittedInSrcIP - The source IP address cannot be
! 108: * wild-carded
! 109: * 716 WildCardNotPermittedInExtPort - The external port cannot be wild-carded
! 110: * 718 ConflictInMappingEntry - The port mapping entry specified conflicts
! 111: * with a mapping assigned previously to another client
! 112: * 724 SamePortValuesRequired - Internal and External port values
! 113: * must be the same
! 114: * 725 OnlyPermanentLeasesSupported - The NAT implementation only supports
! 115: * permanent lease times on port mappings
! 116: * 726 RemoteHostOnlySupportsWildcard - RemoteHost must be a wildcard
! 117: * and cannot be a specific IP address or DNS name
! 118: * 727 ExternalPortOnlySupportsWildcard - ExternalPort must be a wildcard and
! 119: * cannot be a specific port value
! 120: * 728 NoPortMapsAvailable - There are not enough free ports available to
! 121: * complete port mapping.
! 122: * 729 ConflictWithOtherMechanisms - Attempted port mapping is not allowed
! 123: * due to conflict with other mechanisms.
! 124: * 732 WildCardNotPermittedInIntPort - The internal port cannot be wild-carded
! 125: */
! 126: MINIUPNP_LIBSPEC int
! 127: UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
! 128: const char * extPort,
! 129: const char * inPort,
! 130: const char * inClient,
! 131: const char * desc,
! 132: const char * proto,
! 133: const char * remoteHost,
! 134: const char * leaseDuration);
! 135:
! 136: /* UPNP_AddAnyPortMapping()
! 137: * if desc is NULL, it will be defaulted to "libminiupnpc"
! 138: * remoteHost is usually NULL because IGD don't support it.
! 139: *
! 140: * Return values :
! 141: * 0 : SUCCESS
! 142: * NON ZERO : ERROR. Either an UPnP error code or an unknown error.
! 143: *
! 144: * List of possible UPnP errors for AddPortMapping :
! 145: * errorCode errorDescription (short) - Description (long)
! 146: * 402 Invalid Args - See UPnP Device Architecture section on Control.
! 147: * 501 Action Failed - See UPnP Device Architecture section on Control.
! 148: * 606 Action not authorized - The action requested REQUIRES authorization and
! 149: * the sender was not authorized.
! 150: * 715 WildCardNotPermittedInSrcIP - The source IP address cannot be
! 151: * wild-carded
! 152: * 716 WildCardNotPermittedInExtPort - The external port cannot be wild-carded
! 153: * 728 NoPortMapsAvailable - There are not enough free ports available to
! 154: * complete port mapping.
! 155: * 729 ConflictWithOtherMechanisms - Attempted port mapping is not allowed
! 156: * due to conflict with other mechanisms.
! 157: * 732 WildCardNotPermittedInIntPort - The internal port cannot be wild-carded
! 158: */
! 159: MINIUPNP_LIBSPEC int
! 160: UPNP_AddAnyPortMapping(const char * controlURL, const char * servicetype,
! 161: const char * extPort,
! 162: const char * inPort,
! 163: const char * inClient,
! 164: const char * desc,
! 165: const char * proto,
! 166: const char * remoteHost,
! 167: const char * leaseDuration,
! 168: char * reservedPort);
! 169:
! 170: /* UPNP_DeletePortMapping()
! 171: * Use same argument values as what was used for AddPortMapping().
! 172: * remoteHost is usually NULL because IGD don't support it.
! 173: * Return Values :
! 174: * 0 : SUCCESS
! 175: * NON ZERO : error. Either an UPnP error code or an undefined error.
! 176: *
! 177: * List of possible UPnP errors for DeletePortMapping :
! 178: * 402 Invalid Args - See UPnP Device Architecture section on Control.
! 179: * 606 Action not authorized - The action requested REQUIRES authorization
! 180: * and the sender was not authorized.
! 181: * 714 NoSuchEntryInArray - The specified value does not exist in the array */
! 182: MINIUPNP_LIBSPEC int
! 183: UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
! 184: const char * extPort, const char * proto,
! 185: const char * remoteHost);
! 186:
! 187: /* UPNP_DeletePortRangeMapping()
! 188: * Use same argument values as what was used for AddPortMapping().
! 189: * remoteHost is usually NULL because IGD don't support it.
! 190: * Return Values :
! 191: * 0 : SUCCESS
! 192: * NON ZERO : error. Either an UPnP error code or an undefined error.
! 193: *
! 194: * List of possible UPnP errors for DeletePortMapping :
! 195: * 606 Action not authorized - The action requested REQUIRES authorization
! 196: * and the sender was not authorized.
! 197: * 730 PortMappingNotFound - This error message is returned if no port
! 198: * mapping is found in the specified range.
! 199: * 733 InconsistentParameters - NewStartPort and NewEndPort values are not consistent. */
! 200: MINIUPNP_LIBSPEC int
! 201: UPNP_DeletePortMappingRange(const char * controlURL, const char * servicetype,
! 202: const char * extPortStart, const char * extPortEnd,
! 203: const char * proto,
! 204: const char * manage);
! 205:
! 206: /* UPNP_GetPortMappingNumberOfEntries()
! 207: * not supported by all routers */
! 208: MINIUPNP_LIBSPEC int
! 209: UPNP_GetPortMappingNumberOfEntries(const char * controlURL,
! 210: const char * servicetype,
! 211: unsigned int * numEntries);
! 212:
! 213: /* UPNP_GetSpecificPortMappingEntry()
! 214: * retrieves an existing port mapping
! 215: * params :
! 216: * in extPort
! 217: * in proto
! 218: * in remoteHost
! 219: * out intClient (16 bytes)
! 220: * out intPort (6 bytes)
! 221: * out desc (80 bytes)
! 222: * out enabled (4 bytes)
! 223: * out leaseDuration (16 bytes)
! 224: *
! 225: * return value :
! 226: * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
! 227: * or a UPnP Error Code.
! 228: *
! 229: * List of possible UPnP errors for _GetSpecificPortMappingEntry :
! 230: * 402 Invalid Args - See UPnP Device Architecture section on Control.
! 231: * 501 Action Failed - See UPnP Device Architecture section on Control.
! 232: * 606 Action not authorized - The action requested REQUIRES authorization
! 233: * and the sender was not authorized.
! 234: * 714 NoSuchEntryInArray - The specified value does not exist in the array.
! 235: */
! 236: MINIUPNP_LIBSPEC int
! 237: UPNP_GetSpecificPortMappingEntry(const char * controlURL,
! 238: const char * servicetype,
! 239: const char * extPort,
! 240: const char * proto,
! 241: const char * remoteHost,
! 242: char * intClient,
! 243: char * intPort,
! 244: char * desc,
! 245: char * enabled,
! 246: char * leaseDuration);
! 247:
! 248: /* UPNP_GetGenericPortMappingEntry()
! 249: * params :
! 250: * in index
! 251: * out extPort (6 bytes)
! 252: * out intClient (16 bytes)
! 253: * out intPort (6 bytes)
! 254: * out protocol (4 bytes)
! 255: * out desc (80 bytes)
! 256: * out enabled (4 bytes)
! 257: * out rHost (64 bytes)
! 258: * out duration (16 bytes)
! 259: *
! 260: * return value :
! 261: * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
! 262: * or a UPnP Error Code.
! 263: *
! 264: * Possible UPNP Error codes :
! 265: * 402 Invalid Args - See UPnP Device Architecture section on Control.
! 266: * 606 Action not authorized - The action requested REQUIRES authorization
! 267: * and the sender was not authorized.
! 268: * 713 SpecifiedArrayIndexInvalid - The specified array index is out of bounds
! 269: */
! 270: MINIUPNP_LIBSPEC int
! 271: UPNP_GetGenericPortMappingEntry(const char * controlURL,
! 272: const char * servicetype,
! 273: const char * index,
! 274: char * extPort,
! 275: char * intClient,
! 276: char * intPort,
! 277: char * protocol,
! 278: char * desc,
! 279: char * enabled,
! 280: char * rHost,
! 281: char * duration);
! 282:
! 283: /* UPNP_GetListOfPortMappings() Available in IGD v2
! 284: *
! 285: *
! 286: * Possible UPNP Error codes :
! 287: * 606 Action not Authorized
! 288: * 730 PortMappingNotFound - no port mapping is found in the specified range.
! 289: * 733 InconsistantParameters - NewStartPort and NewEndPort values are not
! 290: * consistent.
! 291: */
! 292: MINIUPNP_LIBSPEC int
! 293: UPNP_GetListOfPortMappings(const char * controlURL,
! 294: const char * servicetype,
! 295: const char * startPort,
! 296: const char * endPort,
! 297: const char * protocol,
! 298: const char * numberOfPorts,
! 299: struct PortMappingParserData * data);
! 300:
! 301: /* IGD:2, functions for service WANIPv6FirewallControl:1 */
! 302: MINIUPNP_LIBSPEC int
! 303: UPNP_GetFirewallStatus(const char * controlURL,
! 304: const char * servicetype,
! 305: int * firewallEnabled,
! 306: int * inboundPinholeAllowed);
! 307:
! 308: MINIUPNP_LIBSPEC int
! 309: UPNP_GetOutboundPinholeTimeout(const char * controlURL, const char * servicetype,
! 310: const char * remoteHost,
! 311: const char * remotePort,
! 312: const char * intClient,
! 313: const char * intPort,
! 314: const char * proto,
! 315: int * opTimeout);
! 316:
! 317: MINIUPNP_LIBSPEC int
! 318: UPNP_AddPinhole(const char * controlURL, const char * servicetype,
! 319: const char * remoteHost,
! 320: const char * remotePort,
! 321: const char * intClient,
! 322: const char * intPort,
! 323: const char * proto,
! 324: const char * leaseTime,
! 325: char * uniqueID);
! 326:
! 327: MINIUPNP_LIBSPEC int
! 328: UPNP_UpdatePinhole(const char * controlURL, const char * servicetype,
! 329: const char * uniqueID,
! 330: const char * leaseTime);
! 331:
! 332: MINIUPNP_LIBSPEC int
! 333: UPNP_DeletePinhole(const char * controlURL, const char * servicetype, const char * uniqueID);
! 334:
! 335: MINIUPNP_LIBSPEC int
! 336: UPNP_CheckPinholeWorking(const char * controlURL, const char * servicetype,
! 337: const char * uniqueID, int * isWorking);
! 338:
! 339: MINIUPNP_LIBSPEC int
! 340: UPNP_GetPinholePackets(const char * controlURL, const char * servicetype,
! 341: const char * uniqueID, int * packets);
! 342:
! 343: #ifdef __cplusplus
! 344: }
! 345: #endif
! 346:
! 347: #endif
! 348:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>