source: trunk/third-party/miniupnp/upnpcommands.h @ 8263

Last change on this file since 8263 was 8263, checked in by charles, 13 years ago

(trunk) upgrade miniupnp to miniupnpc-1.3, which has small portability fixes

File size: 6.7 KB
Line 
1/* $Id: upnpcommands.h,v 1.17 2009/04/17 21:21:19 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
10#include "upnpreplyparse.h"
11#include "declspec.h"
12
13/* MiniUPnPc return codes : */
14#define UPNPCOMMAND_SUCCESS (0)
15#define UPNPCOMMAND_UNKNOWN_ERROR (-1)
16#define UPNPCOMMAND_INVALID_ARGS (-2)
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22#if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
23#define UNSIGNED_INTEGER unsigned long long
24#define STRTOUI strtoull
25#else
26#define UNSIGNED_INTEGER unsigned int
27#define STRTOUI strtoul
28#endif
29
30LIBSPEC UNSIGNED_INTEGER
31UPNP_GetTotalBytesSent(const char * controlURL,
32                                        const char * servicetype);
33
34LIBSPEC UNSIGNED_INTEGER
35UPNP_GetTotalBytesReceived(const char * controlURL,
36                                                const char * servicetype);
37
38LIBSPEC UNSIGNED_INTEGER
39UPNP_GetTotalPacketsSent(const char * controlURL,
40                                        const char * servicetype);
41
42LIBSPEC UNSIGNED_INTEGER
43UPNP_GetTotalPacketsReceived(const char * controlURL,
44                                        const char * servicetype);
45
46/* UPNP_GetStatusInfo()
47 * status and lastconnerror are 64 byte buffers
48 * Return values :
49 * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
50 * or a UPnP Error code */
51LIBSPEC int
52UPNP_GetStatusInfo(const char * controlURL,
53                               const char * servicetype,
54                                   char * status,
55                                   unsigned int * uptime,
56                   char * lastconnerror);
57
58/* UPNP_GetConnectionTypeInfo()
59 * argument connectionType is a 64 character buffer
60 * Return Values :
61 * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
62 * or a UPnP Error code */
63LIBSPEC int
64UPNP_GetConnectionTypeInfo(const char * controlURL,
65                           const char * servicetype,
66                                                   char * connectionType);
67
68/* UPNP_GetExternalIPAddress() call the corresponding UPNP method.
69 * if the third arg is not null the value is copied to it.
70 * at least 16 bytes must be available
71 *
72 * Return values :
73 * 0 : SUCCESS
74 * NON ZERO : ERROR Either an UPnP error code or an unknown error.
75 *
76 * possible UPnP Errors :
77 * 402 Invalid Args - See UPnP Device Architecture section on Control.
78 * 501 Action Failed - See UPnP Device Architecture section on Control. */
79LIBSPEC int
80UPNP_GetExternalIPAddress(const char * controlURL,
81                          const char * servicetype,
82                          char * extIpAdd);
83
84/* UPNP_GetLinkLayerMaxBitRates()
85 * call WANCommonInterfaceConfig:1#GetCommonLinkProperties
86 *
87 * return values :
88 * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
89 * or a UPnP Error Code. */
90LIBSPEC int
91UPNP_GetLinkLayerMaxBitRates(const char* controlURL,
92                                                        const char* servicetype,
93                                                        unsigned int * bitrateDown,
94                                                        unsigned int * bitrateUp);
95
96/* UPNP_AddPortMapping()
97 * if desc is NULL, it will be defaulted to "libminiupnpc"
98 * remoteHost is usually NULL because IGD don't support it.
99 *
100 * Return values :
101 * 0 : SUCCESS
102 * NON ZERO : ERROR. Either an UPnP error code or an unknown error.
103 *
104 * List of possible UPnP errors for AddPortMapping :
105 * errorCode errorDescription (short) - Description (long)
106 * 402 Invalid Args - See UPnP Device Architecture section on Control.
107 * 501 Action Failed - See UPnP Device Architecture section on Control.
108 * 715 WildCardNotPermittedInSrcIP - The source IP address cannot be
109 *                                   wild-carded
110 * 716 WildCardNotPermittedInExtPort - The external port cannot be wild-carded
111 * 718 ConflictInMappingEntry - The port mapping entry specified conflicts
112 *                     with a mapping assigned previously to another client
113 * 724 SamePortValuesRequired - Internal and External port values
114 *                              must be the same
115 * 725 OnlyPermanentLeasesSupported - The NAT implementation only supports
116 *                  permanent lease times on port mappings
117 * 726 RemoteHostOnlySupportsWildcard - RemoteHost must be a wildcard
118 *                             and cannot be a specific IP address or DNS name
119 * 727 ExternalPortOnlySupportsWildcard - ExternalPort must be a wildcard and
120 *                                        cannot be a specific port value */
121LIBSPEC int
122UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
123                    const char * extPort,
124                                    const char * inPort,
125                                        const char * inClient,
126                                        const char * desc,
127                    const char * proto,
128                    const char * remoteHost);
129
130/* UPNP_DeletePortMapping()
131 * Use same argument values as what was used for AddPortMapping().
132 * remoteHost is usually NULL because IGD don't support it.
133 * Return Values :
134 * 0 : SUCCESS
135 * NON ZERO : error. Either an UPnP error code or an undefined error.
136 *
137 * List of possible UPnP errors for DeletePortMapping :
138 * 402 Invalid Args - See UPnP Device Architecture section on Control.
139 * 714 NoSuchEntryInArray - The specified value does not exist in the array */
140LIBSPEC int
141UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
142                       const char * extPort, const char * proto,
143                       const char * remoteHost);
144
145/* UPNP_GetPortMappingNumberOfEntries()
146 * not supported by all routers */
147LIBSPEC int
148UPNP_GetPortMappingNumberOfEntries(const char* controlURL, const char* servicetype, unsigned int * num);
149
150/* UPNP_GetSpecificPortMappingEntry retrieves an existing port mapping
151 * the result is returned in the intClient and intPort strings
152 * please provide 16 and 6 bytes of data
153 *
154 * return value :
155 * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
156 * or a UPnP Error Code. */
157LIBSPEC int
158UPNP_GetSpecificPortMappingEntry(const char * controlURL,
159                                 const char * servicetype,
160                                 const char * extPort,
161                                 const char * proto,
162                                 char * intClient,
163                                 char * intPort);
164
165/* UPNP_GetGenericPortMappingEntry()
166 *
167 * return value :
168 * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
169 * or a UPnP Error Code.
170 *
171 * Possible UPNP Error codes :
172 * 402 Invalid Args - See UPnP Device Architecture section on Control.
173 * 713 SpecifiedArrayIndexInvalid - The specified array index is out of bounds
174 */
175LIBSPEC int
176UPNP_GetGenericPortMappingEntry(const char * controlURL,
177                                const char * servicetype,
178                                                                const char * index,
179                                                                char * extPort,
180                                                                char * intClient,
181                                                                char * intPort,
182                                                                char * protocol,
183                                                                char * desc,
184                                                                char * enabled,
185                                                                char * rHost,
186                                                                char * duration);
187
188#ifdef __cplusplus
189}
190#endif
191
192#endif
193
Note: See TracBrowser for help on using the repository browser.