libUPnP  1.6.20
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 #include "UpnpString.h"
49 
50 /*
51  * \todo Document the exact reason of these include files and solve this
52  * include mess in an include file like UpnpTime.h
53  */
54 #ifdef WIN32
55  #include <time.h>
56  #ifdef UPNP_USE_MSVCPP
57  #include <sys/types.h> /* needed for off_t */
58  #endif
59 #elif (defined(BSD) && BSD >= 199306)
60  #include <time.h>
61 #else
62  /* Other systems ??? */
63 #endif
64 
65 #define LINE_SIZE (size_t)180
66 #define NAME_SIZE (size_t)256
67 #define MNFT_NAME_SIZE 64
68 #define MODL_NAME_SIZE 32
69 #define SERL_NUMR_SIZE 64
70 #define MODL_DESC_SIZE 64
71 #define UPNP_INFINITE -1
72 #define UPNP_USING_CHUNKED -3
73 #define UPNP_UNTIL_CLOSE -4
74 
94 #define UPNP_E_SUCCESS 0
95 
99 #define UPNP_E_INVALID_HANDLE -100
100 
107 #define UPNP_E_INVALID_PARAM -101
108 
114 #define UPNP_E_OUTOF_HANDLE -102
115 
116 #define UPNP_E_OUTOF_CONTEXT -103
117 
123 #define UPNP_E_OUTOF_MEMORY -104
124 
131 #define UPNP_E_INIT -105
132 
133 #define UPNP_E_BUFFER_TOO_SMALL -106
134 
140 #define UPNP_E_INVALID_DESC -107
141 
149 #define UPNP_E_INVALID_URL -108
150 
151 #define UPNP_E_INVALID_SID -109
152 
153 #define UPNP_E_INVALID_DEVICE -110
154 
161 #define UPNP_E_INVALID_SERVICE -111
162 
169 #define UPNP_E_BAD_RESPONSE -113
170 
171 #define UPNP_E_BAD_REQUEST -114
172 
179 #define UPNP_E_INVALID_ACTION -115
180 
186 #define UPNP_E_FINISH -116
187 
193 #define UPNP_E_INIT_FAILED -117
194 
200 #define UPNP_E_URL_TOO_BIG -118
201 
211 #define UPNP_E_BAD_HTTPMSG -119
212 
219 #define UPNP_E_ALREADY_REGISTERED -120
220 
225 #define UPNP_E_INVALID_INTERFACE -121
226 
234 #define UPNP_E_NETWORK_ERROR -200
235 
244 #define UPNP_E_SOCKET_WRITE -201
245 
254 #define UPNP_E_SOCKET_READ -202
255 
264 #define UPNP_E_SOCKET_BIND -203
265 
274 #define UPNP_E_SOCKET_CONNECT -204
275 
284 #define UPNP_E_OUTOF_SOCKET -205
285 
292 #define UPNP_E_LISTEN -206
293 
300 #define UPNP_E_TIMEDOUT -207
301 
308 #define UPNP_E_SOCKET_ERROR -208
309 
310 #define UPNP_E_FILE_WRITE_ERROR -209
311 
316 #define UPNP_E_CANCELED -210
317 
318 #define UPNP_E_EVENT_PROTOCOL -300
319 
323 #define UPNP_E_SUBSCRIBE_UNACCEPTED -301
324 
328 #define UPNP_E_UNSUBSCRIBE_UNACCEPTED -302
329 
333 #define UPNP_E_NOTIFY_UNACCEPTED -303
334 
341 #define UPNP_E_INVALID_ARGUMENT -501
342 
347 #define UPNP_E_FILE_NOT_FOUND -502
348 
352 #define UPNP_E_FILE_READ_ERROR -503
353 
358 #define UPNP_E_EXT_NOT_XML -504
359 
360 #define UPNP_E_NO_WEB_SERVER -505
361 #define UPNP_E_OUTOF_BOUNDS -506
362 
367 #define UPNP_E_NOT_FOUND -507
368 
373 #define UPNP_E_INTERNAL_ERROR -911
374 
375 /* SOAP-related error codes */
376 #define UPNP_SOAP_E_INVALID_ACTION 401
377 #define UPNP_SOAP_E_INVALID_ARGS 402
378 #define UPNP_SOAP_E_OUT_OF_SYNC 403
379 #define UPNP_SOAP_E_INVALID_VAR 404
380 #define UPNP_SOAP_E_ACTION_FAILED 501
381 
382 /* @} ErrorCodes */
383 
384 #if UPNP_VERSION >= 10800
385 /*
386  * Opaque data structures. The following includes are data structures that
387  * must be externally visible. Since version 1.8.0, only an opaque typedef
388  * is visible from the outside world. Any operation on these data types
389  * must be done using the appropriate interface functions.
390  *
391  * This policy has the great advantage that it is now possible to change
392  * the internal implementation of these data structures without breaking
393  * the API.
394  */
395 #include "ActionComplete.h"
396 #include "ActionRequest.h"
397 #include "Discovery.h"
398 #include "Event.h"
399 #include "EventSubscribe.h"
400 #include "FileInfo.h"
401 #include "StateVarComplete.h"
402 #include "StateVarRequest.h"
403 #include "SubscriptionRequest.h"
404 #endif /* UPNP_VERSION >= 10800 */
405 
412 enum UpnpOpenFileMode
413 {
414  UPNP_READ,
415  UPNP_WRITE
416 };
417 
425 typedef int UpnpClient_Handle;
426 
435 typedef int UpnpDevice_Handle;
436 
445  /*
446  * Control callbacks
447  */
448 
454 
459 
465 
470 
471  /*
472  * Discovery callbacks
473  */
474 
480 
486 
492 
497 
498  /*
499  * Eventing callbacks
500  */
501 
512 
517 
522 
527 
532 
538 
544 };
545 
546 typedef enum Upnp_EventType_e Upnp_EventType;
547 
555 typedef char Upnp_SID[44];
556 
568 
571 
574 
578 };
579 
580 typedef enum Upnp_SType_e Upnp_SType;
581 
591 
595 
599 };
600 
601 typedef enum Upnp_DescType_e Upnp_DescType;
602 
603 #if UPNP_VERSION < 10800
604 
607 {
609  int ErrCode;
610 
612  int Socket;
613 
615  char ErrStr[LINE_SIZE];
616 
618  char ActionName[NAME_SIZE];
619 
621  char DevUDN[NAME_SIZE];
622 
624  char ServiceID[NAME_SIZE];
625 
628 
631 
633  struct sockaddr_storage CtrlPtIPAddr;
634 
638 };
639 
641 {
643  int ErrCode;
644 
647 
650 
653 
654 };
655 
660 {
662  int ErrCode;
663 
665  int Socket;
666 
668  char ErrStr[LINE_SIZE];
669 
671  char DevUDN[NAME_SIZE];
672 
674  char ServiceID[NAME_SIZE];
675 
677  char StateVarName[NAME_SIZE];
678 
680  struct sockaddr_storage CtrlPtIPAddr;
681 
685 };
686 
691 {
693  int ErrCode;
694 
697 
699  char StateVarName[NAME_SIZE];
700 
703 };
704 
708 {
711 
713  int EventKey;
714 
717 
718 };
719 
720 /*
721  * This typedef is required by Doc++ to parse the last entry of the
722  * Upnp_Discovery structure correctly.
723  */
724 
725 
728 {
730  int ErrCode;
731 
733  int Expires;
734 
736  char DeviceId[LINE_SIZE];
737 
739  char DeviceType[LINE_SIZE];
740 
742  char ServiceType[LINE_SIZE];
743 
745  char ServiceVer[LINE_SIZE];
746 
748  char Location[LINE_SIZE];
749 
751  char Os[LINE_SIZE];
752 
754  char Date[LINE_SIZE];
755 
757  char Ext[LINE_SIZE];
758 
760  struct sockaddr_storage DestAddr;
761 };
762 
767 
775 
777  int ErrCode;
778 
781 
783  int TimeOut;
784 
785 };
786 
791 {
793  char *ServiceId;
794 
796  char *UDN;
797 
800 
801 };
802 
803 struct File_Info
804 {
808  off_t file_length;
809 
813 
817 
821 
826 };
827 #endif /* UPNP_VERSION < 10800 */
828 
854 typedef int (*Upnp_FunPtr)(
856  Upnp_EventType EventType,
858  void *Event,
860  void *Cookie);
861 
862 /* @} Constants and Types */
863 
864 #ifdef __cplusplus
865 extern "C" {
866 #endif /* __cplusplus */
867 
910  const char *HostIP,
913  unsigned short DestPort);
914 
947 #ifdef UPNP_ENABLE_IPV6
952  const char *IfName,
955  unsigned short DestPort);
956 #endif
957 
977 EXPORT_SPEC int UpnpFinish(void);
978 
990 EXPORT_SPEC unsigned short UpnpGetServerPort(void);
991 
1003 #ifdef UPNP_ENABLE_IPV6
1004 EXPORT_SPEC unsigned short UpnpGetServerPort6(void);
1005 #endif
1006 
1018 
1030 #ifdef UPNP_ENABLE_IPV6
1032 
1033 EXPORT_SPEC char *UpnpGetServerUlaGuaIp6Address(void);
1034 #endif
1035 
1074  const char *DescUrl,
1076  Upnp_FunPtr Callback,
1078  const void *Cookie,
1080  UpnpDevice_Handle *Hnd);
1081 
1152  Upnp_DescType descriptionType,
1155  const char* description,
1158  size_t bufferLen,
1161  int config_baseURL,
1163  Upnp_FunPtr Fun,
1166  const void* Cookie,
1168  UpnpDevice_Handle* Hnd);
1169 
1208  const char *DescUrl,
1210  Upnp_FunPtr Callback,
1212  const void *Cookie,
1214  UpnpDevice_Handle *Hnd,
1217  int AddressFamily);
1218 
1258  const char *DescUrl,
1260  Upnp_FunPtr Callback,
1262  const void *Cookie,
1264  UpnpDevice_Handle *Hnd,
1267  int AddressFamily,
1270  const char *LowerDescUrl);
1271 
1290  UpnpDevice_Handle Hnd);
1291 
1313  UpnpDevice_Handle Hnd,
1315  int PowerState,
1317  int SleepPeriod,
1319  int RegistrationState);
1320 
1341  Upnp_FunPtr Callback,
1343  const void *Cookie,
1345  UpnpClient_Handle *Hnd);
1346 
1365  UpnpClient_Handle Hnd);
1366 
1376  UpnpClient_Handle Hnd,
1378  size_t contentLength);
1379 
1399  size_t contentLength);
1400 
1401 /* @} Initialization and Registration */
1402 
1403 /******************************************************************************
1404  ******************************************************************************
1405  * *
1406  * D I S C O V E R Y *
1407  * *
1408  ******************************************************************************
1409  ******************************************************************************/
1410 
1442  UpnpClient_Handle Hnd,
1447  int Mx,
1450  const char *TTarget_constarget_const,
1452  const void *Cookie_const);
1453 
1471  UpnpDevice_Handle Hnd,
1473  int Exp);
1474 
1495  UpnpDevice_Handle Hnd,
1497  int Exp,
1499  int PowerState,
1501  int SleepPeriod,
1503  int RegistrationState);
1504 
1505 /* @} Discovery */
1506 
1507 /******************************************************************************
1508  ******************************************************************************
1509  * *
1510  * C O N T R O L *
1511  * *
1512  ******************************************************************************
1513  ******************************************************************************/
1514 
1548  UpnpClient_Handle Hnd,
1550  const char *ActionURL,
1552  const char *VarName,
1556  DOMString *StVarVal);
1557 
1577  UpnpClient_Handle Hnd,
1579  const char *ActionURL,
1581  const char *VarName,
1584  Upnp_FunPtr Fun,
1586  const void *Cookie);
1587 
1613  UpnpClient_Handle Hnd,
1615  const char *ActionURL,
1617  const char *ServiceType,
1619  const char *DevUDN,
1621  IXML_Document *Action,
1624  IXML_Document **RespNode);
1625 
1651  UpnpClient_Handle Hnd,
1653  const char *ActionURL,
1655  const char *ServiceType,
1657  const char *DevUDN,
1660  IXML_Document *Header,
1662  IXML_Document *Action,
1665  IXML_Document **RespNode);
1666 
1690  UpnpClient_Handle Hnd,
1692  const char *ActionURL,
1694  const char *ServiceType,
1696  const char *DevUDN,
1698  IXML_Document *Action,
1701  Upnp_FunPtr Fun,
1704  const void *Cookie);
1705 
1729  UpnpClient_Handle Hnd,
1731  const char *ActionURL,
1733  const char *ServiceType,
1735  const char *DevUDN,
1738  IXML_Document *Header,
1740  IXML_Document *Action,
1743  Upnp_FunPtr Fun,
1746  const void *Cookie);
1747 
1750 /******************************************************************************
1751  ******************************************************************************
1752  * *
1753  * E V E N T I N G *
1754  * *
1755  ******************************************************************************
1756  ******************************************************************************/
1757 
1791  UpnpDevice_Handle Hnd,
1793  const char *DevID,
1795  const char *ServID,
1797  const char **VarName,
1799  const char **NewVal,
1801  int cVariables,
1803  const Upnp_SID SubsId);
1804 
1829  UpnpDevice_Handle Hnd,
1831  const char *DevID,
1833  const char *ServID,
1837  IXML_Document *PropSet,
1839  Upnp_SID SubsId);
1840 
1866  const char *DevID,
1868  const char *ServID,
1870  const char **VarName,
1872  const char **NewVal,
1874  int cVariables);
1875 
1901  const char *DevID,
1903  const char *ServID,
1907  IXML_Document *PropSet);
1908 
1939  UpnpClient_Handle Hnd,
1942  int *TimeOut,
1944  const Upnp_SID SubsId);
1945 
1995  UpnpClient_Handle Hnd,
1998  int TimeOut,
2000  Upnp_SID SubsId,
2003  Upnp_FunPtr Fun,
2005  const void *Cookie);
2006 
2023  UpnpDevice_Handle Hnd,
2025  int MaxSubscriptions);
2026 
2044  UpnpDevice_Handle Hnd,
2046  int MaxSubscriptionTimeOut);
2047 
2079  UpnpClient_Handle Hnd,
2081  const char *PublisherUrl,
2085  int *TimeOut,
2087  Upnp_SID SubsId);
2088 
2139  UpnpClient_Handle Hnd,
2141  const char *PublisherUrl,
2144  int TimeOut,
2146  Upnp_FunPtr Fun,
2148  const void *Cookie);
2149 
2181  UpnpClient_Handle Hnd,
2183  const Upnp_SID SubsId);
2184 
2233  UpnpClient_Handle Hnd,
2235  Upnp_SID SubsId,
2238  Upnp_FunPtr Fun,
2240  const void *Cookie);
2241 
2245 /******************************************************************************
2246  ******************************************************************************
2247  * *
2248  * C L I E N T - A P I *
2249  * *
2250  ******************************************************************************
2251  ******************************************************************************/
2252 
2287  const char *url,
2289  char **outBuf,
2292  char *contentType);
2293 
2324  const char *url,
2326  void **handle,
2328  char **contentType,
2330  int *contentLength,
2332  int *httpStatus,
2336  int timeout);
2337 
2368  const char *url,
2370  const char *proxy_str,
2372  void **handle,
2374  char **contentType,
2376  int *contentLength,
2378  int *httpStatus,
2382  int timeout);
2383 
2416  const char *url,
2418  void **handle,
2420  char **contentType,
2422  int *contentLength,
2424  int *httpStatus,
2426  int lowRange,
2428  int highRange,
2432  int timeout);
2433 
2453  void *handle,
2455  char *buf,
2457  size_t *size,
2461  int timeout);
2462 
2473  void *handle,
2475  size_t *length,
2477  size_t *total);
2478 
2489  void *handle);
2490 
2502  void *handle);
2503 
2531  const char *url,
2534  void **handle,
2536  const char *contentType,
2538  int contentLength,
2541  int timeout);
2542 
2559  void *handle,
2561  char *buf,
2563  size_t *size,
2566  int timeout);
2567 
2584  void *handle,
2586  int *httpStatus,
2589  int timeout);
2590 
2620  const char *url,
2622  IXML_Document **xmlDoc);
2623 
2626 /******************************************************************************
2627  ******************************************************************************
2628  * *
2629  * W E B S E R V E R A P I *
2630  * *
2631  ******************************************************************************
2632  ******************************************************************************/
2633 
2658  const char *rootDir);
2659 
2663 typedef void *UpnpWebFileHandle;
2664 
2668 typedef int (*VDCallback_GetInfo)(
2670  const char *filename,
2672 #if UPNP_VERSION < 10800
2673  struct File_Info *info
2674 #else
2675  UpnpFileInfo *info
2676 #endif /* UPNP_VERSION < 10800 */
2677  );
2678 
2688 
2694  const char *filename,
2697  enum UpnpOpenFileMode Mode);
2698 
2708 
2712 typedef int (*VDCallback_Read)(
2714  UpnpWebFileHandle fileHnd,
2716  char *buf,
2718  size_t buflen);
2719 
2729 
2733 typedef int (*VDCallback_Write)(
2735  UpnpWebFileHandle fileHnd,
2737  char *buf,
2739  size_t buflen);
2740 
2750 
2754 typedef int (*VDCallback_Seek) (
2756  UpnpWebFileHandle fileHnd,
2760  off_t offset,
2765  int origin);
2766 
2776 
2780 typedef int (*VDCallback_Close)(
2782  UpnpWebFileHandle fileHnd);
2783 
2793 
2800 {
2801  VDCallback_GetInfo get_info;
2802  VDCallback_Open open;
2803  VDCallback_Read read;
2804  VDCallback_Write write;
2805  VDCallback_Seek seek;
2806  VDCallback_Close close;
2807 };
2808 
2818  int enable);
2819 
2828 
2838  struct UpnpVirtualDirCallbacks *callbacks );
2839 
2856  const char *dirName);
2857 
2867  const char *dirName);
2868 
2873 
2874 /* @} Web Server API */
2875 
2876 #ifdef __cplusplus
2877 }
2878 #endif /* __cplusplus */
2879 
2880 /* @} UPnPAPI UPnP API */
2881 
2882 #endif /* UPNP_H */
int UpnpDownloadXmlDoc(const char *url, IXML_Document **xmlDoc)
Downloads an XML document specified in a URL.
Definition: upnpapi.c:3171
char * ServiceId
Definition: upnp.h:793
Definition: upnp.h:531
int UpnpClient_Handle
Returned when a control point application registers with UpnpRegisterClient.
Definition: upnp.h:425
IXML_Document * ActionResult
Definition: upnp.h:652
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:1083
char ActionName[(size_t) 256]
Definition: upnp.h:618
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:937
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:772
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:2437
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:588
Definition: upnp.h:543
Definition: upnp.h:727
The { UpnpVirtualDirCallbacks} structure contains the pointers to file-related callback functions a d...
Definition: upnp.h:2799
IXML_Document * ActionRequest
Definition: upnp.h:627
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:3055
char DevUDN[(size_t) 256]
Definition: upnp.h:621
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:2808
int ErrCode
Definition: upnp.h:777
int UpnpVirtualDir_set_GetInfoCallback(VDCallback_GetInfo callback)
Sets the get_info callback function to be used to access a virtual directory.
Definition: upnpapi.c:4245
Definition: upnp.h:537
Definition: upnp.h:491
void UpnpRemoveAllVirtualDirs(void)
Removes all virtual directory mappings.
Definition: upnpapi.c:4155
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:2930
int UpnpRenewSubscription(UpnpClient_Handle Hnd, int *TimeOut, const Upnp_SID SubsId)
Renews a subscription that is about to expire.
Definition: upnpapi.c:2208
IXML_Document * ActionRequest
Definition: upnp.h:649
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 is_readable
Definition: upnp.h:820
Upnp_SType_e
Represents the different types of searches that can be performed using the SDK for UPnP Devices API...
Definition: upnp.h:565
int UpnpSetVirtualDirCallbacks(struct UpnpVirtualDirCallbacks *callbacks)
Sets the callback functions to be used to access a virtual directory.
Definition: upnpapi.c:4223
time_t last_modified
Definition: upnp.h:812
UpnpString object declaration.
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:3099
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:1680
int Socket
Definition: upnp.h:665
int UpnpAcceptSubscriptionExt(UpnpDevice_Handle Hnd, const char *DevID, const char *ServID, IXML_Document *PropSet, Upnp_SID SubsId)
Similar to UpnpAcceptSubscription() except that it takes a DOM document for the variables to event ra...
Definition: upnpapi.c:2516
Definition: upnp.h:496
unsigned short UpnpGetServerPort(void)
Returns the internal server IPv4 UPnP listening port.
Definition: upnpapi.c:678
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:2140
int UpnpSetMaxSubscriptions(UpnpDevice_Handle Hnd, int MaxSubscriptions)
Sets the maximum number of subscriptions accepted per service.
Definition: upnpapi.c:1847
int UpnpRemoveVirtualDir(const char *dirName)
Removes a virtual directory mapping made with UpnpAddVirtualDir.
Definition: upnpapi.c:4106
Definition: upnp.h:516
Definition: upnp.h:458
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:2021
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:1268
int UpnpCloseHttpGet(void *handle)
Closes the connection and frees memory that was allocated for the handle parameter.
Definition: upnpapi.c:3136
Definition: upnp.h:598
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:1099
char * UDN
Definition: upnp.h:796
Definition: upnp.h:567
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:3142
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:2092
Definition: upnp.h:570
int UpnpVirtualDir_set_CloseCallback(VDCallback_Close callback)
Sets the close callback function to be used to access a virtual directory.
Definition: upnpapi.c:4310
Definition: upnp.h:511
int UpnpSetContentLength(UpnpClient_Handle Hnd, size_t contentLength)
Definition: upnpapi.c:4322
int TimeOut
Definition: upnp.h:783
int UpnpVirtualDir_set_OpenCallback(VDCallback_Open callback)
Sets the open callback function to be used to access a virtual directory.
Definition: upnpapi.c:4258
Definition: upnp.h:594
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:3114
int UpnpInit2(const char *IfName, unsigned short DestPort)
Initializes the Linux SDK for UPnP Devices (IPv4 or IPv6).
Definition: upnp.h:766
int ErrCode
Definition: upnp.h:662
int UpnpUnRegisterRootDevice(UpnpDevice_Handle Hnd)
Unregisters a root device registered with UpnpRegisterRootDevice, UpnpRegisterRootDevice2, UpnpRegisterRootDevice3 or UpnpRegisterRootDevice4.
Definition: upnpapi.c:1261
DOMString content_type
Definition: upnp.h:825
int UpnpSendAdvertisement(UpnpDevice_Handle Hnd, int Exp)
Sends out the discovery announcements for all devices and services for a device.
Definition: upnpapi.c:1673
int ErrCode
Definition: upnp.h:730
int Expires
Definition: upnp.h:733
Definition: upnp.h:577
Definition: upnp.h:690
int(* VDCallback_GetInfo)(const char *filename, struct File_Info *info)
Get-info callback function prototype.
Definition: upnp.h:2668
Definition: upnp.h:606
char ServiceID[(size_t) 256]
Definition: upnp.h:624
Upnp_EventType_e
The reason code for an event callback.
Definition: upnp.h:444
Definition: upnp.h:526
Definition: upnp.h:590
int UpnpVirtualDir_set_SeekCallback(VDCallback_Seek callback)
Sets the seek callback function to be used to access a virtual directory.
Definition: upnpapi.c:4297
int UpnpIsWebserverEnabled(void)
Returns TRUE if the webserver is enabled, or FALSE if it is not.
Definition: upnpapi.c:4214
Definition: upnp.h:790
int UpnpVirtualDir_set_ReadCallback(VDCallback_Read callback)
Sets the read callback function to be used to access a virtual directory.
Definition: upnpapi.c:4271
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:2601
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:3154
struct sockaddr_storage CtrlPtIPAddr
Definition: upnp.h:633
Definition: upnp.h:464
Upnp_SID Sid
Definition: upnp.h:799
Definition: upnp.h:659
UpnpString * CtrlUrl
Definition: upnp.h:646
Upnp_SID Sid
Definition: upnp.h:710
int UpnpInit(const char *HostIP, unsigned short DestPort)
Initializes the Linux SDK for UPnP Devices (IPv4 only).
Definition: upnpapi.c:432
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
UpnpString * PublisherUrl
Definition: upnp.h:780
IXML_Document * SoapHeader
Definition: upnp.h:637
int ErrCode
Definition: upnp.h:609
int UpnpCancelHttpGet(void *handle)
Set the cancel flag of the handle parameter.
Definition: upnpapi.c:3130
int is_directory
Definition: upnp.h:816
Upnp_SID Sid
Definition: upnp.h:774
Definition: upnp.h:803
int UpnpDevice_Handle
Returned when a device application registers with UpnpRegisterRootDevice, UpnpRegisterRootDevice2, UpnpRegisterRootDevice3 or UpnpRegisterRootDevice4.
Definition: upnp.h:435
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:2336
int(* Upnp_FunPtr)(Upnp_EventType EventType, void *Event, void *Cookie)
Definition: upnp.h:854
DOMString CurrentVal
Definition: upnp.h:684
DOMString CurrentVal
Definition: upnp.h:702
Definition: upnp.h:707
Definition: upnp.h:469
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:3086
IXML_Document * ActionResult
Definition: upnp.h:630
int UpnpSetMaxSubscriptionTimeOut(UpnpDevice_Handle Hnd, int MaxSubscriptionTimeOut)
Sets the maximum time-out accepted for a subscription request or renewal.
Definition: upnpapi.c:1884
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:3148
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:2657
int ErrCode
Definition: upnp.h:643
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:2390
UpnpWebFileHandle(* VDCallback_Open)(const char *filename, enum UpnpOpenFileMode Mode)
Open callback function prototype.
Definition: upnp.h:2692
int ErrCode
Definition: upnp.h:693
int UpnpVirtualDir_set_WriteCallback(VDCallback_Write callback)
Sets the write callback function to be used to access a virtual directory.
Definition: upnpapi.c:4284
int(* VDCallback_Close)(UpnpWebFileHandle fileHnd)
Close callback function prototype.
Definition: upnp.h:2780
#define DOMString
The type of DOM strings.
Definition: ixml.h:59
int(* VDCallback_Write)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen)
Write callback function prototype.
Definition: upnp.h:2733
char * UpnpGetServerIpAddress(void)
Returns the local IPv4 listening ip address.
Definition: upnpapi.c:696
char * UpnpGetServerIp6Address(void)
Returns the local IPv6 listening ip address.
Definition: upnpapi.c:704
Definition: upnp.h:573
Definition: upnp.h:453
void * UpnpWebFileHandle
The type of handle returned by the web server for open requests.
Definition: upnp.h:2663
off_t file_length
Definition: upnp.h:808
int(* VDCallback_Read)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen)
Read callback function prototype.
Definition: upnp.h:2712
int UpnpUnRegisterClient(UpnpClient_Handle Hnd)
Unregisters a control point application, unsubscribing all active subscriptions.
Definition: upnpapi.c:1391
Data structure representing the DOM Document.
Definition: ixml.h:187
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:2713
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:1947
struct s_UpnpString UpnpString
Type of the string objects inside libupnp.
Definition: UpnpString.h:38
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
Definition: upnp.h:555
int UpnpFinish(void)
Terminates the Linux SDK for UPnP Devices.
Definition: upnpapi.c:597
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:2264
int(* VDCallback_Seek)(UpnpWebFileHandle fileHnd, off_t offset, int origin)
Seek callback function prototype.
Definition: upnp.h:2754
UpnpString * CtrlUrl
Definition: upnp.h:696
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:1790
int EventKey
Definition: upnp.h:713
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:4353
Definition: upnp.h:521
int UpnpEnableWebserver(int enable)
Enables or disables the webserver.
Definition: upnpapi.c:4177
#define EXPORT_SPEC
Export functions on WIN32 DLLs.
Definition: UpnpGlobal.h:81
int Socket
Definition: upnp.h:612
IXML_Document * ChangedVariables
Definition: upnp.h:716
Definition: upnp.h:640
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:1343
int UpnpAddVirtualDir(const char *dirName)
Adds a virtual directory mapping.
Definition: upnpapi.c:4043
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:2999
char ErrStr[(size_t) 180]
Definition: upnp.h:615