Browse code

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.

Andrei Pelinescu-Onciul authored on 18/11/2008 22:59:14
Showing 1 changed files
... ...
@@ -44,6 +44,8 @@
44 44
  *  2008-11-17  sip-router version: includes some of the openser/kamailio
45 45
  *               changes: f(void) instead of f(), free_fixup_function()
46 46
  *              dual module interface support: ser & kamailio (andrei)
47
+ *  2008-11-18  prototypes for various fixed parameters numbers module
48
+ *               functions (3, 4, 5 & 6) and variable parameters (andrei)
47 49
  */
48 50
 
49 51
 /*!
... ...
@@ -89,6 +91,15 @@
89 89
 
90 90
 typedef  struct module_exports* (*module_register)(void);
91 91
 typedef  int (*cmd_function)(struct sip_msg*, char*, char*);
92
+typedef  int (*cmd_function3)(struct sip_msg*, char*, char*, char*);
93
+typedef  int (*cmd_function4)(struct sip_msg*, char*, char*, char*, char*);
94
+typedef  int (*cmd_function5)(struct sip_msg*,  char*, char*, char*,
95
+												char*, char*);
96
+typedef  int (*cmd_function6)(struct sip_msg*,  char*, char*, char*,
97
+												char*, char*, char*);
98
+/* variable number of param module function, takes as param the sip_msg,
99
+   extra paremeters number and a pointer to an array of parameters */
100
+typedef  int (*cmd_function_var)(struct sip_msg*, int no, action_u_t* vals );
92 101
 typedef  int (*fixup_function)(void** param, int param_no);
93 102
 typedef  int (*free_fixup_function)(void** param, int param_no);
94 103
 typedef  int (*response_function)(struct sip_msg*);
... ...
@@ -114,6 +125,13 @@ typedef unsigned int modparam_t;
114 114
 
115 115
 typedef int (*param_func_t)( modparam_t type, void* val);
116 116
 
117
+/* magic parameter number values */
118
+
119
+#define NO_SCRIPT     -1    /* export not usable from scripts */
120
+#define VAR_PARAM_NO  -128  /* function has variable number of parameters
121
+							   (see cmd_function_var for the prototype) */
122
+
123
+/* functions flags */
117 124
 #define REQUEST_ROUTE 1  /* Function can be used in request route blocks */
118 125
 #define FAILURE_ROUTE 2  /* Function can be used in reply route blocks */
119 126
 #define ONREPLY_ROUTE 4  /* Function can be used in on_reply */