ngfd-plugin
hook.h File Reference
#include <glib.h>

Go to the source code of this file.

Classes

struct  _NHook
 Internal hook structure. More...
 

Typedefs

typedef enum _NHookPriority NHookPriority
 Enum defining the order in which callbacks are executed.
 
typedef struct _NHook NHook
 Internal hook structure.
 
typedef void(* NHookCallback) (NHook *hook, void *data, void *userdata)
 Hook callback function.
 

Enumerations

enum  _NHookPriority {
  N_HOOK_PRIORITY_LAST = -100 , N_HOOK_PRIORITY_LOW = -10 , N_HOOK_PRIORITY_DEFAULT = 0 , N_HOOK_PRIORITY_HIGH = 10 ,
  N_HOOK_PRIORITY_FIRST = 100
}
 Enum defining the order in which callbacks are executed. More...
 

Functions

void n_hook_init (NHook *hook)
 Initializes hook structure.
 
int n_hook_connect (NHook *hook, int priority, NHookCallback callback, void *userdata)
 Connect callback function to hook.
 
void n_hook_disconnect (NHook *hook, NHookCallback callback, void *userdata)
 Disconnects callback function from hook.
 
int n_hook_fire (NHook *hook, void *data)
 Executes callback functions associated with hook.
 

Typedef Documentation

◆ NHook

typedef struct _NHook NHook

Internal hook structure.

◆ NHookCallback

typedef void(* NHookCallback) (NHook *hook, void *data, void *userdata)

Hook callback function.

◆ NHookPriority

Enum defining the order in which callbacks are executed.

Enumeration Type Documentation

◆ _NHookPriority

Enum defining the order in which callbacks are executed.

Enumerator
N_HOOK_PRIORITY_LAST 
N_HOOK_PRIORITY_LOW 
N_HOOK_PRIORITY_DEFAULT 
N_HOOK_PRIORITY_HIGH 
N_HOOK_PRIORITY_FIRST 

Function Documentation

◆ n_hook_connect()

int n_hook_connect ( NHook * hook,
int priority,
NHookCallback callback,
void * userdata )

Connect callback function to hook.

Parameters
hookHook.
priorityPriority of the callback function.
callbackCallback function.
userdataUserdata.
Returns
TRUE if success.
See also
NHookPriority
NHookCallback

◆ n_hook_disconnect()

void n_hook_disconnect ( NHook * hook,
NHookCallback callback,
void * userdata )

Disconnects callback function from hook.

Parameters
hookHook.
callbackCallback function.
userdataUserdata.

◆ n_hook_fire()

int n_hook_fire ( NHook * hook,
void * data )

Executes callback functions associated with hook.

Parameters
hookHook.
dataData to pass the callback functions as userdata.
Returns
TRUE if success.

◆ n_hook_init()

void n_hook_init ( NHook * hook)

Initializes hook structure.

Parameters
hookHook.