[sr-dev] question about module function arguments

Juha Heinanen jh at tutpro.com
Wed Oct 13 15:38:08 CEST 2010


Andrei Pelinescu-Onciul writes:

> 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).

ok.  while you are at it, how about making the interface a bit more user
friendly.  now all args are converted automatically to strings.  it
would nice, if i could list, which are converted to string and which to
ints.  something like this:

static cmd_export_t cmds[]={
	{"print3", (cmd_function)print_f3, 3, "dss", REQUEST_ROUTE},
	{0, 0, 0, 0, 0}
};

/* 3 parameters, no fixup version */
static int print_f3(struct sip_msg* msg, int i1, char* s2, char* s3)
{
	printf("%d%s%s\n", i1, s2, s3);
	return 1;
}

or if all args for some reason need to be strings:

/* 3 parameters, no fixup version */
static int print_f3(struct sip_msg* msg, char* s1, char* s2, char* s3)
{
	printf("%d%s%s\n", (int)s1, s2, s3);
	return 1;
}

-- juha



More information about the sr-dev mailing list