29 lines
583 B
C
29 lines
583 B
C
#if !defined(__HOOK_H__)
|
|
|
|
#define __HOOK_H__ 1
|
|
|
|
#include <stdarg.h>
|
|
#include <stddef.h>
|
|
|
|
#include "xlist.h"
|
|
|
|
#define HOOK_BEFORE_EVENT (0)
|
|
#define HOOK_AFTER_EVENT (1)
|
|
|
|
typedef int (*hook_fn_t)(int, int, int, void*, va_list);
|
|
typedef struct {
|
|
hook_fn_t fn;
|
|
void* data;
|
|
} hook_item_t;
|
|
|
|
typedef struct {
|
|
int maxtypes;
|
|
xlist_t* hooks;
|
|
} hooksys_t;
|
|
|
|
extern int xce_hook_init(hooksys_t*, int);
|
|
extern int xce_add_hook(hooksys_t*, int, hook_fn_t, void*);
|
|
extern int xce_run_hooks(hooksys_t*, int, int, int, ...);
|
|
extern void xce_hook_fini(hooksys_t*);
|
|
|
|
#endif
|