forked from vollero/openCAPWAP
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CWBinding.h
160 lines (132 loc) · 7.36 KB
/
CWBinding.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
/************************************************************************************************
* Copyright (c) 2006-2009 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 *
* *
* Authors : 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) *
* Daniele De Sanctis (danieledesanctis@gmail.com) *
* Antonio Davoli (antonio.davoli@gmail.com) *
************************************************************************************************/
#ifndef __CAPWAP_CWBinding_HEADER__
#define __CAPWAP_CWBinding_HEADER__
#define CW_BINDING_HLEN 4
#define CW_BINDING_WIRELESSID 1
#define CW_BINDING_DATALENGTH 4
#define NUM_QOS_PROFILES 4
#define UNUSED_QOS_VALUE 255
#define VOICE_QUEUE_INDEX 0
#define VIDEO_QUEUE_INDEX 1
#define BESTEFFORT_QUEUE_INDEX 2
#define BACKGROUND_QUEUE_INDEX 3
#define BINDING_MIN_ELEM_TYPE 1024
#define BINDING_MAX_ELEM_TYPE 2047
#define UNUSED_OFDM_VALUE 255
// Wireless ID viene preso dal campo WBID
//#define CW_TRANSPORT_HEADER_WIRELESS_ID_START 0
//#define CW_TRANSPORT_HEADER_WIRELESS_ID_LEN 8
//#define CW_TRANSPORT_HEADER_LENGTH_START 8
#define CW_TRANSPORT_HEADER_LENGTH_START 0
#define CW_TRANSPORT_HEADER_LENGTH_LEN 8
//#define CW_TRANSPORT_HEADER_RSSI_START 16
#define CW_TRANSPORT_HEADER_RSSI_START 8
#define CW_TRANSPORT_HEADER_RSSI_LEN 8
//#define CW_TRANSPORT_HEADER_SNR_START 24
#define CW_TRANSPORT_HEADER_SNR_START 16
#define CW_TRANSPORT_HEADER_SNR_LEN 8
// Poiche' nel draft 09 il campo del CAPWAP header Wireless Specific
// Information e' stato privato del sottocampo Wireless ID con il
// conseguente shift a sx di 8 bit dei sottocampi successivi il sottocampo
// datarate del binding si trova a cavallo tra 2 word da 4 byte quindi
// vanno specificati due offset.
//#define CW_TRANSPORT_HEADER_DATARATE_START 0
//#define CW_TRANSPORT_HEADER_DATARATE_LEN 16
#define CW_TRANSPORT_HEADER_DATARATE_1_START 24
#define CW_TRANSPORT_HEADER_DATARATE_1_LEN 8
#define CW_TRANSPORT_HEADER_DATARATE_2_START 0
#define CW_TRANSPORT_HEADER_DATARATE_2_LEN 8
//#define CW_TRANSPORT_HEADER_PADDING_START 16
//#define CW_TRANSPORT_HEADER_PADDING_LEN 16
#define CW_TRANSPORT_HEADER_PADDING_START 8
#define CW_TRANSPORT_HEADER_PADDING_LEN 24
#define BINDING_MSG_ELEMENT_TYPE_OFDM_CONTROL 1033
#define BINDING_MSG_ELEMENT_TYPE_WTP_QOS 1045
/****************************************************
* 2009 Update: *
* Lengths Messages Element Definition *
* Specified in the 802.11 binding *
****************************************************/
#define BINDING_MSG_ELEMENT_TYPE_OFDM_CONTROL_LENGTH 8
/****************************************************
* 2009 Update: *
* Define Structure for OFDM contol *
* Values Management *
****************************************************/
typedef struct {
int currentChan; /* 16 Bit Value */
unsigned char BandSupport;
unsigned int TIThreshold;
} OFDMControlValues;
typedef struct {
unsigned char queueDepth;
int cwMin;
int cwMax;
unsigned char AIFS;
unsigned char dot1PTag;
unsigned char DSCPTag;
} WTPQosValues;
typedef struct {
WTPQosValues *qosValues;
} bindingValues;
/*---------------------------*/
typedef struct __attribute__ ((packed)) {
uint8_t length;
union {
struct {
uint8_t RSSI;
uint8_t SNR;
uint16_t dataRate;
} ieee80211;
};
} CWBindingTransportHeaderValues;
typedef struct {
CWProtocolMessage frame;
CWBindingTransportHeaderValues *bindingValues;
} CWBindingDataListElement;
extern const int gMaxCAPWAPHeaderSizeBinding;
CWBool CWAssembleDataMessage(CWTransportMessage *tm, int PMTU,
unsigned int rid, CWBindingProtocol wbid,
CWBool keepAlive, CWBool isNative, CWMAC *radio_mac,
CWBindingTransportHeaderValues *binding,
CWProtocolMessage *msg);
CWBindingTransportHeaderValues *CWParseTransportHeaderBinding(CWProtocolMessage *pm);
CWBool CWParseTransportHeaderMACAddress(CWProtocolMessage *pm, unsigned char *mac_ptr);
#endif