libUPnP  1.8.4
upnp.h
Go to the documentation of this file.
1 #ifndef UPNP_H
2 #define UPNP_H
3 
4 /*******************************************************************************
5  *
6  * Copyright (c) 2000-2003 Intel Corporation
7  * All rights reserved.
8  * Copyright (C) 2011-2012 France Telecom All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions are met:
12  *
13  * * Redistributions of source code must retain the above copyright notice,
14  * this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  * * Neither name of Intel Corporation nor the names of its contributors
19  * may be used to endorse or promote products derived from this software
20  * without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
26  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
30  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  ******************************************************************************/
35 
44 #include "ixml.h"
45 #include "upnpconfig.h"
46 #include "UpnpGlobal.h"
47 #include "UpnpInet.h"
48 
49 /*
50  * \todo Document the exact reason of these include files and solve this
51  * include mess in an include file like UpnpTime.h
52  */
53 #ifdef _WIN32
54  #include <time.h>
55  #if defined(UPNP_USE_MSVCPP) || defined(UPNP_USE_BCBPP)
56  #include <sys/types.h> /* needed for off_t */
57  #endif
58 #elif (defined(BSD) && BSD >= 199306)
59  #include <time.h>
60 #else
61  /* Other systems ??? */
62 #endif
63 
64 #ifdef UPNP_ENABLE_OPEN_SSL
65 #include <openssl/ssl.h>
66 #endif
67 
68 #define LINE_SIZE (size_t)180
69 #define NAME_SIZE (size_t)256
70 #define MNFT_NAME_SIZE 64
71 #define MODL_NAME_SIZE 32
72 #define SERL_NUMR_SIZE 64
73 #define MODL_DESC_SIZE 64
74 #define UPNP_INFINITE -1
75 #define UPNP_USING_CHUNKED -3
76 #define UPNP_UNTIL_CLOSE -4
77 
97 #define UPNP_E_SUCCESS 0
98 
102 #define UPNP_E_INVALID_HANDLE -100
103 
110 #define UPNP_E_INVALID_PARAM -101
111 
117 #define UPNP_E_OUTOF_HANDLE -102
118 
119 #define UPNP_E_OUTOF_CONTEXT -103
120 
126 #define UPNP_E_OUTOF_MEMORY -104
127 
134 #define UPNP_E_INIT -105
135 
136 #define UPNP_E_BUFFER_TOO_SMALL -106
137 
143 #define UPNP_E_INVALID_DESC -107
144 
152 #define UPNP_E_INVALID_URL -108
153 
154 #define UPNP_E_INVALID_SID -109
155 
156 #define UPNP_E_INVALID_DEVICE -110
157 
164 #define UPNP_E_INVALID_SERVICE -111
165 
172 #define UPNP_E_BAD_RESPONSE -113
173 
174 #define UPNP_E_BAD_REQUEST -114
175 
182 #define UPNP_E_INVALID_ACTION -115
183 
189 #define UPNP_E_FINISH -116
190 
196 #define UPNP_E_INIT_FAILED -117
197 
203 #define UPNP_E_URL_TOO_BIG -118
204 
214 #define UPNP_E_BAD_HTTPMSG -119
215 
222 #define UPNP_E_ALREADY_REGISTERED -120
223 
228 #define UPNP_E_INVALID_INTERFACE -121
229 
237 #define UPNP_E_NETWORK_ERROR -200
238 
247 #define UPNP_E_SOCKET_WRITE -201
248 
257 #define UPNP_E_SOCKET_READ -202
258 
267 #define UPNP_E_SOCKET_BIND -203
268 
277 #define UPNP_E_SOCKET_CONNECT -204
278 
287 #define UPNP_E_OUTOF_SOCKET -205
288 
295 #define UPNP_E_LISTEN -206
296 
303 #define UPNP_E_TIMEDOUT -207
304 
311 #define UPNP_E_SOCKET_ERROR -208
312 
313 #define UPNP_E_FILE_WRITE_ERROR -209
314 
319 #define UPNP_E_CANCELED -210
320 
321 #define UPNP_E_EVENT_PROTOCOL -300
322 
326 #define UPNP_E_SUBSCRIBE_UNACCEPTED -301
327 
331 #define UPNP_E_UNSUBSCRIBE_UNACCEPTED -302
332 
336 #define UPNP_E_NOTIFY_UNACCEPTED -303
337 
344 #define UPNP_E_INVALID_ARGUMENT -501
345 
350 #define UPNP_E_FILE_NOT_FOUND -502
351 
355 #define UPNP_E_FILE_READ_ERROR -503
356 
361 #define UPNP_E_EXT_NOT_XML -504
362 
363 #define UPNP_E_NO_WEB_SERVER -505
364 #define UPNP_E_OUTOF_BOUNDS -506
365 
370 #define UPNP_E_NOT_FOUND -507
371 
376 #define UPNP_E_INTERNAL_ERROR -911
377 
378 /* SOAP-related error codes */
379 #define UPNP_SOAP_E_INVALID_ACTION 401
380 #define UPNP_SOAP_E_INVALID_ARGS 402
381 #define UPNP_SOAP_E_OUT_OF_SYNC 403
382 #define UPNP_SOAP_E_INVALID_VAR 404
383 #define UPNP_SOAP_E_ACTION_FAILED 501
384 
385 /* @} ErrorCodes */
386 
387 /*
388  * Opaque data structures. The following includes are data structures that
389  * must be externally visible. Since version 1.8.0, only an opaque typedef
390  * is visible from the outside world. Any operation on these data types
391  * must be done using the appropriate interface functions.
392  *
393  * This policy has the great advantage that it is now possible to change
394  * the internal implementation of these data structures without breaking
395  * the API.
396  */
397 #include "ActionComplete.h"
398 #include "ActionRequest.h"
399 #include "Discovery.h"
400 #include "Event.h"
401 #include "EventSubscribe.h"
402 #include "FileInfo.h"
403 #include "StateVarComplete.h"
404 #include "StateVarRequest.h"
405 #include "SubscriptionRequest.h"
406 
413 enum UpnpOpenFileMode
414 {
415  UPNP_READ,
416  UPNP_WRITE
417 };
418 
426 typedef int UpnpClient_Handle;
427 
436 typedef int UpnpDevice_Handle;
437 
445 typedef char Upnp_SID[44];
446 
458 
461 
464 
468 };
469 
470 typedef enum Upnp_SType_e Upnp_SType;
471 
481 
485 
489 };
490 
491 typedef enum Upnp_DescType_e Upnp_DescType;
492 
493 #include "Callback.h"
494 
495 /* @} Constants and Types */
496 
497 #ifdef __cplusplus
498 extern "C" {
499 #endif /* __cplusplus */
500 
543  const char *HostIP,
546  unsigned short DestPort);
547 
584  const char *IfName,
587  unsigned short DestPort);
588 
601 #ifdef UPNP_ENABLE_OPEN_SSL
602 EXPORT_SPEC int UpnpInitSslContext(
606  int initOpenSslLib,
609  const SSL_METHOD *sslMethod);
610 #endif
611 
631 EXPORT_SPEC int UpnpFinish(void);
632 
644 EXPORT_SPEC unsigned short UpnpGetServerPort(void);
645 
657 EXPORT_SPEC unsigned short UpnpGetServerPort6(void);
670 
683 
684 EXPORT_SPEC char *UpnpGetServerUlaGuaIp6Address(void);
724  const char *DescUrl,
726  Upnp_FunPtr Callback,
728  const void *Cookie,
730  UpnpDevice_Handle *Hnd);
731 
802  Upnp_DescType descriptionType,
805  const char* description,
808  size_t bufferLen,
811  int config_baseURL,
813  Upnp_FunPtr Fun,
816  const void* Cookie,
818  UpnpDevice_Handle* Hnd);
819 
858  const char *DescUrl,
860  Upnp_FunPtr Callback,
862  const void *Cookie,
864  UpnpDevice_Handle *Hnd,
867  int AddressFamily);
868 
908  const char *DescUrl,
910  Upnp_FunPtr Callback,
912  const void *Cookie,
914  UpnpDevice_Handle *Hnd,
917  int AddressFamily,
920  const char *LowerDescUrl);
921 
940  UpnpDevice_Handle Hnd);
941 
963  UpnpDevice_Handle Hnd,
965  int PowerState,
967  int SleepPeriod,
969  int RegistrationState);
970 
991  Upnp_FunPtr Callback,
993  const void *Cookie,
995  UpnpClient_Handle *Hnd);
996 
1014  UpnpClient_Handle Hnd);
1015 
1025  UpnpClient_Handle Hnd,
1027  size_t contentLength);
1028 
1048  size_t contentLength);
1049 
1050 /* @} Initialization and Registration */
1051 
1052 /******************************************************************************
1053  ******************************************************************************
1054  * *
1055  * D I S C O V E R Y *
1056  * *
1057  ******************************************************************************
1058  ******************************************************************************/
1059 
1091  UpnpClient_Handle Hnd,
1096  int Mx,
1099  const char *TTarget_constarget_const,
1101  const void *Cookie_const);
1102 
1120  UpnpDevice_Handle Hnd,
1126  int Exp);
1127 
1148  UpnpDevice_Handle Hnd,
1154  int Exp,
1156  int PowerState,
1158  int SleepPeriod,
1160  int RegistrationState);
1161 
1162 /* @} Discovery */
1163 
1164 /******************************************************************************
1165  ******************************************************************************
1166  * *
1167  * C O N T R O L *
1168  * *
1169  ******************************************************************************
1170  ******************************************************************************/
1171 
1205  UpnpClient_Handle Hnd,
1207  const char *ActionURL,
1209  const char *VarName,
1213  DOMString *StVarVal);
1214 
1234  UpnpClient_Handle Hnd,
1236  const char *ActionURL,
1238  const char *VarName,
1241  Upnp_FunPtr Fun,
1243  const void *Cookie);
1244 
1270  UpnpClient_Handle Hnd,
1272  const char *ActionURL,
1274  const char *ServiceType,
1276  const char *DevUDN,
1278  IXML_Document *Action,
1281  IXML_Document **RespNode);
1282 
1308  UpnpClient_Handle Hnd,
1310  const char *ActionURL,
1312  const char *ServiceType,
1314  const char *DevUDN,
1317  IXML_Document *Header,
1319  IXML_Document *Action,
1322  IXML_Document **RespNode);
1323 
1347  UpnpClient_Handle Hnd,
1349  const char *ActionURL,
1351  const char *ServiceType,
1353  const char *DevUDN,
1355  IXML_Document *Action,
1358  Upnp_FunPtr Fun,
1361  const void *Cookie);
1362 
1386  UpnpClient_Handle Hnd,
1388  const char *ActionURL,
1390  const char *ServiceType,
1392  const char *DevUDN,
1395  IXML_Document *Header,
1397  IXML_Document *Action,
1400  Upnp_FunPtr Fun,
1403  const void *Cookie);
1404 
1407 /******************************************************************************
1408  ******************************************************************************
1409  * *
1410  * E V E N T I N G *
1411  * *
1412  ******************************************************************************
1413  ******************************************************************************/
1414 
1448  UpnpDevice_Handle Hnd,
1450  const char *DevID,
1452  const char *ServID,
1454  const char **VarName,
1456  const char **NewVal,
1458  int cVariables,
1460  const Upnp_SID SubsId);
1461 
1486  UpnpDevice_Handle Hnd,
1488  const char *DevID,
1490  const char *ServID,
1494  IXML_Document *PropSet,
1496  const Upnp_SID SubsId);
1497 
1523  const char *DevID,
1525  const char *ServID,
1527  const char **VarName,
1529  const char **NewVal,
1531  int cVariables);
1532 
1558  const char *DevID,
1560  const char *ServID,
1564  IXML_Document *PropSet);
1565 
1596  UpnpClient_Handle Hnd,
1599  int *TimeOut,
1601  const Upnp_SID SubsId);
1602 
1652  UpnpClient_Handle Hnd,
1655  int TimeOut,
1657  Upnp_SID SubsId,
1660  Upnp_FunPtr Fun,
1662  const void *Cookie);
1663 
1680  UpnpDevice_Handle Hnd,
1682  int MaxSubscriptions);
1683 
1701  UpnpDevice_Handle Hnd,
1703  int MaxSubscriptionTimeOut);
1704 
1736  UpnpClient_Handle Hnd,
1738  const char *PublisherUrl,
1742  int *TimeOut,
1744  Upnp_SID SubsId);
1745 
1796  UpnpClient_Handle Hnd,
1798  const char *PublisherUrl,
1801  int TimeOut,
1803  Upnp_FunPtr Fun,
1805  const void *Cookie);
1806 
1838  UpnpClient_Handle Hnd,
1840  const Upnp_SID SubsId);
1841 
1890  UpnpClient_Handle Hnd,
1892  Upnp_SID SubsId,
1895  Upnp_FunPtr Fun,
1897  const void *Cookie);
1898 
1902 /******************************************************************************
1903  ******************************************************************************
1904  * *
1905  * C L I E N T - A P I *
1906  * *
1907  ******************************************************************************
1908  ******************************************************************************/
1909 
1920  UPNP_HTTPMETHOD_PUT = 0,
1921  UPNP_HTTPMETHOD_DELETE = 1,
1922  UPNP_HTTPMETHOD_GET = 2,
1923  UPNP_HTTPMETHOD_HEAD = 3,
1924  UPNP_HTTPMETHOD_POST = 4
1925 };
1926 
1927 typedef enum Upnp_HttpMethod_e Upnp_HttpMethod;
1928 
1957  const char *url,
1959  char **outBuf,
1962  char *contentType);
1963 
1996  const char *url,
1998  void **handle,
2000  char **contentType,
2002  int *contentLength,
2004  int *httpStatus,
2008  int timeout);
2009 
2042  const char *url,
2044  const char *proxy_str,
2046  void **handle,
2048  char **contentType,
2050  int *contentLength,
2052  int *httpStatus,
2056  int timeout);
2057 
2090  const char *url,
2092  void **handle,
2094  char **contentType,
2096  int *contentLength,
2098  int *httpStatus,
2100  int lowRange,
2102  int highRange,
2106  int timeout);
2107 
2127  void *handle,
2129  char *buf,
2131  size_t *size,
2135  int timeout);
2136 
2147  void *handle,
2149  size_t *length,
2151  size_t *total);
2152 
2163  void *handle);
2164 
2176  void *handle);
2177 
2205  const char *url,
2208  void **handle,
2210  const char *contentType,
2212  int contentLength,
2216  int timeout);
2217 
2234  void *handle,
2236  char *buf,
2238  size_t *size,
2242  int timeout);
2243 
2260  void *handle,
2262  int *httpStatus,
2266  int timeout);
2267 
2293  const char *url,
2296  void **handle,
2300  int timeout);
2301 
2328  /* ![in] The method to use to make the request. */
2329  Upnp_HttpMethod method,
2333  const char *url,
2335  void *handle,
2338  UpnpString *headers,
2340  const char *contentType,
2344  int contentLength,
2348  int timeout);
2349 
2366  void *handle,
2368  char *buf,
2370  size_t *size,
2374  int timeout);
2375 
2396  void *handle,
2400  int timeout);
2401 
2433  void *handle,
2436  UpnpString *headers,
2438  char **contentType,
2440  int *contentLength,
2442  int *httpStatus,
2446  int timeout);
2447 
2469  void *handle,
2471  char *buf,
2473  size_t *size,
2477  int timeout);
2478 
2494  void *handle);
2495 
2525  const char *url,
2527  IXML_Document **xmlDoc);
2528 
2531 /******************************************************************************
2532  ******************************************************************************
2533  * *
2534  * W E B S E R V E R A P I *
2535  * *
2536  ******************************************************************************
2537  ******************************************************************************/
2538 
2563  const char *rootDir);
2564 
2568 typedef void *UpnpWebFileHandle;
2569 
2573 typedef int (*VDCallback_GetInfo)(
2575  const char *filename,
2577  UpnpFileInfo *info,
2579  const void *cookie);
2580 
2590 
2596  const char *filename,
2599  enum UpnpOpenFileMode Mode,
2601  const void *cookie);
2602 
2612 
2616 typedef int (*VDCallback_Read)(
2618  UpnpWebFileHandle fileHnd,
2620  char *buf,
2622  size_t buflen,
2624  const void *cookie);
2625 
2635 
2639 typedef int (*VDCallback_Write)(
2641  UpnpWebFileHandle fileHnd,
2643  char *buf,
2645  size_t buflen,
2647  const void *cookie);
2648 
2658 
2662 typedef int (*VDCallback_Seek) (
2664  UpnpWebFileHandle fileHnd,
2668  off_t offset,
2673  int origin,
2675  const void *cookie);
2676 
2686 
2690 typedef int (*VDCallback_Close)(
2692  UpnpWebFileHandle fileHnd,
2694  const void *cookie);
2695 
2705 
2715  int enable);
2716 
2725 
2742  const char *dirName,
2744  const void *cookie,
2746  const void **oldcookie);
2747 
2757  const char *dirName);
2758 
2763 
2764 /* @} Web Server API */
2765 
2766 #ifdef __cplusplus
2767 }
2768 #endif /* __cplusplus */
2769 
2770 /* @} UPnPAPI UPnP API */
2771 
2772 #endif /* UPNP_H */
UpnpActionComplete object declaration.
UpnpActionRequest object declaration.
int(* Upnp_FunPtr)(Upnp_EventType EventType, const void *Event, void *Cookie)
Definition: Callback.h:145
UpnpDiscovery object declararion.
UpnpEventSubscribe object declararion.
UpnpEvent object declararion.
UpnpFileInfo object declararion.
UpnpStateVarComplete object declararion.
UpnpStateVarRequest object declararion.
UpnpSubscriptionRequest object declararion.
Defines constants that for some reason are not defined on some systems.
#define EXPORT_SPEC
Export functions on WIN32 DLLs.
Definition: UpnpGlobal.h:87
Provides a platform independent way to include TCP/IP types and functions.
int(* VDCallback_Seek)(UpnpWebFileHandle fileHnd, off_t offset, int origin, const void *cookie)
Seek callback function prototype.
Definition: upnp.h:2662
int UpnpCloseHttpGet(void *handle)
Closes the connection and frees memory that was allocated for the handle parameter.
Definition: upnpapi.c:3157
int UpnpSendActionEx(UpnpClient_Handle Hnd, const char *ActionURL, const char *ServiceType, const char *DevUDN, IXML_Document *Header, IXML_Document *Action, IXML_Document **RespNode)
Sends a message to change a state variable in a service.
Definition: upnpapi.c:2653
int UpnpSearchAsync(UpnpClient_Handle Hnd, int Mx, const char *TTarget_constarget_const, const void *Cookie_const)
Searches for devices matching the given search target.
Definition: upnpapi.c:1810
void UpnpRemoveAllVirtualDirs(void)
Removes all virtual directory mappings.
Definition: upnpapi.c:4258
int UpnpVirtualDir_set_GetInfoCallback(VDCallback_GetInfo callback)
Sets the get_info callback function to be used to access a virtual directory.
Definition: upnpapi.c:4327
int UpnpRenewSubscriptionAsync(UpnpClient_Handle Hnd, int TimeOut, Upnp_SID SubsId, Upnp_FunPtr Fun, const void *Cookie)
Renews a subscription that is about to expire, generating a callback when the operation is complete.
Definition: upnpapi.c:2260
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
Definition: upnp.h:445
int UpnpOpenHttpGet(const char *url, void **handle, char **contentType, int *contentLength, int *httpStatus, int timeout)
Gets a file specified in a URL.
Definition: upnpapi.c:3090
int(* VDCallback_Close)(UpnpWebFileHandle fileHnd, const void *cookie)
Close callback function prototype.
Definition: upnp.h:2690
unsigned short UpnpGetServerPort(void)
Returns the internal server IPv4 UPnP listening port.
Definition: upnpapi.c:712
int UpnpRegisterRootDevice2(Upnp_DescType descriptionType, const char *description, size_t bufferLen, int config_baseURL, Upnp_FunPtr Fun, const void *Cookie, UpnpDevice_Handle *Hnd)
Registers a device application with the UPnP Library. Similar to UpnpRegisterRootDevice,...
Definition: upnpapi.c:976
Upnp_DescType_e
Specifies the type of description in UpnpRegisterRootDevice2.
Definition: upnp.h:478
int UpnpReadHttpGet(void *handle, char *buf, size_t *size, int timeout)
Gets specified number of bytes from a file specified in a URL.
Definition: upnpapi.c:3163
int UpnpSubscribeAsync(UpnpClient_Handle Hnd, const char *PublisherUrl, int TimeOut, Upnp_FunPtr Fun, const void *Cookie)
Performs the same operation as UpnpSubscribe, but returns immediately and calls the registered callba...
Definition: upnpapi.c:1943
int UpnpCloseHttpPost(void *handle, int *httpStatus, int timeout)
Sends and receives any pending data, closes the connection with the server, and frees memory allocate...
Definition: upnpapi.c:3077
int UpnpSendAdvertisementLowPower(UpnpDevice_Handle Hnd, int Exp, int PowerState, int SleepPeriod, int RegistrationState)
Sends out the discovery announcements for all devices and services for a device.
Definition: upnpapi.c:1698
int UpnpSendActionAsync(UpnpClient_Handle Hnd, const char *ActionURL, const char *ServiceType, const char *DevUDN, IXML_Document *Action, Upnp_FunPtr Fun, const void *Cookie)
Sends a message to change a state variable in a service, generating a callback when the operation is ...
Definition: upnpapi.c:2709
int UpnpRenewSubscription(UpnpClient_Handle Hnd, int *TimeOut, const Upnp_SID SubsId)
Renews a subscription that is about to expire.
Definition: upnpapi.c:2204
int UpnpSubscribe(UpnpClient_Handle Hnd, const char *PublisherUrl, int *TimeOut, Upnp_SID SubsId)
Registers a control point to receive event notifications from another device.
Definition: upnpapi.c:2017
int UpnpUnSubscribeAsync(UpnpClient_Handle Hnd, Upnp_SID SubsId, Upnp_FunPtr Fun, const void *Cookie)
Removes a subscription of a control point from a service previously subscribed to using UpnpSubscribe...
Definition: upnpapi.c:2136
int UpnpAcceptSubscriptionExt(UpnpDevice_Handle Hnd, const char *DevID, const char *ServID, IXML_Document *PropSet, const Upnp_SID SubsId)
Similar to UpnpAcceptSubscription() except that it takes a DOM document for the variables to event ra...
Definition: upnpapi.c:2512
int UpnpEnableWebserver(int enable)
Enables or disables the webserver.
Definition: upnpapi.c:4280
int UpnpRegisterRootDevice4(const char *DescUrl, Upnp_FunPtr Callback, const void *Cookie, UpnpDevice_Handle *Hnd, int AddressFamily, const char *LowerDescUrl)
Registers a device application for a specific address family with the UPnP library....
Definition: upnpapi.c:1133
int UpnpOpenHttpPost(const char *url, void **handle, const char *contentType, int contentLength, int timeout)
Makes an HTTP POST request message, opens a connection to the server and sends the POST request to th...
Definition: upnpapi.c:3051
void * UpnpWebFileHandle
The type of handle returned by the web server for open requests.
Definition: upnp.h:2568
int UpnpDownloadUrlItem(const char *url, char **outBuf, char *contentType)
Downloads a file specified in a URL.
Definition: upnpapi.c:3226
int UpnpAddVirtualDir(const char *dirName, const void *cookie, const void **oldcookie)
Adds a virtual directory mapping.
Definition: upnpapi.c:4140
int UpnpReadHttpResponse(void *handle, char *buf, size_t *size, int timeout)
Reads the content of a response using a connection previously created by UpnpOpenHttpConnection.
Definition: upnpapi.c:3213
int UpnpSetMaxContentLength(size_t contentLength)
Sets the maximum content-length that the SDK will process on an incoming SOAP requests or responses.
Definition: upnpapi.c:4435
int UpnpMakeHttpRequest(Upnp_HttpMethod method, const char *url, void *handle, UpnpString *headers, const char *contentType, int contentLength, int timeout)
Makes a HTTP request using a connection previously created by UpnpOpenHttpConnection.
Definition: upnpapi.c:3182
int UpnpSendAction(UpnpClient_Handle Hnd, const char *ActionURL, const char *ServiceType, const char *DevUDN, IXML_Document *Action, IXML_Document **RespNode)
Sends a message to change a state variable in a service.
Definition: upnpapi.c:2597
int UpnpUnSubscribe(UpnpClient_Handle Hnd, const Upnp_SID SubsId)
Removes the subscription of a control point from a service previously subscribed to using UpnpSubscri...
Definition: upnpapi.c:2088
int UpnpFinish(void)
Initializes the OpenSSL library, and the OpenSSL context for use with pupnp.
Definition: upnpapi.c:638
int UpnpOpenHttpGetProxy(const char *url, const char *proxy_str, void **handle, char **contentType, int *contentLength, int *httpStatus, int timeout)
Gets a file specified in a URL through the specified proxy.
Definition: upnpapi.c:3112
Upnp_HttpMethod_e
Different HTTP methods.
Definition: upnp.h:1919
int UpnpVirtualDir_set_WriteCallback(VDCallback_Write callback)
Sets the write callback function to be used to access a virtual directory.
Definition: upnpapi.c:4366
int UpnpIsWebserverEnabled(void)
Returns TRUE if the webserver is enabled, or FALSE if it is not.
Definition: upnpapi.c:4317
int UpnpWriteHttpPost(void *handle, char *buf, size_t *size, int timeout)
Sends a request to a server to copy the contents of a buffer to the URI specified in the UpnpOpenHttp...
Definition: upnpapi.c:3067
int UpnpVirtualDir_set_SeekCallback(VDCallback_Seek callback)
Sets the seek callback function to be used to access a virtual directory.
Definition: upnpapi.c:4379
int UpnpHttpGetProgress(void *handle, size_t *length, size_t *total)
Retrieve progress information of a http-get transfer.
Definition: upnpapi.c:3169
int UpnpSetMaxSubscriptions(UpnpDevice_Handle Hnd, int MaxSubscriptions)
Sets the maximum number of subscriptions accepted per service.
Definition: upnpapi.c:1867
int UpnpGetServiceVarStatus(UpnpClient_Handle Hnd, const char *ActionURL, const char *VarName, DOMString *StVarVal)
Queries the state of a state variable of a service on another device.
Definition: upnpapi.c:2995
int UpnpVirtualDir_set_ReadCallback(VDCallback_Read callback)
Sets the read callback function to be used to access a virtual directory.
Definition: upnpapi.c:4353
char * UpnpGetServerIpAddress(void)
Returns the local IPv4 listening ip address.
Definition: upnpapi.c:732
int UpnpInit2(const char *IfName, unsigned short DestPort)
Initializes the Linux SDK for UPnP Devices (IPv4 or IPv6).
Definition: upnpapi.c:513
int UpnpNotify(UpnpDevice_Handle, const char *DevID, const char *ServID, const char **VarName, const char **NewVal, int cVariables)
Sends out an event change notification to all control points subscribed to a particular service.
Definition: upnpapi.c:2332
int UpnpClient_Handle
Returned when a control point application registers with UpnpRegisterClient.
Definition: upnp.h:426
int UpnpSetWebServerRootDir(const char *rootDir)
Sets the document root directory for the internal web server.
int UpnpCloseHttpConnection(void *handle)
Closes the connection created with UpnpOpenHttpConnection and frees any memory associated with the co...
Definition: upnpapi.c:3220
int UpnpSetMaxSubscriptionTimeOut(UpnpDevice_Handle Hnd, int MaxSubscriptionTimeOut)
Sets the maximum time-out accepted for a subscription request or renewal.
Definition: upnpapi.c:1904
int UpnpGetServiceVarStatusAsync(UpnpClient_Handle Hnd, const char *ActionURL, const char *VarName, Upnp_FunPtr Fun, const void *Cookie)
Queries the state of a variable of a service, generating a callback when the operation is complete.
Definition: upnpapi.c:2926
int UpnpRegisterRootDevice3(const char *DescUrl, Upnp_FunPtr Callback, const void *Cookie, UpnpDevice_Handle *Hnd, int AddressFamily)
Registers a device application for a specific address family with the UPnP library.
Definition: upnpapi.c:1117
int UpnpSetContentLength(UpnpClient_Handle Hnd, size_t contentLength)
Definition: upnpapi.c:4404
int UpnpSendActionExAsync(UpnpClient_Handle Hnd, const char *ActionURL, const char *ServiceType, const char *DevUDN, IXML_Document *Header, IXML_Document *Action, Upnp_FunPtr Fun, const void *Cookie)
Sends a message to change a state variable in a service, generating a callback when the operation is ...
Definition: upnpapi.c:2804
int UpnpSendAdvertisement(UpnpDevice_Handle Hnd, int Exp)
Sends out the discovery announcements for all devices and services for a device.
Definition: upnpapi.c:1691
int UpnpNotifyExt(UpnpDevice_Handle, const char *DevID, const char *ServID, IXML_Document *PropSet)
Similar to UpnpNotify except that it takes a DOM document for the event rather than an array of strin...
Definition: upnpapi.c:2386
Upnp_SType_e
Represents the different types of searches that can be performed using the SDK for UPnP Devices API.
Definition: upnp.h:455
int UpnpDevice_Handle
Returned when a device application registers with UpnpRegisterRootDevice, UpnpRegisterRootDevice2,...
Definition: upnp.h:436
int UpnpRegisterRootDevice(const char *DescUrl, Upnp_FunPtr Callback, const void *Cookie, UpnpDevice_Handle *Hnd)
Registers a device application with the UPnP Library.
Definition: upnpapi.c:816
int UpnpRegisterClient(Upnp_FunPtr Callback, const void *Cookie, UpnpClient_Handle *Hnd)
Registers a control point application with the UPnP Library.
Definition: upnpapi.c:1361
int(* VDCallback_GetInfo)(const char *filename, UpnpFileInfo *info, const void *cookie)
Get-info callback function prototype.
Definition: upnp.h:2573
int UpnpUnRegisterRootDeviceLowPower(UpnpDevice_Handle Hnd, int PowerState, int SleepPeriod, int RegistrationState)
Unregisters a root device registered with UpnpRegisterRootDevice, UpnpRegisterRootDevice2,...
Definition: upnpapi.c:1286
int UpnpOpenHttpGetEx(const char *url, void **handle, char **contentType, int *contentLength, int *httpStatus, int lowRange, int highRange, int timeout)
Gets specified number of bytes from a file specified in the URL.
Definition: upnpapi.c:3135
int UpnpAcceptSubscription(UpnpDevice_Handle Hnd, const char *DevID, const char *ServID, const char **VarName, const char **NewVal, int cVariables, const Upnp_SID SubsId)
Accepts a subscription request and sends out the current state of the eventable variables for a servi...
Definition: upnpapi.c:2433
unsigned short UpnpGetServerPort6(void)
Returns the internal server IPv6 UPnP listening port.
Definition: upnpapi.c:720
int UpnpUnRegisterRootDevice(UpnpDevice_Handle Hnd)
Unregisters a root device registered with UpnpRegisterRootDevice, UpnpRegisterRootDevice2,...
Definition: upnpapi.c:1279
int UpnpRemoveVirtualDir(const char *dirName)
Removes a virtual directory mapping made with UpnpAddVirtualDir.
Definition: upnpapi.c:4209
int UpnpEndHttpRequest(void *handle, int timeout)
Indicates the end of a HTTP request previously made by UpnpMakeHttpRequest.
Definition: upnpapi.c:3198
int UpnpDownloadXmlDoc(const char *url, IXML_Document **xmlDoc)
Downloads an XML document specified in a URL.
Definition: upnpapi.c:3243
int UpnpInit(const char *HostIP, unsigned short DestPort)
Initializes the Linux SDK for UPnP Devices (IPv4 only).
Definition: upnpapi.c:457
int UpnpCancelHttpGet(void *handle)
Set the cancel flag of the handle parameter.
Definition: upnpapi.c:3151
int UpnpWriteHttpRequest(void *handle, char *buf, size_t *size, int timeout)
Writes the content of a HTTP request initiated by a UpnpMakeHttpRequest call. The end of the content ...
Definition: upnpapi.c:3191
int(* VDCallback_Write)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie)
Write callback function prototype.
Definition: upnp.h:2639
int UpnpVirtualDir_set_OpenCallback(VDCallback_Open callback)
Sets the open callback function to be used to access a virtual directory.
Definition: upnpapi.c:4340
char * UpnpGetServerIp6Address(void)
Returns the local IPv6 listening ip address.
Definition: upnpapi.c:740
int UpnpUnRegisterClient(UpnpClient_Handle Hnd)
Unregisters a control point application, unsubscribing all active subscriptions.
Definition: upnpapi.c:1409
int(* VDCallback_Read)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie)
Read callback function prototype.
Definition: upnp.h:2616
int UpnpOpenHttpConnection(const char *url, void **handle, int timeout)
Opens a connection to the server.
Definition: upnpapi.c:3175
int UpnpGetHttpResponse(void *handle, UpnpString *headers, char **contentType, int *contentLength, int *httpStatus, int timeout)
Gets the response from the server using a connection previously created by UpnpOpenHttpConnection.
Definition: upnpapi.c:3204
int UpnpVirtualDir_set_CloseCallback(VDCallback_Close callback)
Sets the close callback function to be used to access a virtual directory.
Definition: upnpapi.c:4392
UpnpWebFileHandle(* VDCallback_Open)(const char *filename, enum UpnpOpenFileMode Mode, const void *cookie)
Open callback function prototype.
Definition: upnp.h:2594
@ UPNPREG_FILENAME_DESC
Definition: upnp.h:484
@ UPNPREG_BUF_DESC
Definition: upnp.h:488
@ UPNPREG_URL_DESC
Definition: upnp.h:480
@ UPNP_S_ROOT
Definition: upnp.h:460
@ UPNP_S_ALL
Definition: upnp.h:457
@ UPNP_S_SERVICE
Definition: upnp.h:467
@ UPNP_S_DEVICE
Definition: upnp.h:463
struct s_UpnpString UpnpString
Type of the string objects inside libupnp.
Definition: UpnpString.h:38
#define DOMString
The type of DOM strings.
Definition: ixml.h:59
Data structure representing the DOM Document.
Definition: ixml.h:198