actube/src/mod/cisco/cisco_out_lw_path_mtu.c

35 lines
767 B
C

#include "cw/lw.h"
#include "cw/cw.h"
#include "cw/dbg.h"
#include "cw/cfg.h"
#include "capwap_cisco.h"
#include "mod_cisco.h"
int cisco_out_lw_path_mtu(struct cw_ElemHandler * eh,
struct cw_ElemHandlerParams * params, uint8_t * dst)
{
char key[CW_CFG_MAX_KEY_LEN];
int len,max;
sprintf(key,"%s/%s",eh->key,"len");
len = cw_cfg_get_word(params->cfg,key,0);
if (len == 0)
return 0;
sprintf(key,"%s/%s",eh->key,"max");
max = cw_cfg_get_word(params->cfg,key,0);
lw_set_word(dst+16,max);
lw_set_word(dst+16+2,len);
memset(dst+16+4,0,len-4);
/* put the lwap elem header */
lw_set_dword(dst + 10, eh->vendor);
lw_set_word(dst + 14, eh->id);
return len + 6 + cw_put_elem_vendor_hdr(dst, eh->vendor, CISCO_ELEM_SPAM_VENDOR_SPECIFIC, len+6);
}