3 * modules/plugin strtuctures declarations
10 #include "parser/msg_parser.h" /* for sip_msg */
12 typedef struct module_exports* (*module_register)();
13 typedef int (*cmd_function)(struct sip_msg*, char*, char*);
14 typedef int (*fixup_function)(void** param, int param_no);
15 typedef int (*response_function)(struct sip_msg*);
16 typedef void (*onbreak_function)(struct sip_msg*);
17 typedef void (*destroy_function)();
18 typedef int (*init_function)(void);
19 typedef int (*child_init_function)(int rank);
23 STR_PARAM, /* String parameter type */
24 INT_PARAM, /* Integer parameter type */
25 } modparam_t; /* Allowed types of parameters */
28 struct module_exports{
29 char* name; /* null terminated module name */
30 char** cmd_names; /* cmd names registered by this modules */
31 cmd_function* cmd_pointers; /* pointers to the corresponding functions */
32 int* param_no; /* number of parameters used by the function */
33 fixup_function* fixup_pointers; /* pointers to functions called to "fix"
34 * the params, e.g: precompile a re
36 int cmd_no; /* number of registered commands
37 * (size of cmd_{names,pointers}
40 char** param_names; /* parameter names registered by this modules */
41 modparam_t* param_types; /* Type of parameters */
42 void** param_pointers; /* Pointers to the corresponding memory locations */
43 int par_no; /* Number of registered parameters */
46 init_function init_f; /* Initilization function */
47 response_function response_f; /* function used for responses,
51 destroy_function destroy_f; /* function called when the module should
52 * be "destroyed", e.g: on ser exit;
55 onbreak_function onbreak_f;
56 child_init_function init_child_f; /* Function will be called by all
57 * processes after the fork
64 struct module_exports* exports;
65 struct sr_module* next;
68 struct sr_module* modules; /* global module list*/
70 int register_builtin_modules();
71 int register_module(struct module_exports*, char*, void*);
72 int load_module(char* path);
73 cmd_function find_export(char* name, int param_no);
74 struct sr_module* find_module(void *f, int* r);
75 void destroy_modules();
76 int init_child(int rank);
77 int init_modules(void);
80 * Find a parameter with given type and return it's
82 * If there is no such parameter, NULL is returned
84 void* find_param_export(char* mod, char* name, modparam_t type);
86 /* modules function prototypes:
87 * struct module_exports* mod_register(); (type module_register)
88 * int foo_cmd(struct sip_msg* msg, char* param);
89 * - returns >0 if ok , <0 on error, 0 to stop processing (==DROP)
90 * int response_f(struct sip_msg* msg)
91 * - returns >0 if ok, 0 to drop message