Annotation of embedaddon/miniupnpc/upnpcommands.h, revision 1.1.1.2
1.1.1.2 ! misho 1: /* $Id: upnpcommands.h,v 1.25 2012/09/27 15:42:10 nanard Exp $ */
1.1 misho 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 */
1.1.1.2 ! misho 7: #ifndef UPNPCOMMANDS_H_INCLUDED
! 8: #define UPNPCOMMANDS_H_INCLUDED
1.1 misho 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
22: extern "C" {
23: #endif
24:
25: LIBSPEC UNSIGNED_INTEGER
26: UPNP_GetTotalBytesSent(const char * controlURL,
27: const char * servicetype);
28:
29: LIBSPEC UNSIGNED_INTEGER
30: UPNP_GetTotalBytesReceived(const char * controlURL,
31: const char * servicetype);
32:
33: LIBSPEC UNSIGNED_INTEGER
34: UPNP_GetTotalPacketsSent(const char * controlURL,
35: const char * servicetype);
36:
37: LIBSPEC UNSIGNED_INTEGER
38: UPNP_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 */
46: LIBSPEC int
47: UPNP_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 */
58: LIBSPEC int
59: UPNP_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.
1.1.1.2 ! misho 65: * at least 16 bytes must be available
1.1 misho 66: *
67: * Return values :
68: * 0 : SUCCESS
69: * NON ZERO : ERROR Either an UPnP error code or an unknown error.
1.1.1.2 ! misho 70: *
1.1 misho 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. */
74: LIBSPEC int
75: UPNP_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. */
85: LIBSPEC int
86: UPNP_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.
1.1.1.2 ! misho 98: *
1.1 misho 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
1.1.1.2 ! misho 109: * must be the same
1.1 misho 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 */
116: LIBSPEC int
117: UPNP_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 */
136: LIBSPEC int
137: UPNP_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 */
143: LIBSPEC int
144: UPNP_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. */
162: LIBSPEC int
163: UPNP_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: */
193: LIBSPEC int
194: UPNP_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: */
215: LIBSPEC int
216: UPNP_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:
1.1.1.2 ! misho 224: /* IGD:2, functions for service WANIPv6FirewallControl:1 */
1.1 misho 225: LIBSPEC int
226: UPNP_GetFirewallStatus(const char * controlURL,
227: const char * servicetype,
1.1.1.2 ! misho 228: int * firewallEnabled,
1.1 misho 229: int * inboundPinholeAllowed);
230:
231: LIBSPEC int
232: UPNP_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:
240: LIBSPEC int
241: UPNP_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:
250: LIBSPEC int
251: UPNP_UpdatePinhole(const char * controlURL, const char * servicetype,
252: const char * uniqueID,
253: const char * leaseTime);
254:
255: LIBSPEC int
256: UPNP_DeletePinhole(const char * controlURL, const char * servicetype, const char * uniqueID);
257:
258: LIBSPEC int
259: UPNP_CheckPinholeWorking(const char * controlURL, const char * servicetype,
260: const char * uniqueID, int * isWorking);
261:
262: LIBSPEC int
263: UPNP_GetPinholePackets(const char * controlURL, const char * servicetype,
264: const char * uniqueID, int * packets);
265:
266: #ifdef __cplusplus
267: }
268: #endif
269:
270: #endif
271:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>