1#ifndef COMPA_INC_API_HPP
2#define COMPA_INC_API_HPP
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
75#define UPNP_E_SUCCESS 0
80#define UPNP_E_INVALID_HANDLE -100
88#define UPNP_E_INVALID_PARAM -101
95#define UPNP_E_OUTOF_HANDLE -102
97#define UPNP_E_OUTOF_CONTEXT -103
105#define UPNP_E_OUTOF_MEMORY -104
113#define UPNP_E_INIT -105
115#define UPNP_E_BUFFER_TOO_SMALL -106
122#define UPNP_E_INVALID_DESC -107
131#define UPNP_E_INVALID_URL -108
133#define UPNP_E_INVALID_SID -109
135#define UPNP_E_INVALID_DEVICE -110
143#define UPNP_E_INVALID_SERVICE -111
151#define UPNP_E_BAD_RESPONSE -113
153#define UPNP_E_BAD_REQUEST -114
161#define UPNP_E_INVALID_ACTION -115
169#define UPNP_E_FINISH -116
176#define UPNP_E_INIT_FAILED -117
183#define UPNP_E_URL_TOO_BIG -118
194#define UPNP_E_BAD_HTTPMSG -119
202#define UPNP_E_ALREADY_REGISTERED -120
208#define UPNP_E_INVALID_INTERFACE -121
217#define UPNP_E_NETWORK_ERROR -200
227#define UPNP_E_SOCKET_WRITE -201
237#define UPNP_E_SOCKET_READ -202
247#define UPNP_E_SOCKET_BIND -203
257#define UPNP_E_SOCKET_CONNECT -204
267#define UPNP_E_OUTOF_SOCKET -205
275#define UPNP_E_LISTEN -206
283#define UPNP_E_TIMEDOUT -207
291#define UPNP_E_SOCKET_ERROR -208
293#define UPNP_E_FILE_WRITE_ERROR -209
300#define UPNP_E_CANCELED -210
310#define UPNP_E_SOCKET_ACCEPT -211
312#define UPNP_E_EVENT_PROTOCOL -300
317#define UPNP_E_SUBSCRIBE_UNACCEPTED -301
322#define UPNP_E_UNSUBSCRIBE_UNACCEPTED -302
327#define UPNP_E_NOTIFY_UNACCEPTED -303
335#define UPNP_E_INVALID_ARGUMENT -501
341#define UPNP_E_FILE_NOT_FOUND -502
346#define UPNP_E_FILE_READ_ERROR -503
352#define UPNP_E_EXT_NOT_XML -504
354#define UPNP_E_NO_WEB_SERVER -505
355#define UPNP_E_OUTOF_BOUNDS -506
361#define UPNP_E_NOT_FOUND -507
367#define UPNP_E_INTERNAL_ERROR -911
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
549 unsigned short DestPort);
690 const char*
const DescUrl,
696 const void*
const Cookie,
774 const char*
const description_const,
777 const size_t bufferLen,
780 const int config_baseURL,
786 const void*
const Cookie,
829 const char*
const DescUrl,
835 const void*
const Cookie,
840 const int AddressFamily);
851 const char*
const DescUrl,
855 const void*
const Cookie,
859 const int AddressFamily,
862 const char*
const LowerDescUrl);
915 int RegistrationState);
987 size_t contentLength);
1036 const char* Target_const,
1038 const void* Cookie_const);
1101 int RegistrationState);
1161 const char* ActionURL_const,
1163 const char* VarName_const,
1191 const char* ActionURL_const,
1193 const char* VarName_const,
1199 const void* Cookie_const);
1230 const char* ActionURL_const,
1232 const char* ServiceType_const,
1234 const char* DevUDN_const,
1270 const char* ActionURL_const,
1272 const char* ServiceType_const,
1274 const char* DevUDN_const,
1311 const char* ActionURL_const,
1313 const char* ServiceType_const,
1315 const char* DevUDN_const,
1323 const void* Cookie_const);
1352 const char* ActionURL_const,
1354 const char* ServiceType_const,
1356 const char* DevUDN_const,
1367 const void* Cookie_const);
1413 const char* DevID_const,
1416 const char* ServName_const,
1418 const char** VarName_const,
1420 const char** NewVal_const,
1455 const char* DevID_const,
1458 const char* ServName_const,
1494 const char* DevID_const,
1496 const char* ServName_const,
1498 const char** VarName_const,
1500 const char** NewVal_const,
1531 const char* DevID_const,
1533 const char* ServName_const,
1642 const void* Cookie_const);
1664 int MaxSubscriptions);
1687 int MaxSubscriptionTimeOut);
1724 const char* EvtUrl_const,
1786 const char* EvtUrl_const,
1793 const void* Cookie_const);
1894 const void* Cookie_const);
2051 const char* proxy_str,
2098 const char* url_str,
2224 const char* contentType,
2359 const char* contentType,
2576 const char* filename,
2583 const void** request_cookie);
2604 const char* rootDir);
2622 const char* filename,
2629 const void* request_cookie);
2655 const void* request_cookie);
2681 const void* request_cookie);
2712 const void* request_cookie);
2734 const void* request_cookie);
2813 const char* corsString);
2829 const char* newDirName,
2834 const void** oldcookie);
2848 const char* dirName);
2861#include <upnpconfig.h>
Definition of event type codes.
int(* Upnp_FunPtr)(Upnp_EventType EventType, const void *Event, void *Cookie)
enum Upnp_SType_e Upnp_SType
Represents the different types of searches that can be performed using the SDK for UPnP Devices API.
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
Upnp_DescType_e
Specifies the type of description in UpnpRegisterRootDevice2.
int UpnpClient_Handle
Returned when a control point application registers with UpnpRegisterClient().
UpnpOpenFileMode
Represents the different types of searches that can be performed using the SDK for UPnP Devices API.
Upnp_SType_e
Represents the different types of searches that can be performed using the SDK for UPnP Devices API.
int UpnpDevice_Handle
Returned when a device application registers with UpnpRegisterRootDevice(),UpnpRegisterRootDevice2(),...
enum Upnp_DescType_e Upnp_DescType
Represents the different types of searches that can be performed using the SDK for UPnP Devices API.
Header file for UpnpActionComplete methods.
Header file for UpnpActionRequest methods.
Header file for UpnpDiscovery methods.
Header file for UpnpEventSubscribe methods.
Header file for UpnpEvent methods.
Header file for UpnpFileInfo methods.
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.
#define DOMString
The type of DOM strings.
PUPNP_Api char * UpnpGetServerIpAddress(void)
Returns the local IPv4 listening ip address.
PUPNP_Api unsigned short UpnpGetServerUlaGuaPort6(void)
Returns the internal server IPv6 ULA or GUA UPnP listening port.
PUPNP_Api in_port_t UpnpGetServerPort(void)
Returns the internal server IPv4 UPnP listening port.
PUPNP_Api unsigned short UpnpGetServerPort6(void)
Returns the internal server IPv6 link-local (LLA) UPnP listening port.
PUPNP_Api int UpnpRegisterClient(Upnp_FunPtr Fun, const void *Cookie, UpnpClient_Handle *Hnd)
Registers a control point application with the UPnP Library.
PUPNP_Api int UpnpRegisterRootDevice2(const Upnp_DescType descriptionType, const char *const description_const, const size_t bufferLen, const int config_baseURL, const Upnp_FunPtr Fun, const void *const Cookie, UpnpDevice_Handle *const Hnd)
Registers one root- or logical-device object with the UPnP Library with additional description and ge...
PUPNP_Api int UpnpSetMaxContentLength(size_t contentLength)
Sets the maximum content-length that the SDK will process on an incoming SOAP requests or responses.
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...
PUPNP_Api int UpnpUnRegisterClient(UpnpClient_Handle Hnd)
Unregisters a control point application, unsubscribing all active subscriptions.
PUPNP_Api int UpnpFinish(void)
Terminates the Linux SDK for UPnP Devices.
PUPNP_Api char * UpnpGetServerIp6Address(void)
Returns the IPv6 link-local listening ip address.
PUPNP_Api int UpnpUnRegisterRootDeviceLowPower(UpnpDevice_Handle Hnd, int PowerState, int SleepPeriod, int RegistrationState)
Unregisters a root device registered with UpnpRegisterRootDevice(), UpnpRegisterRootDevice2(),...
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.
PUPNP_Api char * UpnpGetServerUlaGuaIp6Address(void)
Returns the IPv6 unique-local or globally-unique listening ip address.
PUPNP_Api int UpnpInit2(const char *IfName, unsigned short DestPort)
Initializes the Linux SDK for UPnP Devices.
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.
PUPNP_Api int UpnpUnRegisterRootDevice(UpnpDevice_Handle Hnd)
Unregisters a root device registered with UpnpRegisterRootDevice(), UpnpRegisterRootDevice2(),...
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 ...
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 ...
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.
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.
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.
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.
PUPNP_Api int UpnpHttpGetProgress(void *Handle, size_t *length, size_t *total)
Retrieve progress information of a http-get transfer.
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...
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.
PUPNP_Api int UpnpCancelHttpGet(void *Handle)
Set the cancel flag of the handle parameter.
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...
PUPNP_Api int UpnpOpenHttpConnection(const char *url, void **handle, int timeout)
Opens a connection to the server.
PUPNP_Api int UpnpDownloadUrlItem(const char *url, char **outBuf, char *contentType)
Downloads a file specified in a URL.
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.
PUPNP_Api int UpnpEndHttpRequest(void *handle, int timeout)
Indicates the end of a HTTP request previously made by UpnpMakeHttpRequest().
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().
PUPNP_Api int UpnpOpenHttpGet(const char *url, void **handle, char **contentType, int *contentLength, int *httpStatus, int timeout)
Gets a file specified in a URL.
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...
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().
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().
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.
Upnp_HttpMethod
Different HTTP methods.
PUPNP_Api int UpnpCloseHttpGet(void *Handle)
Closes the connection and frees memory that was allocated for the handle parameter.
PUPNP_Api int UpnpCloseHttpConnection(void *handle)
Closes the connection created with UpnpOpenHttpConnection() and frees any memory associated with the ...
PUPNP_Api int UpnpDownloadXmlDoc(const char *url, IXML_Document **xmlDoc)
Downloads an XML document specified in a URL.
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...
@ UPNP_HTTPMETHOD_DELETE
DELETE.
@ UPNP_HTTPMETHOD_GET
GET.
@ UPNP_HTTPMETHOD_HEAD
HEAD.
@ UPNP_HTTPMETHOD_PUT
PUT.
@ UPNP_HTTPMETHOD_POST
POST.
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.
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.
PUPNP_Api int UpnpSendAdvertisement(UpnpDevice_Handle Hnd, int Exp)
Sends out the discovery announcements for all devices and services contained within one root device.
PUPNP_Api int UpnpSetMaxSubscriptionTimeOut(UpnpDevice_Handle Hnd, int MaxSubscriptionTimeOut)
Sets the maximum time-out accepted for a subscription request or renewal.
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.
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...
PUPNP_Api int UpnpSetMaxSubscriptions(UpnpDevice_Handle Hnd, int MaxSubscriptions)
Sets the maximum number of subscriptions accepted per service.
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.
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.
PUPNP_Api int UpnpRenewSubscription(UpnpClient_Handle Hnd, int *TimeOut, const Upnp_SID SubsId)
Renews a subscription that is about to expire.
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...
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...
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...
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...
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...
int(* VDCallback_Close)(UpnpWebFileHandle fileHnd, const void *cookie, const void *request_cookie)
Close callback function prototype.
PUPNP_Api int UpnpVirtualDir_set_GetInfoCallback(VDCallback_GetInfo callback)
Sets the get_info callback function to be used to access a web directory.
PUPNP_Api void UpnpSetAllowLiteralHostRedirection(int enable)
Enable or disable literal IP redirection.
PUPNP_Api int UpnpVirtualDir_set_ReadCallback(VDCallback_Read callback)
Sets the read callback function to be used to access a web directory.
PUPNP_Api int UpnpVirtualDir_set_SeekCallback(VDCallback_Seek callback)
Sets the seek callback function to be used to access a web directory.
PUPNP_Api int UpnpIsWebserverEnabled(void)
Returns the status of the webserver.
void * UpnpWebFileHandle
The type of handle returned by the web server for open requests.
PUPNP_Api int UpnpSetWebServerRootDir(const char *rootDir)
Sets the document root directory for the internal web server.
int(* VDCallback_GetInfo)(const char *filename, UpnpFileInfo *info, const void *cookie, const void **request_cookie)
Get-info callback function prototype.
PUPNP_Api void UpnpSetHostValidateCallback(WebCallback_HostValidate callback, void *cookie)
Set callback for validating HTTP requests HOST header values.
int(* WebCallback_HostValidate)(const char *hostname, void *cookie)
Callback for validating HTTP requests HOST header values.
PUPNP_Api void UpnpRemoveAllVirtualDirs(void)
Removes all web directory mappings.
int(* VDCallback_Seek)(UpnpWebFileHandle fileHnd, off_t offset, int origin, const void *cookie, const void *request_cookie)
Seek callback function prototype.
PUPNP_Api int UpnpVirtualDir_set_OpenCallback(VDCallback_Open callback)
Sets the open callback function to be used to access a web directory.
PUPNP_Api int UpnpAddVirtualDir(const char *newDirName, const void *cookie, const void **oldcookie)
Adds a web directory mapping.
PUPNP_Api int UpnpVirtualDir_set_WriteCallback(VDCallback_Write callback)
Sets the write callback function to be used to access a web directory.
PUPNP_Api int UpnpVirtualDir_set_CloseCallback(VDCallback_Close callback)
Sets the close callback function to be used to access a web directory.
int(* VDCallback_Write)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie, const void *request_cookie)
Write callback function prototype.
int(* VDCallback_Read)(UpnpWebFileHandle fileHnd, char *buf, size_t buflen, const void *cookie, const void *request_cookie)
Read callback function prototype.
UpnpWebFileHandle(* VDCallback_Open)(const char *filename, enum UpnpOpenFileMode Mode, const void *cookie, const void *request_cookie)
Open callback function prototype.
PUPNP_Api int UpnpSetWebServerCorsString(const char *corsString)
Assign the Access-Control-Allow-Origin specfied by the input const char* cors_string parameter to the...
PUPNP_Api int UpnpEnableWebserver(int enable)
Enables or disables the webserver.
PUPNP_Api int UpnpRemoveVirtualDir(const char *dirName)
Removes a web directory mapping made with UpnpAddVirtualDir().