44 #include "VirtualDir.h"
47 #define MAX_INTERFACES 256
49 #define DEFAULT_INTERFACE 1
53 #define NUM_HANDLE 200
57 #define DEFAULT_MAXAGE 1800
59 #define DEFAULT_SOAP_CONTENT_LENGTH 16000
60 #define MAX_SOAP_CONTENT_LENGTH 32000
65 #define UPNP_TIMEOUT 30
67 typedef enum {HND_INVALID=-1,HND_CLIENT,HND_DEVICE} Upnp_Handle_Type;
82 #ifdef INCLUDE_DEVICE_APIS
106 #ifdef INCLUDE_CLIENT_APIS
130 #define HandleLock() HandleWriteLock()
133 #define HandleWriteLock() \
134 UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying a write lock\n"); \
135 ithread_rwlock_wrlock(&GlobalHndRWLock); \
136 UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Write lock acquired\n");
139 #define HandleReadLock() \
140 UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying a read lock\n"); \
141 ithread_rwlock_rdlock(&GlobalHndRWLock); \
142 UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Read lock acquired\n");
145 #define HandleUnlock() \
146 UpnpPrintf(UPNP_INFO, API,__FILE__, __LINE__, "Trying Unlock\n"); \
147 ithread_rwlock_unlock(&GlobalHndRWLock); \
148 UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Unlocked rwlock\n");
160 int *client_handle_out,
171 const int AddressFamily,
173 int *device_handle_out,
219 char VarName[NAME_SIZE];
220 char NewVal[NAME_SIZE];
221 char DevType[NAME_SIZE];
222 char DevId[NAME_SIZE];
223 char ServiceType[NAME_SIZE];
224 char ServiceVer[NAME_SIZE];
231 struct DevDesc *Devdesc;
245 #define E_HTTP_SYNTAX -6
Upnp_FunPtr Callback
Definition: upnpapi.h:75
int UpnpClient_Handle
Returned when a control point application registers with UpnpRegisterClient.
Definition: upnp.h:461
virtualDirList * pVirtualDirList
Definition: upnpapi.c:103
ClientSubscription * ClientSubList
Definition: upnpapi.h:108
IXML_Document * DescDocument
Definition: upnpapi.h:90
Upnp_Handle_Type GetClientHandleInfo(int *client_handle_out, struct Handle_Info **HndInfo)
Get client handle info.
Definition: upnpapi.c:3330
char DescURL[LINE_SIZE]
Definition: upnpapi.h:84
Definition: TimerThread.h:71
Definition: upnpapi.h:214
size_t g_maxContentLength
Definition: upnpapi.c:161
ithread_rwlock_t GlobalHndRWLock
Definition: upnpapi.c:111
IXML_NodeList * DeviceList
Definition: upnpapi.h:92
int GetFreeHandle()
Get a free handle.
Definition: upnpapi.c:3312
Upnp_Handle_Type HType
Definition: upnpapi.h:73
int gIF_INDEX
Definition: upnpapi.c:144
unsigned short LOCAL_PORT_V6
Definition: upnpapi.c:150
LinkedList SsdpSearchList
Definition: upnpapi.h:110
void InitHandleList()
Initialize handle table.
Definition: VirtualDir.h:11
char gIF_NAME[LINE_SIZE]
Definition: upnpapi.c:135
IXML_NodeList * ServiceList
Definition: upnpapi.h:94
Upnp_SID gUpnpSdkNLSuuid
Definition: upnpapi.c:180
ThreadPool gMiniServerThreadPool
Definition: upnpapi.c:129
Upnp_Handle_Type GetHandleInfo(int Hnd, struct Handle_Info **HndInfo)
Get handle information.
Definition: upnpapi.c:3377
int MaxSubscriptionTimeOut
Definition: upnpapi.h:100
A thread pool similar to the thread pool in the UPnP SDK.
Definition: ThreadPool.h:266
char gIF_IPV4[22]
Definition: upnpapi.c:138
char gIF_IPV6[65]
Definition: upnpapi.c:141
int aliasInstalled
Definition: upnpapi.h:79
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:2868
Definition: service_table.h:89
ThreadPool gRecvThreadPool
Definition: upnpapi.c:126
int getlocalhostname(char *out, const int out_len)
Get local IP address.
Definition: upnpapi.c:3454
service_table ServiceTable
Definition: upnpapi.h:96
WebServerState bWebServerState
Definition: upnpapi.c:132
Data structure representing a list of nodes.
Definition: ixml.h:231
void AutoAdvertise(void *input)
This function is a timer thread scheduled by UpnpSendAdvertisement to the send advetisement again...
Definition: upnpapi.c:3609
unsigned short LOCAL_PORT_V4
Definition: upnpapi.c:147
char * Cookie
Definition: upnpapi.h:77
ThreadPool gSendThreadPool
Definition: upnpapi.c:123
int MaxSubscriptions
Definition: upnpapi.h:98
TimerThread gTimerThread
Definition: upnpapi.c:120
int DeviceAf
Definition: upnpapi.h:102
Data structure representing the DOM Document.
Definition: ixml.h:183
Definition: VirtualDir.h:61
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
Definition: upnp.h:590
int(* Upnp_FunPtr)(Upnp_EventType EventType, void *Event, void *Cookie)
Definition: upnp.h:664
char DescXML[LINE_SIZE]
Definition: upnpapi.h:86
int FreeHandle(int Handle)
Free handle.
Definition: upnpapi.c:3404
Upnp_Handle_Type GetDeviceHandleInfo(const int AddressFamily, int *device_handle_out, struct Handle_Info **HndInfo)
Retrieves the device handle and information of the first device of the address family spcified...
Definition: upnpapi.c:3351
Definition: LinkedList.h:111
struct VirtualDirCallbacks virtualDirCallback
Definition: upnpapi.c:100
int PrintHandleInfo(UpnpClient_Handle Hnd)
Print handle info.
Definition: upnpapi.c:3432
void UpnpThreadDistribution(struct UpnpNonblockParam *Param)
Schedule async functions in threadpool.
Definition: upnpapi.c:3200