More work on CAPWAP VM

FossilOrigin-Name: 9d9a86d2bafe31253a6f505e874f188792539485bb4462f4d778e6c53ac3000b
This commit is contained in:
7u83@mail.ru
2015-04-05 18:27:17 +00:00
parent ab8128a20f
commit 1158167262
33 changed files with 648 additions and 532 deletions

View File

@ -6,9 +6,9 @@
#include "capwap.h"
/*
int cw_put_subelem_version(uint8_t *dst,uint16_t subelem_id, uint32_t vendor_id,bstr16_t data)
{
printf("Vendor putter %d\n",vendor_id);
uint8_t *d=dst;
d += cw_put_dword(d,vendor_id);
@ -16,10 +16,10 @@ printf("Vendor putter %d\n",vendor_id);
d += cw_put_data(d,bstr16_data(data),bstr16_len(data));
return d-dst;
}
*/
int cw_out_ac_descriptor(struct conn *conn,uint32_t elem_id,uint8_t *dst,struct cw_item * item)
int cw_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,uint8_t *dst)
{
uint8_t *d = dst+4;
@ -31,18 +31,14 @@ int cw_out_ac_descriptor(struct conn *conn,uint32_t elem_id,uint8_t *dst,struct
return 0;
}
struct cw_ac_status *s = (struct cw_ac_status*)(i->data);
d += cw_put_dword (d, (s->stations << 16) | (s->limit) );
d += cw_put_dword (d, (s->active_wtps <<16) | (s->max_wtps) );
d += cw_put_dword (d, (s->security<<24) | (s->rmac_field<<16) | (s->dtls_policy));
d+=cw_put_ac_status(d ,(struct cw_ac_status*)(i->data));
i = cw_itemstore_get(conn->local,CW_ITEM_AC_HARDWARE_VERSION);
if ( i ) {
d += cw_put_subelem_version(d,CW_SUBELEM_AC_HARDWARE_VERSION,*((uint32_t*)(i->data)),i->data+4);
d += cw_put_version(d,CW_SUBELEM_AC_HARDWARE_VERSION,*((uint32_t*)(i->data)),i->data+4);
}
else {
cw_dbg(DBG_ELEM_ERR, "Can't send hard version in AC descriptor, not set.");
@ -52,7 +48,7 @@ int cw_out_ac_descriptor(struct conn *conn,uint32_t elem_id,uint8_t *dst,struct
i = cw_itemstore_get(conn->local,CW_ITEM_AC_SOFTWARE_VERSION);
if ( i ) {
d += cw_put_subelem_version(d,CW_SUBELEM_AC_SOFTWARE_VERSION,*((uint32_t*)(i->data)),i->data+4);
d += cw_put_version(d,CW_SUBELEM_AC_SOFTWARE_VERSION,*((uint32_t*)(i->data)),i->data+4);
}
else {
cw_dbg(DBG_ELEM_ERR, "Can't send software version in AC descriptor, not set.");
@ -60,7 +56,7 @@ int cw_out_ac_descriptor(struct conn *conn,uint32_t elem_id,uint8_t *dst,struct
int len = d-dst-4;
return len + cw_put_elem_hdr(dst,CW_ELEM_AC_DESCRIPTOR,len);
return len + cw_put_elem_hdr(dst,a->elem_id,len);
}