hook.h File Reference

Go to the source code of this file.

Typedefs

typedef struct hook_s hook_t
typedef int(* hook_server_init_t )(void)
typedef int(* hook_server_term_t )(void)
typedef int(* hook_child_init_t )(void)
typedef int(* hook_child_term_t )(void)
typedef int(* hook_request_t )(request_t *, response_t *)

Functions

int hook_server_init (hook_server_init_t)
int hook_server_term (hook_server_term_t)
int hook_child_init (hook_child_init_t)
int hook_child_term (hook_child_term_t)
int hook_request (hook_request_t)
int hook_create (hook_t **phook)
int hook_free (hook_t *hook)

Typedef Documentation

typedef int(* hook_child_init_t)(void)

Definition at line 32 of file hook.h.

typedef int(* hook_child_term_t)(void)

Definition at line 33 of file hook.h.

typedef int(* hook_request_t)(request_t *, response_t *)

Definition at line 39 of file hook.h.

typedef int(* hook_server_init_t)(void)

Definition at line 25 of file hook.h.

typedef int(* hook_server_term_t)(void)

Definition at line 26 of file hook.h.

typedef struct hook_s hook_t

Definition at line 18 of file hook.h.


Function Documentation

int hook_child_init ( hook_child_init_t  func  ) 

Set a hook to be notified when new children get forked.

When the main server forks a child func will be called in the child context so it'll have the opportunity to initialize any one-per-process resources.

Note that a single child can (and probably will) handle more then one HTTP connection.

Pass a NULL pointer to disable a previously set hook.

Parameters:
func the function pointer
Returns:
0 on success, not zero on error

Definition at line 21 of file child_nfy.c.

int hook_child_term ( hook_child_term_t  func  ) 

Set a hook to be notified when a child is about to die.

This hook executes just before the child dies; you may use it to free resources allocated by the hook_child_init hook.

Pass a NULL pointer to disable a previously set hook.

Parameters:
func the function pointer
Returns:
0 on success, not zero on error

Definition at line 47 of file child_nfy.c.

int hook_create ( hook_t **  phook  ) 

Definition at line 6 of file hook.c.

int hook_free ( hook_t hook  ) 

Definition at line 22 of file hook.c.

int hook_request ( hook_request_t  func  ) 

Set a hook that executes on every HTTP request.

This hook will be executed on every HTTP request; for dynamic pages the hook will fire after the execution of the code of the dynamic page.

Pass a NULL pointer to disable a previously set hook.

Parameters:
func the function pointer
Returns:
0 on success, not zero on error

Definition at line 17 of file req.c.

int hook_server_init ( hook_server_init_t  func  ) 

Set a hook that executes when on server startup.

This hook will be executed just once on server startup.

Pass a NULL pointer to disable a previously set hook.

Parameters:
func the function pointer
Returns:
0 on success, not zero on error

Definition at line 16 of file server_nfy.c.

int hook_server_term ( hook_server_term_t  func  ) 

Set a hook that executes just before quitting the server.

This hook is called during the shutdown procedure of the Klone server.

Pass a NULL pointer to disable a previously set hook.

Parameters:
func the function pointer
Returns:
0 on success, not zero on error

Definition at line 41 of file server_nfy.c.