45 #include "VirtualDir.h"
48 #define MAX_INTERFACES 256
54 #define DEFAULT_MAXAGE 1800
56 #define DEFAULT_SOAP_CONTENT_LENGTH 16000
57 #define MAX_SOAP_CONTENT_LENGTH (size_t)32000
59 #define NUM_HANDLE 200
66 #define UPNP_TIMEOUT 30
68 typedef enum {HND_INVALID=-1,HND_CLIENT,HND_DEVICE} Upnp_Handle_Type;
83 #ifdef INCLUDE_DEVICE_APIS
98 int RegistrationState;
116 #ifdef INCLUDE_CLIENT_APIS
138 #define HandleLock() HandleWriteLock()
141 #define HandleWriteLock() \
142 UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying a write lock\n"); \
143 ithread_rwlock_wrlock(&GlobalHndRWLock); \
144 UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Write lock acquired\n");
147 #define HandleReadLock() \
148 UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying a read lock\n"); \
149 ithread_rwlock_rdlock(&GlobalHndRWLock); \
150 UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Read lock acquired\n");
153 #define HandleUnlock() \
154 UpnpPrintf(UPNP_INFO, API,__FILE__, __LINE__, "Trying Unlock\n"); \
155 ithread_rwlock_unlock(&GlobalHndRWLock); \
156 UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Unlocked rwlock\n");
168 int *client_handle_out,
185 int *device_handle_out,
202 int *device_handle_out,
211 extern char gIF_IPV4[INET_ADDRSTRLEN];
213 extern char gIF_IPV6[INET6_ADDRSTRLEN];
256 char VarName[NAME_SIZE];
257 char NewVal[NAME_SIZE];
258 char DevType[NAME_SIZE];
259 char DevId[NAME_SIZE];
260 char ServiceType[NAME_SIZE];
261 char ServiceVer[NAME_SIZE];
268 struct DevDesc *Devdesc;
282 #define E_HTTP_SYNTAX -6
int(* Upnp_FunPtr)(Upnp_EventType EventType, const void *Event, void *Cookie)
Definition: Callback.h:145
unsigned gIF_IPV6_ULA_GUA_PREFIX_LENGTH
Definition: upnpapi.c:162
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
Definition: upnp.h:448
struct VirtualDirCallbacks virtualDirCallback
Definition: upnpapi.c:107
void UpnpThreadDistribution(struct UpnpNonblockParam *Param)
Schedule async functions in threadpool.
Definition: upnpapi.c:3917
ThreadPool gSendThreadPool
Definition: upnpapi.c:130
char gIF_IPV6_ULA_GUA[INET6_ADDRSTRLEN]
Definition: upnpapi.c:159
ThreadPool gRecvThreadPool
Definition: upnpapi.c:133
unsigned short LOCAL_PORT_V6_ULA_GUA
Definition: upnpapi.c:174
int PrintHandleInfo(UpnpClient_Handle Hnd)
Print handle info.
Definition: upnpapi.c:4162
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,...
Definition: upnpapi.c:4086
unsigned gIF_IPV6_PREFIX_LENGTH
Definition: upnpapi.c:155
size_t g_maxContentLength
Definition: upnpapi.c:185
int UpnpClient_Handle
Returned when a control point application registers with UpnpRegisterClient.
Definition: upnp.h:429
virtualDirList * pVirtualDirList
Definition: upnpapi.c:110
int g_UpnpSdkEQMaxLen
Definition: upnpapi.c:191
int UpnpGetIfInfo(const char *IfName)
Retrieve interface information and keep it in global variables. If NULL, we'll find the first suitabl...
Definition: upnpapi.c:3575
unsigned short LOCAL_PORT_V6
Definition: upnpapi.c:171
unsigned short LOCAL_PORT_V4
Definition: upnpapi.c:168
ithread_rwlock_t GlobalHndRWLock
Definition: upnpapi.c:118
int UpnpDevice_Handle
Returned when a device application registers with UpnpRegisterRootDevice, UpnpRegisterRootDevice2,...
Definition: upnp.h:439
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....
Definition: upnpapi.c:4049
void AutoAdvertise(void *input)
This function is a timer thread scheduled by UpnpSendAdvertisement to the send advetisement again.
Definition: upnpapi.c:4201
char gIF_IPV4[INET_ADDRSTRLEN]
Definition: upnpapi.c:145
TimerThread gTimerThread
Definition: upnpapi.c:127
char gIF_NAME[LINE_SIZE]
Definition: upnpapi.c:142
unsigned gIF_INDEX
Definition: upnpapi.c:165
ThreadPool gMiniServerThreadPool
Definition: upnpapi.c:136
char gIF_IPV4_NETMASK[INET_ADDRSTRLEN]
Definition: upnpapi.c:148
int g_UpnpSdkEQMaxAge
Definition: upnpapi.c:201
char gIF_IPV6[INET6_ADDRSTRLEN]
Definition: upnpapi.c:152
Upnp_Handle_Type GetHandleInfo(int Hnd, struct Handle_Info **HndInfo)
Get handle information.
Definition: upnpapi.c:4126
Upnp_Handle_Type GetClientHandleInfo(int *client_handle_out, struct Handle_Info **HndInfo)
Get client handle info.
Definition: upnpapi.c:4029
WebServerState bWebServerState
Definition: upnpapi.c:139
Upnp_Handle_Type HType
Definition: upnpapi.h:74
IXML_NodeList * ServiceList
Definition: upnpapi.h:104
int aliasInstalled
Definition: upnpapi.h:80
char DescXML[LINE_SIZE]
Definition: upnpapi.h:90
GenlibClientSubscription * ClientSubList
Definition: upnpapi.h:118
service_table ServiceTable
Definition: upnpapi.h:106
char LowerDescURL[LINE_SIZE]
Definition: upnpapi.h:88
char DescURL[LINE_SIZE]
Definition: upnpapi.h:85
IXML_Document * DescDocument
Definition: upnpapi.h:100
char * Cookie
Definition: upnpapi.h:78
Upnp_FunPtr Callback
Definition: upnpapi.h:76
int MaxSubscriptionTimeOut
Definition: upnpapi.h:110
int MaxSubscriptions
Definition: upnpapi.h:108
LinkedList SsdpSearchList
Definition: upnpapi.h:120
IXML_NodeList * DeviceList
Definition: upnpapi.h:102
int DeviceAf
Definition: upnpapi.h:112
Definition: LinkedList.h:84
Definition: service_table.h:72
Definition: service_table.h:90
A thread pool similar to the thread pool in the UPnP SDK.
Definition: ThreadPool.h:216
Definition: TimerThread.h:68
Definition: upnpapi.h:252
Definition: VirtualDir.h:12
Data structure representing the DOM Document.
Definition: ixml.h:160
Data structure representing a list of nodes.
Definition: ixml.h:203
Definition: GenlibClientSubscription.c:19
Definition: VirtualDir.h:62