Separated cw_out_radio generic
There are now cw_write_radio_element.c and cw_out_radio_generic.c FossilOrigin-Name: b3f00eee8523c9adba6782e6ca63137be405c1d5164695ac614c31c2518f36bb
This commit is contained in:
parent
8d97c47fd7
commit
8cb55b6e7a
@ -4,8 +4,8 @@
|
||||
<Project Name="wtp" Path="wtp.project" Active="No"/>
|
||||
<Project Name="mod_cipwap" Path="mod_cipwap.project" Active="No"/>
|
||||
<Project Name="mod_capwap" Path="mod_capwap.project" Active="No"/>
|
||||
<Project Name="mod_cisco" Path="mod_cisco.project" Active="Yes"/>
|
||||
<Project Name="libcw" Path="libcw.project" Active="No"/>
|
||||
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
|
||||
<Project Name="libcw" Path="libcw.project" Active="Yes"/>
|
||||
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
|
||||
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
|
||||
<BuildMatrix>
|
||||
|
@ -267,6 +267,7 @@
|
||||
<File Name="src/cw/cw_out_radio_generic.c"/>
|
||||
<File Name="src/cw/cw_read_radio_generic.c"/>
|
||||
<File Name="src/cw/cw_read_from.c"/>
|
||||
<File Name="src/cw/cw_write_radio_element.c"/>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<Description/>
|
||||
|
@ -107,7 +107,8 @@ CWSRC=\
|
||||
cw_type_word.c\
|
||||
cw_util.c\
|
||||
cw_write_descriptor_subelem.c\
|
||||
cw_read_from.c
|
||||
cw_read_from.c \
|
||||
cw_write_radio_element.c\
|
||||
|
||||
|
||||
LWSRC=\
|
||||
|
@ -349,7 +349,9 @@ int cw_read_wtp_descriptor(mavl_t mbag, struct conn *conn,
|
||||
int cw_write_descriptor_subelem (uint8_t *dst, mavl_t ktvstore,
|
||||
int subelem_id, const char * parent_key);
|
||||
|
||||
|
||||
int cw_write_radio_element(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params, int idx,
|
||||
uint8_t * dst);
|
||||
|
||||
|
||||
extern int cw_read_wtp_descriptor_7(mavl_t mbag, struct conn *conn,
|
||||
struct cw_ElemHandler *eh, uint8_t * data, int len,
|
||||
|
@ -2,50 +2,9 @@
|
||||
#include "cw.h"
|
||||
#include "dbg.h"
|
||||
|
||||
|
||||
static int cw_put_radio_generic(struct cw_ElemHandler * handler, int idx, struct cw_ElemHandlerParams * params
|
||||
, uint8_t * dst)
|
||||
{
|
||||
char key[CW_KTV_MAX_KEY_LEN];
|
||||
cw_KTV_t *elem, search;
|
||||
int len;
|
||||
uint8_t * d;
|
||||
|
||||
len =0;
|
||||
|
||||
sprintf(key,"radio/%d/%s",idx,handler->key);
|
||||
|
||||
printf("Looking for key: %s\n",key);
|
||||
|
||||
search.key=key;
|
||||
elem = mavl_get(params->conn->local_cfg, &search);
|
||||
|
||||
if (elem==NULL){
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Size for msg elem header depends on
|
||||
vendor specific payload */
|
||||
d = handler->vendor ? dst+10 : dst+4;
|
||||
|
||||
/* put radio id */
|
||||
len += cw_put_byte(d+len,idx);
|
||||
|
||||
len += ((const cw_Type_t*)(handler->type))->put(elem,d+len);
|
||||
/* l = len + cw_put_elem_hdr(dst, handler->id, len);*/
|
||||
|
||||
/* if (handler->vendor)
|
||||
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
||||
*/
|
||||
return len + cw_put_elem_hdr(dst, handler->id, len);
|
||||
}
|
||||
|
||||
|
||||
int cw_out_radio_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params
|
||||
, uint8_t * dst)
|
||||
{
|
||||
/* char key[CW_KTV_MAX_KEY_LEN];*/
|
||||
/* cw_KTV_t *elem, search;*/
|
||||
int len,i,l;
|
||||
int radios;
|
||||
len =0;
|
||||
@ -53,10 +12,10 @@ int cw_out_radio_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerP
|
||||
radios = cw_ktv_get_byte(params->conn->local_cfg,"wtp-descriptor/max-radios",0);
|
||||
|
||||
for(i=1;i<radios+1;i++){
|
||||
l = cw_put_radio_generic(handler,i,params,dst+len);
|
||||
l = cw_write_radio_element(handler,params,i,dst+len);
|
||||
cw_dbg_elem(DBG_ELEM_OUT,params->conn,params->msgdata->type,handler,dst,l);
|
||||
len+=l;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
40
src/cw/cw_write_radio_element.c
Normal file
40
src/cw/cw_write_radio_element.c
Normal file
@ -0,0 +1,40 @@
|
||||
#include "cw.h"
|
||||
|
||||
|
||||
int cw_write_radio_element(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params, int idx
|
||||
, uint8_t * dst)
|
||||
{
|
||||
char key[CW_KTV_MAX_KEY_LEN];
|
||||
cw_KTV_t *elem, search;
|
||||
int len;
|
||||
uint8_t * d;
|
||||
|
||||
len =0;
|
||||
|
||||
sprintf(key,"radio/%d/%s",idx,handler->key);
|
||||
|
||||
/*printf("Looking for key: %s\n",key);*/
|
||||
|
||||
search.key=key;
|
||||
elem = mavl_get(params->conn->local_cfg, &search);
|
||||
|
||||
if (elem==NULL){
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Size for msg elem header depends on
|
||||
vendor specific payload */
|
||||
d = handler->vendor ? dst+10 : dst+4;
|
||||
|
||||
/* put radio id */
|
||||
len += cw_put_byte(d+len,idx);
|
||||
|
||||
len += ((const cw_Type_t*)(handler->type))->put(elem,d+len);
|
||||
/* l = len + cw_put_elem_hdr(dst, handler->id, len);*/
|
||||
|
||||
/* if (handler->vendor)
|
||||
return len + cw_put_elem_vendor_hdr(dst, handler->vendor, handler->id, len);
|
||||
*/
|
||||
return len + cw_put_elem_hdr(dst, handler->id, len);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ int capwap_in_capwap_control_ip_address(struct cw_ElemHandler *eh,
|
||||
sprintf(key,"%s/address",eh->key);
|
||||
idx = cw_ktv_idx_get(params->conn->remote_cfg,key,0,CW_TYPE_IPADDRESS);
|
||||
|
||||
printf("SKEY is %s , idx: %d\n",key,idx);
|
||||
/* printf("SKEY is %s , idx: %d\n",key,idx);*/
|
||||
|
||||
sprintf(key,"%s/address.%d",eh->key,idx+1);
|
||||
cw_ktv_add(params->conn->remote_cfg,key,CW_TYPE_IPADDRESS,data,len-2);
|
||||
|
@ -26,6 +26,7 @@ wtp-descriptor/bootloader/vendor:Dword:906090
|
||||
wtp-descriptor/bootloader/version:Bstr16:.x171312
|
||||
wtp-descriptor/max-radios:Byte:2
|
||||
|
||||
radio/1/wtp-radio-information:Dword:04
|
||||
radio/2/wtp-radio-information:Dword:03
|
||||
radio/1/wtp-radio-information:Dword:01
|
||||
radio/2/wtp-radio-information:Dword:02
|
||||
|
||||
wtp-name:Bstr16:WFAT01
|
||||
|
Loading…
Reference in New Issue
Block a user