forked from vollero/openCAPWAP
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CWWTP.h
220 lines (181 loc) · 9.15 KB
/
CWWTP.h
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
/*******************************************************************************************
* 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 "WTPProtocol.h"
#include "WTPBinding.h"
/*______________________________________________________*/
/* *******************___DEFINE___******************* */
#define WTP_LOG_FILE_NAME "/var/log/wtp.log.txt"
/*_____________________________________________________*/
/* *******************___TYPES___******************* */
typedef struct {
char *address;
CWBool received;
int seqNum;
} CWACDescriptor;
/*_____________________________________________________________*/
/* *******************___WTP VARIABLES___******************* */
extern char *gInterfaceName;
extern char *gEthInterfaceName;
extern char *gRadioInterfaceName_0;
extern char *gBaseMACInterfaceName;
extern char gBoardReversionNo;
extern char **gCWACAddresses;
extern int gCWACCount;
extern int gHostapd_port;
extern char *gHostapd_unix_path;
extern unsigned char gRADIO_MAC[6];
extern pthread_mutex_t gRADIO_MAC_mutex;
extern char *gWTPLocation;
extern char *gWTPName;
extern unsigned 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 struct timeval gEchoLatency;
extern unsigned char gWTPMACMode;
extern unsigned char gWTPTunnelMode;
extern CWACDescriptor *gCWACList;
extern CWACInfoValues *gACInfoPtr;
extern int gEchoInterval;
extern int gCWMaxDiscoveryInterval;
extern int gWTPStatisticsTimer;
extern WTPRebootStatisticsInfo gWTPRebootStatistics;
extern CWWTPRadiosInfo gRadiosInfo;
extern CWSecurityContext gWTPSecurityContext;
extern CWSecuritySession gWTPSession;
extern CWPendingRequestMessage gPendingRequestMsgs[MAX_PENDING_REQUEST_MSGS];
extern CWSafeList gPacketReceiveList;
extern CWSafeList gFrameList;
extern CWThreadCondition gInterfaceWait;
extern CWThreadMutex gInterfaceMutex;
extern const char gWtpVersion[];
extern char *gWtpSerialNumber;
extern char *gWtpModelNumber;
extern char *gWtpHardwareVersion;
extern char *gWtpActiveSoftwareVersion;
extern char *gWtpBootVersion;
/*__________________________________________________________*/
/* *******************___PROTOTYPES___******************* */
/* in WTP.c */
CWBool CWWTPLoadConfiguration();
CWBool CWWTPInitConfiguration();
void CWWTPResetRadioStatistics(WTPRadioStatisticsInfo * radioStatistics);
CWBool CWReceiveMessage(CWProtocolMessage *pm);
CWBool CWWTPSendAcknowledgedPacket(int seqNum,
CWList msgElemlist,
CWBool(assembleFunc) (CWTransportMessage *, int, int, CWList),
CWBool(parseFunc) (CWProtocolMessage *, int, void *),
CWBool(saveFunc) (void *), void *valuesPtr);
void CWWTPDestroy();
/* in WTPRunState.c */
CWBool CWAssembleWTPDataTansferRequest(CWTransportMessage *tm, int PMTU, int seqNum, CWList msgElemList);
CWBool CWAssembleWTPEventRequest(CWTransportMessage *tm, int PMTU, int seqNum, CWList msgElemList);
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(unsigned 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, CWTransportMessage *tm);
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, CWTransportMessage *tm);
#ifdef SOFTMAC
//in WTPmacDriverInteraction.c
int set_wme_cwmin(int acclass, int value);
int set_wme_cwmax(int acclass, int value);
int set_wme_aifsn(int acclass, int value);
int set_txq(int code, int cwmin, int cwmax, int aifs, int burst_time);
#else
#ifndef BCM
//in WTPDriverInteraction.c
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);
#else
//in WTPBcmDriverInteraction.c
int set_wme_cwmin(int acclass, int value);
int set_wme_cwmax(int acclass, int value);
int set_wme_aifsn(int acclass, int value);
#endif
#endif
/* in WTPDiscoveryState.c */
CWStateTransition CWWTPEnterDiscovery();
void CWWTPPickACInterface();
CWBool CWWTPPickAC();
void CWResetDiscoveredACAddresses();
CWBool CWAddDiscoveredACAddress(unsigned char priority,
int family,
struct sockaddr *addr, socklen_t addrlen);
CWBool CWParseACAddressListWithPrio(CWProtocolMessage *pm, int len);
CWStateTransition CWWTPEnterSulking();
CWStateTransition CWWTPEnterJoin();
CWStateTransition CWWTPEnterConfigure();
CWStateTransition CWWTPEnterDataCheck();
CWStateTransition CWWTPEnterRun();
CWBool CWStartHeartbeatTimer();
CWBool CWStopHeartbeatTimer();
CWBool CWStartNeighborDeadTimer();
CWBool CWStopNeighborDeadTimer();
void CWWTPRetransmitTimerExpiredHandler(CWTimerArg arg);
extern CWBool WTPExitOnUpdateCommit;
#endif