2015-04-11 19:02:21 +02:00
|
|
|
#include "log.h"
|
2018-03-03 17:42:28 +01:00
|
|
|
#include "capwap.h"
|
2015-04-11 19:02:21 +02:00
|
|
|
#include "conn.h"
|
2016-03-04 21:01:38 +01:00
|
|
|
#include "cw.h"
|
|
|
|
|
2018-03-17 17:29:09 +01:00
|
|
|
#define CW_MODE_CISCO 1
|
2016-03-04 21:01:38 +01:00
|
|
|
|
2015-04-26 15:48:40 +02:00
|
|
|
static int cw_put_encryption_subelems(uint8_t *dst,int capwap_mode)
|
2015-04-11 19:02:21 +02:00
|
|
|
{
|
2015-04-26 15:48:40 +02:00
|
|
|
if (capwap_mode==CW_MODE_CISCO){
|
|
|
|
cw_put_word(dst,0x01);
|
|
|
|
return 2;
|
|
|
|
}
|
2015-04-18 11:20:24 +02:00
|
|
|
|
2015-04-11 19:02:21 +02:00
|
|
|
int n=2;
|
|
|
|
|
|
|
|
dst+=cw_put_byte(dst,n);
|
|
|
|
|
|
|
|
int i;
|
|
|
|
for (i=0; i<n; i++){
|
|
|
|
dst+=cw_put_byte(dst,0);
|
|
|
|
dst+=cw_put_byte(dst,0);
|
|
|
|
dst+=cw_put_byte(dst,0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 3*n+1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-17 12:32:40 +01:00
|
|
|
/*
|
2015-04-11 19:02:21 +02:00
|
|
|
int cw_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a, uint8_t * dst)
|
|
|
|
{
|
2015-04-19 23:27:44 +02:00
|
|
|
|
|
|
|
mbag_t mbag = conn->config;
|
|
|
|
|
2015-04-11 19:02:21 +02:00
|
|
|
// XXX Dummy WTP Descriptor Header
|
|
|
|
uint8_t *d = dst+4;
|
|
|
|
|
2015-04-26 15:48:40 +02:00
|
|
|
d+=cw_put_byte(d,conn->radios->count); //max radios
|
2015-04-19 16:44:20 +02:00
|
|
|
d+=cw_put_byte(d,2); //radios in use
|
2015-04-26 15:48:40 +02:00
|
|
|
|
|
|
|
d+=cw_put_encryption_subelems(d,conn->capwap_mode);
|
2015-04-11 19:02:21 +02:00
|
|
|
|
2015-04-19 23:27:44 +02:00
|
|
|
mbag_item_t * i;
|
|
|
|
i = mbag_get(mbag,CW_ITEM_WTP_HARDWARE_VERSION);
|
2018-03-12 11:22:06 +01:00
|
|
|
/* if ( i ) {
|
2018-03-03 17:42:28 +01:00
|
|
|
d += cw_put_version(d,CW_SUBELEM_WTP_HARDWARE_VERSION,i->u2.data);
|
2015-04-11 19:02:21 +02:00
|
|
|
}
|
|
|
|
else {
|
2015-04-19 16:44:20 +02:00
|
|
|
cw_log(LOG_ERR, "Can't send Hardware Version in WTP Descriptor, not set.");
|
|
|
|
}
|
|
|
|
|
2015-04-19 23:27:44 +02:00
|
|
|
i = mbag_get(mbag,CW_ITEM_WTP_SOFTWARE_VERSION);
|
2015-04-19 16:44:20 +02:00
|
|
|
if ( i ) {
|
2018-03-03 17:42:28 +01:00
|
|
|
d += cw_put_version(d,CW_SUBELEM_WTP_SOFTWARE_VERSION,i->u2.data);
|
2015-04-19 16:44:20 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
cw_log(LOG_ERR, "Can't send Software Version in WTP descriptor, not set.");
|
2015-04-11 19:02:21 +02:00
|
|
|
}
|
|
|
|
|
2016-03-25 11:09:48 +01:00
|
|
|
i = mbag_get(mbag,CW_ITEM_WTP_BOOT_VERSION);
|
|
|
|
if ( i ) {
|
2018-03-03 17:42:28 +01:00
|
|
|
d += cw_put_version(d,CW_SUBELEM_WTP_BOOTLOADER_VERSION,i->u2.data);
|
2016-03-25 11:09:48 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
cw_log(LOG_INFO, "Can't send Boot Version in WTP descriptor, not set.");
|
|
|
|
}
|
|
|
|
|
|
|
|
i = mbag_get(mbag,CW_ITEM_WTP_OTHER_VERSION);
|
|
|
|
if ( i ) {
|
2018-03-03 17:42:28 +01:00
|
|
|
d += cw_put_version(d,CW_SUBELEM_WTP_OTHERSOFTWARE_VERSION,i->u2.data);
|
2016-03-25 11:09:48 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
cw_log(LOG_INFO, "Can't send Other Version in WTP descriptor, not set.");
|
|
|
|
}
|
2018-03-17 12:32:40 +01:00
|
|
|
*
|
|
|
|
// int len = d-dst-4;
|
|
|
|
// return len + cw_put_elem_hdr(dst,a->elem_id,len);
|
2015-04-11 19:02:21 +02:00
|
|
|
}
|
2018-03-17 12:32:40 +01:00
|
|
|
*/
|