PageRenderTime 18ms CodeModel.GetById 1ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 0ms

/thirdparty/libportfwd/third-party/miniupnpc-1.6/upnpcommands.h

http://github.com/tomahawk-player/tomahawk
C Header | 271 lines | 129 code | 27 blank | 115 comment | 0 complexity | 37ae629f1622180b67fabaa001af9148 MD5 | raw file
  1/* $Id: upnpcommands.h,v 1.23 2011/04/11 09:14:00 nanard Exp $ */
  2/* Miniupnp project : http://miniupnp.free.fr/
  3 * Author : Thomas Bernard
  4 * Copyright (c) 2005-2011 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
 10#include "upnpreplyparse.h"
 11#include "portlistingparse.h"
 12#include "declspec.h"
 13#include "miniupnpctypes.h"
 14
 15/* MiniUPnPc return codes : */
 16#define UPNPCOMMAND_SUCCESS (0)
 17#define UPNPCOMMAND_UNKNOWN_ERROR (-1)
 18#define UPNPCOMMAND_INVALID_ARGS (-2)
 19#define UPNPCOMMAND_HTTP_ERROR (-3)
 20
 21#ifdef __cplusplus
 22extern "C" {
 23#endif
 24
 25LIBSPEC UNSIGNED_INTEGER
 26UPNP_GetTotalBytesSent(const char * controlURL,
 27					const char * servicetype);
 28
 29LIBSPEC UNSIGNED_INTEGER
 30UPNP_GetTotalBytesReceived(const char * controlURL,
 31						const char * servicetype);
 32
 33LIBSPEC UNSIGNED_INTEGER
 34UPNP_GetTotalPacketsSent(const char * controlURL,
 35					const char * servicetype);
 36
 37LIBSPEC UNSIGNED_INTEGER
 38UPNP_GetTotalPacketsReceived(const char * controlURL,
 39					const char * servicetype);
 40
 41/* UPNP_GetStatusInfo()
 42 * status and lastconnerror are 64 byte buffers
 43 * Return values :
 44 * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
 45 * or a UPnP Error code */
 46LIBSPEC int
 47UPNP_GetStatusInfo(const char * controlURL,
 48			       const char * servicetype,
 49				   char * status,
 50				   unsigned int * uptime,
 51                   char * lastconnerror);
 52
 53/* UPNP_GetConnectionTypeInfo()
 54 * argument connectionType is a 64 character buffer
 55 * Return Values :
 56 * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
 57 * or a UPnP Error code */
 58LIBSPEC int
 59UPNP_GetConnectionTypeInfo(const char * controlURL,
 60                           const char * servicetype,
 61						   char * connectionType);
 62
 63/* UPNP_GetExternalIPAddress() call the corresponding UPNP method.
 64 * if the third arg is not null the value is copied to it.
 65 * at least 16 bytes must be available 
 66 *
 67 * Return values :
 68 * 0 : SUCCESS
 69 * NON ZERO : ERROR Either an UPnP error code or an unknown error.
 70 * 
 71 * possible UPnP Errors :
 72 * 402 Invalid Args - See UPnP Device Architecture section on Control.
 73 * 501 Action Failed - See UPnP Device Architecture section on Control. */
 74LIBSPEC int
 75UPNP_GetExternalIPAddress(const char * controlURL,
 76                          const char * servicetype,
 77                          char * extIpAdd);
 78
 79/* UPNP_GetLinkLayerMaxBitRates()
 80 * call WANCommonInterfaceConfig:1#GetCommonLinkProperties
 81 *
 82 * return values :
 83 * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
 84 * or a UPnP Error Code. */
 85LIBSPEC int
 86UPNP_GetLinkLayerMaxBitRates(const char* controlURL,
 87							const char* servicetype,
 88							unsigned int * bitrateDown,
 89							unsigned int * bitrateUp);
 90
 91/* UPNP_AddPortMapping()
 92 * if desc is NULL, it will be defaulted to "libminiupnpc"
 93 * remoteHost is usually NULL because IGD don't support it.
 94 *
 95 * Return values :
 96 * 0 : SUCCESS
 97 * NON ZERO : ERROR. Either an UPnP error code or an unknown error.
 98 * 
 99 * List of possible UPnP errors for AddPortMapping :
100 * errorCode errorDescription (short) - Description (long)
101 * 402 Invalid Args - See UPnP Device Architecture section on Control.
102 * 501 Action Failed - See UPnP Device Architecture section on Control.
103 * 715 WildCardNotPermittedInSrcIP - The source IP address cannot be
104 *                                   wild-carded
105 * 716 WildCardNotPermittedInExtPort - The external port cannot be wild-carded
106 * 718 ConflictInMappingEntry - The port mapping entry specified conflicts
107 *                     with a mapping assigned previously to another client
108 * 724 SamePortValuesRequired - Internal and External port values
109 *                              must be the same 
110 * 725 OnlyPermanentLeasesSupported - The NAT implementation only supports
111 *                  permanent lease times on port mappings
112 * 726 RemoteHostOnlySupportsWildcard - RemoteHost must be a wildcard
113 *                             and cannot be a specific IP address or DNS name
114 * 727 ExternalPortOnlySupportsWildcard - ExternalPort must be a wildcard and
115 *                                        cannot be a specific port value */
116LIBSPEC int
117UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
118                    const char * extPort,
119				    const char * inPort,
120					const char * inClient,
121					const char * desc,
122                    const char * proto,
123                    const char * remoteHost,
124                    const char * leaseDuration);
125
126/* UPNP_DeletePortMapping()
127 * Use same argument values as what was used for AddPortMapping().
128 * remoteHost is usually NULL because IGD don't support it.
129 * Return Values :
130 * 0 : SUCCESS
131 * NON ZERO : error. Either an UPnP error code or an undefined error.
132 *
133 * List of possible UPnP errors for DeletePortMapping :
134 * 402 Invalid Args - See UPnP Device Architecture section on Control.
135 * 714 NoSuchEntryInArray - The specified value does not exist in the array */
136LIBSPEC int
137UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
138                       const char * extPort, const char * proto,
139                       const char * remoteHost);
140
141/* UPNP_GetPortMappingNumberOfEntries()
142 * not supported by all routers */
143LIBSPEC int
144UPNP_GetPortMappingNumberOfEntries(const char* controlURL,
145                                   const char* servicetype,
146                                   unsigned int * num);
147
148/* UPNP_GetSpecificPortMappingEntry()
149 *    retrieves an existing port mapping
150 * params :
151 *  in   extPort
152 *  in   proto
153 *  out  intClient (16 bytes)
154 *  out  intPort (6 bytes)
155 *  out  desc (80 bytes)
156 *  out  enabled (4 bytes)
157 *  out  leaseDuration (16 bytes)
158 *
159 * return value :
160 * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
161 * or a UPnP Error Code. */
162LIBSPEC int
163UPNP_GetSpecificPortMappingEntry(const char * controlURL,
164                                 const char * servicetype,
165                                 const char * extPort,
166                                 const char * proto,
167                                 char * intClient,
168                                 char * intPort,
169                                 char * desc,
170                                 char * enabled,
171                                 char * leaseDuration);
172
173/* UPNP_GetGenericPortMappingEntry()
174 * params :
175 *  in   index
176 *  out  extPort (6 bytes)
177 *  out  intClient (16 bytes)
178 *  out  intPort (6 bytes)
179 *  out  protocol (4 bytes)
180 *  out  desc (80 bytes)
181 *  out  enabled (4 bytes)
182 *  out  rHost (64 bytes)
183 *  out  duration (16 bytes)
184 *
185 * return value :
186 * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
187 * or a UPnP Error Code.
188 *
189 * Possible UPNP Error codes :
190 * 402 Invalid Args - See UPnP Device Architecture section on Control.
191 * 713 SpecifiedArrayIndexInvalid - The specified array index is out of bounds
192 */
193LIBSPEC int
194UPNP_GetGenericPortMappingEntry(const char * controlURL,
195                                const char * servicetype,
196								const char * index,
197								char * extPort,
198								char * intClient,
199								char * intPort,
200								char * protocol,
201								char * desc,
202								char * enabled,
203								char * rHost,
204								char * duration);
205
206/* UPNP_GetListOfPortMappings()      Available in IGD v2
207 *
208 *
209 * Possible UPNP Error codes :
210 * 606 Action not Authorized
211 * 730 PortMappingNotFound - no port mapping is found in the specified range.
212 * 733 InconsistantParameters - NewStartPort and NewEndPort values are not
213 *                              consistent.
214 */
215LIBSPEC int
216UPNP_GetListOfPortMappings(const char * controlURL,
217                           const char * servicetype,
218                           const char * startPort,
219                           const char * endPort,
220                           const char * protocol,
221                           const char * numberOfPorts,
222                           struct PortMappingParserData * data);
223
224/* IGD:2, functions for service WANIPv6FirewallControl:1 */ 
225LIBSPEC int
226UPNP_GetFirewallStatus(const char * controlURL,
227				const char * servicetype,
228				int * firewallEnabled, 
229				int * inboundPinholeAllowed);
230
231LIBSPEC int
232UPNP_GetOutboundPinholeTimeout(const char * controlURL, const char * servicetype,
233                    const char * remoteHost,
234                    const char * remotePort,
235                    const char * intClient,
236                    const char * intPort,
237                    const char * proto,
238                    int * opTimeout);
239
240LIBSPEC int
241UPNP_AddPinhole(const char * controlURL, const char * servicetype,
242                    const char * remoteHost,
243                    const char * remotePort,
244                    const char * intClient,
245                    const char * intPort,
246                    const char * proto,
247                    const char * leaseTime,
248                    char * uniqueID);
249
250LIBSPEC int
251UPNP_UpdatePinhole(const char * controlURL, const char * servicetype,
252                    const char * uniqueID,
253                    const char * leaseTime);
254
255LIBSPEC int
256UPNP_DeletePinhole(const char * controlURL, const char * servicetype, const char * uniqueID);
257
258LIBSPEC int
259UPNP_CheckPinholeWorking(const char * controlURL, const char * servicetype,
260                                 const char * uniqueID, int * isWorking);
261
262LIBSPEC int
263UPNP_GetPinholePackets(const char * controlURL, const char * servicetype,
264                                 const char * uniqueID, int * packets);
265
266#ifdef __cplusplus
267}
268#endif
269
270#endif
271