/third-party/miniupnp/upnpcommands.h

https://github.com/pieter/transmission · C++ Header · 179 lines · 76 code · 19 blank · 84 comment · 0 complexity · e9ea831ec0ca76705f43dfa4a7985baf MD5 · raw file

  1. /* $Id: upnpcommands.h,v 1.14 2008/09/25 18:02:50 nanard Exp $ */
  2. /* Miniupnp project : http://miniupnp.free.fr/
  3. * Author : Thomas Bernard
  4. * Copyright (c) 2005-2008 Thomas Bernard
  5. * This software is subject to the conditions detailed in the
  6. * LICENCE file provided within this distribution */
  7. #ifndef __UPNPCOMMANDS_H__
  8. #define __UPNPCOMMANDS_H__
  9. #include "upnpreplyparse.h"
  10. #include "declspec.h"
  11. /* MiniUPnPc return codes : */
  12. #define UPNPCOMMAND_SUCCESS (0)
  13. #define UPNPCOMMAND_UNKNOWN_ERROR (-1)
  14. #define UPNPCOMMAND_INVALID_ARGS (-2)
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. LIBSPEC unsigned int
  19. UPNP_GetTotalBytesSent(const char * controlURL,
  20. const char * servicetype);
  21. LIBSPEC unsigned int
  22. UPNP_GetTotalBytesReceived(const char * controlURL,
  23. const char * servicetype);
  24. LIBSPEC unsigned int
  25. UPNP_GetTotalPacketsSent(const char * controlURL,
  26. const char * servicetype);
  27. LIBSPEC unsigned int
  28. UPNP_GetTotalPacketsReceived(const char * controlURL,
  29. const char * servicetype);
  30. /* UPNP_GetStatusInfo()
  31. * status and lastconnerror are 64 byte buffers
  32. * Return values :
  33. * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
  34. * or a UPnP Error code */
  35. LIBSPEC int
  36. UPNP_GetStatusInfo(const char * controlURL,
  37. const char * servicetype,
  38. char * status,
  39. unsigned int * uptime,
  40. char * lastconnerror);
  41. /* UPNP_GetConnectionTypeInfo()
  42. * argument connectionType is a 64 character buffer
  43. * Return Values :
  44. * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
  45. * or a UPnP Error code */
  46. LIBSPEC int
  47. UPNP_GetConnectionTypeInfo(const char * controlURL,
  48. const char * servicetype,
  49. char * connectionType);
  50. /* UPNP_GetExternalIPAddress() call the corresponding UPNP method.
  51. * if the third arg is not null the value is copied to it.
  52. * at least 16 bytes must be available
  53. *
  54. * Return values :
  55. * 0 : SUCCESS
  56. * NON ZERO : ERROR Either an UPnP error code or an unknown error.
  57. *
  58. * possible UPnP Errors :
  59. * 402 Invalid Args - See UPnP Device Architecture section on Control.
  60. * 501 Action Failed - See UPnP Device Architecture section on Control. */
  61. LIBSPEC int
  62. UPNP_GetExternalIPAddress(const char * controlURL,
  63. const char * servicetype,
  64. char * extIpAdd);
  65. /* UPNP_GetLinkLayerMaxBitRates()
  66. * call WANCommonInterfaceConfig:1#GetCommonLinkProperties
  67. *
  68. * return values :
  69. * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
  70. * or a UPnP Error Code. */
  71. LIBSPEC int
  72. UPNP_GetLinkLayerMaxBitRates(const char* controlURL,
  73. const char* servicetype,
  74. unsigned int * bitrateDown,
  75. unsigned int * bitrateUp);
  76. /* UPNP_AddPortMapping()
  77. *
  78. * Return values :
  79. * 0 : SUCCESS
  80. * NON ZERO : ERROR. Either an UPnP error code or an unknown error.
  81. *
  82. * List of possible UPnP errors for AddPortMapping :
  83. * errorCode errorDescription (short) - Description (long)
  84. * 402 Invalid Args - See UPnP Device Architecture section on Control.
  85. * 501 Action Failed - See UPnP Device Architecture section on Control.
  86. * 715 WildCardNotPermittedInSrcIP - The source IP address cannot be
  87. * wild-carded
  88. * 716 WildCardNotPermittedInExtPort - The external port cannot be wild-carded
  89. * 718 ConflictInMappingEntry - The port mapping entry specified conflicts
  90. * with a mapping assigned previously to another client
  91. * 724 SamePortValuesRequired - Internal and External port values
  92. * must be the same
  93. * 725 OnlyPermanentLeasesSupported - The NAT implementation only supports
  94. * permanent lease times on port mappings
  95. * 726 RemoteHostOnlySupportsWildcard - RemoteHost must be a wildcard
  96. * and cannot be a specific IP address or DNS name
  97. * 727 ExternalPortOnlySupportsWildcard - ExternalPort must be a wildcard and
  98. * cannot be a specific port value */
  99. LIBSPEC int
  100. UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
  101. const char * extPort,
  102. const char * inPort,
  103. const char * inClient,
  104. const char * desc,
  105. const char * proto);
  106. /* UPNP_DeletePortMapping()
  107. * Return Values :
  108. * 0 : SUCCESS
  109. * NON ZERO : error. Either an UPnP error code or an undefined error.
  110. *
  111. * List of possible UPnP errors for DeletePortMapping :
  112. * 402 Invalid Args - See UPnP Device Architecture section on Control.
  113. * 714 NoSuchEntryInArray - The specified value does not exist in the array */
  114. LIBSPEC int
  115. UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
  116. const char * extPort, const char * proto);
  117. /* UPNP_GetPortMappingNumberOfEntries()
  118. * not supported by all routers */
  119. LIBSPEC int
  120. UPNP_GetPortMappingNumberOfEntries(const char* controlURL, const char* servicetype, unsigned int * num);
  121. /* UPNP_GetSpecificPortMappingEntry retrieves an existing port mapping
  122. * the result is returned in the intClient and intPort strings
  123. * please provide 16 and 6 bytes of data
  124. *
  125. * return value :
  126. * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
  127. * or a UPnP Error Code. */
  128. LIBSPEC int
  129. UPNP_GetSpecificPortMappingEntry(const char * controlURL,
  130. const char * servicetype,
  131. const char * extPort,
  132. const char * proto,
  133. char * intClient,
  134. char * intPort);
  135. /* UPNP_GetGenericPortMappingEntry()
  136. *
  137. * return value :
  138. * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
  139. * or a UPnP Error Code.
  140. *
  141. * Possible UPNP Error codes :
  142. * 402 Invalid Args - See UPnP Device Architecture section on Control.
  143. * 713 SpecifiedArrayIndexInvalid - The specified array index is out of bounds
  144. */
  145. LIBSPEC int
  146. UPNP_GetGenericPortMappingEntry(const char * controlURL,
  147. const char * servicetype,
  148. const char * index,
  149. char * extPort,
  150. char * intClient,
  151. char * intPort,
  152. char * protocol,
  153. char * desc,
  154. char * enabled,
  155. char * rHost,
  156. char * duration);
  157. #ifdef __cplusplus
  158. }
  159. #endif
  160. #endif