libUPnP
1.8.0
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
upnp
src
inc
upnpapi.h
Go to the documentation of this file.
1
/*******************************************************************************
2
*
3
* Copyright (c) 2000-2003 Intel Corporation
4
* All rights reserved.
5
*
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions are met:
8
*
9
* * Redistributions of source code must retain the above copyright notice,
10
* this list of conditions and the following disclaimer.
11
* * Redistributions in binary form must reproduce the above copyright notice,
12
* this list of conditions and the following disclaimer in the documentation
13
* and/or other materials provided with the distribution.
14
* * Neither name of Intel Corporation nor the names of its contributors
15
* may be used to endorse or promote products derived from this software
16
* without specific prior written permission.
17
*
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
22
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
*
30
******************************************************************************/
31
32
33
#ifndef UPNPAPI_H
34
#define UPNPAPI_H
35
36
42
#include "
client_table.h
"
43
#include "
upnp.h
"
44
#include "VirtualDir.h"
/* for struct VirtualDirCallbacks */
45
46
47
#define MAX_INTERFACES 256
48
49
#define DEFAULT_INTERFACE 1
50
51
#define DEV_LIMIT 200
52
53
#define NUM_HANDLE 200
54
55
#define DEFAULT_MX 5
56
57
#define DEFAULT_MAXAGE 1800
58
59
#define DEFAULT_SOAP_CONTENT_LENGTH 16000
60
#define MAX_SOAP_CONTENT_LENGTH 32000
61
62
extern
size_t
g_maxContentLength
;
63
64
/* 30-second timeout */
65
#define UPNP_TIMEOUT 30
66
67
typedef
enum
{HND_INVALID=-1,HND_CLIENT,HND_DEVICE} Upnp_Handle_Type;
68
69
/* Data to be stored in handle table for */
70
struct
Handle_Info
71
{
73
Upnp_Handle_Type
HType
;
75
Upnp_FunPtr
Callback
;
77
char
*
Cookie
;
79
int
aliasInstalled
;
80
81
/* Device Only */
82
#ifdef INCLUDE_DEVICE_APIS
83
84
char
DescURL
[LINE_SIZE];
86
char
DescXML
[LINE_SIZE];
87
/* Advertisement timeout */
88
int
MaxAge;
90
IXML_Document
*
DescDocument
;
92
IXML_NodeList
*
DeviceList
;
94
IXML_NodeList
*
ServiceList
;
96
service_table
ServiceTable
;
98
int
MaxSubscriptions
;
100
int
MaxSubscriptionTimeOut
;
102
int
DeviceAf
;
103
#endif
104
105
/* Client only */
106
#ifdef INCLUDE_CLIENT_APIS
107
108
ClientSubscription *
ClientSubList
;
110
LinkedList
SsdpSearchList
;
111
#endif
112
};
113
114
115
extern
ithread_rwlock_t
GlobalHndRWLock
;
116
117
123
Upnp_Handle_Type
GetHandleInfo
(
125
int
Hnd,
127
struct
Handle_Info
**HndInfo);
128
129
130
#define HandleLock() HandleWriteLock()
131
132
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");
137
138
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");
143
144
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");
149
150
158
Upnp_Handle_Type
GetClientHandleInfo
(
160
int
*client_handle_out,
162
struct
Handle_Info
**HndInfo);
169
Upnp_Handle_Type
GetDeviceHandleInfo
(
171
const
int
AddressFamily,
173
int
*device_handle_out,
175
struct
Handle_Info
**HndInfo);
176
177
178
extern
char
gIF_NAME
[LINE_SIZE];
180
extern
char
gIF_IPV4
[22];
182
extern
char
gIF_IPV6
[65];
183
extern
int
gIF_INDEX
;
184
185
186
extern
unsigned
short
LOCAL_PORT_V4
;
187
extern
unsigned
short
LOCAL_PORT_V6
;
188
189
191
extern
Upnp_SID
gUpnpSdkNLSuuid
;
192
193
194
extern
TimerThread
gTimerThread
;
195
extern
ThreadPool
gRecvThreadPool
;
196
extern
ThreadPool
gSendThreadPool
;
197
extern
ThreadPool
gMiniServerThreadPool
;
198
199
200
typedef
enum
{
201
SUBSCRIBE,
202
UNSUBSCRIBE,
203
DK_NOTIFY,
204
QUERY,
205
ACTION,
206
STATUS,
207
DEVDESCRIPTION,
208
SERVDESCRIPTION,
209
MINI,
210
RENEW
211
} UpnpFunName;
212
213
214
struct
UpnpNonblockParam
215
{
216
UpnpFunName FunName;
217
int
Handle;
218
int
TimeOut;
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];
225
char
Url[NAME_SIZE];
226
Upnp_SID
SubsId;
227
char
*Cookie;
228
Upnp_FunPtr
Fun;
229
IXML_Document
*Header;
230
IXML_Document
*Act;
231
struct
DevDesc *Devdesc;
232
};
233
234
235
extern
virtualDirList
*
pVirtualDirList
;
236
extern
struct
VirtualDirCallbacks
virtualDirCallback
;
237
238
239
typedef
enum
{
240
WEB_SERVER_DISABLED,
241
WEB_SERVER_ENABLED
242
} WebServerState;
243
244
245
#define E_HTTP_SYNTAX -6
246
247
266
int
UpnpGetIfInfo
(
268
const
char
*IfName);
269
270
274
void
InitHandleList
();
275
276
283
int
GetFreeHandle
();
284
285
291
int
FreeHandle
(
293
int
Handle);
294
295
296
void
UpnpThreadDistribution
(
struct
UpnpNonblockParam
* Param);
297
298
303
void
AutoAdvertise
(
305
void
*input);
306
307
316
int
getlocalhostname
(
318
char
*out,
320
const
int
out_len);
321
322
328
int
PrintHandleInfo
(
330
UpnpClient_Handle
Hnd);
331
332
333
extern
WebServerState
bWebServerState
;
334
335
336
#endif
/* UPNPAPI_H */
337
Generated on Sat Feb 2 2013 05:11:55 for libUPnP by
1.8.3.1