Monero
Loading...
Searching...
No Matches
upnpcommands.h
Go to the documentation of this file.
1/* $Id: upnpcommands.h,v 1.32 2018/03/13 23:34:47 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
22extern "C" {
23#endif
24
26
28UPNP_GetTotalBytesSent(const char * controlURL,
29 const char * servicetype);
30
32UPNP_GetTotalBytesReceived(const char * controlURL,
33 const char * servicetype);
34
36UPNP_GetTotalPacketsSent(const char * controlURL,
37 const char * servicetype);
38
40UPNP_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 */
49UPNP_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 */
61UPNP_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. */
77UPNP_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. */
88UPNP_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 */
127UPNP_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 */
160UPNP_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 */
183UPNP_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. */
201UPNP_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 */
209UPNP_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 */
237UPNP_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 */
271UPNP_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 */
293UPNP_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 */
303UPNP_GetFirewallStatus(const char * controlURL,
304 const char * servicetype,
305 int * firewallEnabled,
306 int * inboundPinholeAllowed);
307
309UPNP_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
318UPNP_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
328UPNP_UpdatePinhole(const char * controlURL, const char * servicetype,
329 const char * uniqueID,
330 const char * leaseTime);
331
333UPNP_DeletePinhole(const char * controlURL, const char * servicetype, const char * uniqueID);
334
336UPNP_CheckPinholeWorking(const char * controlURL, const char * servicetype,
337 const char * uniqueID, int * isWorking);
338
340UPNP_GetPinholePackets(const char * controlURL, const char * servicetype,
341 const char * uniqueID, int * packets);
342
343#ifdef __cplusplus
344}
345#endif
346
347#endif
348
#define MINIUPNP_LIBSPEC
Definition miniupnpc_declspec.h:16
#define UNSIGNED_INTEGER
Definition miniupnpctypes.h:14
Definition portlistingparse.h:49
std::string data
Definition base58.cpp:37
MINIUPNP_LIBSPEC int UPNP_GetLinkLayerMaxBitRates(const char *controlURL, const char *servicetype, unsigned int *bitrateDown, unsigned int *bitrateUp)
Definition upnpcommands.c:230
MINIUPNP_LIBSPEC int UPNP_DeletePortMapping(const char *controlURL, const char *servicetype, const char *extPort, const char *proto, const char *remoteHost)
Definition upnpcommands.c:471
MINIUPNP_LIBSPEC int UPNP_GetStatusInfo(const char *controlURL, const char *servicetype, char *status, unsigned int *uptime, char *lastconnerror)
Definition upnpcommands.c:122
MINIUPNP_LIBSPEC int UPNP_GetFirewallStatus(const char *controlURL, const char *servicetype, int *firewallEnabled, int *inboundPinholeAllowed)
Definition upnpcommands.c:881
MINIUPNP_LIBSPEC UNSIGNED_INTEGER UPNP_GetTotalPacketsSent(const char *controlURL, const char *servicetype)
Definition upnpcommands.c:74
MINIUPNP_LIBSPEC int UPNP_DeletePortMappingRange(const char *controlURL, const char *servicetype, const char *extPortStart, const char *extPortEnd, const char *proto, const char *manage)
Definition upnpcommands.c:517
MINIUPNP_LIBSPEC int UPNP_GetConnectionTypeInfo(const char *controlURL, const char *servicetype, char *connectionType)
Definition upnpcommands.c:187
MINIUPNP_LIBSPEC UNSIGNED_INTEGER UPNP_GetTotalBytesReceived(const char *controlURL, const char *servicetype)
Definition upnpcommands.c:50
MINIUPNP_LIBSPEC int UPNP_GetGenericPortMappingEntry(const char *controlURL, const char *servicetype, const char *index, char *extPort, char *intClient, char *intPort, char *protocol, char *desc, char *enabled, char *rHost, char *duration)
Definition upnpcommands.c:565
MINIUPNP_LIBSPEC int UPNP_GetPortMappingNumberOfEntries(const char *controlURL, const char *servicetype, unsigned int *numEntries)
Definition upnpcommands.c:662
MINIUPNP_LIBSPEC int UPNP_GetExternalIPAddress(const char *controlURL, const char *servicetype, char *extIpAdd)
Definition upnpcommands.c:299
MINIUPNP_LIBSPEC int UPNP_AddPortMapping(const char *controlURL, const char *servicetype, const char *extPort, const char *inPort, const char *inClient, const char *desc, const char *proto, const char *remoteHost, const char *leaseDuration)
Definition upnpcommands.c:339
MINIUPNP_LIBSPEC int UPNP_GetPinholePackets(const char *controlURL, const char *servicetype, const char *uniqueID, int *packets)
Definition upnpcommands.c:1196
MINIUPNP_LIBSPEC int UPNP_GetListOfPortMappings(const char *controlURL, const char *servicetype, const char *startPort, const char *endPort, const char *protocol, const char *numberOfPorts, struct PortMappingParserData *data)
Definition upnpcommands.c:797
MINIUPNP_LIBSPEC int UPNP_UpdatePinhole(const char *controlURL, const char *servicetype, const char *uniqueID, const char *leaseTime)
Definition upnpcommands.c:1062
MINIUPNP_LIBSPEC int UPNP_GetOutboundPinholeTimeout(const char *controlURL, const char *servicetype, const char *remoteHost, const char *remotePort, const char *intClient, const char *intPort, const char *proto, int *opTimeout)
Definition upnpcommands.c:925
MINIUPNP_LIBSPEC int UPNP_CheckPinholeWorking(const char *controlURL, const char *servicetype, const char *uniqueID, int *isWorking)
Definition upnpcommands.c:1147
MINIUPNP_LIBSPEC int UPNP_DeletePinhole(const char *controlURL, const char *servicetype, const char *uniqueID)
Definition upnpcommands.c:1106
MINIUPNP_LIBSPEC int UPNP_AddPinhole(const char *controlURL, const char *servicetype, const char *remoteHost, const char *remotePort, const char *intClient, const char *intPort, const char *proto, const char *leaseTime, char *uniqueID)
Definition upnpcommands.c:981
MINIUPNP_LIBSPEC UNSIGNED_INTEGER UPNP_GetTotalPacketsReceived(const char *controlURL, const char *servicetype)
Definition upnpcommands.c:98
MINIUPNP_LIBSPEC int UPNP_AddAnyPortMapping(const char *controlURL, const char *servicetype, const char *extPort, const char *inPort, const char *inClient, const char *desc, const char *proto, const char *remoteHost, const char *leaseDuration, char *reservedPort)
Definition upnpcommands.c:402
MINIUPNP_LIBSPEC int UPNP_GetSpecificPortMappingEntry(const char *controlURL, const char *servicetype, const char *extPort, const char *proto, const char *remoteHost, char *intClient, char *intPort, char *desc, char *enabled, char *leaseDuration)
Definition upnpcommands.c:703
MINIUPNP_LIBSPEC UNSIGNED_INTEGER UPNP_GetTotalBytesSent(const char *controlURL, const char *servicetype)
Definition upnpcommands.c:26