libUPnP  1.8.4
upnp.h
Go to the documentation of this file.
1 #ifndef UPNP_H
2 #define UPNP_H
3 
4 /*******************************************************************************
5  *
6  * Copyright (c) 2000-2003 Intel Corporation
7  * All rights reserved.
8  * Copyright (C) 2011-2012 France Telecom All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions are met:
12  *
13  * * Redistributions of source code must retain the above copyright notice,
14  * this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  * * Neither name of Intel Corporation nor the names of its contributors
19  * may be used to endorse or promote products derived from this software
20  * without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
26  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
30  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  ******************************************************************************/
35 
44 #include "ixml.h"
45 #include "upnpconfig.h"
46 #include "UpnpGlobal.h"
47 #include "UpnpInet.h"
48 
49 /*
50  * \todo Document the exact reason of these include files and solve this
51  * include mess in an include file like UpnpTime.h
52  */
53 #ifdef _WIN32
54  #include <time.h>
55  #if defined(UPNP_USE_MSVCPP) || defined(UPNP_USE_BCBPP)
56  #include <sys/types.h> /* needed for off_t */
57  #endif
58 #elif (defined(BSD) && BSD >= 199306)
59  #include <time.h>
60 #else
61  /* Other systems ??? */
62 #endif
63 
64 #ifdef UPNP_ENABLE_OPEN_SSL
65 #include <openssl/ssl.h>
66 #endif
67 
68 #define LINE_SIZE (size_t)180
69 #define NAME_SIZE (size_t)256
70 #define MNFT_NAME_SIZE 64
71 #define MODL_NAME_SIZE 32
72 #define SERL_NUMR_SIZE 64
73 #define MODL_DESC_SIZE 64
74 #define UPNP_INFINITE -1
75 #define UPNP_USING_CHUNKED -3
76 #define UPNP_UNTIL_CLOSE -4
77 
97 #define UPNP_E_SUCCESS 0
98 
102 #define UPNP_E_INVALID_HANDLE -100
103 
110 #define UPNP_E_INVALID_PARAM -101
111 
117 #define UPNP_E_OUTOF_HANDLE -102
118 
119 #define UPNP_E_OUTOF_CONTEXT -103
120 
126 #define UPNP_E_OUTOF_MEMORY -104
127 
134 #define UPNP_E_INIT -105
135 
136 #define UPNP_E_BUFFER_TOO_SMALL -106
137 
143 #define UPNP_E_INVALID_DESC -107
144 
152 #define UPNP_E_INVALID_URL -108
153 
154 #define UPNP_E_INVALID_SID -109
155 
156 #define UPNP_E_INVALID_DEVICE -110
157 
164 #define UPNP_E_INVALID_SERVICE -111
165 
172 #define UPNP_E_BAD_RESPONSE -113
173 
174 #define UPNP_E_BAD_REQUEST -114
175 
182 #define UPNP_E_INVALID_ACTION -115
183 
189 #define UPNP_E_FINISH -116
190 
196 #define UPNP_E_INIT_FAILED -117
197 
203 #define UPNP_E_URL_TOO_BIG -118
204 
214 #define UPNP_E_BAD_HTTPMSG -119
215 
222 #define UPNP_E_ALREADY_REGISTERED -120
223 
228 #define UPNP_E_INVALID_INTERFACE -121
229 
237 #define UPNP_E_NETWORK_ERROR -200
238 
247 #define UPNP_E_SOCKET_WRITE -201
248 
257 #define UPNP_E_SOCKET_READ -202
258 
267 #define UPNP_E_SOCKET_BIND -203
268 
277 #define UPNP_E_SOCKET_CONNECT -204
278 
287 #define UPNP_E_OUTOF_SOCKET -205
288 
295 #define UPNP_E_LISTEN -206
296 
303 #define UPNP_E_TIMEDOUT -207
304 
311 #define UPNP_E_SOCKET_ERROR -208
312 
313 #define UPNP_E_FILE_WRITE_ERROR -209
314 
319 #define UPNP_E_CANCELED -210
320 
321 #define UPNP_E_EVENT_PROTOCOL -300
322 
326 #define UPNP_E_SUBSCRIBE_UNACCEPTED -301
327 
331 #define UPNP_E_UNSUBSCRIBE_UNACCEPTED -302
332 
336 #define UPNP_E_NOTIFY_UNACCEPTED -303
337 
344 #define UPNP_E_INVALID_ARGUMENT -501
345 
350 #define UPNP_E_FILE_NOT_FOUND -502
351 
355 #define UPNP_E_FILE_READ_ERROR -503
356 
361 #define UPNP_E_EXT_NOT_XML -504
362 
363 #define UPNP_E_NO_WEB_SERVER -505
364 #define UPNP_E_OUTOF_BOUNDS -506
365 
370 #define UPNP_E_NOT_FOUND -507
371 
376 #define UPNP_E_INTERNAL_ERROR -911
377 
378 /* SOAP-related error codes */
379 #define UPNP_SOAP_E_INVALID_ACTION 401
380 #define UPNP_SOAP_E_INVALID_ARGS 402
381 #define UPNP_SOAP_E_OUT_OF_SYNC 403
382 #define UPNP_SOAP_E_INVALID_VAR 404
383 #define UPNP_SOAP_E_ACTION_FAILED 501
384 
385 /* @} ErrorCodes */
386 
387 /*
388  * Opaque data structures. The following includes are data structures that
389  * must be externally visible. Since version 1.8.0, only an opaque typedef
390  * is visible from the outside world. Any operation on these data types
391  * must be done using the appropriate interface functions.
392  *
393  * This policy has the great advantage that it is now possible to change
394  * the internal implementation of these data structures without breaking
395  * the API.
396  */
397 #include "ActionComplete.h"
398 #include "ActionRequest.h"
399 #include "Discovery.h"
400 #include "Event.h"
401 #include "EventSubscribe.h"
402 #include "FileInfo.h"
403 #include "StateVarComplete.h"
404 #include "StateVarRequest.h"
405 #include "SubscriptionRequest.h"
406 
413 enum UpnpOpenFileMode
414 {
415  UPNP_READ,
416  UPNP_WRITE
417 };
418 
426 typedef int UpnpClient_Handle;
427 
436 typedef int UpnpDevice_Handle;
437 
445 typedef char Upnp_SID[44];
446 
458 
461 
464 
468 };
469 
470 typedef enum Upnp_SType_e Upnp_SType;
471 
481 
485 
489 };
490 
491 typedef enum Upnp_DescType_e Upnp_DescType;
492 
493 #include "Callback.h"
494 
495 /* @} Constants and Types */
496 
497 #ifdef __cplusplus
498 extern "C" {
499 #endif /* __cplusplus */
500 
543  const char *IfName,
546  unsigned short DestPort);
547 
560 #ifdef UPNP_ENABLE_OPEN_SSL
561 EXPORT_SPEC int UpnpInitSslContext(
565  int initOpenSslLib,
568  const SSL_METHOD *sslMethod);
569 #endif
570 
590 EXPORT_SPEC int UpnpFinish(void);
591 
603 EXPORT_SPEC unsigned short UpnpGetServerPort(void);
604 
616 EXPORT_SPEC unsigned short UpnpGetServerPort6(void);
629 
642 
643 EXPORT_SPEC char *UpnpGetServerUlaGuaIp6Address(void);
683  const char *DescUrl,
685  Upnp_FunPtr Callback,
687  const void *Cookie,
689  UpnpDevice_Handle *Hnd);
690 
761  Upnp_DescType descriptionType,
764  const char* description,
767  size_t bufferLen,
770  int config_baseURL,
772  Upnp_FunPtr Fun,
775  const void* Cookie,
777  UpnpDevice_Handle* Hnd);
778 
817  const char *DescUrl,
819  Upnp_FunPtr Callback,
821  const void *Cookie,
823  UpnpDevice_Handle *Hnd,
826  int AddressFamily);
827 
867  const char *DescUrl,
869  Upnp_FunPtr Callback,
871  const void *Cookie,
873  UpnpDevice_Handle *Hnd,
876  int AddressFamily,
879  const char *LowerDescUrl);
880 
899  UpnpDevice_Handle Hnd);
900 
922  UpnpDevice_Handle Hnd,
924  int PowerState,
926  int SleepPeriod,
928  int RegistrationState);
929 
950  Upnp_FunPtr Callback,
952  const void *Cookie,
954  UpnpClient_Handle *Hnd);
955 
973  UpnpClient_Handle Hnd);
974 
984  UpnpClient_Handle Hnd,
986  size_t contentLength);
987 
1007  size_t contentLength);
1008 
1009 /* @} Initialization and Registration */
1010 
1011 /******************************************************************************
1012  ******************************************************************************
1013  * *
1014  * D I S C O V E R Y *
1015  * *
1016  ******************************************************************************
1017  ******************************************************************************/
1018 
1050  UpnpClient_Handle Hnd,
1055  int Mx,
1058  const char *TTarget_constarget_const,
1060  const void *Cookie_const);
1061 
1079  UpnpDevice_Handle Hnd,
1085  int Exp);
1086 
1107  UpnpDevice_Handle Hnd,
1113  int Exp,
1115  int PowerState,
1117  int SleepPeriod,
1119  int RegistrationState);
1120 
1121 /* @} Discovery */
1122 
1123 /******************************************************************************
1124  ******************************************************************************
1125  * *
1126  * C O N T R O L *
1127  * *
1128  ******************************************************************************
1129  ******************************************************************************/
1130 
1164  UpnpClient_Handle Hnd,
1166  const char *ActionURL,
1168  const char *VarName,
1172  DOMString *StVarVal);
1173 
1193  UpnpClient_Handle Hnd,
1195  const char *ActionURL,
1197  const char *VarName,
1200  Upnp_FunPtr Fun,
1202  const void *Cookie);
1203 
1229  UpnpClient_Handle Hnd,
1231  const char *ActionURL,
1233  const char *ServiceType,
1235  const char *DevUDN,
1237  IXML_Document *Action,
1240  IXML_Document **RespNode);
1241 
1267  UpnpClient_Handle Hnd,
1269  const char *ActionURL,
1271  const char *ServiceType,
1273  const char *DevUDN,
1276  IXML_Document *Header,
1278  IXML_Document *Action,
1281  IXML_Document **RespNode);
1282 
1306  UpnpClient_Handle Hnd,
1308  const char *ActionURL,
1310  const char *ServiceType,
1312  const char *DevUDN,
1314  IXML_Document *Action,
1317  Upnp_FunPtr Fun,
1320  const void *Cookie);
1321 
1345  UpnpClient_Handle Hnd,
1347  const char *ActionURL,
1349  const char *ServiceType,
1351  const char *DevUDN,
1354  IXML_Document *Header,
1356  IXML_Document *Action,
1359  Upnp_FunPtr Fun,
1362  const void *Cookie);
1363 
1366 /******************************************************************************
1367  ******************************************************************************
1368  * *
1369  * E V E N T I N G *
1370  * *
1371  ******************************************************************************
1372  ******************************************************************************/
1373 
1407  UpnpDevice_Handle Hnd,
1409  const char *DevID,
1411  const char *ServID,
1413  const char **VarName,
1415  const char **NewVal,
1417  int cVariables,
1419  const Upnp_SID SubsId);
1420 
1445  UpnpDevice_Handle Hnd,
1447  const char *DevID,
1449  const char *ServID,
1453  IXML_Document *PropSet,
1455  const Upnp_SID SubsId);
1456 
1482  const char *DevID,
1484  const char *ServID,
1486  const char **VarName,
1488  const char **NewVal,
1490  int cVariables);
1491 
1517  const char *DevID,
1519  const char *ServID,
1523  IXML_Document *PropSet);
1524 
1555  UpnpClient_Handle Hnd,
1558  int *TimeOut,
1560  const Upnp_SID SubsId);
1561 
1611  UpnpClient_Handle Hnd,
1614  int TimeOut,
1616  Upnp_SID SubsId,
1619  Upnp_FunPtr Fun,
1621  const void *Cookie);
1622 
1639  UpnpDevice_Handle Hnd,
1641  int MaxSubscriptions);
1642 
1660  UpnpDevice_Handle Hnd,
1662  int MaxSubscriptionTimeOut);
1663 
1695  UpnpClient_Handle Hnd,
1697  const char *PublisherUrl,
1701  int *TimeOut,
1703  Upnp_SID SubsId);
1704 
1755  UpnpClient_Handle Hnd,
1757  const char *PublisherUrl,
1760  int TimeOut,
1762  Upnp_FunPtr Fun,
1764  const void *Cookie);
1765 
1797  UpnpClient_Handle Hnd,
1799  const Upnp_SID SubsId);
1800 
1849  UpnpClient_Handle Hnd,
1851  Upnp_SID SubsId,
1854  Upnp_FunPtr Fun,
1856  const void *Cookie);
1857 
1861 /******************************************************************************
1862  ******************************************************************************
1863  * *
1864  * C L I E N T - A P I *
1865  * *
1866  ******************************************************************************
1867  ******************************************************************************/
1868 
1879  UPNP_HTTPMETHOD_PUT = 0,
1880  UPNP_HTTPMETHOD_DELETE = 1,
1881  UPNP_HTTPMETHOD_GET = 2,
1882  UPNP_HTTPMETHOD_HEAD = 3,
1883  UPNP_HTTPMETHOD_POST = 4
1884 };
1885 
1886 typedef enum Upnp_HttpMethod_e Upnp_HttpMethod;
1887 
1916  const char *url,
1918  char **outBuf,
1921  char *contentType);
1922 
1955  const char *url,
1957  void **handle,
1959  char **contentType,
1961  int *contentLength,
1963  int *httpStatus,
1967  int timeout);
1968 
2001  const char *url,
2003  const char *proxy_str,
2005  void **handle,
2007  char **contentType,
2009  int *contentLength,
2011  int *httpStatus,
2015  int timeout);
2016 
2049  const char *url,
2051  void **handle,
2053  char **contentType,
2055  int *contentLength,
2057  int *httpStatus,
2059  int lowRange,
2061  int highRange,
2065  int timeout);
2066 
2086  void *handle,
2088  char *buf,
2090  size_t *size,
2094  int timeout);
2095 
2106  void *handle,
2108  size_t *length,
2110  size_t *total);
2111 
2122  void *handle);
2123 
2135  void *handle);
2136 
2164  const char *url,
2167  void **handle,
2169  const char *contentType,
2171  int contentLength,
2175  int timeout);
2176 
2193  void *handle,
2195  char *buf,
2197  size_t *size,
2201  int timeout);
2202 
2219  void *handle,
2221  int *httpStatus,
2225  int timeout);
2226 
2252  const char *url,
2255  void **handle,
2259  int timeout);
2260 
2287  /* ![in] The method to use to make the request. */
2288  Upnp_HttpMethod method,
2292  const char *url,
2294  void *handle,
2297  UpnpString *headers,
2299  const char *contentType,
2303  int contentLength,
2307  int timeout);
2308 
2325  void *handle,
2327  char *buf,
2329  size_t *size,
2333  int timeout);
2334 
2355  void *handle,
2359  int timeout);
2360 
2392  void *handle,
2395  UpnpString *headers,
2397  char **contentType,
2399  int *contentLength,
2401  int *httpStatus,
2405  int timeout);
2406 
2428  void *handle,
2430  char *buf,
2432  size_t *size,
2436  int timeout);
2437 
2453  void *handle);
2454 
2484  const char *url,
2486  IXML_Document **xmlDoc);
2487 
2490 /******************************************************************************
2491  ******************************************************************************
2492  * *
2493  * W E B S E R V E R A P I *
2494  * *
2495  ******************************************************************************
2496  ******************************************************************************/
2497 
2522  const char *rootDir);
2523 
2527 typedef void *UpnpWebFileHandle;
2528 
2532 typedef int (*VDCallback_GetInfo)(
2534  const char *filename,
2536  UpnpFileInfo *info,
2538  const void *cookie);
2539 
2549 
2555  const char *filename,
2558  enum UpnpOpenFileMode Mode,
2560  const void *cookie);
2561 
2571 
2575 typedef int (*VDCallback_Read)(
2577  UpnpWebFileHandle fileHnd,
2579  char *buf,
2581  size_t buflen,
2583  const void *cookie);
2584 
2594 
2598 typedef int (*VDCallback_Write)(
2600  UpnpWebFileHandle fileHnd,
2602  char *buf,
2604  size_t buflen,
2606  const void *cookie);
2607 
2617 
2621 typedef int (*VDCallback_Seek) (
2623  UpnpWebFileHandle fileHnd,
2627  off_t offset,
2632  int origin,
2634  const void *cookie);
2635 
2645 
2649 typedef int (*VDCallback_Close)(
2651  UpnpWebFileHandle fileHnd,
2653  const void *cookie);
2654 
2664 
2674  int enable);
2675 
2684 
2701  const char *dirName,
2703  const void *cookie,
2705  const void **oldcookie);
2706 
2716  const char *dirName);
2717 
2722 
2723 /* @} Web Server API */
2724 
2725 #ifdef __cplusplus
2726 }
2727 #endif /* __cplusplus */
2728 
2729 /* @} UPnPAPI UPnP API */
2730 
2731 #endif /* UPNP_H */
UpnpRegisterRootDevice3
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:1064
VDCallback_Read
int(* VDCallback_Read)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie)
Read callback function prototype.
Definition: upnp.h:2575
UpnpVirtualDir_set_WriteCallback
int UpnpVirtualDir_set_WriteCallback(VDCallback_Write callback)
Sets the write callback function to be used to access a virtual directory.
Definition: upnpapi.c:4163
UpnpGetServiceVarStatus
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:2942
ActionComplete.h
UpnpActionComplete object declaration.
UpnpCloseHttpConnection
int UpnpCloseHttpConnection(void *handle)
Closes the connection created with UpnpOpenHttpConnection and frees any memory associated with the co...
Definition: upnpapi.c:3167
VDCallback_Close
int(* VDCallback_Close)(UpnpWebFileHandle fileHnd, const void *cookie)
Close callback function prototype.
Definition: upnp.h:2649
StateVarRequest.h
UpnpStateVarRequest object declararion.
UPNPREG_BUF_DESC
@ UPNPREG_BUF_DESC
Definition: upnp.h:488
Upnp_DescType_e
Upnp_DescType_e
Specifies the type of description in UpnpRegisterRootDevice2.
Definition: upnp.h:478
UpnpOpenHttpGetProxy
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:3059
FileInfo.h
UpnpFileInfo object declararion.
UpnpOpenHttpPost
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:2998
UPNP_S_SERVICE
@ UPNP_S_SERVICE
Definition: upnp.h:467
UpnpRegisterRootDevice
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:763
UpnpSetContentLength
int UpnpSetContentLength(UpnpClient_Handle Hnd, size_t contentLength)
Definition: upnpapi.c:4201
UpnpSetMaxSubscriptions
int UpnpSetMaxSubscriptions(UpnpDevice_Handle Hnd, int MaxSubscriptions)
Sets the maximum number of subscriptions accepted per service.
Definition: upnpapi.c:1814
Upnp_SID
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
Definition: upnp.h:445
UpnpAcceptSubscription
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:2380
UpnpCloseHttpGet
int UpnpCloseHttpGet(void *handle)
Closes the connection and frees memory that was allocated for the handle parameter.
Definition: upnpapi.c:3104
UpnpRenewSubscription
int UpnpRenewSubscription(UpnpClient_Handle Hnd, int *TimeOut, const Upnp_SID SubsId)
Renews a subscription that is about to expire.
Definition: upnpapi.c:2151
UpnpDownloadXmlDoc
int UpnpDownloadXmlDoc(const char *url, IXML_Document **xmlDoc)
Downloads an XML document specified in a URL.
Definition: upnpapi.c:3190
UpnpSendActionExAsync
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:2751
UpnpClient_Handle
int UpnpClient_Handle
Returned when a control point application registers with UpnpRegisterClient.
Definition: upnp.h:426
UpnpAcceptSubscriptionExt
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:2459
UpnpRemoveAllVirtualDirs
void UpnpRemoveAllVirtualDirs(void)
Removes all virtual directory mappings.
Definition: upnpapi.c:4055
UpnpSendAdvertisementLowPower
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:1645
UpnpGetServiceVarStatusAsync
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:2873
UpnpRegisterRootDevice2
int UpnpRegisterRootDevice2(Upnp_DescType descriptionType, const char *description, size_t bufferLen, int config_baseURL, Upnp_FunPtr Fun, const void *Cookie, UpnpDevice_Handle *Hnd)
Registers a device application with the UPnP Library. Similar to UpnpRegisterRootDevice,...
Definition: upnpapi.c:923
UpnpOpenHttpGetEx
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:3082
UpnpVirtualDir_set_GetInfoCallback
int UpnpVirtualDir_set_GetInfoCallback(VDCallback_GetInfo callback)
Sets the get_info callback function to be used to access a virtual directory.
Definition: upnpapi.c:4124
UpnpRemoveVirtualDir
int UpnpRemoveVirtualDir(const char *dirName)
Removes a virtual directory mapping made with UpnpAddVirtualDir.
Definition: upnpapi.c:4006
Upnp_FunPtr
int(* Upnp_FunPtr)(Upnp_EventType EventType, const void *Event, void *Cookie)
Definition: Callback.h:145
UpnpRegisterClient
int UpnpRegisterClient(Upnp_FunPtr Callback, const void *Cookie, UpnpClient_Handle *Hnd)
Registers a control point application with the UPnP Library.
Definition: upnpapi.c:1308
Discovery.h
UpnpDiscovery object declararion.
_IXML_Document
Data structure representing the DOM Document.
Definition: ixml.h:198
UpnpRegisterRootDevice4
int UpnpRegisterRootDevice4(const char *DescUrl, Upnp_FunPtr Callback, const void *Cookie, UpnpDevice_Handle *Hnd, int AddressFamily, const char *LowerDescUrl)
Registers a device application for a specific address family with the UPnP library....
Definition: upnpapi.c:1080
UPNP_S_DEVICE
@ UPNP_S_DEVICE
Definition: upnp.h:463
UpnpGetServerPort
unsigned short UpnpGetServerPort(void)
Returns the internal server IPv4 UPnP listening port.
Definition: upnpapi.c:659
UPNPREG_URL_DESC
@ UPNPREG_URL_DESC
Definition: upnp.h:480
UpnpUnSubscribeAsync
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:2083
UpnpWriteHttpPost
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:3014
UpnpVirtualDir_set_ReadCallback
int UpnpVirtualDir_set_ReadCallback(VDCallback_Read callback)
Sets the read callback function to be used to access a virtual directory.
Definition: upnpapi.c:4150
UpnpAddVirtualDir
int UpnpAddVirtualDir(const char *dirName, const void *cookie, const void **oldcookie)
Adds a virtual directory mapping.
Definition: upnpapi.c:3937
ActionRequest.h
UpnpActionRequest object declaration.
UpnpInit2
int UpnpInit2(const char *IfName, unsigned short DestPort)
Initializes the Linux SDK for UPnP Devices (IPv4 or IPv6).
Definition: upnpapi.c:460
UpnpReadHttpGet
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:3110
UpnpEndHttpRequest
int UpnpEndHttpRequest(void *handle, int timeout)
Indicates the end of a HTTP request previously made by UpnpMakeHttpRequest.
Definition: upnpapi.c:3145
Upnp_SType_e
Upnp_SType_e
Represents the different types of searches that can be performed using the SDK for UPnP Devices API.
Definition: upnp.h:455
UpnpUnRegisterRootDevice
int UpnpUnRegisterRootDevice(UpnpDevice_Handle Hnd)
Unregisters a root device registered with UpnpRegisterRootDevice, UpnpRegisterRootDevice2,...
Definition: upnpapi.c:1226
UpnpVirtualDir_set_CloseCallback
int UpnpVirtualDir_set_CloseCallback(VDCallback_Close callback)
Sets the close callback function to be used to access a virtual directory.
Definition: upnpapi.c:4189
Callback.h
UpnpUnSubscribe
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:2035
UpnpIsWebserverEnabled
int UpnpIsWebserverEnabled(void)
Returns TRUE if the webserver is enabled, or FALSE if it is not.
Definition: upnpapi.c:4114
VDCallback_Write
int(* VDCallback_Write)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie)
Write callback function prototype.
Definition: upnp.h:2598
UpnpDownloadUrlItem
int UpnpDownloadUrlItem(const char *url, char **outBuf, char *contentType)
Downloads a file specified in a URL.
Definition: upnpapi.c:3173
UpnpSendAction
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:2544
UpnpMakeHttpRequest
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:3129
UpnpHttpGetProgress
int UpnpHttpGetProgress(void *handle, size_t *length, size_t *total)
Retrieve progress information of a http-get transfer.
Definition: upnpapi.c:3116
ixml.h
UPNP_S_ALL
@ UPNP_S_ALL
Definition: upnp.h:457
UpnpString
struct s_UpnpString UpnpString
Type of the string objects inside libupnp.
Definition: UpnpString.h:38
UpnpSubscribe
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:1964
UpnpUnRegisterRootDeviceLowPower
int UpnpUnRegisterRootDeviceLowPower(UpnpDevice_Handle Hnd, int PowerState, int SleepPeriod, int RegistrationState)
Unregisters a root device registered with UpnpRegisterRootDevice, UpnpRegisterRootDevice2,...
Definition: upnpapi.c:1233
Event.h
UpnpEvent object declararion.
UpnpNotify
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:2279
UpnpSendActionAsync
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:2656
UpnpGetServerPort6
unsigned short UpnpGetServerPort6(void)
Returns the internal server IPv6 UPnP listening port.
Definition: upnpapi.c:667
UpnpCancelHttpGet
int UpnpCancelHttpGet(void *handle)
Set the cancel flag of the handle parameter.
Definition: upnpapi.c:3098
UpnpSendActionEx
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:2600
UpnpVirtualDir_set_OpenCallback
int UpnpVirtualDir_set_OpenCallback(VDCallback_Open callback)
Sets the open callback function to be used to access a virtual directory.
Definition: upnpapi.c:4137
UpnpOpenHttpGet
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:3037
UpnpRenewSubscriptionAsync
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:2207
UpnpVirtualDir_set_SeekCallback
int UpnpVirtualDir_set_SeekCallback(VDCallback_Seek callback)
Sets the seek callback function to be used to access a virtual directory.
Definition: upnpapi.c:4176
UPNPREG_FILENAME_DESC
@ UPNPREG_FILENAME_DESC
Definition: upnp.h:484
EXPORT_SPEC
#define EXPORT_SPEC
Export functions on WIN32 DLLs.
Definition: UpnpGlobal.h:87
UpnpSendAdvertisement
int UpnpSendAdvertisement(UpnpDevice_Handle Hnd, int Exp)
Sends out the discovery announcements for all devices and services for a device.
Definition: upnpapi.c:1638
VDCallback_GetInfo
int(* VDCallback_GetInfo)(const char *filename, UpnpFileInfo *info, const void *cookie)
Get-info callback function prototype.
Definition: upnp.h:2532
UpnpSubscribeAsync
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:1890
VDCallback_Open
UpnpWebFileHandle(* VDCallback_Open)(const char *filename, enum UpnpOpenFileMode Mode, const void *cookie)
Open callback function prototype.
Definition: upnp.h:2553
UpnpDevice_Handle
int UpnpDevice_Handle
Returned when a device application registers with UpnpRegisterRootDevice, UpnpRegisterRootDevice2,...
Definition: upnp.h:436
UpnpSetMaxSubscriptionTimeOut
int UpnpSetMaxSubscriptionTimeOut(UpnpDevice_Handle Hnd, int MaxSubscriptionTimeOut)
Sets the maximum time-out accepted for a subscription request or renewal.
Definition: upnpapi.c:1851
Upnp_HttpMethod_e
Upnp_HttpMethod_e
Different HTTP methods.
Definition: upnp.h:1878
UpnpGlobal.h
Defines constants that for some reason are not defined on some systems.
UpnpOpenHttpConnection
int UpnpOpenHttpConnection(const char *url, void **handle, int timeout)
Opens a connection to the server.
Definition: upnpapi.c:3122
DOMString
#define DOMString
The type of DOM strings.
Definition: ixml.h:59
UpnpGetServerIpAddress
char * UpnpGetServerIpAddress(void)
Returns the local IPv4 listening ip address.
Definition: upnpapi.c:679
UpnpGetServerIp6Address
char * UpnpGetServerIp6Address(void)
Returns the local IPv6 listening ip address.
Definition: upnpapi.c:687
UpnpSearchAsync
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:1757
VDCallback_Seek
int(* VDCallback_Seek)(UpnpWebFileHandle fileHnd, off_t offset, int origin, const void *cookie)
Seek callback function prototype.
Definition: upnp.h:2621
UpnpWebFileHandle
void * UpnpWebFileHandle
The type of handle returned by the web server for open requests.
Definition: upnp.h:2527
EventSubscribe.h
UpnpEventSubscribe object declararion.
UpnpNotifyExt
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:2333
SubscriptionRequest.h
UpnpSubscriptionRequest object declararion.
UpnpWriteHttpRequest
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:3138
UpnpReadHttpResponse
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:3160
UpnpSetMaxContentLength
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:4232
StateVarComplete.h
UpnpStateVarComplete object declararion.
UpnpInet.h
Provides a platform independent way to include TCP/IP types and functions.
UpnpGetHttpResponse
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:3151
UpnpEnableWebserver
int UpnpEnableWebserver(int enable)
Enables or disables the webserver.
Definition: upnpapi.c:4077
UpnpFinish
int UpnpFinish(void)
Initializes the OpenSSL library, and the OpenSSL context for use with pupnp.
Definition: upnpapi.c:585
UpnpUnRegisterClient
int UpnpUnRegisterClient(UpnpClient_Handle Hnd)
Unregisters a control point application, unsubscribing all active subscriptions.
Definition: upnpapi.c:1356
UpnpSetWebServerRootDir
int UpnpSetWebServerRootDir(const char *rootDir)
Sets the document root directory for the internal web server.
UpnpCloseHttpPost
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:3024
UPNP_S_ROOT
@ UPNP_S_ROOT
Definition: upnp.h:460