44 #include <unordered_map>
48 #include "upnpconfig.h"
52 #include <sys/socket.h>
54 #include "UpnpGlobal.h"
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
74 #define UPNP_MAX_SEARCH_TIME 80
80 #define UPNP_MIN_SEARCH_TIME 2
96 #define UPNP_E_SUCCESS 0
99 #define UPNP_E_INVALID_HANDLE -100
102 #define UPNP_E_INVALID_PARAM -101
105 #define UPNP_E_OUTOF_HANDLE -102
108 #define UPNP_E_OUTOF_CONTEXT -103
111 #define UPNP_E_OUTOF_MEMORY -104
114 #define UPNP_E_INIT -105
117 #define UPNP_E_BUFFER_TOO_SMALL -106
121 #define UPNP_E_INVALID_DESC -107
124 #define UPNP_E_INVALID_URL -108
127 #define UPNP_E_INVALID_SID -109
130 #define UPNP_E_INVALID_DEVICE -110
133 #define UPNP_E_INVALID_SERVICE -111
137 #define UPNP_E_BAD_RESPONSE -113
140 #define UPNP_E_BAD_REQUEST -114
145 #define UPNP_E_INVALID_ACTION -115
151 #define UPNP_E_FINISH -116
155 #define UPNP_E_INIT_FAILED -117
159 #define UPNP_E_URL_TOO_BIG -118
169 #define UPNP_E_BAD_HTTPMSG -119
177 #define UPNP_E_ALREADY_REGISTERED -120
181 #define UPNP_E_INVALID_INTERFACE -121
190 #define UPNP_E_NETWORK_ERROR -200
200 #define UPNP_E_SOCKET_WRITE -201
210 #define UPNP_E_SOCKET_READ -202
220 #define UPNP_E_SOCKET_BIND -203
230 #define UPNP_E_SOCKET_CONNECT -204
240 #define UPNP_E_OUTOF_SOCKET -205
244 #define UPNP_E_LISTEN -206
252 #define UPNP_E_TIMEDOUT -207
260 #define UPNP_E_SOCKET_ERROR -208
263 #define UPNP_E_FILE_WRITE_ERROR -209
266 #define UPNP_E_CANCELED -210
269 #define UPNP_E_EVENT_PROTOCOL -300
272 #define UPNP_E_SUBSCRIBE_UNACCEPTED -301
275 #define UPNP_E_UNSUBSCRIBE_UNACCEPTED -302
278 #define UPNP_E_NOTIFY_UNACCEPTED -303
281 #define UPNP_E_INVALID_ARGUMENT -501
285 #define UPNP_E_FILE_NOT_FOUND -502
288 #define UPNP_E_FILE_READ_ERROR -503
292 #define UPNP_E_EXT_NOT_XML -504
295 #define UPNP_E_NO_WEB_SERVER -505
298 #define UPNP_E_OUTOF_BOUNDS -506
301 #define UPNP_E_NOT_FOUND -507
305 #define UPNP_E_INTERNAL_ERROR -911
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
317 enum UpnpOpenFileMode
487 std::vector<std::pair<std::string, std::string> >
args;
490 std::vector<std::pair<std::string, std::string> >
resdata;
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())
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)
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))
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)
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())
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())
767 unsigned short DestPort);
809 const char *IfName,
unsigned short DestPort);
849 const std::vector<std::string>& ifnames,
unsigned short DestPort);
895 unsigned short DestPort,
936 #ifdef UPNP_ENABLE_IPV6
947 EXPORT_SPEC
unsigned short UpnpGetServerPort6(
void);
960 EXPORT_SPEC
unsigned short UpnpGetServerUlaGuaPort6(
void);
976 #ifdef UPNP_ENABLE_IPV6
989 EXPORT_SPEC
const char *UpnpGetServerIp6Address(
void);
992 EXPORT_SPEC
const char *UpnpGetServerUlaGuaIp6Address(
void);
1013 size_t contentLength);
1061 const char *DescUrl,
1122 const char* description,
1174 const char *DescUrl,
1185 const char *LowerDescUrl);
1199 const char *product,
1201 const char *version);
1246 int RegistrationState);
1288 const char *product,
1290 const char *version);
1354 const void *cookie);
1382 const std::string& url,
1451 int RegistrationState);
1502 const std::string& headerString,
1503 const std::string& actionURL,
1504 const std::string& serviceType,
1505 const std::string& actionName,
1506 const std::vector<std::pair<std::string, std::string>>& actionParams,
1507 std::vector<std::pair<std::string, std::string>>& responseData,
1509 std::string& errdesc);
1554 const char *ServName,
1556 const char **VarName,
1558 const char **NewVal,
1570 const char *ServName,
1572 const std::string& propertyset,
1603 const char *ServName,
1605 const char **VarName,
1607 const char **NewVal,
1617 const char *ServName,
1619 const std::string& propset);
1639 int MaxSubscriptions);
1782 int MaxSubscriptionTimeOut);
1854 const std::string& url,
1909 const char *rootDir);
1941 typedef int (*WebCallback_HostValidate)(
const char *hostname,
void *cookie);
1943 EXPORT_SPEC
int UpnpSetWebRequestHostValidateCallback(
1944 WebCallback_HostValidate callback,
void *cookie);
1948 WebCallback_HostValidate callback,
void *cookie);
1960 const char *filename,
1964 const void **request_cookiep
1980 const char *filename,
1983 enum UpnpOpenFileMode Mode,
1985 const void *request_cookie
2007 const void *request_cookie
2029 const void *request_cookie
2056 const void *request_cookie
2074 const void *request_cookie
2140 const char *dirName,
const void *cookie,
const void **oldcookie);
2151 const char *dirName);
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
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
std::string Os
Client user-agent string.
Definition: upnp.h:668
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
int is_readable
If the file or directory is readable, this contains a non-zero value. If unreadable,...
Definition: upnp.h:659
std::string content_type
The content type of the file.
Definition: upnp.h:662
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
struct sockaddr_storage CtrlPtIPAddr
IP address of the control point requesting this action.
Definition: upnp.h:665
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
VDCallback_Open open
VDCallback_Open callback
Definition: upnp.h:2098
VDCallback_Seek seek
VDCallback_Seek callback
Definition: upnp.h:2104
VDCallback_Read read
VDCallback_Read callback
Definition: upnp.h:2100
VDCallback_GetInfo get_info
VDCallback_GetInfo callback
Definition: upnp.h:2096
VDCallback_Write write
VDCallback_Write callback
Definition: upnp.h:2102
VDCallback_Close close
VDCallback_Close callback
Definition: upnp.h:2106
std::string xmlResponse
[output] Alternative data return: return an XML document instead of using the resdata vector....
Definition: upnp.h:507
std::vector< std::pair< std::string, std::string > > resdata
[output] The action results.
Definition: upnp.h:490
std::string Os
[input] Client user-agent string
Definition: upnp.h:496
char ActionName[NAME_SIZE]
[input] The Action Name.
Definition: upnp.h:478
char ErrStr[LINE_SIZE]
[output] The error string in case of error.
Definition: upnp.h:475
std::vector< std::pair< std::string, std::string > > args
[input] The action arguments
Definition: upnp.h:487
int ErrCode
[output] The result of the operation.
Definition: upnp.h:469
std::string xmlAction
[input] The XML request document in case the callback has something else to get from there....
Definition: upnp.h:501
char DevUDN[NAME_SIZE]
[input] The unique device ID.
Definition: upnp.h:481
char ServiceID[NAME_SIZE]
[input] The service ID.
Definition: upnp.h:484
struct sockaddr_storage CtrlPtIPAddr
[input] IP address of the control point requesting this action.
Definition: upnp.h:493
char ServiceType[LINE_SIZE]
The service type.
Definition: upnp.h:561
char Ext[LINE_SIZE]
Confirmation that the MAN header was understood by the device.
Definition: upnp.h:576
struct sockaddr_storage DestAddr
The host address of the device responding to the search.
Definition: upnp.h:579
char DeviceType[LINE_SIZE]
The device type.
Definition: upnp.h:558
char Date[LINE_SIZE]
Date when the response was generated.
Definition: upnp.h:573
int ErrCode
The result code of the UpnpSearchAsync call.
Definition: upnp.h:549
char DeviceId[LINE_SIZE]
The unique device identifier.
Definition: upnp.h:555
char Os[LINE_SIZE]
The operating system the device is running.
Definition: upnp.h:570
char Location[LINE_SIZE]
The URL to the UPnP description document for the device.
Definition: upnp.h:567
char ServiceVer[LINE_SIZE]
The service version.
Definition: upnp.h:564
int Expires
The expiration time of the advertisement.
Definition: upnp.h:552
char PublisherUrl[NAME_SIZE]
The event URL being subscribed to or removed from.
Definition: upnp.h:611
int ErrCode
The result of the operation.
Definition: upnp.h:608
int TimeOut
The actual subscription time (for subscriptions only).
Definition: upnp.h:614
Upnp_SID Sid
The SID for this subscription. For subscriptions, this only contains a valid SID if the ErrCode field...
Definition: upnp.h:605
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
int EventKey
The event sequence number.
Definition: upnp.h:533
Upnp_SID Sid
The subscription ID for this subscription.
Definition: upnp.h:530
const char * ServiceId
The identifier for the service being subscribed to.
Definition: upnp.h:627
const char * UDN
Unique Device Name.
Definition: upnp.h:630
Upnp_SID Sid
The assigned subscription ID for this subscription.
Definition: upnp.h:633
EXPORT_SPEC int UpnpVirtualDir_set_CloseCallback(VDCallback_Close callback)
Sets the close callback function to be used to access a virtual directory.
EXPORT_SPEC int UpnpSetWebServerRootDir(const char *rootDir)
Sets the document root directory for the internal WEB server.
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,...
int(* VDCallback_Close)(UpnpWebFileHandle fileHnd, const void *cookie, const void *request_cookie)
Virtual directory close callback function prototype.
Definition: upnp.h:2070
EXPORT_SPEC int UpnpRegisterRootDevice(const char *DescUrl, Upnp_FunPtr Fun, const void *Cookie, UpnpDevice_Handle *Hnd)
Registers a device application with the UPnP Library.
EXPORT_SPEC int UpnpSetHostValidateCallback(WebCallback_HostValidate callback, void *cookie)
EXPORT_SPEC int UpnpNotifyXML(UpnpDevice_Handle, const char *DevID, const char *ServName, const std::string &propset)
enum Upnp_EventType_e Upnp_EventType
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
Specifies the type of description passed to UpnpRegisterRootDevice2.
Definition: upnp.h:419
@ 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
The description is a pointer to a character array containing the XML description document.
Definition: upnp.h:429
@ UPNPREG_URL_DESC
The description is the URL to the description document.
Definition: upnp.h:421
Upnp_InitOption
Definition: upnp.h:448
@ UPNP_OPTION_NEXTBOOTID
NEXTBOOTID value to be sent in SSDP messages, int arg follows. Currently ignored.
Definition: upnp.h:458
@ UPNP_OPTION_NETWORK_WAIT
Max wait seconds for an IP address to be found, int arg follows.
Definition: upnp.h:452
@ UPNP_OPTION_SEARCHPORT
SEARCHPORT value to be sent in SSDP messages, int arg follows. Currently ignored.
Definition: upnp.h:460
@ UPNP_OPTION_BOOTID
BOOTID value to be sent in SSDP messages, int arg follows.
Definition: upnp.h:454
@ UPNP_OPTION_END
Terminate the VARARGs list.
Definition: upnp.h:450
@ UPNP_OPTION_CONFIGID
CONFIGID value to be sent in SSDP messages, int arg follows.
Definition: upnp.h:456
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.
EXPORT_SPEC int UpnpSetMaxSubscriptionTimeOut(UpnpDevice_Handle Hnd, int MaxSubscriptionTimeOut)
Sets the maximum time-out accepted for a subscription request or renewal.
EXPORT_SPEC void UpnpRemoveAllVirtualDirs(void)
Removes all virtual directory mappings.
EXPORT_SPEC int UpnpInit(const char *HostIP, unsigned short DestPort)
Initializes the UPnP SDK for exclusive IP V4 operation on a single interface.
EXPORT_SPEC int UpnpInitWithOptions(const char *IfName, unsigned short DestPort, unsigned int flags,...)
Initializes the library, passing the interface spec as a string.
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.
EXPORT_SPEC int UpnpSetVirtualDirCallbacks(struct UpnpVirtualDirCallbacks *callbacks)
Sets the callback functions to be used to access a virtual directory.
EXPORT_SPEC int UpnpVirtualDir_set_ReadCallback(VDCallback_Read callback)
Sets the read callback function to be used to access a virtual directory.
EXPORT_SPEC const char * UpnpGetServerIpAddress(void)
Returns a local IPv4 listening ip address.
EXPORT_SPEC int UpnpVirtualDir_set_GetInfoCallback(VDCallback_GetInfo callback)
Sets the get_info callback function to be used to access a virtual directory.
void * UpnpWebFileHandle
Definition: upnp.h:1952
EXPORT_SPEC int UpnpVirtualDir_set_SeekCallback(VDCallback_Seek callback)
Sets the seek callback function to be used to access a virtual directory.
EXPORT_SPEC int UpnpSearchAsyncUnicast(UpnpClient_Handle Hnd, const std::string &url, const char *Target, void *cookie)
Unicast search.
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...
EXPORT_SPEC int UpnpUnRegisterRootDeviceLowPower(UpnpDevice_Handle Hnd, int PowerState, int SleepPeriod, int RegistrationState)
Unregisters a root device.
EXPORT_SPEC int UpnpRegisterClient(Upnp_FunPtr Fun, const void *Cookie, UpnpClient_Handle *Hnd)
Registers a control point application with the UPnP Library.
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:1958
EXPORT_SPEC int UpnpSetMaxContentLength(size_t contentLength)
Sets the maximum content-length that the SDK will process on an incoming SOAP requests or responses.
EXPORT_SPEC unsigned short UpnpGetServerPort(void)
Returns the internal server IPv4 UPnP listening port.
Upnp_EventType_e
Definition: upnp.h:335
@ UPNP_EVENT_RENEWAL_COMPLETE
Definition: upnp.h:391
@ UPNP_EVENT_AUTORENEWAL_FAILED
Definition: upnp.h:403
@ UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE
Definition: upnp.h:362
@ UPNP_CONTROL_GET_VAR_REQUEST
Definition: upnp.h:346
@ UPNP_EVENT_SUBSCRIPTION_REQUEST
Definition: upnp.h:383
@ UPNP_DISCOVERY_ADVERTISEMENT_ALIVE
Definition: upnp.h:357
@ UPNP_CONTROL_ACTION_COMPLETE
Definition: upnp.h:344
@ UPNP_EVENT_SUBSCRIPTION_EXPIRED
Definition: upnp.h:409
@ UPNP_DISCOVERY_SEARCH_RESULT
Definition: upnp.h:368
@ UPNP_EVENT_SUBSCRIBE_COMPLETE
Definition: upnp.h:394
@ UPNP_CONTROL_GET_VAR_COMPLETE
Definition: upnp.h:349
@ UPNP_EVENT_UNSUBSCRIBE_COMPLETE
Definition: upnp.h:397
@ UPNP_DISCOVERY_SEARCH_TIMEOUT
Definition: upnp.h:373
@ UPNP_EVENT_RECEIVED
Definition: upnp.h:388
@ UPNP_CONTROL_ACTION_REQUEST
Definition: upnp.h:341
#define NAME_SIZE
Definition: upnp.h:59
int UpnpClient_Handle
Definition: upnp.h:325
EXPORT_SPEC std::string UpnpGetUrlHostPortForClient(const struct sockaddr_storage *)
return an URL host:port string suitable for the passed-in client address.
EXPORT_SPEC int UpnpSendAdvertisement(UpnpDevice_Handle Hnd, int Exp)
Sends out the discovery announcements for all devices and services for a device.
EXPORT_SPEC int UpnpIsWebserverEnabled(void)
Returns TRUE if the webserver is enabled, or FALSE if it is not.
EXPORT_SPEC int UpnpUnRegisterClient(UpnpClient_Handle Hnd)
Unregisters a control point application, unsubscribing all active subscriptions.
EXPORT_SPEC int UpnpVirtualDir_set_WriteCallback(VDCallback_Write callback)
Sets the write callback function to be used to access a virtual directory.
EXPORT_SPEC int UpnpSubsOpsTimeoutMs(UpnpClient_Handle Hnd, int TimeOutMS)
Sets the HTTP timeout for subscription operations.
int UpnpDevice_Handle
Definition: upnp.h:329
EXPORT_SPEC int UpnpFinish(void)
Terminate and clean up the library.
#define LINE_SIZE
Definition: upnp.h:57
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.
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.
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...
std::string Upnp_SID
Holds a service subscription unique identifier.
Definition: upnp.h:415
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.
EXPORT_SPEC int UpnpAddVirtualDir(const char *dirName, const void *cookie, const void **oldcookie)
Adds a virtual directory mapping.
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.
int(* Upnp_FunPtr)(Upnp_EventType EventType, const void *Event, void *Cookie)
Definition: upnp.h:717
EXPORT_SPEC int UpnpSetMaxSubscriptions(UpnpDevice_Handle Hnd, int MaxSubscriptions)
Sets the maximum number of subscriptions accepted per service.
EXPORT_SPEC int UpnpRenewSubscription(UpnpClient_Handle Hnd, int *TimeOut, const Upnp_SID &SubsId)
Renews a subscription that is about to expire.
EXPORT_SPEC int UpnpUnRegisterRootDevice(UpnpDevice_Handle Hnd)
Unregisters a root device.
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:2021
EXPORT_SPEC int UpnpSearchAsync(UpnpClient_Handle Hnd, int Mx, const char *Target, const void *cookie)
Searches for devices matching the given search target.
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:1999
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:1978
enum Upnp_DescType_e Upnp_DescType
Specifies the type of description passed to UpnpRegisterRootDevice2.
EXPORT_SPEC int UpnpDownloadUrlItem(const char *url, char **outBuf, char *contentType)
Downloads a text file specified in a URL.
EXPORT_SPEC int UpnpAcceptSubscriptionXML(UpnpDevice_Handle Hnd, const char *DevID, const char *ServName, const std::string &propertyset, const Upnp_SID &SubsId)
EXPORT_SPEC int UpnpRemoveVirtualDir(const char *dirName)
Removes a virtual directory mapping made with UpnpAddVirtualDir.
EXPORT_SPEC int UpnpVirtualDir_set_OpenCallback(VDCallback_Open callback)
Sets the open callback function to be used to access a virtual directory.
EXPORT_SPEC int UpnpEnableWebserver(int enable)
Enables or disables the WEB server file service. The WEB server is automatically enabled by UpnpInit2...
Upnp_InitFlag
Definition: upnp.h:433
@ UPNP_FLAG_NO_HOST_VALIDATE
Definition: upnp.h:440
@ UPNP_FLAG_IPV6_REQUIRED
Definition: upnp.h:438
@ UPNP_FLAG_REJECT_HOSTNAMES
Definition: upnp.h:443
@ UPNP_FLAG_IPV6
Definition: upnp.h:436
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:2043
EXPORT_SPEC int UpnpInit2(const char *IfName, unsigned short DestPort)
Initializes the library, passing the interface spec as a single string.