[sr-dev] question about module function arguments

Andrei Pelinescu-Onciul andrei at iptel.org
Wed Oct 13 15:29:35 CEST 2010


On Oct 13, 2010 at 16:14, Juha Heinanen <jh at tutpro.com> wrote:
> Andrei Pelinescu-Onciul writes:
> 
> > I you want variable number of parameters, the module function
> > declaration should look like:
> >     {"foov", (cmd_function)foo_var, VAR_PARAM_NO, 0, 0,
> > REQUEST_ROUTE}
> 
> andrei,
> 
> when i compare the above example with modules_s/print example:
> 
> 	{"printv", (cmd_function)print_f_var, VAR_PARAM_NO, 0,
> 	REQUEST_ROUTE},
> 
> the difference is that in foov example there is one field more.  i guess
> it has something to do with s vs. k module interface.

Yes, k interface has an extra free_fixup function.

> when i look
> sr_module.h there is ifdefs KAMAILIO_MOD_INTERFACE.  is it possible to
> match and match module interfaces on per module basis by including
> 
> #define SER_MOD_INTERFACE
> 
> or
> 
> #define KAMAILIO_MOD_INTERFACE
> 
> in the main source file of the module?

You should add it to the Makefile, e.g.:
include ../../Makefile.defs

auto_gen=
NAME=foo.so
LIBS=
DEFS+= -DSER_MOD_INTERFACE

include ../../Makefile.modules

If neither ser or k MOD_INTERFACE is defined, I think you'll probably
get some compilation error.

> 
> it would really be nice if there were a wiki page about this (including
> the fixup stuff).

It should change during 3.2. I'll probably add a SR3.2_MODE_INTERFACE
which will combine ser & k (actually all that is missing is exposing it
to the modules, internally ser & k interfaces are converted to a more
generic sr interface).


Andrei



More information about the sr-dev mailing list