1#ifndef COMPA_UPNPAPI_HPP
2#define COMPA_UPNPAPI_HPP
47#define MAX_INTERFACES 256
56#define DEFAULT_MAXAGE 1800
59#define DEFAULT_SOAP_CONTENT_LENGTH 16000
61#define MAX_SOAP_CONTENT_LENGTH (size_t)32000
71#define UPNP_TIMEOUT 30
76 HND_TABLE_INVALID = -2,
90#ifdef COMPA_HAVE_DEVICE_SSDP
115#ifdef COMPA_HAVE_CTRLPT_SSDP
138#define HandleLock() HandleWriteLock()
141#define HandleWriteLock() pthread_rwlock_wrlock(&GlobalHndRWLock);
144#define HandleReadLock() pthread_rwlock_rdlock(&GlobalHndRWLock);
147#define HandleUnlock() pthread_rwlock_unlock(&GlobalHndRWLock);
151#define HandleWriteLock() \
152 UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying a write lock\n"); \
153 pthread_rwlock_wrlock(&GlobalHndRWLock); \
154 UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Write lock acquired\n");
157#define HandleReadLock() \
158 UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying a read lock\n"); \
159 pthread_rwlock_rdlock(&GlobalHndRWLock); \
160 UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Read lock acquired\n");
163#define HandleUnlock() \
164 UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying Unlock\n"); \
165 pthread_rwlock_unlock(&GlobalHndRWLock); \
166 UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Unlocked rwlock\n");
178 int* client_handle_out,
195 int* device_handle_out,
212 int* device_handle_out,
285#define E_HTTP_SYNTAX -6
int(* Upnp_FunPtr)(Upnp_EventType EventType, const void *Event, void *Cookie)
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
int UpnpClient_Handle
Returned when a control point application registers with UpnpRegisterClient().
int UpnpDevice_Handle
Returned when a device application registers with UpnpRegisterRootDevice(),UpnpRegisterRootDevice2(),...
Genlib Client subscription.
Linked list (no protection).
A timer thread that allows the scheduling of a job to run at a specified time in the future.
Provide the Virtual Directory Callbacks structure.
Data structure representing a list of nodes.
Data structure representing the DOM Document.
int(* WebCallback_HostValidate)(const char *hostname, void *cookie)
Callback for validating HTTP requests HOST header values.
-brief Service information
IXML_Document * Act
UpnpNonblockParam
Upnp_Handle_Type HType
Handle Type.
Upnp_Handle_Type GetHandleInfo(int Hnd, struct Handle_Info **HndInfo)
Get handle information.
IXML_Document * Header
UpnpNonblockParam
char * Cookie
UpnpNonblockParam
UPnPsdk_VIS WebCallback_HostValidate gWebCallback_HostValidate
webCallback for HOST validation.
IXML_NodeList * ServiceList
List of services in the description document.
int aliasInstalled
0 = not installed; otherwise installed.
int Handle
UpnpNonblockParam
struct VirtualDirCallbacks virtualDirCallback
This structure is for virtual directory callbacks.
void UpnpThreadDistribution(struct UpnpNonblockParam *Param)
UpnpThreadDistribution.
ThreadPool gSendThreadPool
Send thread pool.
Upnp_FunPtr Fun
UpnpNonblockParam
ThreadPool gRecvThreadPool
Receive thread pool.
Upnp_Handle_Type GetDeviceHandleInfoForPath(const char *path, int AddressFamily, int *device_handle_out, struct Handle_Info **HndInfo, service_info **serv_info)
Retrieves the device handle and information of the first device of the address family specified,...
UPnPsdk_VIS char gIF_IPV4_NETMASK[INET_ADDRSTRLEN]
Static buffer to contain interface IPv4 netmask. (extern'ed in upnp.h)
char Url[NAME_SIZE]
UpnpNonblockParam
char DescXML[LINE_SIZE]
XML file path for device description.
GenlibClientSubscription * ClientSubList
Client subscription list.
service_table ServiceTable
Table holding subscriptions and URL information.
int SleepPeriod
Sleep Period as defined by UPnP Low Power.
UPnPsdk_VIS char gIF_IPV6_ULA_GUA[INET6_ADDRSTRLEN]
Static buffer to contain interface IPv6 unique-local or globally-unique address (ULA or GUA)....
int PrintHandleInfo(UpnpClient_Handle Hnd)
Print handle info.
UPnPsdk_VIS unsigned short LOCAL_PORT_V4
local IPv4 port for the mini-server
Upnp_SID gUpnpSdkNLSuuid
Global variable used in discovery notifications.
pthread_rwlock_t GlobalHndRWLock
rwlock to synchronize handles (root device or control point handle).
UPnPsdk_VIS char gIF_IPV4[INET_ADDRSTRLEN]
Static buffer to contain interface IPv4 address. (extern'ed in upnp.h)
Upnp_Handle_Type GetClientHandleInfo(int *client_handle_out, struct Handle_Info **HndInfo)
Get client handle info.
UPnPsdk_VIS unsigned short LOCAL_PORT_V6_ULA_GUA
IPv6 ULA or GUA port for the mini-server.
struct DevDesc * Devdesc
UpnpNonblockParam
size_t g_maxContentLength
Maximum content-length (in bytes) that the SDK will process on an incoming packet.
char LowerDescURL[LINE_SIZE]
URL for the use of SSDP when answering to legacy CPs (CP searching for a v1 when the device is v2).
int RegistrationState
Registration State as defined by UPnP Low Power.
virtualDirList * pVirtualDirList
Pointer to the virtual directory list.
int g_UpnpSdkEQMaxLen
Global variable to determines the maximum number of events.
char DescURL[LINE_SIZE]
URL for the use of SSDP.
char ServiceVer[NAME_SIZE]
UpnpNonblockParam
Upnp_SID SubsId
UpnpNonblockParam
UPnPsdk_VIS unsigned gIF_INDEX
Contains network interface index of the link local address gIF_IPV6 that is used as its scope_id.
UPnPsdk_VIS void * gWebCallback_HostValidateCookie
Cookie to the webCallback for HOST validation.
UPnPsdk_VIS unsigned gIF_IPV6_PREFIX_LENGTH
IPv6 LLA prefix length. (extern'ed in upnp.h)
UPnPsdk_VIS unsigned gIF_IPV6_ULA_GUA_PREFIX_LENGTH
IPv6 ULA or GUA prefix length. (extern'ed in upnp.h)
IXML_Document * DescDocument
Description parsed in terms of DOM document.
UpnpFunName FunName
UpnpNonblockParam
int TimeOut
UpnpNonblockParam
UPnPsdk_VIS char gIF_IPV6[INET6_ADDRSTRLEN]
Static buffer to contain interface IPv6 link-local address (LLA). (extern'ed in upnp....
int PowerState
Power State as defined by UPnP Low Power.
char DevId[NAME_SIZE]
UpnpNonblockParam
WebServerState
Possible status of the internal webserver.
void AutoAdvertise(void *input)
This function is a timer thread scheduled by UpnpSendAdvertisement to the send advetisement again.
UPnPsdk_VIS unsigned short LOCAL_PORT_V6
IPv6 LLA port for the mini-server.
UPnPsdk_VIS int gAllowLiteralHostRedirection
Allow literal host names redirection to numeric host names.
Upnp_FunPtr Callback
Callback function pointer.
constexpr int NUM_HANDLE
Maximal number of available UPnP Unit handles.
int MaxSubscriptionTimeOut
???
char NewVal[NAME_SIZE]
UpnpNonblockParam
LinkedList SsdpSearchList
Active SSDP searches.
TimerThread gTimerThread
Global timer thread.
IXML_NodeList * DeviceList
List of devices in the description document.
int MaxAge
Advertisement timeout.
ThreadPool gMiniServerThreadPool
Mini server thread pool.
Upnp_Handle_Type GetDeviceHandleInfo(UpnpDevice_Handle start, int AddressFamily, int *device_handle_out, struct Handle_Info **HndInfo)
Retrieves the device handle and information of the first device of the address family specified....
char VarName[NAME_SIZE]
UpnpNonblockParam
int g_UpnpSdkEQMaxAge
Global variable to determine the maximum number of seconds which an event can spend on a subscription...
int DeviceAf
Address family: AF_INET6 or AF_INET.
char ServiceType[NAME_SIZE]
UpnpNonblockParam
WebServerState bWebServerState
Flag to indicate the state of web server.
char DevType[NAME_SIZE]
UpnpNonblockParam
UPnPsdk_VIS char gIF_NAME[LINE_SIZE]
Static buffer to contain interface name. (extern'ed in upnp.h)
Data to be stored in handle table for Handle Info.
#define UPnPsdk_VIS
Prefix to export symbol for external use.