2016-03-12 04:01:06 +01:00
|
|
|
#include "cw/log.h"
|
|
|
|
#include "cw/cw.h"
|
2018-03-15 20:07:17 +01:00
|
|
|
#include "cw/ktv.h"
|
|
|
|
#include "cw/keys.h"
|
|
|
|
#include "cw/dbg.h"
|
2016-03-12 04:01:06 +01:00
|
|
|
|
2018-03-17 12:32:40 +01:00
|
|
|
int cisco_out_wtp_descriptor(struct cw_ElemHandler * eh,
|
|
|
|
struct cw_ElemHandlerParams * params, uint8_t * dst)
|
2018-03-15 20:07:17 +01:00
|
|
|
{
|
2018-03-17 12:32:40 +01:00
|
|
|
char key[CW_KTV_MAX_KEY_LEN];
|
2018-03-15 20:07:17 +01:00
|
|
|
int len;
|
|
|
|
/* // XXX Dummy WTP Descriptor Header */
|
|
|
|
uint8_t *d;
|
|
|
|
cw_KTV_t * val;
|
|
|
|
|
|
|
|
d = dst+4;
|
2018-03-17 12:32:40 +01:00
|
|
|
|
2018-03-15 20:07:17 +01:00
|
|
|
sprintf(key,"%s/%s",eh->key,CW_SKEY_MAX_RADIOS);
|
|
|
|
val = cw_ktv_get(params->conn->local_cfg,key, CW_TYPE_BYTE);
|
|
|
|
if (val != NULL)
|
|
|
|
d+=val->type->put(val,d);
|
|
|
|
else{
|
|
|
|
cw_dbg(DBG_WARN,"Cannot get value for %s, setting to 0", CW_SKEY_MAX_RADIOS);
|
|
|
|
d+=cw_put_byte(d,0);
|
|
|
|
}
|
|
|
|
|
2018-03-17 12:32:40 +01:00
|
|
|
sprintf(key,"%s/%s",eh->key,CW_SKEY_RADIOS_IN_USE);
|
2018-03-15 20:07:17 +01:00
|
|
|
val = cw_ktv_get(params->conn->local_cfg,key, CW_TYPE_BYTE);
|
|
|
|
if (val != NULL){
|
|
|
|
d+=val->type->put(val,d);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
d+=cw_put_byte(d,0); /*radios in use*/
|
|
|
|
}
|
2016-03-12 04:01:06 +01:00
|
|
|
|
|
|
|
d+=cw_put_encryption_capabilities_7(d,1);
|
|
|
|
|
2018-03-15 20:07:17 +01:00
|
|
|
|
|
|
|
/* hardware version sub element */
|
|
|
|
sprintf(key,"%s/%s",eh->key,CW_SKEY_HARDWARE);
|
|
|
|
d+=cw_write_descriptor_subelem (d, params->conn->local_cfg,
|
|
|
|
CW_SUBELEM_WTP_HARDWARE_VERSION, key);
|
|
|
|
|
|
|
|
/* software version sub element */
|
|
|
|
sprintf(key,"%s/%s",eh->key,CW_SKEY_SOFTWARE);
|
|
|
|
d+=cw_write_descriptor_subelem (d, params->conn->local_cfg,
|
|
|
|
CW_SUBELEM_WTP_SOFTWARE_VERSION, key);
|
|
|
|
|
2018-03-17 12:32:40 +01:00
|
|
|
/* bootloader version sub element */
|
2018-03-15 20:07:17 +01:00
|
|
|
sprintf(key,"%s/%s",eh->key,CW_SKEY_BOOTLOADER);
|
|
|
|
d+=cw_write_descriptor_subelem (d, params->conn->local_cfg,
|
|
|
|
CW_SUBELEM_WTP_BOOTLOADER_VERSION, key);
|
|
|
|
|
|
|
|
len = d-dst-4;
|
|
|
|
return len + cw_put_elem_hdr(dst,eh->id,len);
|
2018-03-17 12:32:40 +01:00
|
|
|
}
|