libnpupnp: /home/dockes/projets/mpdupnp/npupnp/inc/upnp.h Source File

libnpupnp 4.1.0 An almost compatible successor for the Portable UPnP reference library

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 * Copyright (C) 2011-2012 France Telecom All rights reserved.
8 * Copyright (C) 2020 J.F. Dockes <jf@dockes.org>
9 * All rights reserved.
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
40#include <cstdint>
41#include <ctime>
42#include <map>
43#include <string>
44#include <unordered_map>
45#include <utility>
46#include <vector>
47
48#include "upnpconfig.h"
49#ifdef _WIN32
50#include <winsock2.h>
51#else
52#include <sys/socket.h>
53#endif
54#include "UpnpGlobal.h"
55
57#define LINE_SIZE size_t(180)
59#define NAME_SIZE size_t(256)
61#define UPNP_INFINITE -1
66#define UPNP_USING_CHUNKED -3
68#define UPNP_UNTIL_CLOSE -4
69
74#define UPNP_MAX_SEARCH_TIME 80
75
80#define UPNP_MIN_SEARCH_TIME 2
81
82
96#define UPNP_E_SUCCESS 0
97
99#define UPNP_E_INVALID_HANDLE -100
100
102#define UPNP_E_INVALID_PARAM -101
103
105#define UPNP_E_OUTOF_HANDLE -102
106
108#define UPNP_E_OUTOF_CONTEXT -103
109
111#define UPNP_E_OUTOF_MEMORY -104
112
114#define UPNP_E_INIT -105
115
117#define UPNP_E_BUFFER_TOO_SMALL -106
118
121#define UPNP_E_INVALID_DESC -107
122
124#define UPNP_E_INVALID_URL -108
125
127#define UPNP_E_INVALID_SID -109
128
130#define UPNP_E_INVALID_DEVICE -110
131
133#define UPNP_E_INVALID_SERVICE -111
134
137#define UPNP_E_BAD_RESPONSE -113
138
140#define UPNP_E_BAD_REQUEST -114
141
145#define UPNP_E_INVALID_ACTION -115
146
151#define UPNP_E_FINISH -116
152
155#define UPNP_E_INIT_FAILED -117
156
159#define UPNP_E_URL_TOO_BIG -118
160
169#define UPNP_E_BAD_HTTPMSG -119
170
177#define UPNP_E_ALREADY_REGISTERED -120
178
181#define UPNP_E_INVALID_INTERFACE -121
182
190#define UPNP_E_NETWORK_ERROR -200
191
200#define UPNP_E_SOCKET_WRITE -201
201
210#define UPNP_E_SOCKET_READ -202
211
220#define UPNP_E_SOCKET_BIND -203
221
230#define UPNP_E_SOCKET_CONNECT -204
231
240#define UPNP_E_OUTOF_SOCKET -205
241
244#define UPNP_E_LISTEN -206
245
252#define UPNP_E_TIMEDOUT -207
253
260#define UPNP_E_SOCKET_ERROR -208
261
263#define UPNP_E_FILE_WRITE_ERROR -209
264
266#define UPNP_E_CANCELED -210
267
269#define UPNP_E_EVENT_PROTOCOL -300
270
272#define UPNP_E_SUBSCRIBE_UNACCEPTED -301
273
275#define UPNP_E_UNSUBSCRIBE_UNACCEPTED -302
276
278#define UPNP_E_NOTIFY_UNACCEPTED -303
279
281#define UPNP_E_INVALID_ARGUMENT -501
282
285#define UPNP_E_FILE_NOT_FOUND -502
286
288#define UPNP_E_FILE_READ_ERROR -503
289
292#define UPNP_E_EXT_NOT_XML -504
293
295#define UPNP_E_NO_WEB_SERVER -505
296
298#define UPNP_E_OUTOF_BOUNDS -506
299
301#define UPNP_E_NOT_FOUND -507
302
305#define UPNP_E_INTERNAL_ERROR -911
306
307/* SOAP-related error codes */
308#define UPNP_SOAP_E_INVALID_ACTION 401
309#define UPNP_SOAP_E_INVALID_ARGS 402
310#define UPNP_SOAP_E_OUT_OF_SYNC 403
311#define UPNP_SOAP_E_INVALID_VAR 404
312#define UPNP_SOAP_E_ACTION_FAILED 501
313
314/* @} ErrorCodes */
315
316
317enum UpnpOpenFileMode
318{
319 UPNP_READ,
320 UPNP_WRITE
321};
322
325 typedef int UpnpClient_Handle;
326
329 typedef int UpnpDevice_Handle;
330
335 typedef enum Upnp_EventType_e {
336 /* Control callbacks */
337
341 UPNP_CONTROL_ACTION_REQUEST,
342
344 UPNP_CONTROL_ACTION_COMPLETE,
346 UPNP_CONTROL_GET_VAR_REQUEST,
347
349 UPNP_CONTROL_GET_VAR_COMPLETE,
350
351
352 /* Discovery callbacks */
353
357 UPNP_DISCOVERY_ADVERTISEMENT_ALIVE,
358
362 UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE,
363
368 UPNP_DISCOVERY_SEARCH_RESULT,
369
373 UPNP_DISCOVERY_SEARCH_TIMEOUT,
374
375 /* Eventing callbacks */
376
383 UPNP_EVENT_SUBSCRIPTION_REQUEST,
384
388 UPNP_EVENT_RECEIVED,
389
391 UPNP_EVENT_RENEWAL_COMPLETE,
392
394 UPNP_EVENT_SUBSCRIBE_COMPLETE,
395
397 UPNP_EVENT_UNSUBSCRIBE_COMPLETE,
398
403 UPNP_EVENT_AUTORENEWAL_FAILED,
404
409 UPNP_EVENT_SUBSCRIPTION_EXPIRED
410} Upnp_EventType;
411
412
413
415 typedef std::string Upnp_SID;
416
419 typedef enum Upnp_DescType_e {
421 UPNPREG_URL_DESC,
422
425 UPNPREG_FILENAME_DESC,
426
429 UPNPREG_BUF_DESC
430} Upnp_DescType;
431
433 typedef enum {
434 UPNP_FLAG_NONE = 0,
436 UPNP_FLAG_IPV6 = 0x1,
438 UPNP_FLAG_IPV6_REQUIRED = 0x2,
440 UPNP_FLAG_NO_HOST_VALIDATE = 0x4,
443 UPNP_FLAG_REJECT_HOSTNAMES = 0x8,
444} Upnp_InitFlag;
445
448 typedef enum {
450 UPNP_OPTION_END = 0,
452 UPNP_OPTION_NETWORK_WAIT,
454 UPNP_OPTION_BOOTID,
456 UPNP_OPTION_CONFIGID,
458 UPNP_OPTION_NEXTBOOTID,
460 UPNP_OPTION_SEARCHPORT,
461} Upnp_InitOption;
462
467 struct Upnp_Action_Request {
469 int ErrCode;
470
471 /* Old comment said socket number ?? Not set, kept for ABI */
472 int unused1;
473
475 char ErrStr[LINE_SIZE];
476
478 char ActionName[NAME_SIZE];
479
481 char DevUDN[NAME_SIZE];
482
484 char ServiceID[NAME_SIZE];
485
487 std::vector<std::pair<std::string, std::string> > args;
488
490 std::vector<std::pair<std::string, std::string> > resdata;
491
493 struct sockaddr_storage CtrlPtIPAddr;
494
496 std::string Os;
497
501 std::string xmlAction;
502
507 std::string xmlResponse;
508};
509
510/* compat code for libupnp-1.8 */
511typedef struct Upnp_Action_Request UpnpActionRequest;
512#define UpnpActionRequest_get_ErrCode(x) ((x)->ErrCode)
513#define UpnpActionRequest_set_ErrCode(x, v) ((x)->ErrCode = (v))
514#define UpnpActionRequest_get_Socket(x) ((x)->Socket)
515#define UpnpActionRequest_get_ErrStr_cstr(x) ((x)->ErrStr)
516#define UpnpActionRequest_set_ErrStr(x, v) (strncpy((x)->ErrStr, v, LINE_SIZE))
517#define UpnpActionRequest_strcpy_ErrStr(x, v) (strncpy((x)->ErrStr, v, LINE_SIZE))
518#define UpnpActionRequest_get_ActionName_cstr(x) ((x)->ActionName)
519#define UpnpActionRequest_get_DevUDN_cstr(x) ((x)->DevUDN)
520#define UpnpActionRequest_get_ServiceID_cstr(x) ((x)->ServiceID)
521#define UpnpActionRequest_get_xmlAction(x) ((x)->xmlAction)
522#define UpnpActionRequest_get_xmlResponse(x) ((x)->xmlResponse)
523#define UpnpActionRequest_set_xmlResponse(x, v) ((x)->xmlResponse = (v))
524#define UpnpActionRequest_get_CtrlPtIPAddr(x) (&((x)->CtrlPtIPAddr))
525#define UpnpActionRequest_get_Os_cstr(x) ((x)->Os.c_str())
526
528 struct Upnp_Event {
530 Upnp_SID Sid;
531
533 int EventKey;
534
537 std::unordered_map<std::string, std::string> ChangedVariables;
538};
539
540/* compat code for libupnp-1.8 */
541typedef struct Upnp_Event UpnpEvent;
542#define UpnpEvent_get_SID_cstr(x) ((x)->Sid.c_str())
543#define UpnpEvent_get_EventKey(x) ((x)->EventKey)
544#define UpnpEvent_get_ChangedVariables(x) ((x)->ChangedVariables)
545
547 struct Upnp_Discovery {
549 int ErrCode;
550
552 int Expires;
553
555 char DeviceId[LINE_SIZE];
556
558 char DeviceType[LINE_SIZE];
559
561 char ServiceType[LINE_SIZE];
562
564 char ServiceVer[LINE_SIZE];
565
567 char Location[LINE_SIZE];
568
570 char Os[LINE_SIZE];
571
573 char Date[LINE_SIZE];
574
576 char Ext[LINE_SIZE];
577
579 struct sockaddr_storage DestAddr;
580};
581
582/* compat code for libupnp-1.8 */
583typedef struct Upnp_Discovery UpnpDiscovery;
584#define UpnpDiscovery_get_ErrCode(x) ((x)->ErrCode)
585#define UpnpDiscovery_get_Expires(x) ((x)->Expires)
586#define UpnpDiscovery_get_DeviceID_cstr(x) ((x)->DeviceId)
587#define UpnpDiscovery_get_DeviceType_cstr(x) ((x)->DeviceType)
588#define UpnpDiscovery_get_ServiceType_cstr(x) ((x)->ServiceType)
589#define UpnpDiscovery_get_ServiceVer_cstr(x) ((x)->ServiceVer)
590#define UpnpDiscovery_get_Location_cstr(x) ((x)->Location)
591#define UpnpDiscovery_get_Os_cstr(x) ((x)->Os)
592#define UpnpDiscovery_get_Date_cstr(x) ((x)->Date)
593#define UpnpDiscovery_get_Ext_cstr(x) ((x)->Ext)
594#define UpnpDiscovery_get_Os_cstr(x) ((x)->Os)
595#define UpnpDiscovery_get_DestAddr(x) (&((x)->DestAddr))
596
598 struct Upnp_Event_Subscribe {
599
605 Upnp_SID Sid;
606
608 int ErrCode;
609
611 char PublisherUrl[NAME_SIZE];
612
614 int TimeOut;
615};
616
617/* compat code for libupnp-1.8 */
618typedef struct Upnp_Event_Subscribe UpnpEventSubscribe;
619#define UpnpEventSubscribe_get_SID_cstr(x) ((x)->Sid.c_str())
620#define UpnpEventSubscribe_get_ErrCode(x) ((x)->ErrCode)
621#define UpnpEventSubscribe_get_PublisherUrl_cstr(x) ((x)->PublisherUrl)
622#define UpnpEventSubscribe_get_TimeOut(x) ((x)->TimeOut)
623
625 struct Upnp_Subscription_Request {
627 const char *ServiceId;
628
630 const char *UDN;
631
633 Upnp_SID Sid;
634};
635
636/* compat code for libupnp-1.8 */
637typedef struct Upnp_Subscription_Request UpnpSubscriptionRequest;
638#define UpnpSubscriptionRequest_get_ServiceId_cstr(x) ((x)->ServiceId)
639#define UpnpSubscriptionRequest_get_UDN_cstr(x) ((x)->UDN)
640#define UpnpSubscriptionRequest_get_SID_cstr(x) ((x)->Sid.c_str())
641
643 struct File_Info {
647 int64_t file_length{0};
648
651 time_t last_modified{0};
652
655 int is_directory{0};
656
659 int is_readable{0};
660
662 std::string content_type;
663
665 struct sockaddr_storage CtrlPtIPAddr;
666
668 std::string Os;
669
672 std::map<std::string, std::string> request_headers;
673
678 std::vector<std::pair<std::string, std::string>> response_headers;
679};
680
681/* Compat code for libupnp-1.8 */
682typedef struct File_Info UpnpFileInfo;
683#define UpnpFileInfo_get_FileLength(x) ((x)->file_length)
684#define UpnpFileInfo_set_FileLength(x, v) ((x)->file_length = (v))
685#define UpnpFileInfo_get_LastModified(x) ((x)->last_modified)
686#define UpnpFileInfo_set_LastModified(x, v) ((x)->last_modified = (v))
687#define UpnpFileInfo_get_IsDirectory(x) ((x)->is_directory)
688#define UpnpFileInfo_set_IsDirectory(x, v) ((x)->is_directory = (v))
689#define UpnpFileInfo_get_IsReadable(x) ((x)->is_readable)
690#define UpnpFileInfo_set_IsReadable(x, v) ((x)->is_readable = (v))
691#define UpnpFileInfo_get_ContentType(x) ((x)->content_type)
692#define UpnpFileInfo_set_ContentType(x, v) ((x)->content_type = (v))
693#define UpnpFileInfo_get_CtrlPtIPAddr(x) (&((x)->CtrlPtIPAddr))
694#define UpnpFileInfo_get_Os_cstr(x) ((x)->Os.c_str())
695
717 typedef int (*Upnp_FunPtr)(
718 Upnp_EventType EventType, const void *Event, void *Cookie);
719
720
759EXPORT_SPEC int UpnpInit(
762 const char *HostIP,
767 unsigned short DestPort);
768
808EXPORT_SPEC int UpnpInit2(
809 const char *IfName, unsigned short DestPort);
810
848EXPORT_SPEC int UpnpInit2(
849 const std::vector<std::string>& ifnames, unsigned short DestPort);
850
890EXPORT_SPEC int UpnpInitWithOptions(
891 const char *IfNames,
892 unsigned short DestPort,
894 unsigned int flags,
895 ...
896 );
897
898
918EXPORT_SPEC int UpnpFinish(void);
919
931EXPORT_SPEC unsigned short UpnpGetServerPort(void);
932
933#ifdef UPNP_ENABLE_IPV6
944EXPORT_SPEC unsigned short UpnpGetServerPort6(void);
945
957EXPORT_SPEC unsigned short UpnpGetServerUlaGuaPort6(void);
958#endif
959
971EXPORT_SPEC const char *UpnpGetServerIpAddress(void);
972
973#ifdef UPNP_ENABLE_IPV6
986EXPORT_SPEC const char *UpnpGetServerIp6Address(void);
987
989EXPORT_SPEC const char *UpnpGetServerUlaGuaIp6Address(void);
990#endif
991
1007EXPORT_SPEC int UpnpSetMaxContentLength(
1010 size_t contentLength);
1011
1055EXPORT_SPEC int UpnpRegisterRootDevice(
1058 const char *DescUrl,
1060 Upnp_FunPtr Fun,
1062 const void *Cookie,
1064 UpnpDevice_Handle *Hnd);
1065
1114EXPORT_SPEC int UpnpRegisterRootDevice2(
1116 Upnp_DescType descriptionType,
1119 const char* description,
1122 size_t bufferLen,
1124 int ignored,
1126 Upnp_FunPtr Fun,
1128 const void* Cookie,
1130 UpnpDevice_Handle* Hnd);
1131
1168EXPORT_SPEC int UpnpRegisterRootDevice4(
1171 const char *DescUrl,
1173 Upnp_FunPtr Fun,
1175 const void *Cookie,
1177 UpnpDevice_Handle *Hnd,
1179 int,
1182 const char *LowerDescUrl);
1183
1192EXPORT_SPEC int UpnpDeviceSetProduct(
1194 UpnpDevice_Handle Hnd,
1196 const char *product,
1198 const char *version);
1199
1214EXPORT_SPEC int UpnpUnRegisterRootDevice(
1216 UpnpDevice_Handle Hnd);
1217
1235EXPORT_SPEC int UpnpUnRegisterRootDeviceLowPower(
1237 UpnpDevice_Handle Hnd,
1239 int PowerState,
1241 int SleepPeriod,
1243 int RegistrationState);
1244
1269EXPORT_SPEC int UpnpRegisterClient(
1271 Upnp_FunPtr Fun,
1273 const void *Cookie,
1275 UpnpClient_Handle *Hnd);
1276
1281EXPORT_SPEC void UpnpClientSetProduct(
1283 UpnpClient_Handle Hnd,
1285 const char *product,
1287 const char *version);
1288
1306EXPORT_SPEC int UpnpUnRegisterClient(
1308 UpnpClient_Handle Hnd);
1309
1313/******************************************************************************
1314 * *
1315 * D I S C O V E R Y *
1316 * *
1317 ******************************************************************************/
1339EXPORT_SPEC int UpnpSearchAsync(
1341 UpnpClient_Handle Hnd,
1346 int Mx,
1349 const char *Target,
1351 const void *cookie);
1352
1374EXPORT_SPEC int UpnpSearchAsyncUnicast(
1376 UpnpClient_Handle Hnd,
1379 const std::string& url,
1381 const char *Target,
1383 void *cookie);
1384
1406EXPORT_SPEC int UpnpSendAdvertisement(
1408 UpnpDevice_Handle Hnd,
1414 int Exp);
1415
1434EXPORT_SPEC int UpnpSendAdvertisementLowPower(
1436 UpnpDevice_Handle Hnd,
1442 int Exp,
1444 int PowerState,
1446 int SleepPeriod,
1448 int RegistrationState);
1449
1456/******************************************************************************
1457 * *
1458 * C O N T R O L *
1459 * *
1460 ******************************************************************************/
1497EXPORT_SPEC int UpnpSendAction(
1498 UpnpClient_Handle Hnd,
1499 const std::string& headerString,
1500 const std::string& actionURL,
1501 const std::string& serviceType,
1502 const std::string& actionName,
1503 const std::vector<std::pair<std::string, std::string>>& actionParams,
1504 std::vector<std::pair<std::string, std::string>>& responseData,
1505 int* errcodep,
1506 std::string& errdesc);
1507
1510/******************************************************************************
1511 * *
1512 * E V E N T I N G *
1513 * *
1514 ******************************************************************************/
1515
1545EXPORT_SPEC int UpnpAcceptSubscription(
1547 UpnpDevice_Handle Hnd,
1549 const char *DevID,
1551 const char *ServName,
1553 const char **VarName,
1555 const char **NewVal,
1557 int cVariables,
1559 const Upnp_SID& SubsId);
1560
1561EXPORT_SPEC int UpnpAcceptSubscriptionXML(
1563 UpnpDevice_Handle Hnd,
1565 const char *DevID,
1567 const char *ServName,
1569 const std::string& propertyset,
1571 const Upnp_SID& SubsId);
1572
1594EXPORT_SPEC int UpnpNotify(
1596 UpnpDevice_Handle,
1598 const char *DevID,
1600 const char *ServName,
1602 const char **VarName,
1604 const char **NewVal,
1606 int cVariables);
1607
1608EXPORT_SPEC int UpnpNotifyXML(
1610 UpnpDevice_Handle,
1612 const char *DevID,
1614 const char *ServName,
1616 const std::string& propset);
1617
1631EXPORT_SPEC int UpnpSetMaxSubscriptions(
1634 UpnpDevice_Handle Hnd,
1636 int MaxSubscriptions);
1637
1673EXPORT_SPEC int UpnpSubscribe(
1675 UpnpClient_Handle Hnd,
1677 const char *EvtUrl,
1681 int *TimeOut,
1683 Upnp_SID& SubsId);
1684
1715EXPORT_SPEC int UpnpRenewSubscription(
1717 UpnpClient_Handle Hnd,
1720 int *TimeOut,
1722 const Upnp_SID& SubsId);
1723
1753EXPORT_SPEC int UpnpUnSubscribe(
1755 UpnpClient_Handle Hnd,
1757 const Upnp_SID& SubsId);
1758
1774EXPORT_SPEC int UpnpSetMaxSubscriptionTimeOut(
1777 UpnpDevice_Handle Hnd,
1779 int MaxSubscriptionTimeOut);
1780
1795EXPORT_SPEC int UpnpSubsOpsTimeoutMs(
1797 UpnpClient_Handle Hnd,
1799 int TimeOutMS);
1800
1834EXPORT_SPEC int UpnpDownloadUrlItem(
1836 const char *url,
1839 char **outBuf,
1842 char *contentType);
1843
1849EXPORT_SPEC int UpnpDownloadUrlItem(
1851 const std::string& url,
1853 std::string& data,
1855 std::string& ct);
1856
1860/******************************************************************************
1861 * *
1862 * W E B S E R V E R A P I *
1863 * *
1864 ******************************************************************************/
1865
1879EXPORT_SPEC int UpnpEnableWebserver(
1881 int enable);
1882
1890EXPORT_SPEC int UpnpIsWebserverEnabled(void);
1891
1904EXPORT_SPEC int UpnpSetWebServerRootDir(
1906 const char *rootDir);
1907
1921EXPORT_SPEC std::string UpnpGetUrlHostPortForClient(const struct sockaddr_storage*);
1922
1923/*
1924 * @brief Callback for validating HTTP requests HOST header values.
1925 *
1926 * This is called when a GET/POST/HEAD request to the Web server contains a host
1927 * name (instead of a numeric address) in the HOST header. The client code can chose
1928 * to authorize the request. Else it will be either redirected to a numeric
1929 * address or rejected depending on the UPNP_FLAG_REJECT_HOSTNAMES
1930 * option. Specific UPnP (SOAP/SUBSCRIBE...) requests are always checked to
1931 * contain a numeric address and will not trigger the callback.
1932 *
1933 * @param hostname the value in the request HOST header.
1934 * @return An integer representing one of the following:
1935 * \li \c UPNP_E_SUCCESS: a request with the HOST header set to hostname should be processed.
1936 * \li \c UPNP_E_BAD_HTTPMSG the request should be redirected or rejected.
1937 */
1938typedef int (*WebCallback_HostValidate)(const char *hostname, void *cookie);
1939
1940EXPORT_SPEC int UpnpSetWebRequestHostValidateCallback(
1941 WebCallback_HostValidate callback, void *cookie);
1942
1944EXPORT_SPEC int UpnpSetHostValidateCallback(
1945 WebCallback_HostValidate callback, void *cookie);
1946
1958EXPORT_SPEC int UpnpSetWebServerCorsString(
1960 const char *corsString);
1961
1962
1964 typedef void *UpnpWebFileHandle;
1965
1970 typedef int (*VDCallback_GetInfo)(
1972 const char *filename,
1974 struct File_Info *info,
1975 const void *cookie,
1976 const void **request_cookiep
1977 );
1978
1987EXPORT_SPEC int UpnpVirtualDir_set_GetInfoCallback(VDCallback_GetInfo callback);
1988
1990 typedef UpnpWebFileHandle (*VDCallback_Open)(
1992 const char *filename,
1995 enum UpnpOpenFileMode Mode,
1996 const void *cookie,
1997 const void *request_cookie
1998 );
1999
2008EXPORT_SPEC int UpnpVirtualDir_set_OpenCallback(VDCallback_Open callback);
2009
2011 typedef int (*VDCallback_Read)(
2013 UpnpWebFileHandle fileHnd,
2015 char *buf,
2017 size_t buflen,
2018 const void *cookie,
2019 const void *request_cookie
2020 );
2021
2030EXPORT_SPEC int UpnpVirtualDir_set_ReadCallback(VDCallback_Read callback);
2031
2033 typedef int (*VDCallback_Write)(
2035 UpnpWebFileHandle fileHnd,
2037 char *buf,
2039 size_t buflen,
2040 const void *cookie,
2041 const void *request_cookie
2042 );
2043
2052EXPORT_SPEC int UpnpVirtualDir_set_WriteCallback(VDCallback_Write callback);
2053
2055 typedef int (*VDCallback_Seek) (
2057 UpnpWebFileHandle fileHnd,
2061 int64_t offset,
2066 int origin,
2067 const void *cookie,
2068 const void *request_cookie
2069 );
2070
2079EXPORT_SPEC int UpnpVirtualDir_set_SeekCallback(VDCallback_Seek callback);
2080
2082 typedef int (*VDCallback_Close)(
2084 UpnpWebFileHandle fileHnd,
2085 const void *cookie,
2086 const void *request_cookie
2087 );
2088
2097EXPORT_SPEC int UpnpVirtualDir_set_CloseCallback(VDCallback_Close callback);
2098
2105 struct UpnpVirtualDirCallbacks
2106{
2108 VDCallback_GetInfo get_info;
2110 VDCallback_Open open;
2112 VDCallback_Read read;
2114 VDCallback_Write write;
2116 VDCallback_Seek seek;
2118 VDCallback_Close close;
2119};
2120
2128EXPORT_SPEC int UpnpSetVirtualDirCallbacks(
2130 struct UpnpVirtualDirCallbacks *callbacks );
2131
2151EXPORT_SPEC int UpnpAddVirtualDir(
2152 const char *dirName, const void *cookie, const void **oldcookie);
2153
2161EXPORT_SPEC int UpnpRemoveVirtualDir(
2163 const char *dirName);
2164
2168EXPORT_SPEC void UpnpRemoveAllVirtualDirs(void);
2169
2170/* @} Web Server API */
2171
2172#endif /* UPNP_H */
File_Info
Definition upnp.h:643
File_Info::file_length
int64_t file_length
The length of the file. A length less than 0 indicates the size is unknown, and data will be sent unt...
Definition upnp.h:647
File_Info::request_headers
std::map< std::string, std::string > request_headers
Headers received with the HTTP request. Set by the library before calling VDCallback_GetInfo.
Definition upnp.h:672
File_Info::Os
std::string Os
Client user-agent string.
Definition upnp.h:668
File_Info::is_directory
int is_directory
If the file is a directory, contains a non-zero value. For a regular file, it should be 0.
Definition upnp.h:655
File_Info::is_readable
int is_readable
If the file or directory is readable, this contains a non-zero value. If unreadable,...
Definition upnp.h:659
File_Info::content_type
std::string content_type
The content type of the file.
Definition upnp.h:662
File_Info::last_modified
time_t last_modified
The time at which the contents of the file was modified; The time system is always local (not GMT).
Definition upnp.h:651
File_Info::CtrlPtIPAddr
struct sockaddr_storage CtrlPtIPAddr
IP address of the control point requesting this action.
Definition upnp.h:665
File_Info::response_headers
std::vector< std::pair< std::string, std::string > > response_headers
Additional headers which should be set in the response. Set by the client inside the VDCallback_GetIn...
Definition upnp.h:678
UpnpVirtualDirCallbacks
Definition upnp.h:2106
UpnpVirtualDirCallbacks::open
VDCallback_Open open
VDCallback_Open callback
Definition upnp.h:2110
UpnpVirtualDirCallbacks::seek
VDCallback_Seek seek
VDCallback_Seek callback
Definition upnp.h:2116
UpnpVirtualDirCallbacks::read
VDCallback_Read read
VDCallback_Read callback
Definition upnp.h:2112
UpnpVirtualDirCallbacks::get_info
VDCallback_GetInfo get_info
VDCallback_GetInfo callback
Definition upnp.h:2108
UpnpVirtualDirCallbacks::write
VDCallback_Write write
VDCallback_Write callback
Definition upnp.h:2114
UpnpVirtualDirCallbacks::close
VDCallback_Close close
VDCallback_Close callback
Definition upnp.h:2118
Upnp_Action_Request
Definition upnp.h:467
Upnp_Action_Request::xmlResponse
std::string xmlResponse
[output] Alternative data return: return an XML document instead of using the resdata vector....
Definition upnp.h:507
Upnp_Action_Request::resdata
std::vector< std::pair< std::string, std::string > > resdata
[output] The action results.
Definition upnp.h:490
Upnp_Action_Request::Os
std::string Os
[input] Client user-agent string
Definition upnp.h:496
Upnp_Action_Request::ActionName
char ActionName[NAME_SIZE]
[input] The Action Name.
Definition upnp.h:478
Upnp_Action_Request::ErrStr
char ErrStr[LINE_SIZE]
[output] The error string in case of error.
Definition upnp.h:475
Upnp_Action_Request::args
std::vector< std::pair< std::string, std::string > > args
[input] The action arguments
Definition upnp.h:487
Upnp_Action_Request::ErrCode
int ErrCode
[output] The result of the operation.
Definition upnp.h:469
Upnp_Action_Request::xmlAction
std::string xmlAction
[input] The XML request document in case the callback has something else to get from there....
Definition upnp.h:501
Upnp_Action_Request::DevUDN
char DevUDN[NAME_SIZE]
[input] The unique device ID.
Definition upnp.h:481
Upnp_Action_Request::ServiceID
char ServiceID[NAME_SIZE]
[input] The service ID.
Definition upnp.h:484
Upnp_Action_Request::CtrlPtIPAddr
struct sockaddr_storage CtrlPtIPAddr
[input] IP address of the control point requesting this action.
Definition upnp.h:493
Upnp_Discovery
Definition upnp.h:547
Upnp_Discovery::ServiceType
char ServiceType[LINE_SIZE]
The service type.
Definition upnp.h:561
Upnp_Discovery::Ext
char Ext[LINE_SIZE]
Confirmation that the MAN header was understood by the device.
Definition upnp.h:576
Upnp_Discovery::DestAddr
struct sockaddr_storage DestAddr
The host address of the device responding to the search.
Definition upnp.h:579
Upnp_Discovery::DeviceType
char DeviceType[LINE_SIZE]
The device type.
Definition upnp.h:558
Upnp_Discovery::Date
char Date[LINE_SIZE]
Date when the response was generated.
Definition upnp.h:573
Upnp_Discovery::ErrCode
int ErrCode
The result code of the UpnpSearchAsync call.
Definition upnp.h:549
Upnp_Discovery::DeviceId
char DeviceId[LINE_SIZE]
The unique device identifier.
Definition upnp.h:555
Upnp_Discovery::Os
char Os[LINE_SIZE]
The operating system the device is running.
Definition upnp.h:570
Upnp_Discovery::Location
char Location[LINE_SIZE]
The URL to the UPnP description document for the device.
Definition upnp.h:567
Upnp_Discovery::ServiceVer
char ServiceVer[LINE_SIZE]
The service version.
Definition upnp.h:564
Upnp_Discovery::Expires
int Expires
The expiration time of the advertisement.
Definition upnp.h:552
Upnp_Event_Subscribe
Definition upnp.h:598
Upnp_Event_Subscribe::PublisherUrl
char PublisherUrl[NAME_SIZE]
The event URL being subscribed to or removed from.
Definition upnp.h:611
Upnp_Event_Subscribe::ErrCode
int ErrCode
The result of the operation.
Definition upnp.h:608
Upnp_Event_Subscribe::TimeOut
int TimeOut
The actual subscription time (for subscriptions only).
Definition upnp.h:614
Upnp_Event_Subscribe::Sid
Upnp_SID Sid
The SID for this subscription. For subscriptions, this only contains a valid SID if the ErrCode field...
Definition upnp.h:605
Upnp_Event
Definition upnp.h:528
Upnp_Event::ChangedVariables
std::unordered_map< std::string, std::string > ChangedVariables
The changes generating the event. std::map would have been a better choice, but too late to change....
Definition upnp.h:537
Upnp_Event::EventKey
int EventKey
The event sequence number.
Definition upnp.h:533
Upnp_Event::Sid
Upnp_SID Sid
The subscription ID for this subscription.
Definition upnp.h:530
Upnp_Subscription_Request
Definition upnp.h:625
Upnp_Subscription_Request::ServiceId
const char * ServiceId
The identifier for the service being subscribed to.
Definition upnp.h:627
Upnp_Subscription_Request::UDN
const char * UDN
Unique Device Name.
Definition upnp.h:630
Upnp_Subscription_Request::Sid
Upnp_SID Sid
The assigned subscription ID for this subscription.
Definition upnp.h:633
UpnpVirtualDir_set_CloseCallback
EXPORT_SPEC int UpnpVirtualDir_set_CloseCallback(VDCallback_Close callback)
Sets the close callback function to be used to access a virtual directory.
UpnpSetWebServerRootDir
EXPORT_SPEC int UpnpSetWebServerRootDir(const char *rootDir)
Sets the document root directory for the internal WEB server.
UpnpRegisterRootDevice2
EXPORT_SPEC int UpnpRegisterRootDevice2(Upnp_DescType descriptionType, const char *description, size_t bufferLen, int ignored, Upnp_FunPtr Fun, const void *Cookie, UpnpDevice_Handle *Hnd)
Registers a device application with the UPnP Library. Similar to UpnpRegisterRootDevice,...
VDCallback_Close
int(* VDCallback_Close)(UpnpWebFileHandle fileHnd, const void *cookie, const void *request_cookie)
Virtual directory close callback function prototype.
Definition upnp.h:2082
UpnpRegisterRootDevice
EXPORT_SPEC int UpnpRegisterRootDevice(const char *DescUrl, Upnp_FunPtr Fun, const void *Cookie, UpnpDevice_Handle *Hnd)
Registers a device application with the UPnP Library.
UpnpSetHostValidateCallback
EXPORT_SPEC int UpnpSetHostValidateCallback(WebCallback_HostValidate callback, void *cookie)
UpnpNotifyXML
EXPORT_SPEC int UpnpNotifyXML(UpnpDevice_Handle, const char *DevID, const char *ServName, const std::string &propset)
Upnp_EventType
enum Upnp_EventType_e Upnp_EventType
UpnpAcceptSubscription
EXPORT_SPEC int UpnpAcceptSubscription(UpnpDevice_Handle Hnd, const char *DevID, const char *ServName, const char **VarName, const char **NewVal, int cVariables, const Upnp_SID &SubsId)
Accepts a subscription request and sends out the current state of the eventable variables for a servi...
Upnp_DescType_e
Upnp_DescType_e
Specifies the type of description passed to UpnpRegisterRootDevice2.
Definition upnp.h:419
UPNPREG_FILENAME_DESC
@ UPNPREG_FILENAME_DESC
The description is a file name on the local file system containing the description of the device.
Definition upnp.h:425
UPNPREG_BUF_DESC
@ UPNPREG_BUF_DESC
The description is a pointer to a character array containing the XML description document.
Definition upnp.h:429
UPNPREG_URL_DESC
@ UPNPREG_URL_DESC
The description is the URL to the description document.
Definition upnp.h:421
Upnp_InitOption
Upnp_InitOption
Definition upnp.h:448
UPNP_OPTION_NEXTBOOTID
@ UPNP_OPTION_NEXTBOOTID
NEXTBOOTID value to be sent in SSDP messages, int arg follows. Currently ignored.
Definition upnp.h:458
UPNP_OPTION_NETWORK_WAIT
@ UPNP_OPTION_NETWORK_WAIT
Max wait seconds for an IP address to be found, int arg follows.
Definition upnp.h:452
UPNP_OPTION_SEARCHPORT
@ UPNP_OPTION_SEARCHPORT
SEARCHPORT value to be sent in SSDP messages, int arg follows. Currently ignored.
Definition upnp.h:460
UPNP_OPTION_BOOTID
@ UPNP_OPTION_BOOTID
BOOTID value to be sent in SSDP messages, int arg follows.
Definition upnp.h:454
UPNP_OPTION_END
@ UPNP_OPTION_END
Terminate the VARARGs list.
Definition upnp.h:450
UPNP_OPTION_CONFIGID
@ UPNP_OPTION_CONFIGID
CONFIGID value to be sent in SSDP messages, int arg follows.
Definition upnp.h:456
UpnpDeviceSetProduct
EXPORT_SPEC int UpnpDeviceSetProduct(UpnpDevice_Handle Hnd, const char *product, const char *version)
Set the product information part of the SERVER header sent with some network requests.
UpnpSetMaxSubscriptionTimeOut
EXPORT_SPEC int UpnpSetMaxSubscriptionTimeOut(UpnpDevice_Handle Hnd, int MaxSubscriptionTimeOut)
Sets the maximum time-out accepted for a subscription request or renewal.
UpnpRemoveAllVirtualDirs
EXPORT_SPEC void UpnpRemoveAllVirtualDirs(void)
Removes all virtual directory mappings.
UpnpInit
EXPORT_SPEC int UpnpInit(const char *HostIP, unsigned short DestPort)
Initializes the UPnP SDK for exclusive IP V4 operation on a single interface.
UpnpSendAction
EXPORT_SPEC int UpnpSendAction(UpnpClient_Handle Hnd, const std::string &headerString, const std::string &actionURL, const std::string &serviceType, const std::string &actionName, const std::vector< std::pair< std::string, std::string > > &actionParams, std::vector< std::pair< std::string, std::string > > &responseData, int *errcodep, std::string &errdesc)
Sends a message to change a state variable in a service.
UpnpSendAdvertisementLowPower
EXPORT_SPEC 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.
UpnpSetVirtualDirCallbacks
EXPORT_SPEC int UpnpSetVirtualDirCallbacks(struct UpnpVirtualDirCallbacks *callbacks)
Sets the callback functions to be used to access a virtual directory.
UpnpVirtualDir_set_ReadCallback
EXPORT_SPEC int UpnpVirtualDir_set_ReadCallback(VDCallback_Read callback)
Sets the read callback function to be used to access a virtual directory.
UpnpVirtualDir_set_GetInfoCallback
EXPORT_SPEC int UpnpVirtualDir_set_GetInfoCallback(VDCallback_GetInfo callback)
Sets the get_info callback function to be used to access a virtual directory.
UpnpWebFileHandle
void * UpnpWebFileHandle
Definition upnp.h:1964
UpnpVirtualDir_set_SeekCallback
EXPORT_SPEC int UpnpVirtualDir_set_SeekCallback(VDCallback_Seek callback)
Sets the seek callback function to be used to access a virtual directory.
UpnpSearchAsyncUnicast
EXPORT_SPEC int UpnpSearchAsyncUnicast(UpnpClient_Handle Hnd, const std::string &url, const char *Target, void *cookie)
Unicast search.
UpnpUnSubscribe
EXPORT_SPEC int UpnpUnSubscribe(UpnpClient_Handle Hnd, const Upnp_SID &SubsId)
Removes the subscription of a control point from a service previously subscribed to using UpnpSubscri...
UpnpUnRegisterRootDeviceLowPower
EXPORT_SPEC int UpnpUnRegisterRootDeviceLowPower(UpnpDevice_Handle Hnd, int PowerState, int SleepPeriod, int RegistrationState)
Unregisters a root device.
UpnpInitWithOptions
EXPORT_SPEC int UpnpInitWithOptions(const char *IfNames, unsigned short DestPort, unsigned int flags,...)
Initializes the library, passing the interface spec as a string.
UpnpRegisterClient
EXPORT_SPEC int UpnpRegisterClient(Upnp_FunPtr Fun, const void *Cookie, UpnpClient_Handle *Hnd)
Registers a control point application with the UPnP Library.
VDCallback_GetInfo
int(* VDCallback_GetInfo)(const char *filename, struct File_Info *info, const void *cookie, const void **request_cookiep)
Virtual Directory function prototype for the "get file information" callback. This is guaranteed to ...
Definition upnp.h:1970
UpnpSetMaxContentLength
EXPORT_SPEC int UpnpSetMaxContentLength(size_t contentLength)
Sets the maximum content-length that the SDK will process on an incoming SOAP requests or responses.
UpnpGetServerPort
EXPORT_SPEC unsigned short UpnpGetServerPort(void)
Returns the internal server IPv4 UPnP listening port.
Upnp_EventType_e
Upnp_EventType_e
Definition upnp.h:335
UPNP_EVENT_RENEWAL_COMPLETE
@ UPNP_EVENT_RENEWAL_COMPLETE
Definition upnp.h:391
UPNP_EVENT_AUTORENEWAL_FAILED
@ UPNP_EVENT_AUTORENEWAL_FAILED
Definition upnp.h:403
UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE
@ UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE
Definition upnp.h:362
UPNP_CONTROL_GET_VAR_REQUEST
@ UPNP_CONTROL_GET_VAR_REQUEST
Definition upnp.h:346
UPNP_EVENT_SUBSCRIPTION_REQUEST
@ UPNP_EVENT_SUBSCRIPTION_REQUEST
Definition upnp.h:383
UPNP_DISCOVERY_ADVERTISEMENT_ALIVE
@ UPNP_DISCOVERY_ADVERTISEMENT_ALIVE
Definition upnp.h:357
UPNP_CONTROL_ACTION_COMPLETE
@ UPNP_CONTROL_ACTION_COMPLETE
Definition upnp.h:344
UPNP_EVENT_SUBSCRIPTION_EXPIRED
@ UPNP_EVENT_SUBSCRIPTION_EXPIRED
Definition upnp.h:409
UPNP_DISCOVERY_SEARCH_RESULT
@ UPNP_DISCOVERY_SEARCH_RESULT
Definition upnp.h:368
UPNP_EVENT_SUBSCRIBE_COMPLETE
@ UPNP_EVENT_SUBSCRIBE_COMPLETE
Definition upnp.h:394
UPNP_CONTROL_GET_VAR_COMPLETE
@ UPNP_CONTROL_GET_VAR_COMPLETE
Definition upnp.h:349
UPNP_EVENT_UNSUBSCRIBE_COMPLETE
@ UPNP_EVENT_UNSUBSCRIBE_COMPLETE
Definition upnp.h:397
UPNP_DISCOVERY_SEARCH_TIMEOUT
@ UPNP_DISCOVERY_SEARCH_TIMEOUT
Definition upnp.h:373
UPNP_EVENT_RECEIVED
@ UPNP_EVENT_RECEIVED
Definition upnp.h:388
UPNP_CONTROL_ACTION_REQUEST
@ UPNP_CONTROL_ACTION_REQUEST
Definition upnp.h:341
NAME_SIZE
#define NAME_SIZE
Definition upnp.h:59
UpnpClient_Handle
int UpnpClient_Handle
Definition upnp.h:325
UpnpGetUrlHostPortForClient
EXPORT_SPEC std::string UpnpGetUrlHostPortForClient(const struct sockaddr_storage *)
return an URL host:port string suitable for the passed-in client address.
UpnpSendAdvertisement
EXPORT_SPEC int UpnpSendAdvertisement(UpnpDevice_Handle Hnd, int Exp)
Sends out the discovery announcements for all devices and services for a device.
UpnpGetServerIpAddress
EXPORT_SPEC const char * UpnpGetServerIpAddress(void)
Returns a local IPv4 listening ip address.
UpnpIsWebserverEnabled
EXPORT_SPEC int UpnpIsWebserverEnabled(void)
Returns TRUE if the webserver is enabled, or FALSE if it is not.
UpnpUnRegisterClient
EXPORT_SPEC int UpnpUnRegisterClient(UpnpClient_Handle Hnd)
Unregisters a control point application, unsubscribing all active subscriptions.
UpnpVirtualDir_set_WriteCallback
EXPORT_SPEC int UpnpVirtualDir_set_WriteCallback(VDCallback_Write callback)
Sets the write callback function to be used to access a virtual directory.
UpnpSubsOpsTimeoutMs
EXPORT_SPEC int UpnpSubsOpsTimeoutMs(UpnpClient_Handle Hnd, int TimeOutMS)
Sets the HTTP timeout for subscription operations.
UpnpDevice_Handle
int UpnpDevice_Handle
Definition upnp.h:329
UpnpFinish
EXPORT_SPEC int UpnpFinish(void)
Terminate and clean up the library.
UpnpSetWebServerCorsString
EXPORT_SPEC int UpnpSetWebServerCorsString(const char *corsString)
Assign the Access-Control-Allow-Origin specfied by the input const char* cors_string parameterto the ...
LINE_SIZE
#define LINE_SIZE
Definition upnp.h:57
UpnpSubscribe
EXPORT_SPEC int UpnpSubscribe(UpnpClient_Handle Hnd, const char *EvtUrl, int *TimeOut, Upnp_SID &SubsId)
Registers a control point to receive event notifications from another device.
UpnpClientSetProduct
EXPORT_SPEC void UpnpClientSetProduct(UpnpClient_Handle Hnd, const char *product, const char *version)
Set the product information part of the User-Agent header sent with some network requests.
UpnpRegisterRootDevice4
EXPORT_SPEC int UpnpRegisterRootDevice4(const char *DescUrl, Upnp_FunPtr Fun, const void *Cookie, UpnpDevice_Handle *Hnd, int, const char *LowerDescUrl)
Registers a device application with the UPnP library. This function can also be used to specify a ded...
Upnp_SID
std::string Upnp_SID
Holds a service subscription unique identifier.
Definition upnp.h:415
UpnpAddVirtualDir
EXPORT_SPEC int UpnpAddVirtualDir(const char *dirName, const void *cookie, const void **oldcookie)
Adds a virtual directory mapping.
UpnpNotify
EXPORT_SPEC int UpnpNotify(UpnpDevice_Handle, const char *DevID, const char *ServName, const char **VarName, const char **NewVal, int cVariables)
Sends out an event change notification to all control points subscribed to a particular service.
Upnp_FunPtr
int(* Upnp_FunPtr)(Upnp_EventType EventType, const void *Event, void *Cookie)
Definition upnp.h:717
UpnpSetMaxSubscriptions
EXPORT_SPEC int UpnpSetMaxSubscriptions(UpnpDevice_Handle Hnd, int MaxSubscriptions)
Sets the maximum number of subscriptions accepted per service.
UpnpRenewSubscription
EXPORT_SPEC int UpnpRenewSubscription(UpnpClient_Handle Hnd, int *TimeOut, const Upnp_SID &SubsId)
Renews a subscription that is about to expire.
UpnpUnRegisterRootDevice
EXPORT_SPEC int UpnpUnRegisterRootDevice(UpnpDevice_Handle Hnd)
Unregisters a root device.
VDCallback_Write
int(* VDCallback_Write)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie, const void *request_cookie)
Virtual Directory Write callback function prototype.
Definition upnp.h:2033
UpnpSearchAsync
EXPORT_SPEC int UpnpSearchAsync(UpnpClient_Handle Hnd, int Mx, const char *Target, const void *cookie)
Searches for devices matching the given search target.
VDCallback_Read
int(* VDCallback_Read)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie, const void *request_cookie)
Virtual Directory Read callback function prototype.
Definition upnp.h:2011
VDCallback_Open
UpnpWebFileHandle(* VDCallback_Open)(const char *filename, enum UpnpOpenFileMode Mode, const void *cookie, const void *request_cookie)
Virtual Directory Open callback function prototype.
Definition upnp.h:1990
Upnp_DescType
enum Upnp_DescType_e Upnp_DescType
Specifies the type of description passed to UpnpRegisterRootDevice2.
UpnpDownloadUrlItem
EXPORT_SPEC int UpnpDownloadUrlItem(const char *url, char **outBuf, char *contentType)
Downloads a text file specified in a URL.
UpnpAcceptSubscriptionXML
EXPORT_SPEC int UpnpAcceptSubscriptionXML(UpnpDevice_Handle Hnd, const char *DevID, const char *ServName, const std::string &propertyset, const Upnp_SID &SubsId)
UpnpRemoveVirtualDir
EXPORT_SPEC int UpnpRemoveVirtualDir(const char *dirName)
Removes a virtual directory mapping made with UpnpAddVirtualDir.
UpnpVirtualDir_set_OpenCallback
EXPORT_SPEC int UpnpVirtualDir_set_OpenCallback(VDCallback_Open callback)
Sets the open callback function to be used to access a virtual directory.
UpnpEnableWebserver
EXPORT_SPEC int UpnpEnableWebserver(int enable)
Enables or disables the WEB server file service. The WEB server is automatically enabled by UpnpInit2...
Upnp_InitFlag
Upnp_InitFlag
Definition upnp.h:433
UPNP_FLAG_NO_HOST_VALIDATE
@ UPNP_FLAG_NO_HOST_VALIDATE
Definition upnp.h:440
UPNP_FLAG_IPV6_REQUIRED
@ UPNP_FLAG_IPV6_REQUIRED
Definition upnp.h:438
UPNP_FLAG_REJECT_HOSTNAMES
@ UPNP_FLAG_REJECT_HOSTNAMES
Definition upnp.h:443
UPNP_FLAG_IPV6
@ UPNP_FLAG_IPV6
Definition upnp.h:436
VDCallback_Seek
int(* VDCallback_Seek)(UpnpWebFileHandle fileHnd, int64_t offset, int origin, const void *cookie, const void *request_cookie)
Virtual Directory Seek callback function prototype.
Definition upnp.h:2055
UpnpInit2
EXPORT_SPEC int UpnpInit2(const char *IfName, unsigned short DestPort)
Initializes the library, passing the interface spec as a single string.