Moep Library  2.0-nc
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups
moep_frame_ops Struct Reference

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...
 

Detailed Description

frame header operations

The struct moep_frame_ops defines the operations needed to handle the frame headers for the protocol defined by a module.

Field Documentation

void*(* moep_frame_ops::create)(void)

create a header

The function create() should allocate a new header and initialize some default values.

Returns
This function should return the new header.
Return values
NULLon 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.

Parameters
rawa pointer to the buffer
maxlenthe available length in the buffer
Returns
This function should return the new header.
Return values
NULLon 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.

Parameters
hdrthe header
Returns
This function should return the length of the built header.
Return values
-1on 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.

Parameters
hdrthe header
rawthe buffer
maxlenthe available length in the buffer
Returns
This function should return the length of the built header.
Return values
-1on 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.

Parameters
hdrthe header

The documentation for this struct was generated from the following file: