2015-03-23 22:31:59 +01:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "lwapp.h"
|
2018-04-07 19:28:00 +02:00
|
|
|
/*#include "lwapp_cisco.h"*/
|
2018-03-17 17:29:09 +01:00
|
|
|
|
2016-03-04 21:01:38 +01:00
|
|
|
#include "lw.h"
|
2016-03-28 10:47:20 +02:00
|
|
|
#include "vendors.h"
|
2015-03-23 22:31:59 +01:00
|
|
|
|
|
|
|
|
2018-04-07 19:28:00 +02:00
|
|
|
/*
|
2015-03-23 22:31:59 +01:00
|
|
|
int lw_addelem(uint8_t*dst, uint8_t type, uint8_t *msgelem, uint16_t len)
|
|
|
|
{
|
|
|
|
*dst = type;
|
|
|
|
*((uint16_t*)(dst+1)) = htons(len);
|
|
|
|
memcpy(dst,msgelem,len);
|
|
|
|
return len+3;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int lw_addelem_vendor_specific(uint8_t *dst,uint32_t vendor_id,uint16_t elem_id, uint8_t *value, int len)
|
|
|
|
{
|
2018-03-25 10:07:39 +02:00
|
|
|
int l ;
|
2018-03-25 10:35:53 +02:00
|
|
|
lw_set_dword(dst+3,vendor_id);
|
|
|
|
lw_set_word(dst+7,elem_id);
|
2015-03-23 22:31:59 +01:00
|
|
|
memcpy(dst+9,value,len);
|
2018-03-25 10:07:39 +02:00
|
|
|
l= len+9;
|
2015-03-23 22:31:59 +01:00
|
|
|
*dst=LW_ELEM_VENDOR_SPECIFIC;
|
2018-03-25 10:35:53 +02:00
|
|
|
lw_set_word(dst+1,l);
|
2015-03-23 22:31:59 +01:00
|
|
|
return l;
|
|
|
|
}
|
2018-04-07 19:28:00 +02:00
|
|
|
*/
|
|
|
|
|
2015-03-23 22:31:59 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add the vendor specific elem Cisco Padding
|
|
|
|
* @param dst destination
|
|
|
|
*/
|
2018-04-07 19:28:00 +02:00
|
|
|
|
|
|
|
/*
|
2015-03-23 22:31:59 +01:00
|
|
|
int lw_addelem_cisco_padding(uint8_t *dst, int len)
|
|
|
|
{
|
2018-03-25 10:35:53 +02:00
|
|
|
lw_set_dword(dst+3,LW_VENDOR_ID_CISCO);
|
|
|
|
lw_set_word(dst+7,LW_CISCO_PATH_MTU);
|
|
|
|
lw_set_word(dst+9,len);
|
2015-03-23 22:31:59 +01:00
|
|
|
memset(dst+11,0,len);
|
|
|
|
return lw_put_elem_hdr(dst,LW_ELEM_VENDOR_SPECIFIC,11+len);
|
|
|
|
}
|
2018-04-07 19:28:00 +02:00
|
|
|
*/
|
2015-03-23 22:31:59 +01:00
|
|
|
|
2015-03-24 20:14:26 +01:00
|
|
|
/*
|
2015-03-23 22:31:59 +01:00
|
|
|
int lw_put_cisco_path_mtu(uint8_t *dst, uint16_t max, uint16_t padding)
|
|
|
|
{
|
|
|
|
lw_put_dword(dst,LW_VENDOR_CISCO);
|
|
|
|
lw_put_word(dst+4,LW_ELEM_CISCO_PATH_MTU);
|
|
|
|
lw_put_word(dst+6,max);
|
|
|
|
lw_put_word(dst+8,padding+4);
|
|
|
|
memset(dst+10,0,padding);
|
|
|
|
return padding+10;
|
|
|
|
}
|
2015-03-24 20:14:26 +01:00
|
|
|
*/
|
2015-03-23 22:31:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
int lw_addelem_cisco_path_mtu(uint8_t *dst,uint16_t max, uint16_t padding)
|
|
|
|
{
|
|
|
|
lw_put_cisco_path_mtu(dst+3,max,padding);
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|