2018-03-26 14:33:51 +02:00
|
|
|
|
|
|
|
#include "cw/capwap.h"
|
|
|
|
#include "cw/cw.h"
|
|
|
|
#include "cw/dbg.h"
|
2018-04-17 07:46:09 +02:00
|
|
|
#include "cw/dot11.h"
|
2018-03-26 14:33:51 +02:00
|
|
|
#include "cw/capwap80211.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "cw/msgset.h"
|
|
|
|
|
|
|
|
#include "mod_capwap80211.h"
|
|
|
|
|
2018-05-05 00:36:19 +02:00
|
|
|
/*static int capwap80211_in_crate_set(struct cw_ElemHandler *eh,
|
2018-04-17 07:46:09 +02:00
|
|
|
struct cw_ElemHandlerParams *params,
|
|
|
|
uint8_t * data, int len);
|
2018-05-05 00:36:19 +02:00
|
|
|
*/
|
2018-03-26 14:33:51 +02:00
|
|
|
|
|
|
|
static struct cw_ElemHandler handlers[] = {
|
2018-03-26 20:50:18 +02:00
|
|
|
{
|
2018-03-28 19:47:23 +02:00
|
|
|
"IEEE 802.11 WTP Radio Information", /* name */
|
2018-03-27 07:07:14 +02:00
|
|
|
CAPWAP80211_ELEM_WTP_RADIO_INFORMATION, /* Element ID */
|
|
|
|
0, 0, /* Vendor / Proto */
|
|
|
|
0, 0, /* min/max length */
|
2018-03-28 09:36:15 +02:00
|
|
|
CW_TYPE_DWORD, /* type */
|
2018-03-27 07:07:14 +02:00
|
|
|
"wtp-radio-information", /* Key */
|
2018-03-27 18:38:24 +02:00
|
|
|
cw_in_radio_generic, /* get */
|
2018-03-27 07:07:14 +02:00
|
|
|
cw_out_radio_generic /* put */
|
|
|
|
}
|
|
|
|
,
|
2018-04-17 07:46:09 +02:00
|
|
|
{
|
|
|
|
"IEEE 802.11 Rate Set", /* name */
|
|
|
|
CAPWAP80211_ELEM_RATE_SET, /* Element ID */
|
|
|
|
0, 0, /* Vendor / Proto */
|
|
|
|
3, 0, /* min/max length */
|
2018-04-18 09:40:37 +02:00
|
|
|
CW_TYPE_BSTR16, /* type */
|
2018-04-17 07:46:09 +02:00
|
|
|
"rate_set", /* Key */
|
2018-05-05 00:36:19 +02:00
|
|
|
cw_in_radio_generic, /* get */
|
|
|
|
cw_out_radio_generic /* put */
|
2018-04-17 07:46:09 +02:00
|
|
|
}
|
|
|
|
,
|
2018-03-26 20:50:18 +02:00
|
|
|
{NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL}
|
|
|
|
|
|
|
|
|
2018-03-26 14:33:51 +02:00
|
|
|
};
|
|
|
|
|
2018-05-05 00:36:19 +02:00
|
|
|
/*static int discovery_request_states[] = { CAPWAP_STATE_DISCOVERY, 0 };*/
|
2018-03-26 20:50:18 +02:00
|
|
|
static struct cw_ElemDef discovery_request_elements[] = {
|
|
|
|
{0, 0, CAPWAP80211_ELEM_WTP_RADIO_INFORMATION, 1, 0},
|
|
|
|
{0, 0, 0, 0, 0}
|
2018-03-26 14:33:51 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2018-04-07 19:28:22 +02:00
|
|
|
|
2018-05-05 00:36:19 +02:00
|
|
|
/*static int join_request_states[] = { CAPWAP_STATE_JOIN, 0 };*/
|
2018-04-07 19:28:22 +02:00
|
|
|
static struct cw_ElemDef join_request_elements[] = {
|
|
|
|
{0, 0, CAPWAP80211_ELEM_WTP_RADIO_INFORMATION, 1, 0},
|
|
|
|
{0, 0, 0, 0, 0}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2018-05-05 00:36:19 +02:00
|
|
|
/*static int join_response_states[] = { CAPWAP_STATE_JOIN, 0 };*/
|
2018-04-07 21:47:35 +02:00
|
|
|
static struct cw_ElemDef join_response_elements[] = {
|
2018-04-17 07:46:09 +02:00
|
|
|
{0, 0, CAPWAP80211_ELEM_WTP_RADIO_INFORMATION, 1, 0},
|
2018-04-07 21:47:35 +02:00
|
|
|
{0, 0, 0, 0, 0}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2018-05-05 00:36:19 +02:00
|
|
|
/*static int configuration_status_response_states[] = { CAPWAP_STATE_JOIN, 0 };*/
|
2018-04-17 07:46:09 +02:00
|
|
|
static struct cw_ElemDef configuration_status_response_elements[] = {
|
|
|
|
{0, 0, CAPWAP80211_ELEM_RATE_SET , 1, 0},
|
|
|
|
{0, 0, 0, 0, 0}
|
2018-04-07 19:28:22 +02:00
|
|
|
|
2018-04-17 07:46:09 +02:00
|
|
|
};
|
2018-03-26 14:33:51 +02:00
|
|
|
static struct cw_MsgDef messages[] = {
|
|
|
|
{
|
2018-04-17 07:46:09 +02:00
|
|
|
NULL,
|
|
|
|
CAPWAP_MSG_DISCOVERY_REQUEST,
|
|
|
|
CW_ROLE_AC,
|
2018-05-05 00:36:19 +02:00
|
|
|
NULL, /* states */
|
2018-04-17 07:46:09 +02:00
|
|
|
discovery_request_elements
|
2018-03-27 07:07:14 +02:00
|
|
|
}
|
|
|
|
,
|
2018-04-07 19:28:22 +02:00
|
|
|
{
|
2018-05-05 00:36:19 +02:00
|
|
|
NULL, /* name */
|
|
|
|
CAPWAP_MSG_JOIN_REQUEST, /* type */
|
|
|
|
CW_ROLE_AC, /* role */
|
|
|
|
NULL, /* states */
|
|
|
|
join_request_elements /* elements */
|
2018-04-07 19:28:22 +02:00
|
|
|
}
|
|
|
|
,
|
2018-04-07 21:47:35 +02:00
|
|
|
{
|
2018-04-17 07:46:09 +02:00
|
|
|
NULL,
|
|
|
|
CAPWAP_MSG_JOIN_RESPONSE,
|
|
|
|
CW_ROLE_AC,
|
2018-05-05 00:36:19 +02:00
|
|
|
NULL,
|
2018-04-17 07:46:09 +02:00
|
|
|
join_response_elements
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
NULL,
|
|
|
|
CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,
|
|
|
|
CW_ROLE_WTP,
|
2018-05-05 00:36:19 +02:00
|
|
|
NULL,
|
2018-04-17 07:46:09 +02:00
|
|
|
configuration_status_response_elements
|
2018-04-07 21:47:35 +02:00
|
|
|
}
|
|
|
|
,
|
2018-03-26 20:50:18 +02:00
|
|
|
{0, 0, 0, 0, 0}
|
2018-03-26 14:33:51 +02:00
|
|
|
};
|
|
|
|
|
2018-03-26 20:50:18 +02:00
|
|
|
struct cw_MsgSet *capwap80211_register_msgset(set, mode)
|
|
|
|
struct cw_MsgSet *set;
|
|
|
|
int mode;
|
2018-03-26 14:33:51 +02:00
|
|
|
{
|
|
|
|
if (mode != CW_MOD_MODE_BINDINGS)
|
|
|
|
return NULL;
|
2018-03-26 20:50:18 +02:00
|
|
|
|
|
|
|
cw_dbg(DBG_INFO, "CAPWAP80211: Register messages");
|
|
|
|
cw_msgset_add(set, messages, handlers);
|
|
|
|
cw_dbg(DBG_INFO, "CAPWAP0211: Done register messages");
|
|
|
|
|
2018-03-26 14:33:51 +02:00
|
|
|
return set;
|
|
|
|
}
|
2018-04-17 07:46:09 +02:00
|
|
|
|
|
|
|
|
2018-05-05 00:36:19 +02:00
|
|
|
/*
|
2018-04-17 07:46:09 +02:00
|
|
|
static int capwap80211_in_crate_set(struct cw_ElemHandler *eh,
|
|
|
|
struct cw_ElemHandlerParams *params,
|
|
|
|
uint8_t * data, int len)
|
|
|
|
{
|
2018-05-05 00:36:19 +02:00
|
|
|
int radio;
|
2018-04-17 07:46:09 +02:00
|
|
|
int i;
|
|
|
|
radio = cw_get_byte(data);
|
|
|
|
for (i=0; i<len-1; i++){
|
|
|
|
int rate = (data+1)[i];
|
2018-04-17 07:47:11 +02:00
|
|
|
sprintf(d,"%0.1f",dot11_rate2float(val & 0x7f));
|
2018-04-17 07:46:09 +02:00
|
|
|
}
|
2018-05-05 00:36:19 +02:00
|
|
|
|
2018-04-17 07:46:09 +02:00
|
|
|
|
|
|
|
}
|
2018-05-05 00:36:19 +02:00
|
|
|
*/
|