libUPnP 22.1.0
upnp.h
Go to the documentation of this file.
1#ifndef UPNP_H
2#define UPNP_H
3
4/*******************************************************************************
5 *
6 * Copyright (c) 2000-2003 Intel Corporation
7 * All rights reserved.
8 * Copyright (C) 2011-2012 France Telecom All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are met:
12 *
13 * * Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 * * Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 * * Neither name of Intel Corporation nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
26 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
30 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 ******************************************************************************/
35
43
44#include "UpnpGlobal.h"
45#include "UpnpInet.h" /* IWYU pragma: keep */
46#include "ixml.h"
47#include "upnpconfig.h" /* IWYU pragma: keep */
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
89
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
127#define UPNP_E_OUTOF_MEMORY -104
128
135#define UPNP_E_INIT -105
136
137#define UPNP_E_BUFFER_TOO_SMALL -106
138
144#define UPNP_E_INVALID_DESC -107
145
153#define UPNP_E_INVALID_URL -108
154
155#define UPNP_E_INVALID_SID -109
156
157#define UPNP_E_INVALID_DEVICE -110
158
165#define UPNP_E_INVALID_SERVICE -111
166
173#define UPNP_E_BAD_RESPONSE -113
174
175#define UPNP_E_BAD_REQUEST -114
176
183#define UPNP_E_INVALID_ACTION -115
184
191#define UPNP_E_FINISH -116
192
198#define UPNP_E_INIT_FAILED -117
199
205#define UPNP_E_URL_TOO_BIG -118
206
216#define UPNP_E_BAD_HTTPMSG -119
217
224#define UPNP_E_ALREADY_REGISTERED -120
225
230#define UPNP_E_INVALID_INTERFACE -121
231
239#define UPNP_E_NETWORK_ERROR -200
240
249#define UPNP_E_SOCKET_WRITE -201
250
259#define UPNP_E_SOCKET_READ -202
260
269#define UPNP_E_SOCKET_BIND -203
270
279#define UPNP_E_SOCKET_CONNECT -204
280
289#define UPNP_E_OUTOF_SOCKET -205
290
297#define UPNP_E_LISTEN -206
298
305#define UPNP_E_TIMEDOUT -207
306
313#define UPNP_E_SOCKET_ERROR -208
314
315#define UPNP_E_FILE_WRITE_ERROR -209
316
322#define UPNP_E_CANCELED -210
323
324#define UPNP_E_EVENT_PROTOCOL -300
325
329#define UPNP_E_SUBSCRIBE_UNACCEPTED -301
330
334#define UPNP_E_UNSUBSCRIBE_UNACCEPTED -302
335
339#define UPNP_E_NOTIFY_UNACCEPTED -303
340
347#define UPNP_E_INVALID_ARGUMENT -501
348
353#define UPNP_E_FILE_NOT_FOUND -502
354
358#define UPNP_E_FILE_READ_ERROR -503
359
364#define UPNP_E_EXT_NOT_XML -504
365
366#define UPNP_E_NO_WEB_SERVER -505
367#define UPNP_E_OUTOF_BOUNDS -506
368
373#define UPNP_E_NOT_FOUND -507
374
379#define UPNP_E_INTERNAL_ERROR -911
380
381/* SOAP-related error codes */
382#define UPNP_SOAP_E_INVALID_ACTION 401
383#define UPNP_SOAP_E_INVALID_ARGS 402
384#define UPNP_SOAP_E_OUT_OF_SYNC 403
385#define UPNP_SOAP_E_INVALID_VAR 404
386#define UPNP_SOAP_E_ACTION_FAILED 501
387
388/* @} ErrorCodes */
389
390/*
391 * Opaque data structures. The following includes are data structures that
392 * must be externally visible. Since version 1.8.0, only an opaque typedef
393 * is visible from the outside world. Any operation on these data types
394 * must be done using the appropriate interface functions.
395 *
396 * This policy has the great advantage that it is now possible to change
397 * the internal implementation of these data structures without breaking
398 * the API.
399 */
400#include "UpnpActionComplete.h" // IWYU pragma: keep
401#include "UpnpActionRequest.h" // IWYU pragma: keep
402#include "UpnpDiscovery.h" // IWYU pragma: keep
403#include "UpnpEvent.h" // IWYU pragma: keep
404#include "UpnpEventSubscribe.h" // IWYU pragma: keep
405#include "UpnpFileInfo.h" // IWYU pragma: keep
406#include "UpnpStateVarComplete.h" // IWYU pragma: keep
407#include "UpnpStateVarRequest.h" // IWYU pragma: keep
408#include "UpnpSubscriptionRequest.h" // IWYU pragma: keep
409
415
416enum UpnpOpenFileMode
417{
418 UPNP_READ,
419 UPNP_WRITE
420};
421
430
440
448typedef char Upnp_SID[44];
449
474
475typedef enum Upnp_SType_e Upnp_SType;
476
496
497typedef enum Upnp_DescType_e Upnp_DescType;
498
499#include "Callback.h"
500
501/* @} Constants and Types */
502
503#ifdef __cplusplus
504extern "C" {
505#endif /* __cplusplus */
506
512
549 const char *IfName,
552 unsigned short DestPort);
553
566#ifdef UPNP_ENABLE_OPEN_SSL
567UPNP_EXPORT_SPEC int UpnpInitSslContext(
572 int initOpenSslLib,
575 const SSL_METHOD *sslMethod);
576
587UPNP_EXPORT_SPEC SSL_CTX *UpnpGetSslCtx(void);
588
607UPNP_EXPORT_SPEC int UpnpSetSslCtx(
609 SSL_CTX *ctx);
610#endif
611
632
644UPNP_EXPORT_SPEC unsigned short UpnpGetServerPort(void);
645
657UPNP_EXPORT_SPEC unsigned short UpnpGetServerPort6(void);
658
670UPNP_EXPORT_SPEC unsigned short UpnpGetServerUlaGuaPort6(void);
671
683UPNP_EXPORT_SPEC unsigned short UpnpGetSsdpReqPort4(void);
684
696UPNP_EXPORT_SPEC unsigned short UpnpGetSsdpReqPort6(void);
697
710
723
776 const char *DescUrl,
779 Upnp_FunPtr Callback,
782 const void *Cookie,
784 UpnpDevice_Handle *Hnd);
785
856 Upnp_DescType descriptionType,
859 const char *description,
862 size_t bufferLen,
865 int config_baseURL,
868 Upnp_FunPtr Fun,
871 const void *Cookie,
873 UpnpDevice_Handle *Hnd);
874
913 const char *DescUrl,
916 Upnp_FunPtr Callback,
919 const void *Cookie,
924 int AddressFamily);
925
965 const char *DescUrl,
968 Upnp_FunPtr Callback,
971 const void *Cookie,
976 int AddressFamily,
979 const char *LowerDescUrl);
980
1000
1024 int PowerState,
1026 int SleepPeriod,
1028 int RegistrationState);
1029
1050 Upnp_FunPtr Callback,
1053 const void *Cookie,
1056 UpnpClient_Handle *Hnd);
1057
1076 UpnpClient_Handle Hnd);
1077
1102 size_t contentLength);
1103
1137 size_t headerSize);
1138
1139/* @} Initialization and Registration */
1140
1141/******************************************************************************
1142 ******************************************************************************
1143 * *
1144 * D I S C O V E R Y *
1145 * *
1146 ******************************************************************************
1147 ******************************************************************************/
1148
1154
1185 int Mx,
1188 const char *Target_const,
1190 const void *Cookie_const);
1191
1215 int Exp);
1216
1243 int Exp,
1245 int PowerState,
1247 int SleepPeriod,
1249 int RegistrationState);
1250
1251/* @} Discovery */
1252
1253/******************************************************************************
1254 ******************************************************************************
1255 * *
1256 * C O N T R O L *
1257 * *
1258 ******************************************************************************
1259 ******************************************************************************/
1260
1266
1296 const char *ActionURL,
1298 const char *VarName,
1302 DOMString *StVarVal);
1303
1325 const char *ActionURL,
1327 const char *VarName,
1330 Upnp_FunPtr Fun,
1333 const void *Cookie);
1334
1362 const char *ActionURL,
1364 const char *ServiceType,
1366 const char *DevUDN,
1368 IXML_Document *Action,
1371 IXML_Document **RespNode);
1372
1400 const char *ActionURL,
1402 const char *ServiceType,
1404 const char *DevUDN,
1407 IXML_Document *Header,
1409 IXML_Document *Action,
1412 IXML_Document **RespNode);
1413
1439 const char *ActionURL,
1441 const char *ServiceType,
1443 const char *DevUDN,
1445 IXML_Document *Action,
1448 Upnp_FunPtr Fun,
1451 const void *Cookie);
1452
1478 const char *ActionURL,
1480 const char *ServiceType,
1482 const char *DevUDN,
1485 IXML_Document *Header,
1487 IXML_Document *Action,
1490 Upnp_FunPtr Fun,
1493 const void *Cookie);
1494
1496
1497/******************************************************************************
1498 ******************************************************************************
1499 * *
1500 * E V E N T I N G *
1501 * *
1502 ******************************************************************************
1503 ******************************************************************************/
1504
1510
1541 const char *DevID,
1544 const char *ServID,
1546 const char **VarName,
1548 const char **NewVal,
1550 int cVariables,
1552 const Upnp_SID SubsId);
1553
1581 const char *DevID,
1584 const char *ServID,
1588 IXML_Document *PropSet,
1590 const Upnp_SID SubsId);
1591
1618 const char *DevID,
1620 const char *ServID,
1622 const char **VarName,
1624 const char **NewVal,
1626 int cVariables);
1627
1654 const char *DevID,
1656 const char *ServID,
1660 IXML_Document *PropSet);
1661
1696 int *TimeOut,
1698 const Upnp_SID SubsId);
1699
1753 int TimeOut,
1755 Upnp_SID SubsId,
1758 Upnp_FunPtr Fun,
1761 const void *Cookie);
1762
1781 int MaxSubscriptions);
1782
1802 int MaxSubscriptionTimeOut);
1803
1837 const char *PublisherUrl,
1841 int *TimeOut,
1843 Upnp_SID SubsId);
1844
1897 const char *PublisherUrl,
1900 int TimeOut,
1902 Upnp_FunPtr Fun,
1904 const void *Cookie);
1905
1940 const Upnp_SID SubsId);
1941
1995 Upnp_SID SubsId,
1998 Upnp_FunPtr Fun,
2001 const void *Cookie);
2002
2004
2005/******************************************************************************
2006 ******************************************************************************
2007 * *
2008 * C L I E N T - A P I *
2009 * *
2010 ******************************************************************************
2011 ******************************************************************************/
2012
2018
2023{
2024 UPNP_HTTPMETHOD_PUT = 0,
2025 UPNP_HTTPMETHOD_DELETE = 1,
2026 UPNP_HTTPMETHOD_GET = 2,
2027 UPNP_HTTPMETHOD_HEAD = 3,
2028 UPNP_HTTPMETHOD_POST = 4
2029};
2030
2031typedef enum Upnp_HttpMethod_e Upnp_HttpMethod;
2032
2061 const char *url,
2063 char **outBuf,
2066 char *contentType);
2067
2100 const char *url,
2102 void **handle,
2104 char **contentType,
2106 int *contentLength,
2108 int *httpStatus,
2113 int timeout);
2114
2147 const char *url,
2149 const char *proxy_str,
2151 void **handle,
2153 char **contentType,
2155 int *contentLength,
2157 int *httpStatus,
2162 int timeout);
2163
2196 const char *url,
2198 void **handle,
2200 char **contentType,
2202 int *contentLength,
2205 int *httpStatus,
2208 int lowRange,
2211 int highRange,
2215 int timeout);
2216
2236 void *handle,
2238 char *buf,
2240 size_t *size,
2245 int timeout);
2246
2257 void *handle,
2259 size_t *length,
2261 size_t *total);
2262
2273 void *handle);
2274
2286 void *handle);
2287
2315 const char *url,
2319 void **handle,
2322 const char *contentType,
2324 int contentLength,
2328 int timeout);
2329
2346 void *handle,
2348 char *buf,
2350 size_t *size,
2354 int timeout);
2355
2372 void *handle,
2375 int *httpStatus,
2379 int timeout);
2380
2407 const char *url,
2411 void **handle,
2415 int timeout);
2416
2443 /* ![in] The method to use to make the request. */
2444 Upnp_HttpMethod method,
2448 const char *url,
2450 void *handle,
2455 UpnpString *headers,
2457 const char *contentType,
2462 int contentLength,
2466 int timeout);
2467
2485 void *handle,
2487 char *buf,
2489 size_t *size,
2493 int timeout);
2494
2515 void *handle,
2519 int timeout);
2520
2552 void *handle,
2555 UpnpString *headers,
2557 char **contentType,
2559 int *contentLength,
2561 int *httpStatus,
2566 int timeout);
2567
2589 void *handle,
2591 char *buf,
2593 size_t *size,
2598 int timeout);
2599
2615 void *handle);
2616
2646 const char *url,
2648 IXML_Document **xmlDoc);
2649
2651
2652/******************************************************************************
2653 ******************************************************************************
2654 * *
2655 * W E B S E R V E R A P I *
2656 * *
2657 ******************************************************************************
2658 ******************************************************************************/
2659
2665
2684 const char *rootDir);
2685
2689typedef void *UpnpWebFileHandle;
2690
2694typedef int (*VDCallback_GetInfo)(
2696 const char *filename,
2699 UpnpFileInfo *info,
2701 const void *cookie,
2703 const void **request_cookie);
2704
2714 VDCallback_GetInfo callback);
2715
2721 const char *filename,
2724 enum UpnpOpenFileMode Mode,
2726 const void *cookie,
2728 const void *request_cookie);
2729
2739
2743typedef int (*VDCallback_Read)(
2745 UpnpWebFileHandle fileHnd,
2747 char *buf,
2749 size_t buflen,
2751 const void *cookie,
2753 const void *request_cookie);
2754
2764
2768typedef int (*VDCallback_Write)(
2770 UpnpWebFileHandle fileHnd,
2772 char *buf,
2774 size_t buflen,
2776 const void *cookie,
2778 const void *request_cookie);
2779
2789 VDCallback_Write callback);
2790
2794typedef int (*VDCallback_Seek)(
2796 UpnpWebFileHandle fileHnd,
2800 off_t offset,
2805 int origin,
2807 const void *cookie,
2809 const void *request_cookie);
2810
2820
2824typedef int (*VDCallback_Close)(
2826 UpnpWebFileHandle fileHnd,
2828 const void *cookie,
2830 const void *request_cookie);
2831
2841 VDCallback_Close callback);
2842
2855 int enable);
2856
2865
2866/*
2867 * \brief Callback for validating HTTP requests HOST header values.
2868 *
2869 * @param hostname the value in the request HOST header.
2870 * @return An integer representing one of the following:
2871 * \li \c UPNP_E_SUCCESS: a request with the HOST header set to hostname
2872 * should be processed.
2873 * \li \c UPNP_E_BAD_HTTPMSG the request should be rejected.
2874 */
2875typedef int (*WebCallback_HostValidate)(const char *hostname, void *cookie);
2876
2877/*
2878 * \brief Set callback for validating HTTP requests HOST header values.
2879 *
2880 * @param callback the host validating callback function or NULL.
2881 * @param cookie the chocolate you like.
2882 */
2883UPNP_EXPORT_SPEC void UpnpSetHostValidateCallback(
2884 WebCallback_HostValidate callback, void *cookie);
2885
2886/*
2887 * \brief Enable or disable literal IP redirection.
2888 *
2889 * @param enable Zero to disable (default) non-zero to enable.
2890 */
2891UPNP_EXPORT_SPEC void UpnpSetAllowLiteralHostRedirection(int enable);
2892
2906 const char *corsString);
2907
2924 const char *dirName,
2926 const void *cookie,
2929 const void **oldcookie);
2930
2940 const char *dirName);
2941
2946
2947/* @} Web Server API */
2948
2949#ifdef __cplusplus
2950}
2951#endif /* __cplusplus */
2952
2953/* @} UPnPAPI UPnP API */
2954
2955#endif /* UPNP_H */
int(* Upnp_FunPtr)(Upnp_EventType EventType, void *Event, void *Cookie)
Definition Callback.h:145
Header file for UpnpActionComplete methods.
Header file for UpnpActionRequest methods.
Header file for UpnpDiscovery methods.
Header file for UpnpEventSubscribe methods.
Header file for UpnpEvent methods.
Header file for UpnpFileInfo methods.
struct s_UpnpFileInfo UpnpFileInfo
Definition UpnpFileInfo.h:32
Defines constants that for some reason are not defined on some systems.
#define UPNP_EXPORT_SPEC
Export functions on WIN32 DLLs.
Definition UpnpGlobal.h:101
Provides a platform independent way to include TCP/IP types and functions.
Header file for UpnpStateVarComplete methods.
Header file for UpnpStateVarRequest methods.
Header file for UpnpSubscriptionRequest methods.
int UpnpCloseHttpGet(void *handle)
Closes the connection and frees memory that was allocated for the handle parameter.
Definition upnpapi.c:3533
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.
void UpnpRemoveAllVirtualDirs(void)
Removes all virtual directory mappings.
Definition upnpapi.c:4656
int UpnpVirtualDir_set_GetInfoCallback(VDCallback_GetInfo callback)
Sets the get_info callback function to be used to access a virtual directory.
Definition upnpapi.c:4728
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:2597
int(* VDCallback_Close)(UpnpWebFileHandle fileHnd, const void *cookie, const void *request_cookie)
Close callback function prototype.
Definition upnp.h:2824
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
Definition upnp.h:448
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:3449
unsigned short UpnpGetServerPort(void)
Returns the internal server IPv4 UPnP listening port.
Definition upnpapi.c:794
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:1152
Upnp_DescType_e
Specifies the type of description in UpnpRegisterRootDevice2.
Definition upnp.h:484
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:3535
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:2259
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:3438
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.
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 ...
int UpnpRenewSubscription(UpnpClient_Handle Hnd, int *TimeOut, const Upnp_SID SubsId)
Renews a subscription that is about to expire.
Definition upnpapi.c:2536
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:2336
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:2461
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:2850
int UpnpEnableWebserver(int enable)
Enables or disables the webserver.
Definition upnpapi.c:4677
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:1341
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:3414
void * UpnpWebFileHandle
The type of handle returned by the web server for open requests.
Definition upnp.h:2689
int UpnpDownloadUrlItem(const char *url, char **outBuf, char *contentType)
Downloads a file specified in a URL.
Definition upnpapi.c:3602
int UpnpAddVirtualDir(const char *dirName, const void *cookie, const void **oldcookie)
Adds a virtual directory mapping.
Definition upnpapi.c:4540
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:3592
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:4788
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:3550
int UpnpSearchAsync(UpnpClient_Handle Hnd, int Mx, const char *Target_const, const void *Cookie_const)
Searches for devices matching the given search target.
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.
int(* VDCallback_GetInfo)(const char *filename, UpnpFileInfo *info, const void *cookie, const void **request_cookie)
Get-info callback function prototype.
Definition upnp.h:2694
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:2409
int UpnpFinish(void)
Initializes the OpenSSL library, and the OpenSSL context for use with pupnp.
Definition upnpapi.c:703
char * UpnpGetServerUlaGuaIp6Address(void)
Returns the IPv6 unique-local or globally-unique listening ip address.
Definition upnpapi.c:880
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:3480
Upnp_HttpMethod_e
Different HTTP methods.
Definition upnp.h:2023
int UpnpVirtualDir_set_WriteCallback(VDCallback_Write callback)
Sets the write callback function to be used to access a virtual directory.
Definition upnpapi.c:4758
int UpnpIsWebserverEnabled(void)
Returns 1 if the webserver is enabled, or 0 if it is not.
Definition upnpapi.c:4707
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:3433
int UpnpVirtualDir_set_SeekCallback(VDCallback_Seek callback)
Sets the seek callback function to be used to access a virtual directory.
Definition upnpapi.c:4768
int UpnpHttpGetProgress(void *handle, size_t *length, size_t *total)
Retrieve progress information of a http-get transfer.
Definition upnpapi.c:3540
int UpnpSetMaxSubscriptions(UpnpDevice_Handle Hnd, int MaxSubscriptions)
Sets the maximum number of subscriptions accepted per service.
Definition upnpapi.c:2175
int UpnpVirtualDir_set_ReadCallback(VDCallback_Read callback)
Sets the read callback function to be used to access a virtual directory.
Definition upnpapi.c:4748
char * UpnpGetServerIpAddress(void)
Returns the local IPv4 listening ip address.
Definition upnpapi.c:860
int UpnpInit2(const char *IfName, unsigned short DestPort)
Initializes the Linux SDK for UPnP Devices (IPv4 or IPv6).
Definition upnpapi.c:557
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:2672
int UpnpClient_Handle
Returned when a control point application registers with UpnpRegisterClient.
Definition upnp.h:429
int UpnpSetWebServerRootDir(const char *rootDir)
Sets the document root directory for the internal web server.
int UpnpCloseHttpConnection(void *handle)
Closes the connection created with UpnpOpenHttpConnection and frees any memory associated with the co...
Definition upnpapi.c:3597
unsigned short UpnpGetServerUlaGuaPort6(void)
Returns the internal server IPv6 ULA or GUA UPnP listening port.
Definition upnpapi.c:814
int UpnpSetMaxSubscriptionTimeOut(UpnpDevice_Handle Hnd, int MaxSubscriptionTimeOut)
Sets the maximum time-out accepted for a subscription request or renewal.
Definition upnpapi.c:2215
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.
unsigned short UpnpGetSsdpReqPort4(void)
Returns the source IPv4 port used for SSDP M-SEARCH requests.
Definition upnpapi.c:826
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:1324
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 ...
int UpnpSendAdvertisement(UpnpDevice_Handle Hnd, int Exp)
Sends out the discovery announcements for all devices and services for a device.
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:2722
int(* VDCallback_Seek)(UpnpWebFileHandle fileHnd, off_t offset, int origin, const void *cookie, const void *request_cookie)
Seek callback function prototype.
Definition upnp.h:2794
Upnp_SType_e
Represents the different types of searches that can be performed using the SDK for UPnP Devices API.
Definition upnp.h:459
int UpnpDevice_Handle
Returned when a device application registers with UpnpRegisterRootDevice, UpnpRegisterRootDevice2,...
Definition upnp.h:439
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:959
int UpnpRegisterClient(Upnp_FunPtr Callback, const void *Cookie, UpnpClient_Handle *Hnd)
Registers a control point application with the UPnP Library.
Definition upnpapi.c:1617
int UpnpSetMaxHeaderSize(size_t headerSize)
Sets the maximum size of the HTTP header block that the SDK will accept on an incoming request or res...
Definition upnpapi.c:4798
int UpnpUnRegisterRootDeviceLowPower(UpnpDevice_Handle Hnd, int PowerState, int SleepPeriod, int RegistrationState)
Unregisters a root device registered with UpnpRegisterRootDevice, UpnpRegisterRootDevice2,...
Definition upnpapi.c:1529
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:3512
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 event table variables for a ser...
Definition upnpapi.c:2765
unsigned short UpnpGetServerPort6(void)
Returns the internal server IPv6 link-local (LLA) UPnP listening port.
Definition upnpapi.c:802
int UpnpUnRegisterRootDevice(UpnpDevice_Handle Hnd)
Unregisters a root device registered with UpnpRegisterRootDevice, UpnpRegisterRootDevice2,...
Definition upnpapi.c:1519
int UpnpRemoveVirtualDir(const char *dirName)
Removes a virtual directory mapping made with UpnpAddVirtualDir.
Definition upnpapi.c:4609
int UpnpEndHttpRequest(void *handle, int timeout)
Indicates the end of a HTTP request previously made by UpnpMakeHttpRequest.
Definition upnpapi.c:3572
int UpnpDownloadXmlDoc(const char *url, IXML_Document **xmlDoc)
Downloads an XML document specified in a URL.
Definition upnpapi.c:3618
unsigned short UpnpGetSsdpReqPort6(void)
Returns the source IPv6 port used for SSDP M-SEARCH requests.
Definition upnpapi.c:843
int UpnpCancelHttpGet(void *handle)
Set the cancel flag of the handle parameter.
Definition upnpapi.c:3531
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:3567
int(* VDCallback_Write)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie, const void *request_cookie)
Write callback function prototype.
Definition upnp.h:2768
int UpnpVirtualDir_set_OpenCallback(VDCallback_Open callback)
Sets the open callback function to be used to access a virtual directory.
Definition upnpapi.c:4738
int(* VDCallback_Read)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie, const void *request_cookie)
Read callback function prototype.
Definition upnp.h:2743
UpnpWebFileHandle(* VDCallback_Open)(const char *filename, enum UpnpOpenFileMode Mode, const void *cookie, const void *request_cookie)
Open callback function prototype.
Definition upnp.h:2719
char * UpnpGetServerIp6Address(void)
Returns the IPv6 link-local listening ip address.
Definition upnpapi.c:868
int UpnpUnRegisterClient(UpnpClient_Handle Hnd)
Unregisters a control point application, unsubscribing all active subscriptions.
Definition upnpapi.c:1673
int UpnpGetServiceVarStatus(UpnpClient_Handle Hnd, const char *ActionURL, const char *VarName, char **StVarVal)
Queries the state of a state variable of a service on another device.
int UpnpOpenHttpConnection(const char *url, void **handle, int timeout)
Opens a connection to the server.
Definition upnpapi.c:3545
int UpnpSetWebServerCorsString(const char *corsString)
Assign the Access-Control-Allow-Origin specfied by the input const char* cors_string parameterto the ...
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:3577
int UpnpVirtualDir_set_CloseCallback(VDCallback_Close callback)
Sets the close callback function to be used to access a virtual directory.
Definition upnpapi.c:4778
@ UPNPREG_FILENAME_DESC
Definition upnp.h:490
@ UPNPREG_BUF_DESC
Definition upnp.h:494
@ UPNPREG_URL_DESC
Definition upnp.h:486
@ UPNP_S_ROOT
Definition upnp.h:464
@ UPNP_S_ALL
Definition upnp.h:461
@ UPNP_S_SERVICE
Definition upnp.h:472
@ UPNP_S_DEVICE
Definition upnp.h:468
struct s_UpnpString UpnpString
Type of the string objects inside libupnp.
Definition UpnpString.h:33
#define DOMString
The type of DOM strings.
Definition ixml.h:48
struct _IXML_Document IXML_Document
Data structure representing the DOM Document.