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

Function mod_init

modules/b2b_entities/b2b_entities.c:327–542  ·  view source on GitHub ↗

Module initialize function */

Source from the content-addressed store, hash-verified

325
326/** Module initialize function */
327static int mod_init(void)
328{
329 /* inspect the parameters */
330 if(server_hsize< 1 || server_hsize> 20 ||
331 client_hsize< 1 || client_hsize> 20)
332 {
333 LM_ERR("Wrong hash size. Needs to be greater than 1"
334 " and smaller than 20. Be aware that you should set the log 2"
335 " value of the real size\n");
336 return -1;
337 }
338 server_hsize = 1<<server_hsize;
339 client_hsize = 1<<client_hsize;
340
341 if (adv_contact.s)
342 adv_contact.len = strlen(adv_contact.s);
343
344 if(b2b_key_prefix.s)
345 {
346 b2b_key_prefix.len = strlen(b2b_key_prefix.s);
347 if(b2b_key_prefix.len > B2B_MAX_PREFIX_LEN)
348 {
349 LM_ERR("b2b_key_prefix [%s] too long. Maximum size %d\n",
350 b2b_key_prefix.s, B2B_MAX_PREFIX_LEN);
351 return -1;
352 }
353 }
354
355 /* load all TM stuff */
356 if(load_tm_api(&tmb)==-1)
357 {
358 LM_ERR("can't load tm functions\n");
359 return -1;
360 }
361
362 /* load the UAC_AUTH API - FIXME it should be loaded only
363 * if authentication is required */
364 if(load_uac_auth_api(&uac_auth_api)<0)
365 {
366 LM_INFO("authentication functionality disabled:"
367 " load uac_auth first to enable it\n");
368 uac_auth_loaded = 0;
369 }
370 else
371 {
372 uac_auth_loaded = 1;
373 }
374
375 /* initialize the hash tables; they will be allocated in shared memory
376 * to be accesible by all processes */
377 if(init_b2b_htables()< 0)
378 {
379 LM_ERR("Failed to initialize b2b table\n");
380 return -1;
381 }
382 memset(&b2be_dbf, 0, sizeof(db_func_t));
383
384 if(b2be_db_mode) {

Callers

nothing calls this directly

Calls 14

load_tm_apiFunction · 0.85
load_uac_auth_apiFunction · 0.85
init_b2b_htablesFunction · 0.85
db_bind_modFunction · 0.85
db_check_table_versionFunction · 0.85
b2be_initializeFunction · 0.85
b2b_entities_restoreFunction · 0.85
cachedb_bind_modFunction · 0.85
ref_script_route_by_nameFunction · 0.85
register_timerFunction · 0.85
init_ua_sess_timerFunction · 0.85
ua_evi_initFunction · 0.85

Tested by

no test coverage detected