| 735 | /****************** Core (to be used) functions **********************/ |
| 736 | |
| 737 | int init_status_report(void) |
| 738 | { |
| 739 | sr_lock = lock_init_rw(); |
| 740 | if (sr_lock==NULL) { |
| 741 | LM_ERR("Failed to create the global RW lock, abording\n"); |
| 742 | return -1; |
| 743 | } |
| 744 | |
| 745 | sr_evi_id = evi_publish_event(sr_event); |
| 746 | if (sr_evi_id == EVI_ERROR) { |
| 747 | LM_ERR("cannot register 'statis_changed' event\n"); |
| 748 | return -1; |
| 749 | } |
| 750 | |
| 751 | srg_core = (sr_group*)sr_register_group_with_identifier( |
| 752 | CHAR_INT("core"), 0/*not public*/, CHAR_INT_NULL /*main*/, |
| 753 | STATE_NONE, CHAR_INT_NULL/*report*/, 10); |
| 754 | if (srg_core==NULL) { |
| 755 | LM_ERR("Failed to register 'status_report' group and identifier for " |
| 756 | "'core'\n"); |
| 757 | return -1; |
| 758 | } |
| 759 | |
| 760 | /* this is a bit hackish, but 100% safe as time as it is done right |
| 761 | * after the above sr_register_group_with_identifier() - the "main" |
| 762 | * identifier will be the only one in the group, so the first one too */ |
| 763 | sri_core = (srg_core)->identifiers; |
| 764 | /* also it is safe to keep a reference here as we will never delete |
| 765 | * this identifer - but be CAREFULL on this !!! */ |
| 766 | |
| 767 | return 0; |
| 768 | } |
| 769 | |
| 770 | |
| 771 | /****************** Core Scripting functions **********************/ |
no test coverage detected