[Devel] module coding question,
are optional arguments set to null by default?
Ron Winacott
ronw at somanetworks.com
Thu Nov 10 18:05:27 CET 2005
Hello all,
I have a question about the module C function arguments. After you map the
route function to the module C function, the C function has three arguments,
the struct sip_msg* msg, char* str1 and char* str2.
So my question is, if the routing function is called without passing any
arguments will str1 and str2 be NULL or are they pointing at "junk on the
stack"?
I would like to create a function that has an optional flag that may or may
not be passed as str1 and the code would look something like:
module:
static cmd_export_t commands[] = {
{"route_fubar", fubar, 1, 0, REQUEST_ROUTE },
{0, 0, 0, 0, 0}
};
static int
fubar(struct sip_msg* msg, char* str1, char* str2) {
if (str1) {
do_optional_stuff()
}
...
}
ser.cfg :
if (method=="INVITE") {
fubar("flag");
}
else {
fubar();
}
Thanks
ronw.
--
Ron Winacott ronw at somanetworks.com
SOMA Networks, Inc.
More information about the Devel
mailing list