MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / mod_init

Function mod_init

modules/statistics/statistics.c:417–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

415
416
417static int mod_init(void)
418{
419 module_stats *mod;
420 struct list_head *it;
421 struct stat_series_profile *profile;
422 LM_INFO("initializing\n");
423
424 INIT_LIST_HEAD(&script_iters);
425
426 /* initialize all lists */
427 list_for_each(it, &series_profiles) {
428 profile = list_entry(it, struct stat_series_profile, list);
429 profile->hash = hash_init(profile->hash_size);
430 if (!profile->hash) {
431 LM_ERR("could not create profile hash for %s!\n", profile->name.s);
432 return -1;
433 }
434 /* register the module now, so we can make it dynamic */
435 mod = get_stat_module(&profile->group);
436 if (!mod) {
437 mod = add_stat_module(profile->group.s);
438 if (!mod) {
439 LM_ERR("could not register dynamic module %s for %s\n",
440 (profile->group.len?profile->group.s:profile->name.s),
441 profile->name.s);
442 return -1;
443 }
444 mod->is_dyn = 1;
445 } else if (!mod->is_dyn) {
446 LM_WARN("profile %s is does not support dynamic statistics! using %s group!\n",
447 profile->group.s, DYNAMIC_MODULE_NAME);
448 init_str(&profile->group, DYNAMIC_MODULE_NAME);
449 }
450 }
451
452
453 if (register_all_mod_stats()!=0) {
454 LM_ERR("failed to register statistic variables\n");
455 return E_UNSPEC;
456 }
457 return 0;
458}
459
460static void stat_series_free(void *value)
461{

Callers

nothing calls this directly

Calls 6

INIT_LIST_HEADFunction · 0.85
get_stat_moduleFunction · 0.85
add_stat_moduleFunction · 0.85
init_strFunction · 0.85
register_all_mod_statsFunction · 0.85
list_entryClass · 0.50

Tested by

no test coverage detected