| 415 | |
| 416 | |
| 417 | static 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 | |
| 460 | static void stat_series_free(void *value) |
| 461 | { |
nothing calls this directly
no test coverage detected