-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathCWWTP.h
More file actions
310 lines (259 loc) · 10.7 KB
/
CWWTP.h
File metadata and controls
310 lines (259 loc) · 10.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
/*******************************************************************************************
* Copyright (c) 2006-7 Laboratorio di Sistemi di Elaborazione e Bioingegneria Informatica *
* Universita' Campus BioMedico - Italy *
* *
* This program is free software; you can redistribute it and/or modify it under the terms *
* of the GNU General Public License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT ANY *
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
* PARTICULAR PURPOSE. See the GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License along with this *
* program; if not, write to the: *
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, *
* MA 02111-1307, USA. *
* *
* In addition, as a special exception, the copyright holders give permission to link the *
* code of portions of this program with the OpenSSL library under certain conditions as *
* described in each individual source file, and distribute linked combinations including *
* the two. You must obey the GNU General Public License in all respects for all of the *
* code used other than OpenSSL. If you modify file(s) with this exception, you may *
* extend this exception to your version of the file(s), but you are not obligated to do *
* so. If you do not wish to do so, delete this exception statement from your version. *
* If you delete this exception statement from all source files in the program, then also *
* delete it here. *
*
* --------------------------------------------------------------------------------------- *
* Project: Capwap *
* *
* Author : Ludovico Rossi (ludo@bluepixysw.com) *
* Del Moro Andrea (andrea_delmoro@libero.it) *
* Giovannini Federica (giovannini.federica@gmail.com) *
* Massimo Vellucci (m.vellucci@unicampus.it) *
* Mauro Bisson (mauro.bis@gmail.com) *
*******************************************************************************************/
#ifndef __CAPWAP_CWWTP_HEADER__
#define __CAPWAP_CWWTP_HEADER__
/*_______________________________________________________*/
/* *******************___INCLUDE___******************* */
#include "CWCommon.h"
#include "WTPBinding.h"
//Elena Agostini - 07/2014
//#include "NL80211.h"
/*______________________________________________________*/
/* *******************___DEFINE___******************* */
//extern char * WTP_LOG_FILE_NAME;
//Elena Agostini: now it is useless - TODO remove from WTP this const
#define WTP_LOG_FILE_NAME "/var/log/wtp.log.txt"
/*_____________________________________________________*/
/* *******************___TYPES___******************* */
typedef struct {
char *address;
CWBool received;
int seqNum;
} CWACDescriptor;
#include "WTPProtocol.h"
/*_____________________________________________________________*/
/* *******************___WTP VARIABLES___******************* */
extern char* gInterfaceName;
extern char* gEthInterfaceName;
extern char* gBridgeInterfaceName;
extern char* gRadioInterfaceName_0;
extern char* gBaseMACInterfaceName;
extern char gBoardReversionNo;
extern char **gCWACAddresses;
extern int gCWACCount;
//Elena Agostini - 07/2014: nl80211 support
extern int gPhyInterfaceCount;
extern char ** gPhyInterfaceName;
extern int * gPhyInterfaceIndex;
/*
* Elena Agostini - 02/2014
*
* QoS Static Values variables
*/
extern int qosStaticFreq;
extern int qosStaticBitRate;
extern int qosStaticFrag;
extern int qosStaticTxPower;
extern int qosStaticCwMin;
extern int qosStaticCwMax;
extern int qosStaticAifs;
extern int qosStaticWmeCwMin;
extern int qosStaticWmeCwMax;
extern int qosStaticWmeAifsn;
/*
* Elena Agostini - 02/2014
*
* ECN Support Msg Elem MUST be included in Join Request/Response Messages
*/
extern int gWTPECNSupport;
extern int gHostapd_port;
extern char* gHostapd_unix_path;
extern char gRADIO_MAC[6];
extern pthread_mutex_t gRADIO_MAC_mutex;
extern char *gWTPLocation;
extern char *gWTPName;
extern char gWTPSessionID[16];
extern int gIPv4StatusDuplicate;
extern int gIPv6StatusDuplicate;
extern char *gWTPForceACAddress;
extern CWAuthSecurity gWTPForceSecurity;
extern CWSocket gWTPSocket;
extern CWSocket gWTPDataSocket;
extern int gWTPPathMTU;
extern CWACDescriptor *gCWACList;
extern CWACInfoValues *gACInfoPtr;
extern int gEchoInterval;
extern int gWTPStatisticsTimer;
extern WTPRebootStatisticsInfo gWTPRebootStatistics;
extern CWWTPRadiosInfo gRadiosInfo;
extern CWSecurityContext gWTPSecurityContext;
extern CWSecuritySession gWTPSession;
/*
* Elena Agostini - 03/2014
*
* DTLS Data Session WTP
*/
extern CWSecurityContext gWTPSecurityContextData;
extern CWSecuritySession gWTPSessionData;
extern CWPendingRequestMessage gPendingRequestMsgs[MAX_PENDING_REQUEST_MSGS];
extern CWSafeList gPacketReceiveList;
extern CWSafeList gFrameList;
extern CWThreadCondition gInterfaceWait;
extern CWThreadMutex gInterfaceMutex;
//Elena Agostini: Mutex and Cond dedicated to Data Packet List
extern CWSafeList gPacketReceiveDataList;
extern CWThreadCondition gInterfaceWaitData;
extern CWThreadMutex gInterfaceMutexData;
/*
* Elena Agostini - 02/2014: OpenSSL params variables
*/
extern char *gWTPCertificate;
extern char *gWTPKeyfile;
extern char *gWTPPassword;
/*
* Elena Agostini - 02/2014
* Port number params config.wtp
*/
extern int WTP_PORT_CONTROL;
extern int WTP_PORT_DATA;
#define MAC_ADDR_LEN 6
extern int wtpInRunState;
/*__________________________________________________________*/
/* *******************___PROTOTYPES___******************* */
/* in WTP.c */
CWBool CWWTPLoadConfiguration();
CWBool CWWTPInitConfiguration();
void CWWTPResetRadioStatistics(WTPRadioStatisticsInfo *radioStatistics);
CWBool CWReceiveMessage(CWProtocolMessage *msgPtr);
/*
* Elena Agostini - 03/2014
* DTLS Data Session WTP
*/
CWBool CWReceiveDataMessage(CWProtocolMessage *msgPtr);
CWBool CWWTPSendAcknowledgedPacket(int seqNum,
CWList msgElemlist,
CWBool (assembleFunc)(CWProtocolMessage **, int *, int, int, CWList),
CWBool (parseFunc)(char*, int, int, void*),
CWBool (saveFunc)(void*),
void *valuesPtr);
void CWWTPDestroy();
/* in WTPRunState.c */
CWBool CWAssembleWTPDataTansferRequest(CWProtocolMessage **messagesPtr,
int *fragmentsNumPtr,
int PMTU,
int seqNum,
CWList msgElemList);
CWBool CWAssembleWTPEventRequest(CWProtocolMessage **messagesPtr,
int *fragmentsNumPtr,
int PMTU,
int seqNum,
CWList msgElemList,
CWMsgElemDataDeleteStation * infoDeleteStation);
CW_THREAD_RETURN_TYPE CWWTPReceiveDtlsPacket(void *arg);
CW_THREAD_RETURN_TYPE CWWTPReceiveDataPacket(void *arg);
CWBool CWWTPCheckForBindingFrame();
/* in WTPProtocol_User.c */
CWBool CWWTPGetACNameWithIndex (CWACNamesWithIndex *ACsInfo);
int getInterfaceMacAddr(char* interface, unsigned char* macAddr);
int initWTPSessionID(char * sessionID);
int CWWTPGetStatisticsTimer ();
void CWWTPGetIPv6Address(struct sockaddr_in6* myAddr);
CWBool CWGetWTPRadiosAdminState(CWRadiosAdminInfo *valPtr);
CWBool CWGetDecryptErrorReport(int radioID, CWDecryptErrorReportInfo *valPtr);
/* in WTPRetransmission.c */
int CWSendPendingRequestMessage(CWPendingRequestMessage *pendingRequestMsgs,
CWProtocolMessage *messages,
int fragmentsNum);
int CWFindPendingRequestMsgsBox(CWPendingRequestMessage *pendingRequestMsgs,
const int length,
const int msgType,
const int seqNum);
void CWResetPendingMsgBox(CWPendingRequestMessage *pendingRequestMsgs);
CWBool CWUpdatePendingMsgBox(CWPendingRequestMessage *pendingRequestMsgs,
unsigned char msgType,
int seqNum,
int timer_sec,
CWTimerArg timer_arg,
void (*timer_hdl)(CWTimerArg),
int retransmission,
CWProtocolMessage *msgElems,
int fragmentsNum);
//in WTPDriverInteraction.c
/*
* Elena Agostini - 02/2014
*
* No more ioctl() on wireless drivers.
* API coming soon..
*/
//#ifdef SOFTMAC
int set_wme_cwmin(int acclass,int value);
int set_wme_cwmax(int acclass,int value);
int set_wme_aifsn(int acclass,int value);
//#else
int set_cwmin(int sock, struct iwreq wrq, int acclass, int sta, int value);
int get_cwmin(int sock, struct iwreq* wrq, int acclass, int sta);
int set_cwmax(int sock, struct iwreq wrq, int acclass, int sta, int value);
int get_cwmax(int sock, struct iwreq* wrq, int acclass, int sta);
int set_aifs(int sock, struct iwreq wrq, int acclass, int sta, int value);
int get_aifs(int sock, struct iwreq* wrq, int acclass, int sta);
//#endif
/* in WTPDiscoveryState.c */
CWStateTransition CWWTPEnterDiscovery();
void CWWTPPickACInterface();
CWStateTransition CWWTPEnterSulking();
CWStateTransition CWWTPEnterJoin();
CWStateTransition CWWTPEnterConfigure();
CWStateTransition CWWTPEnterDataCheck();
CWStateTransition CWWTPEnterRun();
CWBool CWStartHeartbeatTimer();
CWBool CWStopHeartbeatTimer();
/*
* Elena Agostini - 03/2014
*
* DataChannel Dead Timer
*/
CWBool CWStartDataChannelDeadTimer();
CWBool CWStopDataChannelDeadTimer();
CWBool CWResetDataChannelDeadTimer();
CWBool CWStartKeepAliveTimer();
CWBool CWStopKeepAliveTimer();
/*
* Elena Agostini - 03/2014
*
* Echo Request Timer
*/
CWBool CWStartEchoRequestTimer();
CWBool CWStopEchoRequestsTimer();
CWBool CWResetEchoRequestRetransmit();
void CWWTPEchoRequestTimerExpiredHandler(void *arg);
CWBool CWStartNeighborDeadTimer();
CWBool CWStopNeighborDeadTimer();
void CWWTPNeighborDeadTimerExpired();
void CWWTPHeartBeatTimerExpiredHandler(void *arg);
void CWWTPRetransmitTimerExpiredHandler(CWTimerArg arg);
extern CWBool WTPExitOnUpdateCommit;
#endif