[OpenSER-Devel] Skeleton Module
Daniel Corbe
daniel.junkmail at gmail.com
Mon Dec 3 21:28:35 UTC 2007
I'm having issues with a "skeletal" module, and the openser core refuses to
start when I have it "load"ed in my config file. Not sure why, and I could
use a bit of direction from the rest of the list.
It compiles
-Daniel
-- Cut Here --
#include "../../sr_module.h"
static int mod_init(void);
static void mod_destroy(void);
static int child_init(int);
static int pagemod_test(struct sip_msg *msg);
/* SER exports */
static cmd_export_t cmds[]=
{
{"test", pagemod_test, 0, 0, REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE |
BRANCH_ROUTE },
{0, 0, 0, 0, 0}
};
/*
* Script parameters
*/
static param_export_t mod_params[]=
{
{0, 0, 0}
};
/*
* Export the statistics we have
*/
static stat_export_t mod_stats[] =
{
{0, 0, 0}
};
struct module_exports exports =
{
"page", /* module's name */
cmds, /* exported functions */
mod_params, /* param exports */
mod_stats, /* exported statistics */
mod_init, /* module initialization function */
0, /* reply processing function FIXME Not sure when this is used */
mod_destroy, /* Destroy function */
child_init /* per-child init function */
};
MODULE_VERSION
/*
* Script commands we export.
*/
/**
* @return 0 to continue to load the OpenSER, -1 to stop the loading
* and abort OpenSER.
*/
static int mod_init(void)
{
int result = 0;
return(result);
}
/**
* Called only once when OpenSER is shuting down to clean up module
* resources.
*/
static void mod_destroy()
{
LOG(L_NOTICE, "Starting Up\n");
return;
}
/**
* The rank will be o for the main process calling this function,
* or 1 through n for each listener process. The rank can have a negative
* value if it is a special process calling the child init function.
* Other then the listeners, the rank will equal one of these values:
* PROC_MAIN 0 Main ser process
* PROC_TIMER -1 Timer attendant process
* PROC_FIFO -2 FIFO attendant process
* PROC_TCP_MAIN -4 TCP main process
* PROC_UNIXSOCK -5 Unix domain socket server processes
*
* If this function returns a nonzero value the loading of OpenSER will
* stop.
*/
static int child_init(int rank)
{
int result = 0;
LOG(L_NOTICE, "Starting Child\n");
return(result);
}
static int pagemod_test(struct sip_msg *msg)
{
LOG(L_NOTICE, "Testing 1 2 3\n");
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openser.org/pipermail/devel/attachments/20071203/29688ec3/attachment.htm
More information about the Devel
mailing list