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-06-12
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
398#include <sock_api.hpp>
399#include <UPnPsdk/port.hpp>
400
406enum UpnpOpenFileMode { UPNP_READ, UPNP_WRITE };
407
416
426
434typedef char Upnp_SID[44];
435
459
461
480
482
483#include <Callback.hpp>
484
486
487#ifdef __cplusplus
488extern "C" {
489#endif /* __cplusplus */
490
491/******************************************************************************
492 ******************************************************************************
493 * *
494 * A D D R E S S I N G *
495 * *
496 ******************************************************************************
497 ******************************************************************************/
533PUPNP_Api int UpnpInit2(
549 const char* IfName,
552 unsigned short DestPort);
553
573PUPNP_Api int UpnpFinish(void);
574
586PUPNP_Api in_port_t UpnpGetServerPort(void);
587
599PUPNP_Api unsigned short UpnpGetServerPort6(void);
600
612PUPNP_Api unsigned short UpnpGetServerUlaGuaPort6(void);
613
625PUPNP_Api char* UpnpGetServerIpAddress(void);
626
638PUPNP_Api char* UpnpGetServerIp6Address(void);
639
652PUPNP_Api char* UpnpGetServerUlaGuaIp6Address(void);
653
690PUPNP_Api int UpnpRegisterRootDevice(
693 const char* const DescUrl,
696 const Upnp_FunPtr Fun,
699 const void* const Cookie,
701 UpnpDevice_Handle* const Hnd);
702
772PUPNP_Api int UpnpRegisterRootDevice2(
774 const Upnp_DescType descriptionType,
777 const char* const description_const,
780 const size_t bufferLen,
783 const int config_baseURL,
786 const Upnp_FunPtr Fun,
789 const void* const Cookie,
791 UpnpDevice_Handle* const Hnd);
792
829PUPNP_Api int UpnpRegisterRootDevice3(
832 const char* const DescUrl,
835 const Upnp_FunPtr Fun,
838 const void* const Cookie,
840 UpnpDevice_Handle* const Hnd,
843 const int AddressFamily);
844
852PUPNP_Api int UpnpRegisterRootDevice4(
854 const char* const DescUrl,
856 const Upnp_FunPtr Fun,
858 const void* const Cookie,
860 UpnpDevice_Handle* const Hnd,
862 const int AddressFamily,
865 const char* const LowerDescUrl);
866
885PUPNP_Api int UpnpUnRegisterRootDevice(
888
914 int PowerState,
916 int SleepPeriod,
918 int RegistrationState);
919
938PUPNP_Api int UpnpRegisterClient(
940 Upnp_FunPtr Fun,
943 const void* Cookie,
946 UpnpClient_Handle* Hnd);
947
965PUPNP_Api int UpnpUnRegisterClient(
968
977PUPNP_Api int UpnpSetContentLength(
982 size_t contentLength);
983
1002PUPNP_Api int UpnpSetMaxContentLength(
1005 size_t contentLength);
1006
1008
1009/******************************************************************************
1010 ******************************************************************************
1011 * *
1012 * D I S C O V E R Y *
1013 * *
1014 ******************************************************************************
1015 ******************************************************************************/
1044PUPNP_Api int UpnpSearchAsync(
1051 int Mx,
1054 const char* Target_const,
1056 const void* Cookie_const);
1057
1075PUPNP_Api int UpnpSendAdvertisement(
1083 int Exp);
1084
1105PUPNP_Api int UpnpSendAdvertisementLowPower(
1113 int Exp,
1115 int PowerState,
1117 int SleepPeriod,
1119 int RegistrationState);
1120
1122
1123/******************************************************************************
1124 ******************************************************************************
1125 * *
1126 * D E S C R I P T I O N *
1127 * *
1128 ******************************************************************************
1129 ******************************************************************************/
1131
1134// Nothing available?
1135
1138
1139/******************************************************************************
1140 ******************************************************************************
1141 * *
1142 * C O N T R O L *
1143 * *
1144 ******************************************************************************
1145 ******************************************************************************/
1175PUPNP_Api int UpnpGetServiceVarStatus(
1179 const char* ActionURL_const,
1181 const char* VarName_const,
1185 DOMString* StVar);
1186
1205PUPNP_Api int UpnpGetServiceVarStatusAsync(
1209 const char* ActionURL_const,
1211 const char* VarName_const,
1214 Upnp_FunPtr Fun,
1217 const void* Cookie_const);
1218
1244PUPNP_Api int UpnpSendAction(
1248 const char* ActionURL_const,
1250 const char* ServiceType_const,
1252 const char* DevUDN_const,
1254 IXML_Document* Action,
1257 IXML_Document** RespNodePtr);
1258
1284PUPNP_Api int UpnpSendActionEx(
1288 const char* ActionURL_const,
1290 const char* ServiceType_const,
1292 const char* DevUDN_const,
1295 IXML_Document* Header,
1297 IXML_Document* Action,
1300 IXML_Document** RespNodePtr);
1301
1325PUPNP_Api int UpnpSendActionAsync(
1329 const char* ActionURL_const,
1331 const char* ServiceType_const,
1333 const char* DevUDN_const,
1335 IXML_Document* Act,
1338 Upnp_FunPtr Fun,
1341 const void* Cookie_const);
1342
1366PUPNP_Api int UpnpSendActionExAsync(
1370 const char* ActionURL_const,
1372 const char* ServiceType_const,
1374 const char* DevUDN_const,
1377 IXML_Document* Header,
1379 IXML_Document* Act,
1382 Upnp_FunPtr Fun,
1385 const void* Cookie_const);
1386
1388
1389/******************************************************************************
1390 ******************************************************************************
1391 * *
1392 * E V E N T I N G *
1393 * *
1394 ******************************************************************************
1395 ******************************************************************************/
1426PUPNP_Api int UpnpAcceptSubscription(
1431 const char* DevID_const,
1434 const char* ServName_const,
1436 const char** VarName_const,
1438 const char** NewVal_const,
1440 int cVariables,
1442 const Upnp_SID SubsId);
1443
1468PUPNP_Api int UpnpAcceptSubscriptionExt(
1473 const char* DevID_const,
1476 const char* ServName_const,
1480 IXML_Document* PropSet,
1482 const Upnp_SID SubsId);
1483
1507PUPNP_Api int UpnpNotify(
1512 const char* DevID_const,
1514 const char* ServName_const,
1516 const char** VarName_const,
1518 const char** NewVal_const,
1520 int cVariables);
1521
1544PUPNP_Api int UpnpNotifyExt(
1549 const char* DevID_const,
1551 const char* ServName_const,
1555 IXML_Document* PropSet);
1556
1587PUPNP_Api int UpnpRenewSubscription(
1593 int* TimeOut,
1595 const Upnp_SID SubsId);
1596
1646PUPNP_Api int UpnpRenewSubscriptionAsync(
1652 int TimeOut,
1654 Upnp_SID SubsId,
1657 Upnp_FunPtr Fun,
1660 const void* Cookie_const);
1661
1677PUPNP_Api int UpnpSetMaxSubscriptions(
1682 int MaxSubscriptions);
1683
1700PUPNP_Api int UpnpSetMaxSubscriptionTimeOut(
1705 int MaxSubscriptionTimeOut);
1706
1738PUPNP_Api int UpnpSubscribe(
1742 const char* EvtUrl_const,
1746 int* TimeOut,
1748 Upnp_SID SubsId);
1749
1800PUPNP_Api int UpnpSubscribeAsync(
1804 const char* EvtUrl_const,
1807 int TimeOut,
1809 Upnp_FunPtr Fun,
1811 const void* Cookie_const);
1812
1844PUPNP_Api int UpnpUnSubscribe(
1849 const Upnp_SID SubsId);
1850
1901PUPNP_Api int UpnpUnSubscribeAsync(
1906 Upnp_SID SubsId,
1909 Upnp_FunPtr Fun,
1912 const void* Cookie_const);
1913
1915
1916/******************************************************************************
1917 ******************************************************************************
1918 * *
1919 * P R E S E N T A T I O N *
1920 * *
1921 ******************************************************************************
1922 ******************************************************************************/
1924
1927// Nothing available?
1928
1931
1932/******************************************************************************
1933 ******************************************************************************
1934 * *
1935 * C O N T R O L P O I N T - A P I *
1936 * *
1937 ******************************************************************************
1938 ******************************************************************************/
1952
1979PUPNP_Api int UpnpDownloadUrlItem(
1981 const char* url,
1983 char** outBuf,
1986 char* contentType);
1987
2018PUPNP_Api int UpnpOpenHttpGet(
2020 const char* url,
2022 void** handle,
2024 char** contentType,
2026 int* contentLength,
2028 int* httpStatus,
2033 int timeout);
2034
2065PUPNP_Api int UpnpOpenHttpGetProxy(
2067 const char* url,
2069 const char* proxy_str,
2071 void** handle,
2073 char** contentType,
2075 int* contentLength,
2077 int* httpStatus,
2082 int timeout);
2083
2114PUPNP_Api int UpnpOpenHttpGetEx(
2116 const char* url_str,
2118 void** Handle,
2120 char** contentType,
2122 int* contentLength,
2125 int* httpStatus,
2128 int lowRange,
2131 int highRange,
2135 int timeout);
2136
2154PUPNP_Api int UpnpReadHttpGet(
2156 void* Handle,
2158 char* buf,
2160 size_t* size,
2165 int timeout);
2166
2175PUPNP_Api int UpnpHttpGetProgress(
2177 void* Handle,
2179 size_t* length,
2181 size_t* total);
2182
2190PUPNP_Api int UpnpCancelHttpGet(
2193 void* Handle);
2194
2203PUPNP_Api int UpnpCloseHttpGet(
2206 void* Handle);
2207
2233PUPNP_Api int UpnpOpenHttpPost(
2235 const char* url,
2239 void** handle,
2242 const char* contentType,
2244 int contentLength,
2248 int timeout);
2249
2263PUPNP_Api int UpnpWriteHttpPost(
2266 void* handle,
2268 char* buf,
2270 size_t* size,
2274 int timeout);
2275
2289PUPNP_Api int UpnpCloseHttpPost(
2292 void* handle,
2295 int* httpStatus,
2299 int timeout);
2300
2324PUPNP_Api int UpnpOpenHttpConnection(
2327 const char* url,
2331 void** handle,
2335 int timeout);
2336
2362PUPNP_Api int UpnpMakeHttpRequest(
2364 Upnp_HttpMethod method,
2368 const char* url,
2370 void* handle,
2375 UpnpString* headers,
2377 const char* contentType,
2382 int contentLength,
2386 int timeout);
2387
2402PUPNP_Api int UpnpWriteHttpRequest(
2405 void* handle,
2407 char* buf,
2409 size_t* size,
2413 int timeout);
2414
2433PUPNP_Api int UpnpEndHttpRequest(
2435 void* handle,
2439 int timeout);
2440
2469PUPNP_Api int UpnpGetHttpResponse(
2472 void* handle,
2475 UpnpString* headers,
2477 char** contentType,
2479 int* contentLength,
2481 int* httpStatus,
2486 int timeout);
2487
2506PUPNP_Api int UpnpReadHttpResponse(
2509 void* handle,
2511 char* buf,
2513 size_t* size,
2518 int timeout);
2519
2532PUPNP_Api int UpnpCloseHttpConnection(
2535 void* handle);
2536
2564PUPNP_Api int UpnpDownloadXmlDoc(
2566 const char* url,
2569 IXML_Document** xmlDoc);
2570
2572
2573
2574/******************************************************************************
2575 ******************************************************************************
2576 * *
2577 * W E B S E R V E R A P I *
2578 * *
2579 ******************************************************************************
2580 ******************************************************************************/
2587typedef void* UpnpWebFileHandle;
2588
2592typedef int (*VDCallback_GetInfo)(
2594 const char* filename,
2597 UpnpFileInfo* info,
2599 const void* cookie,
2601 const void** request_cookie);
2602
2619PUPNP_Api int UpnpSetWebServerRootDir(
2622 const char* rootDir);
2623
2634
2640 const char* filename,
2643 enum UpnpOpenFileMode Mode,
2645 const void* cookie,
2647 const void* request_cookie);
2648
2658PUPNP_Api int UpnpVirtualDir_set_OpenCallback(VDCallback_Open callback);
2659
2663typedef int (*VDCallback_Read)(
2665 UpnpWebFileHandle fileHnd,
2667 char* buf,
2669 size_t buflen,
2671 const void* cookie,
2673 const void* request_cookie);
2674
2684PUPNP_Api int UpnpVirtualDir_set_ReadCallback(VDCallback_Read callback);
2685
2689typedef int (*VDCallback_Write)(
2691 UpnpWebFileHandle fileHnd,
2693 char* buf,
2695 size_t buflen,
2697 const void* cookie,
2699 const void* request_cookie);
2700
2711
2715typedef int (*VDCallback_Seek)(
2717 UpnpWebFileHandle fileHnd,
2721 off_t offset,
2726 int origin,
2728 const void* cookie,
2730 const void* request_cookie);
2731
2741PUPNP_Api int UpnpVirtualDir_set_SeekCallback(VDCallback_Seek callback);
2742
2746typedef int (*VDCallback_Close)(
2748 UpnpWebFileHandle fileHnd,
2750 const void* cookie,
2752 const void* request_cookie);
2753
2764
2776PUPNP_Api int UpnpEnableWebserver(
2778 int enable);
2779
2787PUPNP_Api int UpnpIsWebserverEnabled(void);
2788
2800typedef int (*WebCallback_HostValidate)(const char* hostname, void* cookie);
2801
2809 void* cookie);
2810
2816PUPNP_Api void UpnpSetAllowLiteralHostRedirection(int enable);
2817
2829PUPNP_Api int UpnpSetWebServerCorsString(
2831 const char* corsString);
2832
2845PUPNP_Api int UpnpAddVirtualDir(
2847 const char* newDirName,
2850 const void* cookie,
2852 const void** oldcookie);
2853
2863PUPNP_Api int UpnpRemoveVirtualDir(
2866 const char* dirName);
2867
2871PUPNP_Api void UpnpRemoveAllVirtualDirs(void);
2872
2874
2875#ifdef __cplusplus
2876}
2877#endif /* __cplusplus */
2878
2879#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:460
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
Definition API.hpp:434
Upnp_DescType_e
Specifies the type of description in UpnpRegisterRootDevice2.
Definition API.hpp:468
@ UPNPREG_FILENAME_DESC
Definition API.hpp:474
@ UPNPREG_BUF_DESC
Definition API.hpp:478
@ UPNPREG_URL_DESC
Definition API.hpp:470
int UpnpClient_Handle
Returned when a control point application registers with UpnpRegisterClient().
Definition API.hpp:415
UpnpOpenFileMode
Represents the different types of searches that can be performed using the SDK for UPnP Devices API.
Definition API.hpp:406
Upnp_SType_e
Represents the different types of searches that can be performed using the SDK for UPnP Devices API.
Definition API.hpp:444
@ UPNP_S_ROOT
Definition API.hpp:449
@ UPNP_S_ALL
Definition API.hpp:446
@ UPNP_S_SERVICE
Definition API.hpp:457
@ UPNP_S_DEVICE
Definition API.hpp:453
int UpnpDevice_Handle
Returned when a device application registers with UpnpRegisterRootDevice(),UpnpRegisterRootDevice2(),...
Definition API.hpp:425
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:481
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:785
PUPNP_Api unsigned short UpnpGetServerUlaGuaPort6(void)
Returns the internal server IPv6 ULA or GUA UPnP listening port.
Definition upnpapi.cpp:774
PUPNP_Api in_port_t UpnpGetServerPort(void)
Returns the internal server IPv4 UPnP listening port.
Definition upnpapi.cpp:756
PUPNP_Api unsigned short UpnpGetServerPort6(void)
Returns the internal server IPv6 link-local (LLA) UPnP listening port.
Definition upnpapi.cpp:763
PUPNP_Api int UpnpRegisterClient(Upnp_FunPtr Fun, const void *Cookie, UpnpClient_Handle *Hnd)
Registers a control point application with the UPnP Library.
Definition upnpapi.cpp:1409
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:1020
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:3696
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:1311
PUPNP_Api int UpnpUnRegisterClient(UpnpClient_Handle Hnd)
Unregisters a control point application, unsubscribing all active subscriptions.
Definition upnpapi.cpp:1458
PUPNP_Api int UpnpFinish(void)
Terminates the Linux SDK for UPnP Devices.
Definition upnpapi.cpp:684
PUPNP_Api int UpnpSetContentLength(UpnpClient_Handle Hnd, size_t contentLength)
Sets the content-length that the SDK will process on an incoming SOAP requests or responses.
Definition upnpapi.cpp:3666
PUPNP_Api char * UpnpGetServerIp6Address(void)
Returns the IPv6 link-local listening ip address.
Definition upnpapi.cpp:792
PUPNP_Api int UpnpUnRegisterRootDeviceLowPower(UpnpDevice_Handle Hnd, int PowerState, int SleepPeriod, int RegistrationState)
Unregisters a root device registered with UpnpRegisterRootDevice(), UpnpRegisterRootDevice2(),...
Definition upnpapi.cpp:1337
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:1320
PUPNP_Api char * UpnpGetServerUlaGuaIp6Address(void)
Returns the IPv6 unique-local or globally-unique listening ip address.
Definition upnpapi.cpp:803
PUPNP_Api int UpnpInit2(const char *IfName, unsigned short DestPort)
Initializes the Linux SDK for UPnP Devices.
Definition upnpapi.cpp:594
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:866
PUPNP_Api int UpnpUnRegisterRootDevice(UpnpDevice_Handle Hnd)
Unregisters a root device registered with UpnpRegisterRootDevice(), UpnpRegisterRootDevice2(),...
Definition upnpapi.cpp:1331
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:2634
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:2720
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:2586
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:2832
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:2896
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:2538
PUPNP_Api int UpnpHttpGetProgress(void *Handle, size_t *length, size_t *total)
Retrieve progress information of a http-get transfer.
Definition upnpapi.cpp:3019
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:2959
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:3015
PUPNP_Api int UpnpCancelHttpGet(void *Handle)
Set the cancel flag of the handle parameter.
Definition upnpapi.cpp:3011
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:2955
PUPNP_Api int UpnpOpenHttpConnection(const char *url, void **handle, int timeout)
Opens a connection to the server.
Definition upnpapi.cpp:3023
PUPNP_Api int UpnpDownloadUrlItem(const char *url, char **outBuf, char *contentType)
Downloads a file specified in a URL.
Definition upnpapi.cpp:3058
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:3004
PUPNP_Api int UpnpEndHttpRequest(void *handle, int timeout)
Indicates the end of a HTTP request previously made by UpnpMakeHttpRequest().
Definition upnpapi.cpp:3038
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:3027
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:2969
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:3034
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:3042
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:3048
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:2986
Upnp_HttpMethod
Different HTTP methods.
Definition API.hpp:1945
PUPNP_Api int UpnpCloseHttpGet(void *Handle)
Closes the connection and frees memory that was allocated for the handle parameter.
Definition upnpapi.cpp:3013
PUPNP_Api int UpnpCloseHttpConnection(void *handle)
Closes the connection created with UpnpOpenHttpConnection() and frees any memory associated with the ...
Definition upnpapi.cpp:3052
PUPNP_Api int UpnpDownloadXmlDoc(const char *url, IXML_Document **xmlDoc)
Downloads an XML document specified in a URL.
Definition upnpapi.cpp:3080
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:2945
@ UPNP_HTTPMETHOD_DELETE
DELETE.
Definition API.hpp:1947
@ UPNP_HTTPMETHOD_GET
GET.
Definition API.hpp:1948
@ UPNP_HTTPMETHOD_HEAD
HEAD.
Definition API.hpp:1949
@ UPNP_HTTPMETHOD_PUT
PUT.
Definition API.hpp:1946
@ UPNP_HTTPMETHOD_POST
POST.
Definition API.hpp:1950
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:1823
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:1724
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:1718
PUPNP_Api int UpnpSetMaxSubscriptionTimeOut(UpnpDevice_Handle Hnd, int MaxSubscriptionTimeOut)
Sets the maximum time-out accepted for a subscription request or renewal.
Definition upnpapi.cpp:1902
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:2235
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:1939
PUPNP_Api int UpnpSetMaxSubscriptions(UpnpDevice_Handle Hnd, int MaxSubscriptions)
Sets the maximum number of subscriptions accepted per service.
Definition upnpapi.cpp:1869
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:2005
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:2300
PUPNP_Api int UpnpRenewSubscription(UpnpClient_Handle Hnd, int *TimeOut, const Upnp_SID SubsId)
Renews a subscription that is about to expire.
Definition upnpapi.cpp:2182
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:2460
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:2071
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:2345
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:2117
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:2385
int(* VDCallback_Close)(UpnpWebFileHandle fileHnd, const void *cookie, const void *request_cookie)
Close callback function prototype.
Definition API.hpp:2746
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:3599
PUPNP_Api void UpnpSetAllowLiteralHostRedirection(int enable)
Enable or disable literal IP redirection.
Definition upnpapi.cpp:3595
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:3621
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:3643
PUPNP_Api int UpnpIsWebserverEnabled(void)
Returns the status of the webserver.
Definition upnpapi.cpp:3581
void * UpnpWebFileHandle
The type of handle returned by the web server for open requests.
Definition API.hpp:2587
PUPNP_Api int UpnpSetWebServerRootDir(const char *rootDir)
Sets the document root directory for the internal web server.
Definition upnpapi.cpp:3398
int(* VDCallback_GetInfo)(const char *filename, UpnpFileInfo *info, const void *cookie, const void **request_cookie)
Get-info callback function prototype.
Definition API.hpp:2592
PUPNP_Api void UpnpSetHostValidateCallback(WebCallback_HostValidate callback, void *cookie)
Set callback for validating HTTP requests HOST header values.
Definition upnpapi.cpp:3589
int(* WebCallback_HostValidate)(const char *hostname, void *cookie)
Callback for validating HTTP requests HOST header values.
Definition API.hpp:2800
PUPNP_Api void UpnpRemoveAllVirtualDirs(void)
Removes all web directory mappings.
Definition upnpapi.cpp:3545
int(* VDCallback_Seek)(UpnpWebFileHandle fileHnd, off_t offset, int origin, const void *cookie, const void *request_cookie)
Seek callback function prototype.
Definition API.hpp:2715
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:3610
PUPNP_Api int UpnpAddVirtualDir(const char *newDirName, const void *cookie, const void **oldcookie)
Adds a web directory mapping.
Definition upnpapi.cpp:3424
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:3632
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:3654
int(* VDCallback_Write)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie, const void *request_cookie)
Write callback function prototype.
Definition API.hpp:2689
int(* VDCallback_Read)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie, const void *request_cookie)
Read callback function prototype.
Definition API.hpp:2663
UpnpWebFileHandle(* VDCallback_Open)(const char *filename, enum UpnpOpenFileMode Mode, const void *cookie, const void *request_cookie)
Open callback function prototype.
Definition API.hpp:2638
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:3411
PUPNP_Api int UpnpEnableWebserver(int enable)
Enables or disables the webserver.
Definition upnpapi.cpp:3565
PUPNP_Api int UpnpRemoveVirtualDir(const char *dirName)
Removes a web directory mapping made with UpnpAddVirtualDir().
Definition upnpapi.cpp:3499
Specifications to be portable between different platforms.
Declaring only application interface parts from sock.cpp.