libUPnP  1.8.0
upnp.h
Go to the documentation of this file.
1 /*******************************************************************************
2  *
3  * Copyright (c) 2000-2003 Intel Corporation
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *
9  * * Redistributions of source code must retain the above copyright notice,
10  * this list of conditions and the following disclaimer.
11  * * Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  * * Neither name of Intel Corporation nor the names of its contributors
15  * may be used to endorse or promote products derived from this software
16  * without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
22  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  ******************************************************************************/
31 
32 
33 #ifndef UPNP_H
34 #define UPNP_H
35 
36 
46 #include "ixml.h"
47 #include "upnpconfig.h"
48 #include "UpnpGlobal.h"
49 #include "UpnpInet.h"
50 
51 
52 /*
53  * \todo Document the exact reason of these include files and solve this
54  * include mess in an include file like UpnpTime.h
55  */
56 #ifdef WIN32
57  #include <time.h>
58 #elif (defined(BSD) && BSD >= 199306)
59  #include <time.h>
60 #else
61  /* Other systems ??? */
62 #endif
63 
64 
65 #ifdef WIN32
66  /* Do not #include <sys/param.h> */
67 #else
68  #include <sys/param.h>
69 #endif
70 
71 
72 #ifdef WIN32
73  #include <iphlpapi.h>
74 #else
75  #define SOCKET int
76  #define INVALID_SOCKET (SOCKET)(~0)
77 #endif
78 
79 
80 #ifdef WIN32
81  #define UpnpCloseSocket closesocket
82  #define fseeko fseek
83 #else
84  #define UpnpCloseSocket close
85 #endif
86 
87 
88 #define NUM_HANDLE 200
89 #define LINE_SIZE 180
90 #define NAME_SIZE 256
91 #define MNFT_NAME_SIZE 64
92 #define MODL_NAME_SIZE 32
93 #define SERL_NUMR_SIZE 64
94 #define MODL_DESC_SIZE 64
95 #define UPNP_INFINITE -1
96 #define UPNP_USING_CHUNKED -3
97 #define UPNP_UNTIL_CLOSE -4
98 
99 
119 #define UPNP_E_SUCCESS 0
120 
124 #define UPNP_E_INVALID_HANDLE -100
125 
132 #define UPNP_E_INVALID_PARAM -101
133 
139 #define UPNP_E_OUTOF_HANDLE -102
140 
141 #define UPNP_E_OUTOF_CONTEXT -103
142 
148 #define UPNP_E_OUTOF_MEMORY -104
149 
156 #define UPNP_E_INIT -105
157 
158 #define UPNP_E_BUFFER_TOO_SMALL -106
159 
164 #define UPNP_E_INVALID_DESC -107
165 
173 #define UPNP_E_INVALID_URL -108
174 
175 #define UPNP_E_INVALID_SID -109
176 
177 #define UPNP_E_INVALID_DEVICE -110
178 
185 #define UPNP_E_INVALID_SERVICE -111
186 
193 #define UPNP_E_BAD_RESPONSE -113
194 
195 #define UPNP_E_BAD_REQUEST -114
196 
203 #define UPNP_E_INVALID_ACTION -115
204 
210 #define UPNP_E_FINISH -116
211 
217 #define UPNP_E_INIT_FAILED -117
218 
224 #define UPNP_E_URL_TOO_BIG -118
225 
235 #define UPNP_E_BAD_HTTPMSG -119
236 
243 #define UPNP_E_ALREADY_REGISTERED -120
244 
249 #define UPNP_E_INVALID_INTERFACE -121
250 
258 #define UPNP_E_NETWORK_ERROR -200
259 
268 #define UPNP_E_SOCKET_WRITE -201
269 
278 #define UPNP_E_SOCKET_READ -202
279 
288 #define UPNP_E_SOCKET_BIND -203
289 
298 #define UPNP_E_SOCKET_CONNECT -204
299 
308 #define UPNP_E_OUTOF_SOCKET -205
309 
316 #define UPNP_E_LISTEN -206
317 
324 #define UPNP_E_TIMEDOUT -207
325 
332 #define UPNP_E_SOCKET_ERROR -208
333 
334 #define UPNP_E_FILE_WRITE_ERROR -209
335 
340 #define UPNP_E_CANCELED -210
341 
342 #define UPNP_E_EVENT_PROTOCOL -300
343 
347 #define UPNP_E_SUBSCRIBE_UNACCEPTED -301
348 
352 #define UPNP_E_UNSUBSCRIBE_UNACCEPTED -302
353 
357 #define UPNP_E_NOTIFY_UNACCEPTED -303
358 
365 #define UPNP_E_INVALID_ARGUMENT -501
366 
371 #define UPNP_E_FILE_NOT_FOUND -502
372 
376 #define UPNP_E_FILE_READ_ERROR -503
377 
382 #define UPNP_E_EXT_NOT_XML -504
383 
384 #define UPNP_E_NO_WEB_SERVER -505
385 #define UPNP_E_OUTOF_BOUNDS -506
386 
391 #define UPNP_E_NOT_FOUND -507
392 
397 #define UPNP_E_INTERNAL_ERROR -911
398 
399 /* SOAP-related error codes */
400 #define UPNP_SOAP_E_INVALID_ACTION 401
401 #define UPNP_SOAP_E_INVALID_ARGS 402
402 #define UPNP_SOAP_E_OUT_OF_SYNC 403
403 #define UPNP_SOAP_E_INVALID_VAR 404
404 #define UPNP_SOAP_E_ACTION_FAILED 501
405 
406 /* @} ErrorCodes */
407 
408 #ifndef OUT
409 #define OUT
410 #endif
411 
412 #ifndef IN
413 #define IN
414 #endif
415 
416 #ifndef INOUT
417 #define INOUT
418 #endif
419 
420 
421 /*
422  * Opaque data structures. The following includes are data structures that
423  * must be externally visible. Since version 1.8.0, only an opaque typedef
424  * is visible from the outside world. Any operation on these data types
425  * must be done using the appropriate interface functions.
426  *
427  * This policy has the great advantage that it is now possible to change
428  * the internal implementation of these data structures without breaking
429  * the API.
430  */
431 #include "ActionComplete.h"
432 #include "ActionRequest.h"
433 #include "Discovery.h"
434 #include "Event.h"
435 #include "EventSubscribe.h"
436 #include "FileInfo.h"
437 #include "StateVarComplete.h"
438 #include "StateVarRequest.h"
439 #include "SubscriptionRequest.h"
440 
441 
448 enum UpnpOpenFileMode
449 {
450  UPNP_READ,
451  UPNP_WRITE
452 };
453 
461 typedef int UpnpClient_Handle;
462 
470 typedef int UpnpDevice_Handle;
471 
480  /*
481  * Control callbacks
482  */
483 
489 
494 
500 
505 
506  /*
507  * Discovery callbacks
508  */
509 
515 
521 
527 
532 
533  /*
534  * Eventing callbacks
535  */
536 
547 
552 
557 
562 
567 
573 
579 };
580 
581 typedef enum Upnp_EventType_e Upnp_EventType;
582 
590 typedef char Upnp_SID[44];
591 
603 
606 
609 
613 };
614 
615 typedef enum Upnp_SType_e Upnp_SType;
616 
626 
630 
634 };
635 
636 typedef enum Upnp_DescType_e Upnp_DescType;
637 
638 
664 typedef int (*Upnp_FunPtr)(
666  Upnp_EventType EventType,
668  void *Event,
670  void *Cookie);
671 
672 /* @} Constants and Types */
673 
674 
675 #ifdef __cplusplus
676 extern "C" {
677 #endif /* __cplusplus */
678 
679 
723  const char *HostIP,
726  unsigned short DestPort);
727 
728 
765  const char *IfName,
768  unsigned short DestPort);
769 
770 
790 EXPORT_SPEC int UpnpFinish(void);
791 
792 
804 EXPORT_SPEC unsigned short UpnpGetServerPort(void);
805 
806 
818 EXPORT_SPEC unsigned short UpnpGetServerPort6(void);
819 
831 EXPORT_SPEC const char *UpnpGetServerIpAddress(void);
832 
833 
845 EXPORT_SPEC const char *UpnpGetServerIp6Address(void);
846 
847 
887  const char *DescUrl,
889  Upnp_FunPtr Callback,
891  const void *Cookie,
893  UpnpDevice_Handle *Hnd);
894 
965  Upnp_DescType descriptionType,
968  const char* description,
971  size_t bufferLen,
974  int config_baseURL,
976  Upnp_FunPtr Fun,
979  const void* Cookie,
981  UpnpDevice_Handle* Hnd);
982 
983 
1022  const char *DescUrl,
1024  Upnp_FunPtr Callback,
1026  const void *Cookie,
1028  UpnpDevice_Handle *Hnd,
1031  const int AddressFamily);
1032 
1033 
1051  UpnpDevice_Handle Hnd);
1052 
1053 
1074  Upnp_FunPtr Callback,
1076  const void *Cookie,
1078  UpnpClient_Handle *Hnd);
1079 
1080 
1099  UpnpClient_Handle Hnd);
1100 
1101 
1111  UpnpClient_Handle Hnd,
1113  int contentLength);
1114 
1115 
1133  size_t contentLength);
1134 
1135 
1136 /* @} Initialization and Registration */
1137 
1138 
1139 /******************************************************************************
1140  ******************************************************************************
1141  * *
1142  * D I S C O V E R Y *
1143  * *
1144  ******************************************************************************
1145  ******************************************************************************/
1146 
1147 
1180  UpnpClient_Handle Hnd,
1185  int Mx,
1188  const char *TTarget_constarget_const,
1190  const void *Cookie_const);
1191 
1209  UpnpDevice_Handle Hnd,
1211  int Exp);
1212 
1213 
1214 /* @} Discovery */
1215 
1216 
1217 /******************************************************************************
1218  ******************************************************************************
1219  * *
1220  * C O N T R O L *
1221  * *
1222  ******************************************************************************
1223  ******************************************************************************/
1224 
1225 
1260  UpnpClient_Handle Hnd,
1262  const char *ActionURL,
1264  const char *VarName,
1268  DOMString *StVarVal);
1269 
1270 
1290  UpnpClient_Handle Hnd,
1292  const char *ActionURL,
1294  const char *VarName,
1297  Upnp_FunPtr Fun,
1299  const void *Cookie);
1300 
1301 
1327  UpnpClient_Handle Hnd,
1329  const char *ActionURL,
1331  const char *ServiceType,
1333  const char *DevUDN,
1335  IXML_Document *Action,
1338  IXML_Document **RespNode);
1339 
1340 
1366  UpnpClient_Handle Hnd,
1368  const char *ActionURL,
1370  const char *ServiceType,
1372  const char *DevUDN,
1375  IXML_Document *Header,
1377  IXML_Document *Action,
1380  IXML_Document **RespNode);
1381 
1382 
1406  UpnpClient_Handle Hnd,
1408  const char *ActionURL,
1410  const char *ServiceType,
1412  const char *DevUDN,
1414  IXML_Document *Action,
1417  Upnp_FunPtr Fun,
1420  const void *Cookie);
1421 
1422 
1446  UpnpClient_Handle Hnd,
1448  const char *ActionURL,
1450  const char *ServiceType,
1452  const char *DevUDN,
1455  IXML_Document *Header,
1457  IXML_Document *Action,
1460  Upnp_FunPtr Fun,
1463  const void *Cookie);
1464 
1465 
1469 /******************************************************************************
1470  ******************************************************************************
1471  * *
1472  * E V E N T I N G *
1473  * *
1474  ******************************************************************************
1475  ******************************************************************************/
1476 
1477 
1512  UpnpDevice_Handle Hnd,
1514  const char *DevID,
1516  const char *ServID,
1518  const char **VarName,
1520  const char **NewVal,
1522  int cVariables,
1524  const Upnp_SID SubsId);
1525 
1526 
1551  UpnpDevice_Handle Hnd,
1553  const char *DevID,
1555  const char *ServID,
1559  IXML_Document *PropSet,
1561  const Upnp_SID SubsId);
1562 
1563 
1589  const char *DevID,
1591  const char *ServID,
1593  const char **VarName,
1595  const char **NewVal,
1597  int cVariables);
1598 
1599 
1625  const char *DevID,
1627  const char *ServID,
1631  IXML_Document *PropSet);
1632 
1633 
1664  UpnpClient_Handle Hnd,
1667  int *TimeOut,
1669  const Upnp_SID SubsId);
1670 
1671 
1721  UpnpClient_Handle Hnd,
1724  int TimeOut,
1726  Upnp_SID SubsId,
1729  Upnp_FunPtr Fun,
1731  const void *Cookie);
1732 
1733 
1750  UpnpDevice_Handle Hnd,
1752  int MaxSubscriptions);
1753 
1754 
1772  UpnpDevice_Handle Hnd,
1774  int MaxSubscriptionTimeOut);
1775 
1776 
1808  UpnpClient_Handle Hnd,
1810  const char *PublisherUrl,
1814  int *TimeOut,
1816  Upnp_SID SubsId);
1817 
1818 
1869  UpnpClient_Handle Hnd,
1871  const char *PublisherUrl,
1874  int TimeOut,
1876  Upnp_FunPtr Fun,
1878  const void *Cookie);
1879 
1880 
1912  UpnpClient_Handle Hnd,
1914  const Upnp_SID SubsId);
1915 
1916 
1965  UpnpClient_Handle Hnd,
1967  Upnp_SID SubsId,
1970  Upnp_FunPtr Fun,
1972  const void *Cookie);
1973 
1974 
1979 /******************************************************************************
1980  ******************************************************************************
1981  * *
1982  * C L I E N T - A P I *
1983  * *
1984  ******************************************************************************
1985  ******************************************************************************/
1986 
2021  const char *url,
2023  char **outBuf,
2026  char *contentType);
2027 
2028 
2059  const char *url,
2061  void **handle,
2063  char **contentType,
2065  int *contentLength,
2067  int *httpStatus,
2071  int timeout);
2072 
2073 
2104  const char *url,
2106  const char *proxy_str,
2108  void **handle,
2110  char **contentType,
2112  int *contentLength,
2114  int *httpStatus,
2118  int timeout);
2119 
2120 
2153  const char *url,
2155  void **handle,
2157  char **contentType,
2159  int *contentLength,
2161  int *httpStatus,
2163  int lowRange,
2165  int highRange,
2169  int timeout);
2170 
2171 
2191  void *handle,
2193  char *buf,
2195  unsigned int *size,
2199  int timeout);
2200 
2201 
2212  void *handle,
2214  unsigned int *length,
2216  unsigned int *total);
2217 
2218 
2229  void *handle);
2230 
2242  void *handle);
2243 
2244 
2272  const char *url,
2275  void **handle,
2277  const char *contentType,
2279  int contentLength,
2282  int timeout);
2283 
2284 
2301  void *handle,
2303  char *buf,
2305  unsigned int *size,
2308  int timeout);
2309 
2310 
2327  void *handle,
2329  int *httpStatus,
2332  int timeout);
2333 
2334 
2364  const char *url,
2366  IXML_Document **xmlDoc);
2367 
2368 
2371 /******************************************************************************
2372  ******************************************************************************
2373  * *
2374  * W E B S E R V E R A P I *
2375  * *
2376  ******************************************************************************
2377  ******************************************************************************/
2378 
2403  const char *rootDir);
2404 
2405 
2409 typedef void *UpnpWebFileHandle;
2410 
2411 
2415 typedef int (*VDCallback_GetInfo)(
2417  const char *filename,
2419  UpnpFileInfo *info);
2420 
2421 
2431 
2432 
2438  const char *filename,
2441  enum UpnpOpenFileMode Mode);
2442 
2443 
2453 
2454 
2458 typedef int (*VDCallback_Read)(
2460  UpnpWebFileHandle fileHnd,
2462  char *buf,
2464  size_t buflen);
2465 
2466 
2476 
2477 
2481 typedef int (*VDCallback_Write)(
2483  UpnpWebFileHandle fileHnd,
2485  char *buf,
2487  size_t buflen);
2488 
2489 
2499 
2500 
2504 typedef int (*VDCallback_Seek) (
2506  UpnpWebFileHandle fileHnd,
2510  off_t offset,
2515  int origin);
2516 
2517 
2527 
2528 
2532 typedef int (*VDCallback_Close)(
2534  UpnpWebFileHandle fileHnd);
2535 
2536 
2546 
2547 
2557  int enable);
2558 
2559 
2568 
2569 
2586  const char *dirName);
2587 
2588 
2598  const char *dirName);
2599 
2600 
2605 
2606 
2607 /* @} Web Server API */
2608 
2609 
2610 
2611 #ifdef __cplusplus
2612 }
2613 #endif /* __cplusplus */
2614 
2615 
2616 /* @} UPnPAPI UPnP API */
2617 
2618 
2619 #endif /* UPNP_H */
2620 
int UpnpDownloadXmlDoc(const char *url, IXML_Document **xmlDoc)
Downloads an XML document specified in a URL.
Definition: upnpapi.c:2807
Definition: upnp.h:566
int UpnpClient_Handle
Returned when a control point application registers with UpnpRegisterClient.
Definition: upnp.h:461
UpnpEventSubscribe object declararion.
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:790
UpnpActionRequest object declaration.
const char * UpnpGetServerIp6Address(void)
Returns the local IPv6 listening ip address.
Definition: upnpapi.c:628
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:639
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:2117
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:623
Definition: upnp.h:578
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:2688
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:2466
int UpnpVirtualDir_set_GetInfoCallback(VDCallback_GetInfo callback)
Sets the get_info callback function to be used to access a virtual directory.
Definition: upnpapi.c:3812
Definition: upnp.h:572
Definition: upnp.h:526
void UpnpRemoveAllVirtualDirs(void)
Removes all virtual directory mappings.
Definition: upnpapi.c:3743
int(* VDCallback_GetInfo)(const char *filename, UpnpFileInfo *info)
Get-info callback function prototype.
Definition: upnp.h:2415
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:2574
int UpnpRenewSubscription(UpnpClient_Handle Hnd, int *TimeOut, const Upnp_SID SubsId)
Renews a subscription that is about to expire.
Definition: upnpapi.c:1906
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:2710
Upnp_SType_e
Represents the different types of searches that can be performed using the SDK for UPnP Devices API...
Definition: upnp.h:600
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:2732
Definition: upnp.h:531
unsigned short UpnpGetServerPort(void)
Returns the internal server IPv4 UPnP listening port.
Definition: upnpapi.c:598
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:1846
int UpnpSetMaxSubscriptions(UpnpDevice_Handle Hnd, int MaxSubscriptions)
Sets the maximum number of subscriptions accepted per service.
Definition: upnpapi.c:1604
int UpnpRemoveVirtualDir(const char *dirName)
Removes a virtual directory mapping made with UpnpAddVirtualDir.
Definition: upnpapi.c:3692
Definition: upnp.h:551
Definition: upnp.h:493
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:1734
int UpnpCloseHttpGet(void *handle)
Closes the connection and frees memory that was allocated for the handle parameter.
Definition: upnpapi.c:2769
Definition: upnp.h:633
int UpnpRegisterRootDevice3(const char *DescUrl, Upnp_FunPtr Callback, const void *Cookie, UpnpDevice_Handle *Hnd, const int AddressFamily)
Registers a device application for a specific address family with the UPnP library.
Definition: upnpapi.c:920
Definition: upnp.h:602
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:1801
UpnpWebFileHandle(* VDCallback_Open)(const char *filename, enum UpnpOpenFileMode Mode)
Open callback function prototype.
Definition: upnp.h:2436
Definition: upnp.h:605
int UpnpVirtualDir_set_CloseCallback(VDCallback_Close callback)
Sets the close callback function to be used to access a virtual directory.
Definition: upnpapi.c:3877
Definition: upnp.h:546
Definition: ssdplib.h:117
int UpnpVirtualDir_set_OpenCallback(VDCallback_Open callback)
Sets the open callback function to be used to access a virtual directory.
Definition: upnpapi.c:3825
Definition: upnp.h:629
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:2747
int UpnpInit2(const char *IfName, unsigned short DestPort)
Initializes the Linux SDK for UPnP Devices (IPv4 or IPv6).
Definition: upnpapi.c:476
int UpnpUnRegisterRootDevice(UpnpDevice_Handle Hnd)
Unregisters a root device registered with UpnpRegisterRootDevice or UpnpRegisterRootDevice2.
Definition: upnpapi.c:1054
int UpnpSendAdvertisement(UpnpDevice_Handle Hnd, int Exp)
Sends out the discovery announcements for all devices and services for a device.
Definition: upnpapi.c:1457
Definition: upnp.h:612
int UpnpHttpGetProgress(void *handle, unsigned int *length, unsigned int *total)
Retrieve progress information of a http-get transfer.
Definition: upnpapi.c:2781
Upnp_EventType_e
The reason code for an event callback.
Definition: upnp.h:479
Definition: upnp.h:561
Definition: upnp.h:625
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:3864
int UpnpIsWebserverEnabled(void)
Returns TRUE if the webserver is enabled, or FALSE if it is not.
Definition: upnpapi.c:3802
int UpnpVirtualDir_set_ReadCallback(VDCallback_Read callback)
Sets the read callback function to be used to access a virtual directory.
Definition: upnpapi.c:3838
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:2275
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:2787
Definition: upnp.h:499
int UpnpInit(const char *HostIP, unsigned short DestPort)
Initializes the Linux SDK for UPnP Devices (IPv4 only).
Definition: upnpapi.c:420
int UpnpCancelHttpGet(void *handle)
Set the cancel flag of the handle parameter.
Definition: upnpapi.c:2763
UpnpActionComplete object declararion.
int UpnpDevice_Handle
Returned when a device application registers with UpnpRegisterRootDevice or UpnpRegisterRootDevice2.
Definition: upnp.h:470
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:2022
struct s_UpnpFileInfo UpnpFileInfo
Definition: FileInfo.h:17
int(* VDCallback_Write)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen)
Write callback function prototype.
Definition: upnp.h:2481
UpnpFileInfo object declararion.
Definition: upnp.h:504
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:2719
int UpnpSetMaxSubscriptionTimeOut(UpnpDevice_Handle Hnd, int MaxSubscriptionTimeOut)
Sets the maximum time-out accepted for a subscription request or renewal.
Definition: upnpapi.c:1635
unsigned short UpnpGetServerPort6(void)
Returns the internal server IPv6 UPnP listening port.
Definition: upnpapi.c:608
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:2328
int UpnpReadHttpGet(void *handle, char *buf, unsigned int *size, int timeout)
Gets specified number of bytes from a file specified in a URL.
Definition: upnpapi.c:2775
int(* VDCallback_Seek)(UpnpWebFileHandle fileHnd, off_t offset, int origin)
Seek callback function prototype.
Definition: upnp.h:2504
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:2073
UpnpEvent object declararion.
int(* VDCallback_Close)(UpnpWebFileHandle fileHnd)
Close callback function prototype.
Definition: upnp.h:2532
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:3851
#define DOMString
The type of DOM strings.
Definition: ixml.h:55
Definition: upnp.h:608
Definition: upnp.h:488
void * UpnpWebFileHandle
The type of handle returned by the web server for open requests.
Definition: upnp.h:2409
int UpnpUnRegisterClient(UpnpClient_Handle Hnd)
Unregisters a control point application, unsubscribing all active subscriptions.
Definition: upnpapi.c:1175
Data structure representing the DOM Document.
Definition: ixml.h:183
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:2381
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:1668
int(* VDCallback_Read)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen)
Read callback function prototype.
Definition: upnp.h:2458
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
Definition: upnp.h:590
const char * UpnpGetServerIpAddress(void)
Returns the local IPv4 listening ip address.
Definition: upnpapi.c:618
int UpnpFinish(void)
Terminates the Linux SDK for UPnP Devices.
Definition: upnpapi.c:524
int(* Upnp_FunPtr)(Upnp_EventType EventType, void *Event, void *Cookie)
Definition: upnp.h:664
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:1958
UpnpSubscriptionRequest object declararion.
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:1553
int UpnpWriteHttpPost(void *handle, char *buf, unsigned int *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:2700
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:2193
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:3925
Definition: upnp.h:556
UpnpStateVarComplete object declararion.
int UpnpEnableWebserver(int enable)
Enables or disables the webserver.
Definition: upnpapi.c:3765
int UpnpSetContentLength(UpnpClient_Handle Hnd, int contentLength)
Definition: upnpapi.c:3890
#define EXPORT_SPEC
Export functions on WIN32 DLLs.
Definition: UpnpGlobal.h:82
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:1118
int UpnpAddVirtualDir(const char *dirName)
Adds a virtual directory mapping.
Definition: upnpapi.c:3636
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:2635