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

@ -9,27 +9,50 @@ int cw_put_item(uint8_t *dst,struct cw_item*item)
{
switch (item->type){
case CW_ITEMTYPE_STR:
printf("Outing str %s\n",item->data);
return cw_put_data(dst,item->data,strlen( (char*)item->data));
case CW_ITEMTYPE_BYTE:
return cw_put_byte(dst,item->byte);
case CW_ITEMTYPE_WORD:
return cw_put_word(dst,item->word);
case CW_ITEMTYPE_DWORD:
return cw_put_word(dst,item->dword);
return cw_put_dword(dst,item->dword);
}
return 0;
}
int cw_out_generic(struct conn *conn,uint32_t elem_id,uint8_t *dst,struct cw_item * item)
int cw_out_generic(struct conn *conn,struct cw_action_out *a,uint8_t *dst) // ,struct cw_item * item)
{
/* Get the item to put */
struct cw_item *item=NULL;
if (a->get){
item = a->get (conn,a);
}
printf("Out generic item %p\n",item);
/* Size for msg elem header depends on
vendor specific payload */
int start = a->vendor_id ? 10:4;
int len;
if ( !item )
len=0;
else
len = cw_put_item(dst+4,item);
return len + cw_put_elem_hdr(dst,elem_id,len);
else{
printf("Putting it\n");
printf("To put: %d %s\n",len,item->data);
len = cw_put_item(dst+start,item);
printf("Putted: %d %s\n",len,item->data);
}
if (a->vendor_id)
return len + cw_put_elem_vendor_hdr(dst,a->vendor_id,a->elem_id,len);
return len + cw_put_elem_hdr(dst,a->elem_id,len);
}