Module: sip-router Branch: andrei/mod_f_params Commit: ca19a01ec657d1a431b1616a261a5a5f1d53a691 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ca19a01e...
Author: Andrei Pelinescu-Onciul andrei@iptel.org Committer: Andrei Pelinescu-Onciul andrei@iptel.org Date: Tue Nov 18 23:59:14 2008 +0100
mod if: more prototypes and defines
- prototypes for module (cmd_function) with 3, 4, 5, 6 and variable number of parameters added. The 3-6 versions just extend the old version with more char* parameters and are kamailio compatible. The variable number of parameters function is something new and experimental. It takes the sip_msg, the number of extra parameters and an array of action_u_t values (the internal routing engine parameters representation).
- added a magic value for the parameters numbers, to be used by variable parameter functions (VAR_PARAM_NO)
- moved/added the NO_SCRIPT macro (parameters number magic value for functions that should not be called from the script) from tm.
---
sr_module.h | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/sr_module.h b/sr_module.h index 1301138..f2aea0e 100644 --- a/sr_module.h +++ b/sr_module.h @@ -44,6 +44,8 @@ * 2008-11-17 sip-router version: includes some of the openser/kamailio * changes: f(void) instead of f(), free_fixup_function() * dual module interface support: ser & kamailio (andrei) + * 2008-11-18 prototypes for various fixed parameters numbers module + * functions (3, 4, 5 & 6) and variable parameters (andrei) */
/*! @@ -89,6 +91,15 @@
typedef struct module_exports* (*module_register)(void); typedef int (*cmd_function)(struct sip_msg*, char*, char*); +typedef int (*cmd_function3)(struct sip_msg*, char*, char*, char*); +typedef int (*cmd_function4)(struct sip_msg*, char*, char*, char*, char*); +typedef int (*cmd_function5)(struct sip_msg*, char*, char*, char*, + char*, char*); +typedef int (*cmd_function6)(struct sip_msg*, char*, char*, char*, + char*, char*, char*); +/* variable number of param module function, takes as param the sip_msg, + extra paremeters number and a pointer to an array of parameters */ +typedef int (*cmd_function_var)(struct sip_msg*, int no, action_u_t* vals ); typedef int (*fixup_function)(void** param, int param_no); typedef int (*free_fixup_function)(void** param, int param_no); typedef int (*response_function)(struct sip_msg*); @@ -114,6 +125,13 @@ typedef unsigned int modparam_t;
typedef int (*param_func_t)( modparam_t type, void* val);
+/* magic parameter number values */ + +#define NO_SCRIPT -1 /* export not usable from scripts */ +#define VAR_PARAM_NO -128 /* function has variable number of parameters + (see cmd_function_var for the prototype) */ + +/* functions flags */ #define REQUEST_ROUTE 1 /* Function can be used in request route blocks */ #define FAILURE_ROUTE 2 /* Function can be used in reply route blocks */ #define ONREPLY_ROUTE 4 /* Function can be used in on_reply */