libUPnP  1.8.0
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  #ifdef UPNP_USE_MSVCPP
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 
580 #ifdef UPNP_ENABLE_IPV6
585  const char *IfName,
588  unsigned short DestPort);
589 #endif
590 
603 #ifdef UPNP_ENABLE_OPEN_SSL
604 EXPORT_SPEC int UpnpInitSslContext(
608  int initOpenSslLib,
611  const SSL_METHOD *sslMethod);
612 #endif
613 
633 EXPORT_SPEC int UpnpFinish(void);
634 
646 EXPORT_SPEC unsigned short UpnpGetServerPort(void);
647 
659 #ifdef UPNP_ENABLE_IPV6
660 EXPORT_SPEC unsigned short UpnpGetServerPort6(void);
661 #endif
662 
674 
686 #ifdef UPNP_ENABLE_IPV6
688 
689 EXPORT_SPEC char *UpnpGetServerUlaGuaIp6Address(void);
690 #endif
691 
730  const char *DescUrl,
732  Upnp_FunPtr Callback,
734  const void *Cookie,
736  UpnpDevice_Handle *Hnd);
737 
808  Upnp_DescType descriptionType,
811  const char* description,
814  size_t bufferLen,
817  int config_baseURL,
819  Upnp_FunPtr Fun,
822  const void* Cookie,
824  UpnpDevice_Handle* Hnd);
825 
864  const char *DescUrl,
866  Upnp_FunPtr Callback,
868  const void *Cookie,
870  UpnpDevice_Handle *Hnd,
873  int AddressFamily);
874 
914  const char *DescUrl,
916  Upnp_FunPtr Callback,
918  const void *Cookie,
920  UpnpDevice_Handle *Hnd,
923  int AddressFamily,
926  const char *LowerDescUrl);
927 
946  UpnpDevice_Handle Hnd);
947 
969  UpnpDevice_Handle Hnd,
971  int PowerState,
973  int SleepPeriod,
975  int RegistrationState);
976 
997  Upnp_FunPtr Callback,
999  const void *Cookie,
1001  UpnpClient_Handle *Hnd);
1002 
1021  UpnpClient_Handle Hnd);
1022 
1032  UpnpClient_Handle Hnd,
1034  size_t contentLength);
1035 
1055  size_t contentLength);
1056 
1057 /* @} Initialization and Registration */
1058 
1059 /******************************************************************************
1060  ******************************************************************************
1061  * *
1062  * D I S C O V E R Y *
1063  * *
1064  ******************************************************************************
1065  ******************************************************************************/
1066 
1098  UpnpClient_Handle Hnd,
1103  int Mx,
1106  const char *TTarget_constarget_const,
1108  const void *Cookie_const);
1109 
1127  UpnpDevice_Handle Hnd,
1133  int Exp);
1134 
1155  UpnpDevice_Handle Hnd,
1161  int Exp,
1163  int PowerState,
1165  int SleepPeriod,
1167  int RegistrationState);
1168 
1169 /* @} Discovery */
1170 
1171 /******************************************************************************
1172  ******************************************************************************
1173  * *
1174  * C O N T R O L *
1175  * *
1176  ******************************************************************************
1177  ******************************************************************************/
1178 
1212  UpnpClient_Handle Hnd,
1214  const char *ActionURL,
1216  const char *VarName,
1220  DOMString *StVarVal);
1221 
1241  UpnpClient_Handle Hnd,
1243  const char *ActionURL,
1245  const char *VarName,
1248  Upnp_FunPtr Fun,
1250  const void *Cookie);
1251 
1277  UpnpClient_Handle Hnd,
1279  const char *ActionURL,
1281  const char *ServiceType,
1283  const char *DevUDN,
1285  IXML_Document *Action,
1288  IXML_Document **RespNode);
1289 
1315  UpnpClient_Handle Hnd,
1317  const char *ActionURL,
1319  const char *ServiceType,
1321  const char *DevUDN,
1324  IXML_Document *Header,
1326  IXML_Document *Action,
1329  IXML_Document **RespNode);
1330 
1354  UpnpClient_Handle Hnd,
1356  const char *ActionURL,
1358  const char *ServiceType,
1360  const char *DevUDN,
1362  IXML_Document *Action,
1365  Upnp_FunPtr Fun,
1368  const void *Cookie);
1369 
1393  UpnpClient_Handle Hnd,
1395  const char *ActionURL,
1397  const char *ServiceType,
1399  const char *DevUDN,
1402  IXML_Document *Header,
1404  IXML_Document *Action,
1407  Upnp_FunPtr Fun,
1410  const void *Cookie);
1411 
1414 /******************************************************************************
1415  ******************************************************************************
1416  * *
1417  * E V E N T I N G *
1418  * *
1419  ******************************************************************************
1420  ******************************************************************************/
1421 
1455  UpnpDevice_Handle Hnd,
1457  const char *DevID,
1459  const char *ServID,
1461  const char **VarName,
1463  const char **NewVal,
1465  int cVariables,
1467  const Upnp_SID SubsId);
1468 
1493  UpnpDevice_Handle Hnd,
1495  const char *DevID,
1497  const char *ServID,
1501  IXML_Document *PropSet,
1503  const Upnp_SID SubsId);
1504 
1530  const char *DevID,
1532  const char *ServID,
1534  const char **VarName,
1536  const char **NewVal,
1538  int cVariables);
1539 
1565  const char *DevID,
1567  const char *ServID,
1571  IXML_Document *PropSet);
1572 
1603  UpnpClient_Handle Hnd,
1606  int *TimeOut,
1608  const Upnp_SID SubsId);
1609 
1659  UpnpClient_Handle Hnd,
1662  int TimeOut,
1664  Upnp_SID SubsId,
1667  Upnp_FunPtr Fun,
1669  const void *Cookie);
1670 
1687  UpnpDevice_Handle Hnd,
1689  int MaxSubscriptions);
1690 
1708  UpnpDevice_Handle Hnd,
1710  int MaxSubscriptionTimeOut);
1711 
1743  UpnpClient_Handle Hnd,
1745  const char *PublisherUrl,
1749  int *TimeOut,
1751  Upnp_SID SubsId);
1752 
1803  UpnpClient_Handle Hnd,
1805  const char *PublisherUrl,
1808  int TimeOut,
1810  Upnp_FunPtr Fun,
1812  const void *Cookie);
1813 
1845  UpnpClient_Handle Hnd,
1847  const Upnp_SID SubsId);
1848 
1897  UpnpClient_Handle Hnd,
1899  Upnp_SID SubsId,
1902  Upnp_FunPtr Fun,
1904  const void *Cookie);
1905 
1909 /******************************************************************************
1910  ******************************************************************************
1911  * *
1912  * C L I E N T - A P I *
1913  * *
1914  ******************************************************************************
1915  ******************************************************************************/
1916 
1927  UPNP_HTTPMETHOD_PUT = 0,
1928  UPNP_HTTPMETHOD_DELETE = 1,
1929  UPNP_HTTPMETHOD_GET = 2,
1930  UPNP_HTTPMETHOD_HEAD = 3,
1931  UPNP_HTTPMETHOD_POST = 4
1932 };
1933 
1934 typedef enum Upnp_HttpMethod_e Upnp_HttpMethod;
1935 
1964  const char *url,
1966  char **outBuf,
1969  char *contentType);
1970 
2003  const char *url,
2005  void **handle,
2007  char **contentType,
2009  int *contentLength,
2011  int *httpStatus,
2015  int timeout);
2016 
2049  const char *url,
2051  const char *proxy_str,
2053  void **handle,
2055  char **contentType,
2057  int *contentLength,
2059  int *httpStatus,
2063  int timeout);
2064 
2097  const char *url,
2099  void **handle,
2101  char **contentType,
2103  int *contentLength,
2105  int *httpStatus,
2107  int lowRange,
2109  int highRange,
2113  int timeout);
2114 
2134  void *handle,
2136  char *buf,
2138  size_t *size,
2142  int timeout);
2143 
2154  void *handle,
2156  size_t *length,
2158  size_t *total);
2159 
2170  void *handle);
2171 
2183  void *handle);
2184 
2212  const char *url,
2215  void **handle,
2217  const char *contentType,
2219  int contentLength,
2223  int timeout);
2224 
2241  void *handle,
2243  char *buf,
2245  size_t *size,
2249  int timeout);
2250 
2267  void *handle,
2269  int *httpStatus,
2273  int timeout);
2274 
2300  const char *url,
2303  void **handle,
2307  int timeout);
2308 
2335  /* ![in] The method to use to make the request. */
2336  Upnp_HttpMethod method,
2340  const char *url,
2342  void *handle,
2345  UpnpString *headers,
2347  const char *contentType,
2351  int contentLength,
2355  int timeout);
2356 
2373  void *handle,
2375  char *buf,
2377  size_t *size,
2381  int timeout);
2382 
2403  void *handle,
2407  int timeout);
2408 
2440  void *handle,
2443  UpnpString *headers,
2445  char **contentType,
2447  int *contentLength,
2449  int *httpStatus,
2453  int timeout);
2454 
2476  void *handle,
2478  char *buf,
2480  size_t *size,
2484  int timeout);
2485 
2501  void *handle);
2502 
2532  const char *url,
2534  IXML_Document **xmlDoc);
2535 
2538 /******************************************************************************
2539  ******************************************************************************
2540  * *
2541  * W E B S E R V E R A P I *
2542  * *
2543  ******************************************************************************
2544  ******************************************************************************/
2545 
2570  const char *rootDir);
2571 
2575 typedef void *UpnpWebFileHandle;
2576 
2580 typedef int (*VDCallback_GetInfo)(
2582  const char *filename,
2584  UpnpFileInfo *info);
2585 
2595 
2601  const char *filename,
2604  enum UpnpOpenFileMode Mode);
2605 
2615 
2619 typedef int (*VDCallback_Read)(
2621  UpnpWebFileHandle fileHnd,
2623  char *buf,
2625  size_t buflen);
2626 
2636 
2640 typedef int (*VDCallback_Write)(
2642  UpnpWebFileHandle fileHnd,
2644  char *buf,
2646  size_t buflen);
2647 
2657 
2661 typedef int (*VDCallback_Seek) (
2663  UpnpWebFileHandle fileHnd,
2667  off_t offset,
2672  int origin);
2673 
2683 
2687 typedef int (*VDCallback_Close)(
2689  UpnpWebFileHandle fileHnd);
2690 
2700 
2710  int enable);
2711 
2720 
2737  const char *dirName);
2738 
2748  const char *dirName);
2749 
2754 
2755 /* @} Web Server API */
2756 
2757 #ifdef __cplusplus
2758 }
2759 #endif /* __cplusplus */
2760 
2761 /* @} UPnPAPI UPnP API */
2762 
2763 #endif /* UPNP_H */
int UpnpDownloadXmlDoc(const char *url, IXML_Document **xmlDoc)
Downloads an XML document specified in a URL.
Definition: upnpapi.c:3258
int UpnpClient_Handle
Returned when a control point application registers with UpnpRegisterClient.
Definition: upnp.h:426
int(* Upnp_FunPtr)(Upnp_EventType EventType, const void *Event, void *Cookie)
Definition: Callback.h:145
UpnpEventSubscribe object declararion.
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:1116
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, except that it also allows the description document to be specified as a file or a memory buffer.
Definition: upnpapi.c:970
UpnpActionRequest object declaration.
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:805
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:2448
int(* VDCallback_Seek)(UpnpWebFileHandle fileHnd, off_t offset, int origin)
Seek callback function prototype.
Definition: upnp.h:2661
int UpnpSetWebServerRootDir(const char *rootDir)
Sets the document root directory for the internal web server.
Upnp_DescType_e
Specifies the type of description in UpnpRegisterRootDevice2.
Definition: upnp.h:478
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:3066
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:2819
int UpnpVirtualDir_set_GetInfoCallback(VDCallback_GetInfo callback)
Sets the get_info callback function to be used to access a virtual directory.
Definition: upnpapi.c:4304
void UpnpRemoveAllVirtualDirs(void)
Removes all virtual directory mappings.
Definition: upnpapi.c:4235
UpnpWebFileHandle(* VDCallback_Open)(const char *filename, enum UpnpOpenFileMode Mode)
Open callback function prototype.
Definition: upnp.h:2599
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:2941
int UpnpRenewSubscription(UpnpClient_Handle Hnd, int *TimeOut, const Upnp_SID SubsId)
Renews a subscription that is about to expire.
Definition: upnpapi.c:2219
int(* VDCallback_Close)(UpnpWebFileHandle fileHnd)
Close callback function prototype.
Definition: upnp.h:2687
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:3092
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 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:3127
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:1713
unsigned short UpnpGetServerPort(void)
Returns the internal server IPv4 UPnP listening port.
Definition: upnpapi.c:711
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:2151
int UpnpSetMaxSubscriptions(UpnpDevice_Handle Hnd, int MaxSubscriptions)
Sets the maximum number of subscriptions accepted per service.
Definition: upnpapi.c:1882
int UpnpRemoveVirtualDir(const char *dirName)
Removes a virtual directory mapping made with UpnpAddVirtualDir.
Definition: upnpapi.c:4186
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:2032
int UpnpUnRegisterRootDeviceLowPower(UpnpDevice_Handle Hnd, int PowerState, int SleepPeriod, int RegistrationState)
Unregisters a root device registered with UpnpRegisterRootDevice, UpnpRegisterRootDevice2, UpnpRegisterRootDevice3 or UpnpRegisterRootDevice4.
Definition: upnpapi.c:1301
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:3197
int UpnpCloseHttpGet(void *handle)
Closes the connection and frees memory that was allocated for the handle parameter.
Definition: upnpapi.c:3172
Definition: upnp.h:488
int(* VDCallback_Read)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen)
Read callback function prototype.
Definition: upnp.h:2619
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. This function can also be used to specify a dedicated description URL to be returned for legacy CPs.
Definition: upnpapi.c:1132
Definition: upnp.h:457
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:3178
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:2103
Definition: upnp.h:460
int UpnpVirtualDir_set_CloseCallback(VDCallback_Close callback)
Sets the close callback function to be used to access a virtual directory.
Definition: upnpapi.c:4369
int UpnpSetContentLength(UpnpClient_Handle Hnd, size_t contentLength)
Definition: upnpapi.c:4381
int UpnpVirtualDir_set_OpenCallback(VDCallback_Open callback)
Sets the open callback function to be used to access a virtual directory.
Definition: upnpapi.c:4317
Definition: upnp.h:484
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:3150
int UpnpInit2(const char *IfName, unsigned short DestPort)
Initializes the Linux SDK for UPnP Devices (IPv4 or IPv6).
int UpnpUnRegisterRootDevice(UpnpDevice_Handle Hnd)
Unregisters a root device registered with UpnpRegisterRootDevice, UpnpRegisterRootDevice2, UpnpRegisterRootDevice3 or UpnpRegisterRootDevice4.
Definition: upnpapi.c:1294
int UpnpSendAdvertisement(UpnpDevice_Handle Hnd, int Exp)
Sends out the discovery announcements for all devices and services for a device.
Definition: upnpapi.c:1706
int UpnpEndHttpRequest(void *handle, int timeout)
Indicates the end of a HTTP request previously made by UpnpMakeHttpRequest.
Definition: upnpapi.c:3213
Definition: upnp.h:467
Definition: upnp.h:480
UpnpStateVarRequest object declararion.
int UpnpVirtualDir_set_SeekCallback(VDCallback_Seek callback)
Sets the seek callback function to be used to access a virtual directory.
Definition: upnpapi.c:4356
int UpnpIsWebserverEnabled(void)
Returns TRUE if the webserver is enabled, or FALSE if it is not.
Definition: upnpapi.c:4294
int UpnpVirtualDir_set_ReadCallback(VDCallback_Read callback)
Sets the read callback function to be used to access a virtual directory.
Definition: upnpapi.c:4330
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:2612
Provides a platform independent way to include TCP/IP types and functions.
int UpnpDownloadUrlItem(const char *url, char **outBuf, char *contentType)
Downloads a file specified in a URL.
Definition: upnpapi.c:3241
int UpnpInit(const char *HostIP, unsigned short DestPort)
Initializes the Linux SDK for UPnP Devices (IPv4 only).
Definition: upnpapi.c:442
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:3082
int UpnpCancelHttpGet(void *handle)
Set the cancel flag of the handle parameter.
Definition: upnpapi.c:3166
UpnpActionComplete object declaration.
int UpnpDevice_Handle
Returned when a device application registers with UpnpRegisterRootDevice, UpnpRegisterRootDevice2, UpnpRegisterRootDevice3 or UpnpRegisterRootDevice4.
Definition: upnp.h:436
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:2347
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:3219
int(* VDCallback_GetInfo)(const char *filename, UpnpFileInfo *info)
Get-info callback function prototype.
Definition: upnp.h:2580
UpnpFileInfo object declararion.
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:3105
int UpnpSetMaxSubscriptionTimeOut(UpnpDevice_Handle Hnd, int MaxSubscriptionTimeOut)
Sets the maximum time-out accepted for a subscription request or renewal.
Definition: upnpapi.c:1919
unsigned short UpnpGetServerPort6(void)
Returns the internal server IPv6 UPnP listening port.
int UpnpHttpGetProgress(void *handle, size_t *length, size_t *total)
Retrieve progress information of a http-get transfer.
Definition: upnpapi.c:3184
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:2668
int UpnpOpenHttpConnection(const char *url, void **handle, int timeout)
Opens a connection to the server.
Definition: upnpapi.c:3190
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:2401
UpnpEvent object declararion.
UpnpDiscovery object declararion.
int UpnpVirtualDir_set_WriteCallback(VDCallback_Write callback)
Sets the write callback function to be used to access a virtual directory.
Definition: upnpapi.c:4343
int UpnpCloseHttpConnection(void *handle)
Closes the connection created with UpnpOpenHttpConnection and frees any memory associated with the co...
Definition: upnpapi.c:3235
#define DOMString
The type of DOM strings.
Definition: ixml.h:59
char * UpnpGetServerIpAddress(void)
Returns the local IPv4 listening ip address.
Definition: upnpapi.c:729
char * UpnpGetServerIp6Address(void)
Returns the local IPv6 listening ip address.
Definition: upnpapi.c:737
Definition: upnp.h:463
void * UpnpWebFileHandle
The type of handle returned by the web server for open requests.
Definition: upnp.h:2575
int UpnpUnRegisterClient(UpnpClient_Handle Hnd)
Unregisters a control point application, unsubscribing all active subscriptions.
Definition: upnpapi.c:1424
Data structure representing the DOM Document.
Definition: ixml.h:197
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:2724
int(* VDCallback_Write)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen)
Write callback function prototype.
Definition: upnp.h:2640
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:1958
struct s_UpnpString UpnpString
Type of the string objects inside libupnp.
Definition: UpnpString.h:38
Upnp_HttpMethod_e
Different HTTP methods.
Definition: upnp.h:1926
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
Definition: upnp.h:445
int UpnpFinish(void)
Initializes the OpenSSL library, and the OpenSSL context for use with pupnp.
Definition: upnpapi.c:625
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:2275
UpnpSubscriptionRequest object declararion.
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:3206
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:1825
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:2527
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:3228
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:4412
UpnpStateVarComplete object declararion.
int UpnpEnableWebserver(int enable)
Enables or disables the webserver.
Definition: upnpapi.c:4257
#define EXPORT_SPEC
Export functions on WIN32 DLLs.
Definition: UpnpGlobal.h:81
Defines constants that for some reason are not defined on some systems.
int UpnpRegisterClient(Upnp_FunPtr Callback, const void *Cookie, UpnpClient_Handle *Hnd)
Registers a control point application with the UPnP Library.
Definition: upnpapi.c:1376
int UpnpAddVirtualDir(const char *dirName)
Adds a virtual directory mapping.
Definition: upnpapi.c:4123
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:3010