3bf76e49 |
/* $Id$
*
* modules/plugin strtuctures declarations
*
*/
#ifndef sr_module
#include "msg_parser.h" /* for sip_msg */
|
404073d3 |
typedef struct module_exports* (*module_register)();
|
34fd2612 |
typedef int (*cmd_function)(struct sip_msg*, char*, char*);
typedef int (*fixup_function)(void** param, int param_no);
|
3bf76e49 |
typedef int (*response_function)(struct sip_msg*);
|
4bd1673d |
typedef void (*onbreak_function)(struct sip_msg*);
|
bf08223a |
typedef void (*destroy_function)();
|
3bf76e49 |
struct module_exports{
char* name; /* null terminated module name */
|
34fd2612 |
char** cmd_names; /* cmd names registered by this modules */
cmd_function* cmd_pointers; /* pointers to the corresponding functions */
int* param_no; /* number of parameters used by the function */
fixup_function* fixup_pointers; /* pointers to functions called to "fix"
the params, e.g: precompile a re */
|
3bf76e49 |
int cmd_no; /* number of registered commands
(size of cmd_{names,pointers}*/
response_function response_f; /* function used for responses,
|
bf08223a |
returns yes or no;
can be null */
destroy_function destroy_f; /*function called when the module should
be "destroyed", e.g: on ser exit;
can be null */
|
4bd1673d |
onbreak_function onbreak_f;
|
3bf76e49 |
};
struct sr_module{
char* path;
void* handle;
struct module_exports* exports;
struct sr_module* next;
};
|
031e278e |
struct sr_module* modules; /* global module list*/
|
3bf76e49 |
|
404073d3 |
int init_builtin_modules();
int register_module(module_register, char*, void*);
|
3bf76e49 |
int load_module(char* path);
|
34fd2612 |
cmd_function find_export(char* name, int param_no);
struct sr_module* find_module(void *f, int* r);
|
bf08223a |
void destroy_modules();
|
34fd2612 |
|
3bf76e49 |
/* modules function prototypes:
|
404073d3 |
* struct module_exports* mod_register(); (type module_register)
|
3bf76e49 |
* int foo_cmd(struct sip_msg* msg, char* param);
* - returns >0 if ok , <0 on error, 0 to stop processing (==DROP)
* int response_f(struct sip_msg* msg)
* - returns >0 if ok, 0 to drop message
*/
#endif
|