libUPnP
1.6.17
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
* Copyright (C) 2011-2012 France Telecom All rights reserved.
6
*
7
* Redistribution and use in source and binary forms, with or without
8
* modification, are permitted provided that the following conditions are met:
9
*
10
* * Redistributions of source code must retain the above copyright notice,
11
* this list of conditions and the following disclaimer.
12
* * Redistributions in binary form must reproduce the above copyright notice,
13
* this list of conditions and the following disclaimer in the documentation
14
* and/or other materials provided with the distribution.
15
* * Neither name of Intel Corporation nor the names of its contributors
16
* may be used to endorse or promote products derived from this software
17
* without specific prior written permission.
18
*
19
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
23
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
27
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
*
31
******************************************************************************/
32
33
34
#ifndef UPNPAPI_H
35
#define UPNPAPI_H
36
37
43
#include "
client_table.h
"
44
#include "
upnp.h
"
45
#include "VirtualDir.h"
/* for struct VirtualDirCallbacks */
46
47
48
#define MAX_INTERFACES 256
49
50
#define DEFAULT_INTERFACE 1
51
52
#define DEV_LIMIT 200
53
54
#define DEFAULT_MX 5
55
56
#define DEFAULT_MAXAGE 1800
57
58
#define DEFAULT_SOAP_CONTENT_LENGTH 16000
59
#define MAX_SOAP_CONTENT_LENGTH (size_t)32000
60
61
extern
size_t
g_maxContentLength
;
62
63
/* 30-second timeout */
64
#define UPNP_TIMEOUT 30
65
66
typedef
enum
{HND_INVALID=-1,HND_CLIENT,HND_DEVICE} Upnp_Handle_Type;
67
68
/* Data to be stored in handle table for */
69
struct
Handle_Info
70
{
72
Upnp_Handle_Type
HType
;
74
Upnp_FunPtr
Callback
;
76
char
*
Cookie
;
78
int
aliasInstalled
;
79
80
/* Device Only */
81
#ifdef INCLUDE_DEVICE_APIS
82
83
char
DescURL
[LINE_SIZE];
86
char
LowerDescURL
[LINE_SIZE];
88
char
DescXML
[LINE_SIZE];
89
/* Advertisement timeout */
90
int
MaxAge;
91
/* Power State as defined by UPnP Low Power. */
92
int
PowerState;
93
/* Sleep Period as defined by UPnP Low Power. */
94
int
SleepPeriod;
95
/* Registration State as defined by UPnP Low Power. */
96
int
RegistrationState;
98
IXML_Document
*
DescDocument
;
100
IXML_NodeList
*
DeviceList
;
102
IXML_NodeList
*
ServiceList
;
104
service_table
ServiceTable
;
106
int
MaxSubscriptions
;
108
int
MaxSubscriptionTimeOut
;
110
int
DeviceAf
;
111
#endif
112
113
/* Client only */
114
#ifdef INCLUDE_CLIENT_APIS
115
116
ClientSubscription *
ClientSubList
;
118
LinkedList
SsdpSearchList
;
119
#endif
120
};
121
122
extern
ithread_rwlock_t
GlobalHndRWLock
;
123
129
Upnp_Handle_Type
GetHandleInfo
(
131
int
Hnd,
133
struct
Handle_Info
**HndInfo);
134
135
136
#define HandleLock() HandleWriteLock()
137
138
139
#define HandleWriteLock() \
140
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying a write lock\n"); \
141
ithread_rwlock_wrlock(&GlobalHndRWLock); \
142
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Write lock acquired\n");
143
144
145
#define HandleReadLock() \
146
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying a read lock\n"); \
147
ithread_rwlock_rdlock(&GlobalHndRWLock); \
148
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Read lock acquired\n");
149
150
151
#define HandleUnlock() \
152
UpnpPrintf(UPNP_INFO, API,__FILE__, __LINE__, "Trying Unlock\n"); \
153
ithread_rwlock_unlock(&GlobalHndRWLock); \
154
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Unlocked rwlock\n");
155
156
164
Upnp_Handle_Type
GetClientHandleInfo
(
166
int
*client_handle_out,
168
struct
Handle_Info
**HndInfo);
175
Upnp_Handle_Type
GetDeviceHandleInfo
(
177
int
AddressFamily,
179
int
*device_handle_out,
181
struct
Handle_Info
**HndInfo);
182
183
184
extern
char
gIF_NAME
[LINE_SIZE];
185
extern
char
gIF_IPV4
[INET_ADDRSTRLEN];
186
extern
char
gIF_IPV6
[INET6_ADDRSTRLEN];
187
188
extern
char
gIF_IPV6_ULA_GUA
[INET6_ADDRSTRLEN];
189
190
extern
unsigned
gIF_INDEX
;
191
192
193
extern
unsigned
short
LOCAL_PORT_V4
;
194
extern
unsigned
short
LOCAL_PORT_V6
;
195
196
198
extern
Upnp_SID
gUpnpSdkNLSuuid
;
199
200
201
extern
TimerThread
gTimerThread
;
202
extern
ThreadPool
gRecvThreadPool
;
203
extern
ThreadPool
gSendThreadPool
;
204
extern
ThreadPool
gMiniServerThreadPool
;
205
206
207
typedef
enum
{
208
SUBSCRIBE,
209
UNSUBSCRIBE,
210
DK_NOTIFY,
211
QUERY,
212
ACTION,
213
STATUS,
214
DEVDESCRIPTION,
215
SERVDESCRIPTION,
216
MINI,
217
RENEW
218
} UpnpFunName;
219
220
221
struct
UpnpNonblockParam
222
{
223
UpnpFunName FunName;
224
int
Handle;
225
int
TimeOut;
226
char
VarName[NAME_SIZE];
227
char
NewVal[NAME_SIZE];
228
char
DevType[NAME_SIZE];
229
char
DevId[NAME_SIZE];
230
char
ServiceType[NAME_SIZE];
231
char
ServiceVer[NAME_SIZE];
232
UpnpString
*Url;
233
Upnp_SID
SubsId;
234
char
*Cookie;
235
Upnp_FunPtr
Fun;
236
IXML_Document
*Header;
237
IXML_Document
*Act;
238
struct
DevDesc *Devdesc;
239
};
240
241
242
extern
virtualDirList
*
pVirtualDirList
;
243
extern
struct
VirtualDirCallbacks
virtualDirCallback
;
244
245
246
typedef
enum
{
247
WEB_SERVER_DISABLED,
248
WEB_SERVER_ENABLED
249
} WebServerState;
250
251
252
#define E_HTTP_SYNTAX -6
253
254
274
int
UpnpGetIfInfo
(
276
const
char
*IfName);
277
278
279
void
UpnpThreadDistribution
(
struct
UpnpNonblockParam
* Param);
280
281
286
void
AutoAdvertise
(
288
void
*input);
289
290
299
int
getlocalhostname
(
301
char
*out,
303
size_t
out_len);
304
305
311
int
PrintHandleInfo
(
313
UpnpClient_Handle
Hnd);
314
315
316
extern
WebServerState
bWebServerState
;
317
318
319
#endif
/* UPNPAPI_H */
320
Generated on Fri Feb 1 2013 21:41:16 for libUPnP by
1.8.1.2