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

Function mod_init

modules/fraud_detection/fraud_detection.c:186–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186static int mod_init(void)
187{
188 LM_INFO("Initializing module\n");
189 init_db_url(db_url, 0);
190
191 if (mp_use_utc_time)
192 customtime_r = gmtime_r;
193
194 if ((frd_data_lock = lock_init_rw()) == NULL) {
195 LM_CRIT("failed to init reader/writer lock\n");
196 return -1;
197 }
198
199 if ((frd_seq_calls_lock = lock_alloc()) == NULL) {
200 LM_ERR("cannot alloc seq_calls lock\n");
201 return -1;
202 }
203 if (lock_init(frd_seq_calls_lock) == NULL) {
204 LM_ERR ("cannot init seq_calls lock\n");
205 return -1;
206 }
207
208 if (load_dlg_api(&dlgb) != 0) {
209 LM_ERR("failed to load dialog binds\n");
210 return -1;
211 }
212
213 if (frd_event_init() != 0) {
214 LM_ERR("cannot register events\n");
215 return -1;
216 }
217
218 if (load_dr_api(&drb) != 0) {
219 LM_ERR("cannot load dr_api\n");
220 return -1;
221 }
222
223 dr_head = shm_malloc(sizeof(dr_head_p));
224 if (dr_head == NULL) {
225 LM_ERR("no more shm memory\n");
226 return -1;
227 }
228 *dr_head = NULL;
229
230 set_lengths();
231 if (init_stats_table() != 0) {
232 LM_ERR("failed to init fraud stats table\n");
233 return -1;
234 }
235
236 /* Check if table version is ok */
237 frd_init_db();
238 frd_disconnect_db();
239
240 return 0;
241}
242
243static int child_init(int rank)

Callers

nothing calls this directly

Calls 10

lock_init_rwFunction · 0.85
lock_initFunction · 0.85
load_dlg_apiFunction · 0.85
frd_event_initFunction · 0.85
load_dr_apiFunction · 0.85
shm_mallocFunction · 0.85
set_lengthsFunction · 0.85
init_stats_tableFunction · 0.85
frd_init_dbFunction · 0.85
frd_disconnect_dbFunction · 0.85

Tested by

no test coverage detected