Moep Library
2.0-nc
|
frame header operations More...
#include <module.h>
Data Fields | |
void *(* | create )(void) |
create a header More... | |
void *(* | parse )(u8 **raw, size_t *maxlen) |
parse a header More... | |
int(* | build_len )(void *hdr) |
length of the built header More... | |
int(* | build )(void *hdr, u8 *raw, size_t maxlen) |
build a header More... | |
void(* | destroy )(void *hdr) |
destroy a header More... | |
frame header operations
The struct moep_frame_ops defines the operations needed to handle the frame headers for the protocol defined by a module.
void*(* moep_frame_ops::create)(void) |
create a header
The function create() should allocate a new header and initialize some default values.
NULL | on error, errno should be set appropriately. |
void*(* moep_frame_ops::parse)(u8 **raw, size_t *maxlen) |
parse a header
The function parse() should parse the buffer raw and create a new header with the parsed data. The pointer raw should afterwards point behind the parsed data and maxlen should be decremented by the length of the parsed data.
raw | a pointer to the buffer |
maxlen | the available length in the buffer |
NULL | on error, errno should be set appropriately. |
int(* moep_frame_ops::build_len)(void *hdr) |
length of the built header
The function build_len() should compute the size the header will need to be built.
hdr | the header |
-1 | on error, errno should be set appropriately. |
int(* moep_frame_ops::build)(void *hdr, u8 *raw, size_t maxlen) |
build a header
The function build() should build the header into the buffer raw.
hdr | the header |
raw | the buffer |
maxlen | the available length in the buffer |
-1 | on error, errno should be set appropriately. |
void(* moep_frame_ops::destroy)(void *hdr) |
destroy a header
The function destroy() should destroy the header and release all associated ressources.
hdr | the header |