Module: sip-router
Branch: andrei/mod_f_params
Commit: 2873d3842c3bf2585200f381473a5b3f171ab8b0
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2873d38…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Tue Nov 18 00:48:59 2008 +0100
dual module interface support: ser and kamailio
Added support for both ser and kamailio module interfaces: a module
just needs to define its module interface prior to including sr_module.h
(e.g. by adding EXTRA_DEFS+=-DSER_MOD_INTERFACE for a ser module or
EXTRA_DEFS+=-DKAMAILIO_MOD_INTERFACE to the module Makefile).
This way ser and kamailio modules can be mixed at will with only one
Makefile change.
Under the hood, now each module declares its interface version (by
exporting a global symbol named module_interface_ver) and the internal
module loader and module export finder were updated to take the interface
version into account.
Internally the core works now with a generic module_export_u union.
---
action.c | 13 ++-
cfg.y | 8 +-
core_cmd.c | 6 +-
modparam.c | 12 +-
route.c | 8 +-
sr_module.c | 393 ++++++++++++++++++++++++++++++++++++++++++++---------------
sr_module.h | 172 ++++++++++++++++++++++++--
7 files changed, 482 insertions(+), 130 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=287…
Module: sip-router
Branch: andrei/mod_f_params
Commit: 3c72005540cbe07ccc1f6f7c30407e65b933e9f5
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3c72005…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Tue Nov 18 00:21:51 2008 +0100
kamailio compatibility header files
- mi, pvar & statistics basic include files. For now they contain only
basic type declarations and defines to allow compilation (so you cannot
use them, but the code will compile).
- pvar needs more work or replacement
---
mi/mi.h | 99 +++++++++++++++++++++++++++++++++++++++
pvar.h | 145 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
statistics.h | 72 +++++++++++++++++++++++++++++
3 files changed, 316 insertions(+), 0 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=3c7…
Module: sip-router
Branch: andrei/mod_f_params
Commit: 1dd086b90c043db12f70974d7de46691feb0aa0b
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1dd086b…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Mon Nov 17 18:21:53 2008 +0100
module interface: minor changes from kamailio
- changed callback with no params prototypes from f() into f(void), original
commit message:
- sync function definitions with declarations for functions w/o parameters
- this functions were declared as 'f()', that means they can have a
arbitrary number of arguments (because of compatibility to the old style
definitions in the C standard), even if they are defined as f(void)
- there is no warning reported if somebody call a function like this with
some parameters
- another potential problem is, when somebody change the definition to
accept some parameter, but forgot to change also the declaration. Then
the compiler will not report wrong usage of this functions too.
- sometimes ago the '-Wold-style-definition' warning was introduced, the
definitions get then fixed subsequently, but not all declarations
- added free_fixup_function type definition
- added some doxygen comments
Credits go to: Henning Westerholt <henning.westerholt(a)1und1.de>
---
sr_module.h | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/sr_module.h b/sr_module.h
index 15aed59..f099f37 100644
--- a/sr_module.h
+++ b/sr_module.h
@@ -41,6 +41,13 @@
* 2007-06-07 added PROC_INIT, called in the main process context
* (same as PROC_MAIN), buf guaranteed to be called before
* any other process is forked (andrei)
+ * 2008-11-17 sip-router version: includes some of the openser/kamailio
+ * changes: f(void) instead of f(), free_fixup_function()
+ */
+
+/*!
+ * \file
+ * \brief modules/plug-in structures declarations
*/
@@ -53,12 +60,14 @@
#include "route_struct.h"
#include "str.h"
-typedef struct module_exports* (*module_register)();
+typedef struct module_exports* (*module_register)(void);
typedef int (*cmd_function)(struct sip_msg*, char*, char*);
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*);
typedef void (*onbreak_function)(struct sip_msg*);
-typedef void (*destroy_function)();
+typedef void (*destroy_function)(void);
+
typedef int (*init_function)(void);
typedef int (*child_init_function)(int rank);
@@ -193,19 +202,19 @@ extern struct sr_module* modules; /* global module list*/
extern response_function* mod_response_cbks;/* response callback array */
extern int mod_response_cbk_no; /* size of reponse callbacks array */
-int register_builtin_modules();
+int register_builtin_modules(void);
int register_module(struct module_exports*, char*, void*);
int load_module(char* path);
cmd_export_t* find_export_record(char* name, int param_no, int flags);
cmd_function find_export(char* name, int param_no, int flags);
cmd_function find_mod_export(char* mod, char* name, int param_no, int flags);
rpc_export_t* find_rpc_export(char* name, int flags);
-void destroy_modules();
+void destroy_modules(void);
int init_child(int rank);
int init_modules(void);
struct sr_module* find_module_by_name(char* mod);
-/*
+/*! \brief
* Find a parameter with given type and return it's
* address in memory
* If there is no such parameter, NULL is returned