UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
API.hpp
Go to the documentation of this file.
1#ifndef COMPA_INC_API_HPP
2#define COMPA_INC_API_HPP
3/*******************************************************************************
4 *
5 * Copyright (c) 2000-2003 Intel Corporation
6 * All rights reserved.
7 * Copyright (C) 2011-2012 France Telecom All rights reserved.
8 * Copyright (C) 2021+ GPL 3 and higher by Ingo Höft, <Ingo@Hoeft-online.de>
9 * Redistribution only with this Copyright remark. Last modified: 2025-07-08
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
13 *
14 * * Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 * * Redistributions in binary form must reproduce the above copyright notice,
17 * this list of conditions and the following disclaimer in the documentation
18 * and/or other materials provided with the distribution.
19 * * Neither name of Intel Corporation nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
27 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
31 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 *
35 ******************************************************************************/
36// Last compare with ./Pupnp source file on 2024-08-13, ver 1.14.19
37
45#define LINE_SIZE (size_t)180
46#define NAME_SIZE (size_t)256
47#define MNFT_NAME_SIZE 64
48#define MODL_NAME_SIZE 32
49#define SERL_NUMR_SIZE 64
50#define MODL_DESC_SIZE 64
51#define UPNP_INFINITE -1
52#define UPNP_USING_CHUNKED -3
53#define UPNP_UNTIL_CLOSE -4
55
75#define UPNP_E_SUCCESS 0
76
80#define UPNP_E_INVALID_HANDLE -100
81
88#define UPNP_E_INVALID_PARAM -101
89
95#define UPNP_E_OUTOF_HANDLE -102
96
97#define UPNP_E_OUTOF_CONTEXT -103
98
105#define UPNP_E_OUTOF_MEMORY -104
106
113#define UPNP_E_INIT -105
114
115#define UPNP_E_BUFFER_TOO_SMALL -106
116
122#define UPNP_E_INVALID_DESC -107
123
131#define UPNP_E_INVALID_URL -108
132
133#define UPNP_E_INVALID_SID -109
134
135#define UPNP_E_INVALID_DEVICE -110
136
143#define UPNP_E_INVALID_SERVICE -111
144
151#define UPNP_E_BAD_RESPONSE -113
152
153#define UPNP_E_BAD_REQUEST -114
154
161#define UPNP_E_INVALID_ACTION -115
162
169#define UPNP_E_FINISH -116
170
176#define UPNP_E_INIT_FAILED -117
177
183#define UPNP_E_URL_TOO_BIG -118
184
194#define UPNP_E_BAD_HTTPMSG -119
195
202#define UPNP_E_ALREADY_REGISTERED -120
203
208#define UPNP_E_INVALID_INTERFACE -121
209
217#define UPNP_E_NETWORK_ERROR -200
218
227#define UPNP_E_SOCKET_WRITE -201
228
237#define UPNP_E_SOCKET_READ -202
238
247#define UPNP_E_SOCKET_BIND -203
248
257#define UPNP_E_SOCKET_CONNECT -204
258
267#define UPNP_E_OUTOF_SOCKET -205
268
275#define UPNP_E_LISTEN -206
276
283#define UPNP_E_TIMEDOUT -207
284
291#define UPNP_E_SOCKET_ERROR -208
292
293#define UPNP_E_FILE_WRITE_ERROR -209
294
300#define UPNP_E_CANCELED -210
301
310#define UPNP_E_SOCKET_ACCEPT -211
311
312#define UPNP_E_EVENT_PROTOCOL -300
313
317#define UPNP_E_SUBSCRIBE_UNACCEPTED -301
318
322#define UPNP_E_UNSUBSCRIBE_UNACCEPTED -302
323
327#define UPNP_E_NOTIFY_UNACCEPTED -303
328
335#define UPNP_E_INVALID_ARGUMENT -501
336
341#define UPNP_E_FILE_NOT_FOUND -502
342
346#define UPNP_E_FILE_READ_ERROR -503
347
352#define UPNP_E_EXT_NOT_XML -504
353
354#define UPNP_E_NO_WEB_SERVER -505
355#define UPNP_E_OUTOF_BOUNDS -506
356
361#define UPNP_E_NOT_FOUND -507
362
367#define UPNP_E_INTERNAL_ERROR -911
368
369/* SOAP-related error codes */
370#define UPNP_SOAP_E_INVALID_ACTION 401
371#define UPNP_SOAP_E_INVALID_ARGS 402
372#define UPNP_SOAP_E_OUT_OF_SYNC 403
373#define UPNP_SOAP_E_INVALID_VAR 404
374#define UPNP_SOAP_E_ACTION_FAILED 501
375
377
378/*
379 * Opaque data structures. The following includes are data structures that
380 * must be externally visible. Since version 1.8.0, only an opaque typedef
381 * is visible from the outside world. Any operation on these data types
382 * must be done using the appropriate interface functions.
383 *
384 * This policy has the great advantage that it is now possible to change
385 * the internal implementation of these data structures without breaking
386 * the API.
387 */
388#include <UpnpActionComplete.hpp>
389#include <UpnpActionRequest.hpp>
390#include <UpnpDiscovery.hpp>
391#include <UpnpEvent.hpp>
392#include <UpnpEventSubscribe.hpp>
393#include <UpnpFileInfo.hpp>
397
403enum UpnpOpenFileMode { UPNP_READ, UPNP_WRITE };
404
413
423
431typedef char Upnp_SID[44];
432
456
458
477
479
480#include <Callback.hpp>
481
483
484#ifdef __cplusplus
485extern "C" {
486#endif /* __cplusplus */
487
488/******************************************************************************
489 ******************************************************************************
490 * *
491 * A D D R E S S I N G *
492 * *
493 ******************************************************************************
494 ******************************************************************************/
530PUPNP_Api int UpnpInit2(
546 const char* IfName,
549 unsigned short DestPort);
550
570PUPNP_Api int UpnpFinish(void);
571
583PUPNP_Api in_port_t UpnpGetServerPort(void);
584
596PUPNP_Api unsigned short UpnpGetServerPort6(void);
597
609PUPNP_Api unsigned short UpnpGetServerUlaGuaPort6(void);
610
622PUPNP_Api char* UpnpGetServerIpAddress(void);
623
635PUPNP_Api char* UpnpGetServerIp6Address(void);
636
649PUPNP_Api char* UpnpGetServerUlaGuaIp6Address(void);
650
687PUPNP_Api int UpnpRegisterRootDevice(
690 const char* const DescUrl,
693 const Upnp_FunPtr Fun,
696 const void* const Cookie,
698 UpnpDevice_Handle* const Hnd);
699
769PUPNP_Api int UpnpRegisterRootDevice2(
771 const Upnp_DescType descriptionType,
774 const char* const description_const,
777 const size_t bufferLen,
780 const int config_baseURL,
783 const Upnp_FunPtr Fun,
786 const void* const Cookie,
788 UpnpDevice_Handle* const Hnd);
789
826PUPNP_Api int UpnpRegisterRootDevice3(
829 const char* const DescUrl,
832 const Upnp_FunPtr Fun,
835 const void* const Cookie,
837 UpnpDevice_Handle* const Hnd,
840 const int AddressFamily);
841
849PUPNP_Api int UpnpRegisterRootDevice4(
851 const char* const DescUrl,
853 const Upnp_FunPtr Fun,
855 const void* const Cookie,
857 UpnpDevice_Handle* const Hnd,
859 const int AddressFamily,
862 const char* const LowerDescUrl);
863
882PUPNP_Api int UpnpUnRegisterRootDevice(
885
911 int PowerState,
913 int SleepPeriod,
915 int RegistrationState);
916
935PUPNP_Api int UpnpRegisterClient(
937 Upnp_FunPtr Fun,
940 const void* Cookie,
943 UpnpClient_Handle* Hnd);
944
965
984PUPNP_Api int UpnpSetMaxContentLength(
987 size_t contentLength);
988
990
991/******************************************************************************
992 ******************************************************************************
993 * *
994 * D I S C O V E R Y *
995 * *
996 ******************************************************************************
997 ******************************************************************************/
1026PUPNP_Api int UpnpSearchAsync(
1033 int Mx,
1036 const char* Target_const,
1038 const void* Cookie_const);
1039
1057PUPNP_Api int UpnpSendAdvertisement(
1065 int Exp);
1066
1087PUPNP_Api int UpnpSendAdvertisementLowPower(
1095 int Exp,
1097 int PowerState,
1099 int SleepPeriod,
1101 int RegistrationState);
1102
1104
1105/******************************************************************************
1106 ******************************************************************************
1107 * *
1108 * D E S C R I P T I O N *
1109 * *
1110 ******************************************************************************
1111 ******************************************************************************/
1113
1116// Nothing available?
1117
1120
1121/******************************************************************************
1122 ******************************************************************************
1123 * *
1124 * C O N T R O L *
1125 * *
1126 ******************************************************************************
1127 ******************************************************************************/
1157PUPNP_Api int UpnpGetServiceVarStatus(
1161 const char* ActionURL_const,
1163 const char* VarName_const,
1167 DOMString* StVar);
1168
1187PUPNP_Api int UpnpGetServiceVarStatusAsync(
1191 const char* ActionURL_const,
1193 const char* VarName_const,
1196 Upnp_FunPtr Fun,
1199 const void* Cookie_const);
1200
1226PUPNP_Api int UpnpSendAction(
1230 const char* ActionURL_const,
1232 const char* ServiceType_const,
1234 const char* DevUDN_const,
1236 IXML_Document* Action,
1239 IXML_Document** RespNodePtr);
1240
1266PUPNP_Api int UpnpSendActionEx(
1270 const char* ActionURL_const,
1272 const char* ServiceType_const,
1274 const char* DevUDN_const,
1277 IXML_Document* Header,
1279 IXML_Document* Action,
1282 IXML_Document** RespNodePtr);
1283
1307PUPNP_Api int UpnpSendActionAsync(
1311 const char* ActionURL_const,
1313 const char* ServiceType_const,
1315 const char* DevUDN_const,
1317 IXML_Document* Act,
1320 Upnp_FunPtr Fun,
1323 const void* Cookie_const);
1324
1348PUPNP_Api int UpnpSendActionExAsync(
1352 const char* ActionURL_const,
1354 const char* ServiceType_const,
1356 const char* DevUDN_const,
1359 IXML_Document* Header,
1361 IXML_Document* Act,
1364 Upnp_FunPtr Fun,
1367 const void* Cookie_const);
1368
1370
1371/******************************************************************************
1372 ******************************************************************************
1373 * *
1374 * E V E N T I N G *
1375 * *
1376 ******************************************************************************
1377 ******************************************************************************/
1408PUPNP_Api int UpnpAcceptSubscription(
1413 const char* DevID_const,
1416 const char* ServName_const,
1418 const char** VarName_const,
1420 const char** NewVal_const,
1422 int cVariables,
1424 const Upnp_SID SubsId);
1425
1450PUPNP_Api int UpnpAcceptSubscriptionExt(
1455 const char* DevID_const,
1458 const char* ServName_const,
1462 IXML_Document* PropSet,
1464 const Upnp_SID SubsId);
1465
1489PUPNP_Api int UpnpNotify(
1494 const char* DevID_const,
1496 const char* ServName_const,
1498 const char** VarName_const,
1500 const char** NewVal_const,
1502 int cVariables);
1503
1526PUPNP_Api int UpnpNotifyExt(
1531 const char* DevID_const,
1533 const char* ServName_const,
1537 IXML_Document* PropSet);
1538
1569PUPNP_Api int UpnpRenewSubscription(
1575 int* TimeOut,
1577 const Upnp_SID SubsId);
1578
1628PUPNP_Api int UpnpRenewSubscriptionAsync(
1634 int TimeOut,
1636 Upnp_SID SubsId,
1639 Upnp_FunPtr Fun,
1642 const void* Cookie_const);
1643
1659PUPNP_Api int UpnpSetMaxSubscriptions(
1664 int MaxSubscriptions);
1665
1682PUPNP_Api int UpnpSetMaxSubscriptionTimeOut(
1687 int MaxSubscriptionTimeOut);
1688
1720PUPNP_Api int UpnpSubscribe(
1724 const char* EvtUrl_const,
1728 int* TimeOut,
1730 Upnp_SID SubsId);
1731
1782PUPNP_Api int UpnpSubscribeAsync(
1786 const char* EvtUrl_const,
1789 int TimeOut,
1791 Upnp_FunPtr Fun,
1793 const void* Cookie_const);
1794
1826PUPNP_Api int UpnpUnSubscribe(
1831 const Upnp_SID SubsId);
1832
1883PUPNP_Api int UpnpUnSubscribeAsync(
1888 Upnp_SID SubsId,
1891 Upnp_FunPtr Fun,
1894 const void* Cookie_const);
1895
1897
1898/******************************************************************************
1899 ******************************************************************************
1900 * *
1901 * P R E S E N T A T I O N *
1902 * *
1903 ******************************************************************************
1904 ******************************************************************************/
1906
1909// Nothing available?
1910
1913
1914/******************************************************************************
1915 ******************************************************************************
1916 * *
1917 * C O N T R O L P O I N T - A P I *
1918 * *
1919 ******************************************************************************
1920 ******************************************************************************/
1934
1961PUPNP_Api int UpnpDownloadUrlItem(
1963 const char* url,
1965 char** outBuf,
1968 char* contentType);
1969
2000PUPNP_Api int UpnpOpenHttpGet(
2002 const char* url,
2004 void** handle,
2006 char** contentType,
2008 int* contentLength,
2010 int* httpStatus,
2015 int timeout);
2016
2047PUPNP_Api int UpnpOpenHttpGetProxy(
2049 const char* url,
2051 const char* proxy_str,
2053 void** handle,
2055 char** contentType,
2057 int* contentLength,
2059 int* httpStatus,
2064 int timeout);
2065
2096PUPNP_Api int UpnpOpenHttpGetEx(
2098 const char* url_str,
2100 void** Handle,
2102 char** contentType,
2104 int* contentLength,
2107 int* httpStatus,
2110 int lowRange,
2113 int highRange,
2117 int timeout);
2118
2136PUPNP_Api int UpnpReadHttpGet(
2138 void* Handle,
2140 char* buf,
2142 size_t* size,
2147 int timeout);
2148
2157PUPNP_Api int UpnpHttpGetProgress(
2159 void* Handle,
2161 size_t* length,
2163 size_t* total);
2164
2172PUPNP_Api int UpnpCancelHttpGet(
2175 void* Handle);
2176
2185PUPNP_Api int UpnpCloseHttpGet(
2188 void* Handle);
2189
2215PUPNP_Api int UpnpOpenHttpPost(
2217 const char* url,
2221 void** handle,
2224 const char* contentType,
2226 int contentLength,
2230 int timeout);
2231
2245PUPNP_Api int UpnpWriteHttpPost(
2248 void* handle,
2250 char* buf,
2252 size_t* size,
2256 int timeout);
2257
2271PUPNP_Api int UpnpCloseHttpPost(
2274 void* handle,
2277 int* httpStatus,
2281 int timeout);
2282
2306PUPNP_Api int UpnpOpenHttpConnection(
2309 const char* url,
2313 void** handle,
2317 int timeout);
2318
2344PUPNP_Api int UpnpMakeHttpRequest(
2346 Upnp_HttpMethod method,
2350 const char* url,
2352 void* handle,
2357 UpnpString* headers,
2359 const char* contentType,
2364 int contentLength,
2368 int timeout);
2369
2384PUPNP_Api int UpnpWriteHttpRequest(
2387 void* handle,
2389 char* buf,
2391 size_t* size,
2395 int timeout);
2396
2415PUPNP_Api int UpnpEndHttpRequest(
2417 void* handle,
2421 int timeout);
2422
2451PUPNP_Api int UpnpGetHttpResponse(
2454 void* handle,
2457 UpnpString* headers,
2459 char** contentType,
2461 int* contentLength,
2463 int* httpStatus,
2468 int timeout);
2469
2488PUPNP_Api int UpnpReadHttpResponse(
2491 void* handle,
2493 char* buf,
2495 size_t* size,
2500 int timeout);
2501
2514PUPNP_Api int UpnpCloseHttpConnection(
2517 void* handle);
2518
2546PUPNP_Api int UpnpDownloadXmlDoc(
2548 const char* url,
2551 IXML_Document** xmlDoc);
2552
2554
2555
2556/******************************************************************************
2557 ******************************************************************************
2558 * *
2559 * W E B S E R V E R A P I *
2560 * *
2561 ******************************************************************************
2562 ******************************************************************************/
2569typedef void* UpnpWebFileHandle;
2570
2574typedef int (*VDCallback_GetInfo)(
2576 const char* filename,
2579 UpnpFileInfo* info,
2581 const void* cookie,
2583 const void** request_cookie);
2584
2601PUPNP_Api int UpnpSetWebServerRootDir(
2604 const char* rootDir);
2605
2616
2622 const char* filename,
2625 enum UpnpOpenFileMode Mode,
2627 const void* cookie,
2629 const void* request_cookie);
2630
2640PUPNP_Api int UpnpVirtualDir_set_OpenCallback(VDCallback_Open callback);
2641
2645typedef int (*VDCallback_Read)(
2647 UpnpWebFileHandle fileHnd,
2649 char* buf,
2651 size_t buflen,
2653 const void* cookie,
2655 const void* request_cookie);
2656
2666PUPNP_Api int UpnpVirtualDir_set_ReadCallback(VDCallback_Read callback);
2667
2671typedef int (*VDCallback_Write)(
2673 UpnpWebFileHandle fileHnd,
2675 char* buf,
2677 size_t buflen,
2679 const void* cookie,
2681 const void* request_cookie);
2682
2693
2697typedef int (*VDCallback_Seek)(
2699 UpnpWebFileHandle fileHnd,
2703 off_t offset,
2708 int origin,
2710 const void* cookie,
2712 const void* request_cookie);
2713
2723PUPNP_Api int UpnpVirtualDir_set_SeekCallback(VDCallback_Seek callback);
2724
2728typedef int (*VDCallback_Close)(
2730 UpnpWebFileHandle fileHnd,
2732 const void* cookie,
2734 const void* request_cookie);
2735
2746
2758PUPNP_Api int UpnpEnableWebserver(
2760 int enable);
2761
2769PUPNP_Api int UpnpIsWebserverEnabled(void);
2770
2782typedef int (*WebCallback_HostValidate)(const char* hostname, void* cookie);
2783
2791 void* cookie);
2792
2798PUPNP_Api void UpnpSetAllowLiteralHostRedirection(int enable);
2799
2811PUPNP_Api int UpnpSetWebServerCorsString(
2813 const char* corsString);
2814
2827PUPNP_Api int UpnpAddVirtualDir(
2829 const char* newDirName,
2832 const void* cookie,
2834 const void** oldcookie);
2835
2845PUPNP_Api int UpnpRemoveVirtualDir(
2848 const char* dirName);
2849
2853PUPNP_Api void UpnpRemoveAllVirtualDirs(void);
2854
2856
2857#ifdef __cplusplus
2858}
2859#endif /* __cplusplus */
2860
2861#include <upnpconfig.h>
2862
2863#endif // COMPA_INC_API_HPP
Definition of event type codes.
int(* Upnp_FunPtr)(Upnp_EventType EventType, const void *Event, void *Cookie)
Definition Callback.hpp:143
enum Upnp_SType_e Upnp_SType
Represents the different types of searches that can be performed using the SDK for UPnP Devices API.
Definition API.hpp:457
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
Definition API.hpp:431
Upnp_DescType_e
Specifies the type of description in UpnpRegisterRootDevice2.
Definition API.hpp:465
@ UPNPREG_FILENAME_DESC
Definition API.hpp:471
@ UPNPREG_BUF_DESC
Definition API.hpp:475
@ UPNPREG_URL_DESC
Definition API.hpp:467
int UpnpClient_Handle
Returned when a control point application registers with UpnpRegisterClient().
Definition API.hpp:412
UpnpOpenFileMode
Represents the different types of searches that can be performed using the SDK for UPnP Devices API.
Definition API.hpp:403
Upnp_SType_e
Represents the different types of searches that can be performed using the SDK for UPnP Devices API.
Definition API.hpp:441
@ UPNP_S_ROOT
Definition API.hpp:446
@ UPNP_S_ALL
Definition API.hpp:443
@ UPNP_S_SERVICE
Definition API.hpp:454
@ UPNP_S_DEVICE
Definition API.hpp:450
int UpnpDevice_Handle
Returned when a device application registers with UpnpRegisterRootDevice(),UpnpRegisterRootDevice2(),...
Definition API.hpp:422
enum Upnp_DescType_e Upnp_DescType
Represents the different types of searches that can be performed using the SDK for UPnP Devices API.
Definition API.hpp:478
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.
s_UpnpFileInfo
Header file for UpnpFileInfo methods.
Header file for UpnpStateVarComplete methods.
Header file for UpnpStateVarRequest methods.
Header file for UpnpSubscriptionRequest methods.
Internal implementation of the class UpnpString.
Data structure representing the DOM Document.
Definition ixml.hpp:155
#define DOMString
The type of DOM strings.
Definition ixml.hpp:47
PUPNP_Api char * UpnpGetServerIpAddress(void)
Returns the local IPv4 listening ip address.
Definition upnpapi.cpp:977
PUPNP_Api unsigned short UpnpGetServerUlaGuaPort6(void)
Returns the internal server IPv6 ULA or GUA UPnP listening port.
Definition upnpapi.cpp:966
PUPNP_Api in_port_t UpnpGetServerPort(void)
Returns the internal server IPv4 UPnP listening port.
Definition upnpapi.cpp:948
PUPNP_Api unsigned short UpnpGetServerPort6(void)
Returns the internal server IPv6 link-local (LLA) UPnP listening port.
Definition upnpapi.cpp:955
PUPNP_Api int UpnpRegisterClient(Upnp_FunPtr Fun, const void *Cookie, UpnpClient_Handle *Hnd)
Registers a control point application with the UPnP Library.
PUPNP_Api int UpnpRegisterRootDevice2(const Upnp_DescType descriptionType, const char *const description_const, const size_t bufferLen, const int config_baseURL, const Upnp_FunPtr Fun, const void *const Cookie, UpnpDevice_Handle *const Hnd)
Registers one root- or logical-device object with the UPnP Library with additional description and ge...
Definition upnpapi.cpp:1163
PUPNP_Api int UpnpSetMaxContentLength(size_t contentLength)
Sets the maximum content-length that the SDK will process on an incoming SOAP requests or responses.
Definition upnpapi.cpp:3651
PUPNP_Api int UpnpRegisterRootDevice3(const char *const DescUrl, const Upnp_FunPtr Fun, const void *const Cookie, UpnpDevice_Handle *const Hnd, const int AddressFamily)
Registers one UPnP device object for a specific address family with the UPnP library and get a handle...
Definition upnpapi.cpp:1308
PUPNP_Api int UpnpUnRegisterClient(UpnpClient_Handle Hnd)
Unregisters a control point application, unsubscribing all active subscriptions.
PUPNP_Api int UpnpFinish(void)
Terminates the Linux SDK for UPnP Devices.
Definition upnpapi.cpp:876
PUPNP_Api char * UpnpGetServerIp6Address(void)
Returns the IPv6 link-local listening ip address.
Definition upnpapi.cpp:984
PUPNP_Api int UpnpUnRegisterRootDeviceLowPower(UpnpDevice_Handle Hnd, int PowerState, int SleepPeriod, int RegistrationState)
Unregisters a root device registered with UpnpRegisterRootDevice(), UpnpRegisterRootDevice2(),...
Definition upnpapi.cpp:1334
PUPNP_Api int UpnpRegisterRootDevice4(const char *const DescUrl, const Upnp_FunPtr Fun, const void *const Cookie, UpnpDevice_Handle *const Hnd, const int AddressFamily, const char *const LowerDescUrl)
Same as UpnpRegisterRootDevice3() with additional argument to specify a description URL.
Definition upnpapi.cpp:1317
PUPNP_Api char * UpnpGetServerUlaGuaIp6Address(void)
Returns the IPv6 unique-local or globally-unique listening ip address.
Definition upnpapi.cpp:995
PUPNP_Api int UpnpInit2(const char *IfName, unsigned short DestPort)
Initializes the Linux SDK for UPnP Devices.
Definition upnpapi.cpp:786
PUPNP_Api int UpnpRegisterRootDevice(const char *const DescUrl, const Upnp_FunPtr Fun, const void *const Cookie, UpnpDevice_Handle *const Hnd)
Registers one root- or logical-device object with the UPnP Library to get a handle for it.
Definition upnpapi.cpp:1007
PUPNP_Api int UpnpUnRegisterRootDevice(UpnpDevice_Handle Hnd)
Unregisters a root device registered with UpnpRegisterRootDevice(), UpnpRegisterRootDevice2(),...
Definition upnpapi.cpp:1328
PUPNP_Api int UpnpSendActionAsync(UpnpClient_Handle Hnd, const char *ActionURL_const, const char *ServiceType_const, const char *DevUDN_const, IXML_Document *Act, Upnp_FunPtr Fun, const void *Cookie_const)
Sends a message to change a state variable in a service, generating a callback when the operation is ...
Definition upnpapi.cpp:2631
PUPNP_Api int UpnpSendActionExAsync(UpnpClient_Handle Hnd, const char *ActionURL_const, const char *ServiceType_const, const char *DevUDN_const, IXML_Document *Header, IXML_Document *Act, Upnp_FunPtr Fun, const void *Cookie_const)
Sends a message to change a state variable in a service, generating a callback when the operation is ...
Definition upnpapi.cpp:2717
PUPNP_Api int UpnpSendActionEx(UpnpClient_Handle Hnd, const char *ActionURL_const, const char *ServiceType_const, const char *DevUDN_const, IXML_Document *Header, IXML_Document *Action, IXML_Document **RespNodePtr)
Sends a message to change a state variable in a service.
Definition upnpapi.cpp:2583
PUPNP_Api int UpnpGetServiceVarStatusAsync(UpnpClient_Handle Hnd, const char *ActionURL_const, const char *VarName_const, Upnp_FunPtr Fun, const void *Cookie_const)
Queries the state of a variable of a service, generating a callback when the operation is complete.
Definition upnpapi.cpp:2829
PUPNP_Api int UpnpGetServiceVarStatus(UpnpClient_Handle Hnd, const char *ActionURL_const, const char *VarName_const, DOMString *StVar)
Queries the state of a state variable of a service on another device.
Definition upnpapi.cpp:2893
PUPNP_Api int UpnpSendAction(UpnpClient_Handle Hnd, const char *ActionURL_const, const char *ServiceType_const, const char *DevUDN_const, IXML_Document *Action, IXML_Document **RespNodePtr)
Sends a message to change a state variable in a service.
Definition upnpapi.cpp:2535
PUPNP_Api int UpnpHttpGetProgress(void *Handle, size_t *length, size_t *total)
Retrieve progress information of a http-get transfer.
Definition upnpapi.cpp:3016
PUPNP_Api 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.cpp:2956
PUPNP_Api 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.cpp:3012
PUPNP_Api int UpnpCancelHttpGet(void *Handle)
Set the cancel flag of the handle parameter.
Definition upnpapi.cpp:3008
PUPNP_Api 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.cpp:2952
PUPNP_Api int UpnpOpenHttpConnection(const char *url, void **handle, int timeout)
Opens a connection to the server.
Definition upnpapi.cpp:3020
PUPNP_Api int UpnpDownloadUrlItem(const char *url, char **outBuf, char *contentType)
Downloads a file specified in a URL.
Definition upnpapi.cpp:3055
PUPNP_Api int UpnpOpenHttpGetEx(const char *url_str, 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.cpp:3001
PUPNP_Api int UpnpEndHttpRequest(void *handle, int timeout)
Indicates the end of a HTTP request previously made by UpnpMakeHttpRequest().
Definition upnpapi.cpp:3035
PUPNP_Api 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.cpp:3024
PUPNP_Api int UpnpOpenHttpGet(const char *url, void **handle, char **contentType, int *contentLength, int *httpStatus, int timeout)
Gets a file specified in a URL.
Definition upnpapi.cpp:2966
PUPNP_Api 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 conten...
Definition upnpapi.cpp:3031
PUPNP_Api 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.cpp:3039
PUPNP_Api 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.cpp:3045
PUPNP_Api 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.cpp:2983
Upnp_HttpMethod
Different HTTP methods.
Definition API.hpp:1927
PUPNP_Api int UpnpCloseHttpGet(void *Handle)
Closes the connection and frees memory that was allocated for the handle parameter.
Definition upnpapi.cpp:3010
PUPNP_Api int UpnpCloseHttpConnection(void *handle)
Closes the connection created with UpnpOpenHttpConnection() and frees any memory associated with the ...
Definition upnpapi.cpp:3049
PUPNP_Api int UpnpDownloadXmlDoc(const char *url, IXML_Document **xmlDoc)
Downloads an XML document specified in a URL.
Definition upnpapi.cpp:3077
PUPNP_Api 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.cpp:2942
@ UPNP_HTTPMETHOD_DELETE
DELETE.
Definition API.hpp:1929
@ UPNP_HTTPMETHOD_GET
GET.
Definition API.hpp:1930
@ UPNP_HTTPMETHOD_HEAD
HEAD.
Definition API.hpp:1931
@ UPNP_HTTPMETHOD_PUT
PUT.
Definition API.hpp:1928
@ UPNP_HTTPMETHOD_POST
POST.
Definition API.hpp:1932
PUPNP_Api int UpnpSearchAsync(UpnpClient_Handle Hnd, int Mx, const char *Target_const, const void *Cookie_const)
Searches for devices matching the given search target.
Definition upnpapi.cpp:1820
PUPNP_Api int UpnpSendAdvertisementLowPower(UpnpDevice_Handle Hnd, int Exp, int PowerState, int SleepPeriod, int RegistrationState)
Sends out the discovery announcements for all devices and services contained within one root device.
Definition upnpapi.cpp:1721
PUPNP_Api int UpnpSendAdvertisement(UpnpDevice_Handle Hnd, int Exp)
Sends out the discovery announcements for all devices and services contained within one root device.
Definition upnpapi.cpp:1715
PUPNP_Api int UpnpSetMaxSubscriptionTimeOut(UpnpDevice_Handle Hnd, int MaxSubscriptionTimeOut)
Sets the maximum time-out accepted for a subscription request or renewal.
Definition upnpapi.cpp:1899
PUPNP_Api int UpnpRenewSubscriptionAsync(UpnpClient_Handle Hnd, int TimeOut, Upnp_SID SubsId, Upnp_FunPtr Fun, const void *Cookie_const)
Renews a subscription that is about to expire, generating a callback when the operation is complete.
Definition upnpapi.cpp:2232
PUPNP_Api int UpnpSubscribeAsync(UpnpClient_Handle Hnd, const char *EvtUrl_const, int TimeOut, Upnp_FunPtr Fun, const void *Cookie_const)
Performs the same operation as UpnpSubscribe(), but returns immediately and calls the registered call...
Definition upnpapi.cpp:2002
PUPNP_Api int UpnpSetMaxSubscriptions(UpnpDevice_Handle Hnd, int MaxSubscriptions)
Sets the maximum number of subscriptions accepted per service.
Definition upnpapi.cpp:1866
PUPNP_Api int UpnpSubscribe(UpnpClient_Handle Hnd, const char *EvtUrl_const, int *TimeOut, Upnp_SID SubsId)
Registers a control point to receive event notifications from a UPnP device.
Definition upnpapi.cpp:1936
PUPNP_Api int UpnpNotify(UpnpDevice_Handle Hnd, const char *DevID_const, const char *ServName_const, const char **VarName_const, const char **NewVal_const, int cVariables)
Sends out an event change notification to all control points subscribed to a particular service.
Definition upnpapi.cpp:2297
PUPNP_Api int UpnpRenewSubscription(UpnpClient_Handle Hnd, int *TimeOut, const Upnp_SID SubsId)
Renews a subscription that is about to expire.
Definition upnpapi.cpp:2179
PUPNP_Api int UpnpAcceptSubscriptionExt(UpnpDevice_Handle Hnd, const char *DevID_const, const char *ServName_const, 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.cpp:2457
PUPNP_Api 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.cpp:2068
PUPNP_Api int UpnpNotifyExt(UpnpDevice_Handle Hnd, const char *DevID_const, const char *ServName_const, IXML_Document *PropSet)
Similar to UpnpNotify() except that it takes a DOM document for the event rather than an array of str...
Definition upnpapi.cpp:2342
PUPNP_Api int UpnpUnSubscribeAsync(UpnpClient_Handle Hnd, Upnp_SID SubsId, Upnp_FunPtr Fun, const void *Cookie_const)
Removes a subscription of a control point from a service previously subscribed to using UpnpSubscribe...
Definition upnpapi.cpp:2114
PUPNP_Api int UpnpAcceptSubscription(UpnpDevice_Handle Hnd, const char *DevID_const, const char *ServName_const, const char **VarName_const, const char **NewVal_const, 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.cpp:2382
int(* VDCallback_Close)(UpnpWebFileHandle fileHnd, const void *cookie, const void *request_cookie)
Close callback function prototype.
Definition API.hpp:2728
PUPNP_Api int UpnpVirtualDir_set_GetInfoCallback(VDCallback_GetInfo callback)
Sets the get_info callback function to be used to access a web directory.
Definition upnpapi.cpp:3597
PUPNP_Api void UpnpSetAllowLiteralHostRedirection(int enable)
Enable or disable literal IP redirection.
Definition upnpapi.cpp:3593
PUPNP_Api int UpnpVirtualDir_set_ReadCallback(VDCallback_Read callback)
Sets the read callback function to be used to access a web directory.
Definition upnpapi.cpp:3615
PUPNP_Api int UpnpVirtualDir_set_SeekCallback(VDCallback_Seek callback)
Sets the seek callback function to be used to access a web directory.
Definition upnpapi.cpp:3633
PUPNP_Api int UpnpIsWebserverEnabled(void)
Returns the status of the webserver.
Definition upnpapi.cpp:3580
void * UpnpWebFileHandle
The type of handle returned by the web server for open requests.
Definition API.hpp:2569
PUPNP_Api int UpnpSetWebServerRootDir(const char *rootDir)
Sets the document root directory for the internal web server.
Definition upnpapi.cpp:3395
int(* VDCallback_GetInfo)(const char *filename, UpnpFileInfo *info, const void *cookie, const void **request_cookie)
Get-info callback function prototype.
Definition API.hpp:2574
PUPNP_Api void UpnpSetHostValidateCallback(WebCallback_HostValidate callback, void *cookie)
Set callback for validating HTTP requests HOST header values.
Definition upnpapi.cpp:3587
int(* WebCallback_HostValidate)(const char *hostname, void *cookie)
Callback for validating HTTP requests HOST header values.
Definition API.hpp:2782
PUPNP_Api void UpnpRemoveAllVirtualDirs(void)
Removes all web directory mappings.
Definition upnpapi.cpp:3544
int(* VDCallback_Seek)(UpnpWebFileHandle fileHnd, off_t offset, int origin, const void *cookie, const void *request_cookie)
Seek callback function prototype.
Definition API.hpp:2697
PUPNP_Api int UpnpVirtualDir_set_OpenCallback(VDCallback_Open callback)
Sets the open callback function to be used to access a web directory.
Definition upnpapi.cpp:3606
PUPNP_Api int UpnpAddVirtualDir(const char *newDirName, const void *cookie, const void **oldcookie)
Adds a web directory mapping.
Definition upnpapi.cpp:3423
PUPNP_Api int UpnpVirtualDir_set_WriteCallback(VDCallback_Write callback)
Sets the write callback function to be used to access a web directory.
Definition upnpapi.cpp:3624
PUPNP_Api int UpnpVirtualDir_set_CloseCallback(VDCallback_Close callback)
Sets the close callback function to be used to access a web directory.
Definition upnpapi.cpp:3642
int(* VDCallback_Write)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie, const void *request_cookie)
Write callback function prototype.
Definition API.hpp:2671
int(* VDCallback_Read)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie, const void *request_cookie)
Read callback function prototype.
Definition API.hpp:2645
UpnpWebFileHandle(* VDCallback_Open)(const char *filename, enum UpnpOpenFileMode Mode, const void *cookie, const void *request_cookie)
Open callback function prototype.
Definition API.hpp:2620
PUPNP_Api int UpnpSetWebServerCorsString(const char *corsString)
Assign the Access-Control-Allow-Origin specfied by the input const char* cors_string parameter to the...
Definition upnpapi.cpp:3410
PUPNP_Api int UpnpEnableWebserver(int enable)
Enables or disables the webserver.
Definition upnpapi.cpp:3564
PUPNP_Api int UpnpRemoveVirtualDir(const char *dirName)
Removes a web directory mapping made with UpnpAddVirtualDir().
Definition upnpapi.cpp:3498