|
@@ -38,35 +38,31 @@ MODULE_VERSION
|
|
|
|
|
|
str _topos_redis_serverid = STR_NULL;
|
|
str _topos_redis_serverid = STR_NULL;
|
|
|
|
|
|
-static int mod_init(void);
|
|
|
|
|
|
+static int mod_init(void);
|
|
static void mod_destroy(void);
|
|
static void mod_destroy(void);
|
|
-static int child_init(int rank);
|
|
|
|
|
|
+static int child_init(int rank);
|
|
|
|
|
|
tps_storage_api_t _tps_storage_api = {0};
|
|
tps_storage_api_t _tps_storage_api = {0};
|
|
topos_api_t _tps_api = {0};
|
|
topos_api_t _tps_api = {0};
|
|
|
|
|
|
ndb_redis_api_t _tps_redis_api = {0};
|
|
ndb_redis_api_t _tps_redis_api = {0};
|
|
|
|
|
|
-static cmd_export_t cmds[]={
|
|
|
|
- {0, 0, 0, 0, 0, 0}
|
|
|
|
-};
|
|
|
|
|
|
+static cmd_export_t cmds[] = {{0, 0, 0, 0, 0, 0}};
|
|
|
|
|
|
-static param_export_t params[]={
|
|
|
|
- {"serverid", PARAM_STR, &_topos_redis_serverid},
|
|
|
|
- {0, 0, 0}
|
|
|
|
-};
|
|
|
|
|
|
+static param_export_t params[] = {
|
|
|
|
+ {"serverid", PARAM_STR, &_topos_redis_serverid}, {0, 0, 0}};
|
|
|
|
|
|
struct module_exports exports = {
|
|
struct module_exports exports = {
|
|
- "topos_redis", /* module name */
|
|
|
|
- DEFAULT_DLFLAGS, /* dlopen flags */
|
|
|
|
- cmds, /* exported functions */
|
|
|
|
- params, /* exported parameters */
|
|
|
|
- 0, /* exported rpc functions */
|
|
|
|
- 0, /* exported pseudo-variables */
|
|
|
|
- 0, /* response handling function */
|
|
|
|
- mod_init, /* module init function */
|
|
|
|
- child_init, /* per child init function */
|
|
|
|
- mod_destroy /* destroy function */
|
|
|
|
|
|
+ "topos_redis", /* module name */
|
|
|
|
+ DEFAULT_DLFLAGS, /* dlopen flags */
|
|
|
|
+ cmds, /* exported functions */
|
|
|
|
+ params, /* exported parameters */
|
|
|
|
+ 0, /* exported rpc functions */
|
|
|
|
+ 0, /* exported pseudo-variables */
|
|
|
|
+ 0, /* response handling function */
|
|
|
|
+ mod_init, /* module init function */
|
|
|
|
+ child_init, /* per child init function */
|
|
|
|
+ mod_destroy /* destroy function */
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
@@ -75,12 +71,11 @@ struct module_exports exports = {
|
|
*/
|
|
*/
|
|
static int mod_init(void)
|
|
static int mod_init(void)
|
|
{
|
|
{
|
|
- if(_topos_redis_serverid.s==NULL
|
|
|
|
- || _topos_redis_serverid.len<=0) {
|
|
|
|
|
|
+ if(_topos_redis_serverid.s == NULL || _topos_redis_serverid.len <= 0) {
|
|
LM_ERR("invalid serverid parameter\n");
|
|
LM_ERR("invalid serverid parameter\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
- if(topos_load_api(&_tps_api)<0) {
|
|
|
|
|
|
+ if(topos_load_api(&_tps_api) < 0) {
|
|
LM_ERR("failed to bind to topos module\n");
|
|
LM_ERR("failed to bind to topos module\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
@@ -99,7 +94,7 @@ static int mod_init(void)
|
|
_tps_storage_api.update_dialog = tps_redis_update_dialog;
|
|
_tps_storage_api.update_dialog = tps_redis_update_dialog;
|
|
_tps_storage_api.end_dialog = tps_redis_end_dialog;
|
|
_tps_storage_api.end_dialog = tps_redis_end_dialog;
|
|
|
|
|
|
- if(_tps_api.set_storage_api(&_tps_storage_api)<0) {
|
|
|
|
|
|
+ if(_tps_api.set_storage_api(&_tps_storage_api) < 0) {
|
|
LM_ERR("failed to set topos storage api\n");
|
|
LM_ERR("failed to set topos storage api\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
@@ -112,7 +107,7 @@ static int mod_init(void)
|
|
static int child_init(int rank)
|
|
static int child_init(int rank)
|
|
{
|
|
{
|
|
/* skip child init for non-worker process ranks */
|
|
/* skip child init for non-worker process ranks */
|
|
- if (rank==PROC_INIT || rank==PROC_MAIN || rank==PROC_TCP_MAIN)
|
|
|
|
|
|
+ if(rank == PROC_INIT || rank == PROC_MAIN || rank == PROC_TCP_MAIN)
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
return 0;
|
|
return 0;
|