2018-03-17 17:29:09 +01:00
|
|
|
|
2016-03-05 10:11:39 +01:00
|
|
|
#include "cw/log.h"
|
2018-03-25 08:34:32 +02:00
|
|
|
#include "cw/dbg.h"
|
2016-03-05 10:11:39 +01:00
|
|
|
#include "cw/conn.h"
|
2015-04-05 02:10:37 +02:00
|
|
|
|
2018-03-17 17:29:09 +01:00
|
|
|
|
|
|
|
|
2016-03-05 10:11:39 +01:00
|
|
|
#include "cw/capwap.h"
|
|
|
|
#include "cw/cw.h"
|
2022-07-31 17:15:32 +02:00
|
|
|
#include "cw/val.h"
|
2018-03-17 12:32:40 +01:00
|
|
|
#include "cw/keys.h"
|
2016-03-04 21:01:38 +01:00
|
|
|
|
|
|
|
|
2015-04-05 02:10:37 +02:00
|
|
|
|
2018-03-17 12:32:40 +01:00
|
|
|
static int put_ac_status(mavl_t global, mavl_t local, uint8_t *dst, const char * parent_key){
|
2015-04-05 02:10:37 +02:00
|
|
|
|
2022-08-13 09:47:12 +02:00
|
|
|
stop();
|
|
|
|
|
2018-03-17 12:32:40 +01:00
|
|
|
uint8_t *d = dst;
|
|
|
|
|
2022-08-14 12:26:34 +02:00
|
|
|
char key[CW_CFG_MAX_KEY_LEN];
|
2015-04-05 02:10:37 +02:00
|
|
|
|
|
|
|
|
2018-03-20 07:09:09 +01:00
|
|
|
d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/stations",0));
|
|
|
|
d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/station-limit",0));
|
|
|
|
d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/active-wtps",0));
|
|
|
|
d += cw_put_word(d,cw_ktv_get_word(global,"ac-descriptor/max-wtps",0));
|
2018-04-02 01:39:08 +02:00
|
|
|
|
|
|
|
d += cw_put_byte(d,cw_ktv_get_byte(global,"ac-descriptor/security",0));
|
|
|
|
/*
|
2018-03-17 12:32:40 +01:00
|
|
|
security = 0;
|
|
|
|
if (cw_ktv_get(local,"dtls-cert-file",CW_TYPE_BSTR16))
|
|
|
|
security |= CAPWAP_FLAG_AC_SECURITY_X;
|
|
|
|
|
|
|
|
if (cw_ktv_get(local,"dtls-psk",CW_TYPE_BSTR16))
|
|
|
|
security |= CAPWAP_FLAG_AC_SECURITY_S;
|
2015-04-05 02:10:37 +02:00
|
|
|
|
2018-03-17 12:32:40 +01:00
|
|
|
if (security == 0){
|
2018-03-20 07:09:09 +01:00
|
|
|
cw_log(LOG_WARNING,"No AC security selected");
|
2015-04-05 02:10:37 +02:00
|
|
|
}
|
2018-03-17 12:32:40 +01:00
|
|
|
d += cw_put_byte(dst,security);
|
2018-04-02 01:39:08 +02:00
|
|
|
*/
|
2018-03-17 12:32:40 +01:00
|
|
|
sprintf(key,"%s/%s",parent_key,CW_SKEY_RMAC_FIELD);
|
|
|
|
d += cw_put_byte(d,cw_ktv_get_byte(local,key,0));
|
2015-04-05 02:10:37 +02:00
|
|
|
|
2018-03-17 12:32:40 +01:00
|
|
|
d += cw_put_byte(d,0);
|
2015-04-05 02:10:37 +02:00
|
|
|
|
2018-03-17 12:32:40 +01:00
|
|
|
|
|
|
|
sprintf(key,"%s/%s",parent_key,CW_SKEY_DTLS_POLICY);
|
|
|
|
d += cw_put_byte(d,cw_ktv_get_byte(local,key,0));
|
|
|
|
|
|
|
|
return d - dst;
|
2015-04-05 02:10:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-17 12:32:40 +01:00
|
|
|
int capwap_out_ac_descriptor(struct cw_ElemHandler * eh,
|
|
|
|
struct cw_ElemHandlerParams * params, uint8_t * dst)
|
|
|
|
{
|
2022-08-14 12:26:34 +02:00
|
|
|
stop();
|
|
|
|
/* int len,l;
|
2018-03-17 12:32:40 +01:00
|
|
|
uint8_t *d = dst+4;
|
2022-08-14 12:26:34 +02:00
|
|
|
char key[CW_CFG_MAX_KEY_LEN];
|
2018-03-17 12:32:40 +01:00
|
|
|
|
2022-08-13 09:47:12 +02:00
|
|
|
d+=put_ac_status(params->cfg,
|
2022-08-14 12:26:34 +02:00
|
|
|
params->global_cfg,
|
2018-03-17 12:32:40 +01:00
|
|
|
d, eh->key);
|
2015-04-05 02:10:37 +02:00
|
|
|
|
2018-03-17 12:32:40 +01:00
|
|
|
sprintf(key,"%s/%s",eh->key,CW_SKEY_HARDWARE);
|
2022-08-13 09:47:12 +02:00
|
|
|
d+=cw_write_descriptor_subelem (d, params->cfg,
|
2018-03-25 08:34:32 +02:00
|
|
|
CAPWAP_SUBELEM_AC_HARDWARE_VERSION, key);
|
2018-03-17 12:32:40 +01:00
|
|
|
|
|
|
|
sprintf(key,"%s/%s",eh->key,CW_SKEY_SOFTWARE);
|
2022-08-13 09:47:12 +02:00
|
|
|
d+=cw_write_descriptor_subelem (d, params->cfg,
|
2018-03-25 08:34:32 +02:00
|
|
|
CAPWAP_SUBELEM_AC_SOFTWARE_VERSION, key);
|
2018-03-17 12:32:40 +01:00
|
|
|
|
|
|
|
len = d-dst-4;
|
|
|
|
|
2018-03-25 08:34:32 +02:00
|
|
|
l = len + cw_put_elem_hdr(dst,eh->id,len);
|
2022-07-28 01:36:16 +02:00
|
|
|
cw_dbg_elem(DBG_ELEM_OUT,NULL,params->msgdata->type,eh,dst,l);
|
2018-03-25 08:34:32 +02:00
|
|
|
return l;
|
2022-08-14 12:26:34 +02:00
|
|
|
*/
|
|
|
|
return 0;
|
2018-03-17 12:32:40 +01:00
|
|
|
}
|