HTP  0.5
Functions
htp_hooks.c File Reference
#include "htp_config_auto.h"
#include "htp_private.h"

Functions

htp_hook_thtp_hook_copy (const htp_hook_t *hook)
 
htp_hook_thtp_hook_create (void)
 
void htp_hook_destroy (htp_hook_t *hook)
 
htp_status_t htp_hook_register (htp_hook_t **hook, const htp_callback_fn_t callback_fn)
 
htp_status_t htp_hook_run_all (htp_hook_t *hook, void *user_data)
 
htp_status_t htp_hook_run_one (htp_hook_t *hook, void *user_data)
 

Detailed Description

Author
Ivan Ristic ivanr.nosp@m.@web.nosp@m.kreat.nosp@m.or.c.nosp@m.om

Function Documentation

htp_hook_t* htp_hook_copy ( const htp_hook_t hook)

Creates a copy of the provided hook. The hook is allowed to be NULL, in which case this function simply returns a NULL.

Parameters
[in]hook
Returns
A copy of the hook, or NULL (if the provided hook was NULL or, if it wasn't, if there was a memory allocation problem while constructing a copy).
htp_hook_t* htp_hook_create ( void  )

Creates a new hook.

Returns
New htp_hook_t structure on success, NULL on failure.
void htp_hook_destroy ( htp_hook_t hook)

Destroys an existing hook. It is all right to send a NULL to this method because it will simply return straight away.

Parameters
[in]hook
htp_status_t htp_hook_register ( htp_hook_t **  hook,
const htp_callback_fn_t  callback_fn 
)

Registers a new callback with the hook.

Parameters
[in]hook
[in]callback_fn
Returns
HTP_OK on success, HTP_ERROR on memory allocation error.
htp_status_t htp_hook_run_all ( htp_hook_t hook,
void *  user_data 
)

Runs all the callbacks associated with a given hook. Only stops if one of the callbacks returns an error (HTP_ERROR) or stop (HTP_STOP).

Parameters
[in]hook
[in]user_data
Returns
HTP_OK if at least one hook ran successfully, HTP_STOP if there was no error but processing should stop, and HTP_ERROR or any other value less than zero on error.
htp_status_t htp_hook_run_one ( htp_hook_t hook,
void *  user_data 
)

Run callbacks one by one until one of them accepts to service the hook.

Parameters
[in]hook
[in]user_data
Returns
HTP_OK if a hook was found to process the callback, HTP_DECLINED if no hook could be found, HTP_STOP if a hook signalled the processing to stop, and HTP_ERROR or any other value less than zero on error.