forked from vollero/openCAPWAP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCWWTP.h
More file actions
208 lines (171 loc) · 7.85 KB
/
CWWTP.h
File metadata and controls
208 lines (171 loc) · 7.85 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
/*******************************************************************************************
* 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. *
* *
* --------------------------------------------------------------------------------------- *
* 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 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;
extern CWPendingRequestMessage gPendingRequestMsgs[MAX_PENDING_REQUEST_MSGS];
extern CWSafeList gPacketReceiveList;
extern CWSafeList gFrameList;
extern CWThreadCondition gInterfaceWait;
extern CWThreadMutex gInterfaceMutex;
/*__________________________________________________________*/
/* *******************___PROTOTYPES___******************* */
/* in WTP.c */
CWBool CWWTPLoadConfiguration();
CWBool CWWTPInitConfiguration();
void CWWTPResetRadioStatistics(WTPRadioStatisticsInfo *radioStatistics);
CWBool CWReceiveMessage(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);
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);
#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);
#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();
CWStateTransition CWWTPEnterSulking();
CWStateTransition CWWTPEnterJoin();
CWStateTransition CWWTPEnterConfigure();
CWStateTransition CWWTPEnterDataCheck();
CWStateTransition CWWTPEnterRun();
CWBool CWStartHeartbeatTimer();
CWBool CWStopHeartbeatTimer();
CWBool CWStartNeighborDeadTimer();
CWBool CWStopNeighborDeadTimer();
CWBool CWResetTimers();
void CWWTPHeartBeatTimerExpiredHandler(void *arg);
void CWWTPRetransmitTimerExpiredHandler(CWTimerArg arg);
extern CWBool WTPExitOnUpdateCommit;
#endif