handlers for header_len and write_headr in conn

FossilOrigin-Name: 672de93a2c0d038b6d8c9104a8e0b4fdacbe7f181485ee2f185cb81626876391
This commit is contained in:
7u83@mail.ru
2018-04-09 07:27:38 +00:00
parent ad07cbcf1c
commit 7bedc7659b
19 changed files with 167 additions and 64 deletions

View File

@ -27,6 +27,21 @@
#include "conn.h"
#include "capwap.h"
#include "cw.h"
static int write_header(struct cw_ElemHandler * handler, uint8_t * dst, int 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);
}
static int header_len(struct cw_ElemHandler * handler)
{
return handler->vendor ? 10 : 4;
}
/**
* Basic initialization of a conn object
@ -48,7 +63,8 @@ void conn_init(struct conn * conn)
conn->process_packet=conn_process_packet;
conn->process_message=process_message;
conn->write_header = write_header;
conn->header_len = header_len;
}