- memory allocation checks removed
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file parser.h
|
||||
*
|
||||
* @brief Generic parser class used to parse IKEv2-Header and Payload
|
||||
* @brief Interface of parser_t.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -31,57 +31,55 @@
|
||||
typedef struct parser_t parser_t;
|
||||
|
||||
/**
|
||||
* @brief A parser_t object which parses payloads
|
||||
* A parser_t class to parse IKEv2 payloads.
|
||||
*
|
||||
* A parser is used for parsing one chunk of data. Multiple
|
||||
* payloads can be parsed out of the chunk using parse_payload.
|
||||
* The parser remains the state until destroyed.
|
||||
*
|
||||
* @ingroup encoding
|
||||
*/
|
||||
struct parser_t {
|
||||
|
||||
/**
|
||||
* @brief parses the next payload
|
||||
* @brief Parses the next payload.
|
||||
*
|
||||
* @warning caller is responsible for freeing allocated payload
|
||||
* @warning Caller is responsible for freeing allocated payload.
|
||||
*
|
||||
* Rules for parsing are described in the payload definition.
|
||||
*
|
||||
* @param this parser Object
|
||||
* @param this parser_t bject
|
||||
* @param payload_type payload type to parse
|
||||
* @param[out] payload pointer where parsed payload was allocated
|
||||
* @return
|
||||
* - SUCCESSFUL if succeeded,
|
||||
* - NOT_SUPPORTED if payload_type is not supported
|
||||
* - OUT_OF_RES if out of ressources
|
||||
* - PARSE_ERROR if corrupted/invalid data found
|
||||
*/
|
||||
status_t (*parse_payload) (parser_t *this, payload_type_t payload_type, payload_t **payload);
|
||||
|
||||
/**
|
||||
* @brief Resets the current parser context
|
||||
* @brief Resets the current parser context.
|
||||
*
|
||||
* @param parser parser object
|
||||
* @return
|
||||
* - SUCCESSFUL in any case
|
||||
* @param parser parser_t object
|
||||
*/
|
||||
status_t (*reset_context) (parser_t *this);
|
||||
void (*reset_context) (parser_t *this);
|
||||
|
||||
/**
|
||||
* @brief Destroys a parser object
|
||||
* @brief Destroys a parser_t object.
|
||||
*
|
||||
* @param parser parser object
|
||||
* @return
|
||||
* - SUCCESSFUL in any case
|
||||
* @param parser parser_t object
|
||||
*/
|
||||
status_t (*destroy) (parser_t *this);
|
||||
void (*destroy) (parser_t *this);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Constructor to create a parser
|
||||
* @brief Constructor to create a parser_t object.
|
||||
*
|
||||
* @param data chunk of data to parse with this parser object
|
||||
* @return the parser, or NULL if failed
|
||||
*
|
||||
* @param data chunk of data to parse with this parser_t object
|
||||
* @return the parser_t object
|
||||
*
|
||||
* @ingroup encoding
|
||||
*/
|
||||
parser_t *parser_create(chunk_t data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user