/* * Module initialization function */ static int mod_init(void) { DBG("auth_gsm - Initializing\n"); if ((rh=rc_read_config(radius_config)) == NULL) { LOG(L_ERR, "auth_gsm: Error opening radius configuration file \n"); return -1; } if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary")) != 0) { LOG(L_ERR, "auth_gsm: Error opening radius dictionary file \n"); return -2; } sl_reply = find_export("sl_send_reply", 2, 0); if (!sl_reply) { LOG(L_ERR, "auth_gsm:mod_init: This module requires sl module\n"); return -2; } pre_auth_func = (pre_auth_f)find_export("pre_auth", 0, 0); post_auth_func = (post_auth_f)find_export("post_auth", 0, 0); if (!(pre_auth_func && post_auth_func)) { LOG(L_ERR, "auth_gsm:mod_init: This module requires auth module\n"); return -3; } return 0; }
/* * Initialize parent */ static int mod_init(void) { bind_usrloc_t bind_usrloc; DBG("registrar - initializing\n"); /* * We will need sl_send_reply from stateless * module for sending replies */ sl_reply = find_export("sl_send_reply", 2, 0); if (!sl_reply) { LOG(L_ERR, "registrar: This module requires sl module\n"); return -1; } realm_prefix.s = realm_pref; realm_prefix.len = strlen(realm_pref); bind_usrloc = (bind_usrloc_t)find_export("ul_bind_usrloc", 1, 0); if (!bind_usrloc) { LOG(L_ERR, "registrar: Can't bind usrloc\n"); return -1; } if (bind_usrloc(&ul) < 0) { return -1; } def_q = (float)default_q / (float)1000; return 0; }
static int mod_init(void) { DBG("auth_db module - initializing\n"); db_url.len = strlen(db_url.s); user_column.len = strlen(user_column.s); domain_column.len = strlen(domain_column.s); pass_column.len = strlen(pass_column.s); pass_column_2.len = strlen(pass_column.s); if (aaa_avps_init(&avps_column_int, &avps_column_str, &avps_int, &avps_str, &avps_int_n, &avps_str_n) == -1) return -1; /* Find a database module */ if (auth_db_bind(db_url.s)<0) return -2; pre_auth_func = (pre_auth_f)find_export("pre_auth", 0, 0); post_auth_func = (post_auth_f)find_export("post_auth", 0, 0); if (!(pre_auth_func && post_auth_func)) { LOG(L_ERR, "auth_db:mod_init(): This module requires auth module\n"); return -3; } sl_reply = find_export("sl_send_reply", 2, 0); if (!sl_reply) { LOG(L_ERR, "auth_db:mod_init(): This module requires sl module\n"); return -4; } return 0; }
/* * Initialize parent */ static int mod_init(void) { bind_usrloc_t bind_usrloc; DBG("registrar - initializing\n"); /* * We will need sl_send_reply from stateless * module for sending replies */ sl_reply = find_export("sl_send_reply", 2, 0); if (!sl_reply) { LOG(L_ERR, "registrar: This module requires sl module\n"); return -1; } realm_prefix.s = realm_pref; realm_prefix.len = strlen(realm_pref); rcv_param.len = strlen(rcv_param.s); bind_usrloc = (bind_usrloc_t)find_export("ul_bind_usrloc", 1, 0); if (!bind_usrloc) { LOG(L_ERR, "registrar: Can't bind usrloc\n"); return -1; } /* Normalize default_q parameter */ if (default_q != Q_UNSPECIFIED) { if (default_q > MAX_Q) { DBG("registrar: default_q = %d, lowering to MAX_Q: %d\n", default_q, MAX_Q); default_q = MAX_Q; } else if (default_q < MIN_Q) { DBG("registrar: default_q = %d, raising to MIN_Q: %d\n", default_q, MIN_Q); default_q = MIN_Q; } } if (bind_usrloc(&ul) < 0) { return -1; } /* * Test if use_domain parameters of usrloc and registrar * module are equal */ if (ul.use_domain != use_domain) { LOG(L_ERR, "ERROR: 'use_domain' parameters of 'usrloc' and 'registrar' modules" " must have the same value !\n"); LOG(L_ERR, "(Hint: Did you forget to use modparam(\"registrar\", \"use_domain\", 1) in" " in your ser.cfg ?)\n"); return -1; } return 0; }
int test_globalHandler() { struct sip_snmp_handler *h; int (*reg)(const char *, struct sip_snmp_handler*); const char *func = __FUNCTION__; int i; h = snmp_new_handler(sizeof(unsigned long)); if(!h) { LOG(L_ERR, "%s: %s\n", func, strerror(errno)); return -1; } h->on_get = handle_transTable; reg = find_export("snmp_register_table", 2, 0); if(!reg) { LOG(L_ERR, "%s: couldn't find registration function!!\n", func); return -1; } if(reg("sipTransactionTable", h) == -1) { LOG(L_ERR, "%s: couldn't register sipTransactionTable!!\n", func); return -1; } /* now add the rows. We just need to pass indexes for the transactions */ reg = find_export("snmp_register_row", 2, 0); if(!reg) { LOG(L_ERR, "%s: couldn't find registration function!!\n", func); return -1; } h->sip_obj->val_len = sizeof(unsigned long); h->sip_obj->type = SER_UNSIGNED; h->sip_obj->next = NULL; for(i=1; i<=NUM_TRANS; i++) { *h->sip_obj->value.integer = i; if(reg("sipTransactionTable", h) == -1) { LOG(L_ERR, "%s: Failed creating row %d\n", func, i); snmp_free_handler(h->sip_obj->value.voidp); return -1; } } snmp_free_handler(h); return 0; }
/* * Load TM API * return 0 success, -1 failure */ int ospInitTm(void) { load_tm_f load_tm; LOG(L_DBG, "osp: ospInitTm\n"); if ((load_tm = (load_tm_f)find_export("load_tm", NO_SCRIPT, 0)) == 0) { LOG(L_ERR, "osp: ERROR: failed to import load_tm\n"); return -1; } if (load_tm(&osp_tmb) == -1) { LOG(L_ERR, "osp: ERROR: failed to load TM API\n"); LOG(L_ERR, "osp: ERROR: TM is required for reporting call setup usage\n"); return -1; } /* Register callbacks, listen for all incoming requests */ if (osp_tmb.register_tmcb(0, 0, TMCB_REQUEST_IN, ospOnReq, 0) <= 0) { LOG(L_ERR, "osp: ERROR: failed to register TMCB_REQUEST_IN callback\n"); LOG(L_ERR, "osp: ERROR: TM callbacks are required for reporting call set up usage\n"); return -1; } return 0; }
/* * init module function */ static int mod_init(void) { bind_presence_t bind_presence; bind_presence= (bind_presence_t)find_export("bind_presence", 1,0); if (!bind_presence) { LM_ERR("cannot find bind_presence\n"); return -1; } if (bind_presence(&pres) < 0) { LM_ERR("cannot bind to presence module\n"); return -1; } pres_add_event = pres.add_event; if (pres_add_event == NULL) { LM_ERR("could not import add_event function\n"); return -1; } if(conference_add_events() < 0) { LM_ERR("failed to add conference-info events\n"); return -1; } return 0; }
/** * init module function */ static int mod_init(void) { bind_pua_t bind_pua; LM_DBG("initializing\n"); memset (&pua_rpc_api, 0, sizeof(pua_api_t)); bind_pua= (bind_pua_t)find_export("bind_pua", 1,0); if (!bind_pua) { LM_ERR("can't find pua\n"); return -1; } if (bind_pua(&pua_rpc_api) < 0) { LM_ERR("can't bind pua\n"); return -1; } if (pua_rpc_api.send_publish == NULL) { LM_ERR("could not import send_publish\n"); return -1; } if (pua_rpc_api.register_puacb(MI_ASYN_PUBLISH, pua_rpc_publish_callback, NULL) < 0) { LM_ERR("could not register callback\n"); return -1; } return 0; }
/* If the usrloc module is loaded, this function will grab hooks into its * callback registration function, and add handleContactCallbacks() as the * callback for UL_CONTACT_INSERT and UL_CONTACT_EXPIRE. * * Returns 1 on success, and zero otherwise. */ int registerForUSRLOCCallbacks(void) { bind_usrloc_t bind_usrloc; usrloc_api_t ul; bind_usrloc = (bind_usrloc_t)find_export("ul_bind_usrloc", 1, 0); if (!bind_usrloc) { LM_INFO("Can't find ul_bind_usrloc\n"); goto error; } if (bind_usrloc(&ul) < 0 || ul.register_ulcb == NULL) { LM_INFO("Can't bind usrloc\n"); goto error; } ul.register_ulcb(UL_CONTACT_INSERT, handleContactCallbacks, NULL); ul.register_ulcb(UL_CONTACT_EXPIRE, handleContactCallbacks, NULL); ul.register_ulcb(UL_CONTACT_DELETE, handleContactCallbacks, NULL); return 1; error: LM_INFO("failed to register for callbacks with the USRLOC module.\n"); LM_INFO("openserSIPContactTable and openserSIPUserTable will be" " unavailable\n"); return 0; }
static int mod_init(void) { bind_sl_t bind_sl; DBG("speeddial module - initializing\n"); /* Find a database module */ if (bind_dbmod(db_url, &db_funcs)) { LOG(L_ERR, "sd:mod_init: Unable to bind database module\n"); return -1; } if (!DB_CAPABILITY(db_funcs, DB_CAP_QUERY)) { LOG(L_ERR, "sd:mod_init: Database modules does not " "provide all functions needed by SPEEDDIAL module\n"); return -1; } /** * We will need sl_send_reply from stateless * module for sending replies */ bind_sl = (bind_sl_t)find_export("bind_sl", 0, 0); if (!bind_sl) { ERR("This module requires sl module\n"); return -1; } if (bind_sl(&sl) < 0) return -1; return 0; }
static int mod_init(void) { bind_usrloc_t ul_bind_usrloc; if (natpingInterval > 0) { ul_bind_usrloc = (bind_usrloc_t)find_export("ul_bind_usrloc", 1, 0); if (!ul_bind_usrloc) { LOG(L_ERR, "error: mediaproxy/mod_init(): can't find the usrloc " "module. Check if usrloc.so is loaded.\n"); return -1; } if (ul_bind_usrloc(&userLocation) < 0) { LOG(L_ERR, "error: mediaproxy/mod_init(): can't access the usrloc module.\n"); return -1; } register_timer(pingClients, NULL, natpingInterval); } checkAsymmetricFile(&sipAsymmetrics); checkAsymmetricFile(&rtpAsymmetrics); // children won't benefit from this. figure another way //register_timer(checkAsymmetricFiles, NULL, 5); return 0; }
int prepare () { /* using pre-compiled expressions to speed things up*/ compile_expresions(PORT_REGEX,IP_REGEX); #ifdef DEMO load_tm_f load_tm; fprintf(stdout,"===============NEW RUN================\n"); //register callbacks if (!(load_tm=(load_tm_f)find_export("load_tm",NO_SCRIPT,0))) { printf("Error:FCP:prepare:cannot import load_tm\n"); return -1; } if (load_tm(&tmb)==-1) return -1; if (tmb.register_tmcb(TMCB_REQUEST_OUT, func_invite, 0, 0) <= 0) return -1; #endif return 0; }
/* * init module function */ static int mod_init(void) { presence_api_t pres; LM_INFO("initializing...\n"); bind_presence_t bind_presence; bind_presence= (bind_presence_t)find_export("bind_presence", 1,0); if (!bind_presence) { LM_ERR("can't bind presence\n"); return -1; } if (bind_presence(&pres) < 0) { LM_ERR("can't bind pua\n"); return -1; } pres_add_event = pres.add_event; if (pres_add_event == NULL) { LM_ERR("could not import add_event\n"); return -1; } if(callinfo_add_events() < 0) { LM_ERR("failed to add call-info events\n"); return -1; } return 0; }
int mod_init_tm() { load_tm_f load_tm; INFO("osp/tm - initializing\n"); /* import the TM auto-loading function */ if ( !(load_tm=(load_tm_f)find_export("load_tm", NO_SCRIPT, 0))) { ERR("osp:mod_init_tm: can't import load_tm\n"); ERR("osp:mod_init_tm: tm is required for reporting call set up usage info\n"); return -1; } /* let the auto-loading function load all TM stuff */ if (load_tm( &_tmb )==-1) return -1; /* register callbacks*/ /* listen for all incoming requests */ if ( _tmb.register_tmcb( 0, 0, TMCB_REQUEST_IN, onreq, 0 ) <=0 ) { ERR("osp:mod_init_tm: cannot register TMCB_REQUEST_IN callback\n"); ERR("osp:mod_init_tm: tm callbacks are required for reporting call set up usage info\n"); return -1; } return 0; }
/* * initialize module */ static int mod_init(void) { bind_sl_t bind_sl; strl* ptr; DBG("sanity initializing\n"); /* * We will need sl_send_reply from stateless * module for sending replies */ bind_sl = (bind_sl_t)find_export("bind_sl", 0, 0); if (!bind_sl) { ERR("This module requires sl module\n"); return -1; } if (bind_sl(&sl) < 0) return -1; DBG("parsing proxy requires string:\n"); ptr = parse_str_list(&pr_str); proxyrequire_list = ptr; while (ptr != NULL) { DBG("string: '%.*s', next: %p\n", ptr->string.len, ptr->string.s, ptr->next); ptr = ptr->next; } return 0; }
static int mod_init(void) { bind_auth_s_t bind_auth; /* Find a database module */ if (db_bind_mod(&db_url, &auth_dbf) < 0){ LM_ERR("unable to bind to a database driver\n"); return -1; } /* bind to auth module and import the API */ bind_auth = (bind_auth_s_t)find_export("bind_auth_s", 0, 0); if (!bind_auth) { LM_ERR("unable to find bind_auth function. Check if you load" " the auth module.\n"); return -2; } if (bind_auth(&auth_api) < 0) { LM_ERR("unable to bind auth module\n"); return -3; } /* process additional list of credentials */ if (parse_aaa_pvs(credentials_list, &credentials, &credentials_n) != 0) { LM_ERR("failed to parse credentials\n"); return -5; } return 0; }
/** * init module function */ static int mod_init(void) { load_tm_f load_tm; DBG("MSILO: initializing ...\n"); /* binding to mysql module */ if (bind_dbmod()) { DBG("MSILO: ERROR: Database module not found\n"); return -1; } /* import the TM auto-loading function */ if ( !(load_tm=(load_tm_f)find_export("load_tm", NO_SCRIPT, 0))) { LOG(L_ERR, "ERROR: msilo: mod_init: can't import load_tm\n"); return -1; } /* let the auto-loading function load all TM stuff */ if (load_tm( &tmb )==-1) return -1; ml = msg_list_init(); if(!ml) { DBG("ERROR: msilo: mod_init: can't initialize msg list\n"); return -1; } register_timer( m_clean_silo, 0, check_time); reg_addr.s = registrar; reg_addr.len = (registrar)?strlen(registrar):0; return 0; }
/* check if a given forward does exist in one of the imported dlls */ static void check_undefined_forwards( DLLSPEC *spec ) { char *link_name, *api_name, *dll_name, *p; int i, j; for (i = 0; i < spec->nb_entry_points; i++) { ORDDEF *odp = &spec->entry_points[i]; if (!(odp->flags & FLAG_FORWARD)) continue; link_name = xstrdup( odp->link_name ); p = strrchr( link_name, '.' ); *p = 0; api_name = p + 1; dll_name = get_dll_name( link_name, NULL ); for (j = 0; j < nb_imports; j++) { struct import *imp = dll_imports[j]; if (strcasecmp( imp->spec->file_name, dll_name )) continue; if (!find_export( api_name, imp->exports, imp->nb_exports )) warning( "%s:%d: forward '%s' not found in %s\n", spec->src_name, odp->lineno, odp->link_name, imp->spec->file_name ); break; } if (j == nb_imports) warning( "%s:%d: forward '%s' not found in the imported dll list\n", spec->src_name, odp->lineno, odp->link_name ); free( link_name ); free( dll_name ); } }
static int mod_init(void) { load_tm_f load_tm; /* load the tm functions */ if ( !(load_tm=(load_tm_f)find_export("load_tm", NO_SCRIPT, 0))) { LOG(L_ERR, "ERROR:jsonrpc:mod_init: cannot import load_tm\n"); return -1; } /* let the auto-loading function load all TM stuff */ if (load_tm( &tmb )==-1) return -1; if (servers_param == NULL) { LM_ERR("servers parameter missing.\n"); return -1; } register_procs(1); if (pipe(pipe_fds) < 0) { LM_ERR("pipe() failed\n"); return -1; } return(0); }
/* * init module function */ static int mod_init(void) { presence_api_t pres; bind_presence_t bind_presence; bind_presence= (bind_presence_t)find_export("bind_presence", 1,0); if (!bind_presence) { LM_ERR("can't bind presence\n"); return -1; } if (bind_presence(&pres) < 0) { LM_ERR("can't bind pua\n"); return -1; } pres_add_event = pres.add_event; if (pres_add_event == NULL) { LM_ERR("could not import add_event\n"); return -1; } if(mwi_add_events() < 0) { LM_ERR("failed to add mwi events\n"); return -1; } return 0; }
int load_xjab(struct xjab_binds *xjb) { if(!( xjb->register_watcher=(pa_register_watcher_f) find_export("jab_register_watcher", XJ_NO_SCRIPT_F, 0)) ) { LM_ERR("'jab_register_watcher' not found!\n"); return -1; } if(!( xjb->unregister_watcher=(pa_unregister_watcher_f) find_export("jab_unregister_watcher", XJ_NO_SCRIPT_F, 0)) ) { LM_ERR("'jab_unregister_watcher' not found!\n"); return -1; } return 1; }
static int mod_init(void) { load_tm_f load_tm; /* import the TM auto-loading function */ if ( !(load_tm = (load_tm_f)find_export("load_tm", NO_SCRIPT, 0))) { LOG(L_ERR, "ERROR:acc:mod_init: can't import load_tm\n"); return -1; } /* let the auto-loading function load all TM stuff */ if (load_tm( &tmb )==-1) return -1; if (verify_fmt(log_fmt)==-1) return -1; /* register callbacks*/ /* listen for all incoming requests */ if (tmb.register_tmcb( 0, 0, TMCB_REQUEST_IN, on_req, 0, 0) <= 0) { LOG(L_ERR,"ERROR:acc:mod_init: cannot register TMCB_REQUEST_IN " "callback\n"); return -1; } init_data(log_fmt); if (parse_attrs(&avps, &avps_n, attrs) < 0) { ERR("Error while parsing 'attrs' module parameter\n"); return -1; } return 0; }
/* get the pointer to the xl lib functions */ static int get_xl_functions(void) { if (!xl_print) { xl_print=(xl_print_log_f*)find_export("xprint", NO_SCRIPT, 0); if (!xl_print) { LOG(L_CRIT,"ERROR: cannot find \"xprint\", is module xprint loaded?\n"); return -1; } } if (!xl_parse) { xl_parse=(xl_parse_format_f*)find_export("xparse", NO_SCRIPT, 0); if (!xl_parse) { LOG(L_CRIT,"ERROR: cannot find \"xparse\", is module xprint loaded?\n"); return -1; } } if (!xl_free) { xl_free=(xl_elog_free_all_f*)find_export("xfree", NO_SCRIPT, 0); if (!xl_free) { LOG(L_CRIT,"ERROR: cannot find \"xfree\", is module xprint loaded?\n"); return -1; } } if (!xl_nul) { xl_getnul=(xl_get_nulstr_f*)find_export("xnulstr", NO_SCRIPT, 0); if (xl_getnul) { xl_nul=xl_getnul(); } if (!xl_nul){ LOG(L_CRIT,"ERROR: cannot find \"xnulstr\", is module xprint loaded?\n"); return -1; } else { LOG(L_INFO,"INFO: xprint null is \"%.*s\"\n", xl_nul->len, xl_nul->s); } } return 0; }
static int mod_init(void) { bind_auth_t bind_auth; LOG(L_INFO, "AUTH_DB module - initializing\n"); user_column.len = strlen(user_column.s); domain_column.len = strlen(domain_column.s); pass_column.len = strlen(pass_column.s); pass_column_2.len = strlen(pass_column.s); /* Find a database module */ if (bind_dbmod(db_url, &auth_dbf) < 0){ LOG(L_ERR,"ERROR:auth_db:child_init: Unable to bind to " "a database driver\n"); return -1; } /* bind to auth module and import the API */ bind_auth = (bind_auth_t)find_export("bind_auth", 0, 0); if (!bind_auth) { LOG(L_ERR,"ERROR:auth_db:mod_init: Unable to find \"bind_auth\"" "function\n"); return -2; } if (bind_auth(&auth_api) < 0) { LOG(L_ERR,"ERROR:auth_db:mod_init: Unable to bind auth module\n"); return -3; } sl_reply = find_export("sl_send_reply", 2, 0); if (!sl_reply) { LOG(L_ERR,"ERROR:auth_db:mod_init: This module requires sl module\n"); return -4; } /* process additional list of credentials */ if (parse_aaa_avps( credentials_list, &credentials, &credentials_n)!=0) { LOG(L_ERR,"ERROR:auth_db:mod_init: failed to parse credentials\n"); return -5; } return 0; }
/** * Module init function. * Initializes the ISC structures */ static int isc_init( void ) { load_tm_f load_tm; load_scscf_f load_scscf; LOG( L_INFO, "INFO:"M_NAME": - init\n" ); /* import the TM auto-loading function */ if (!(load_tm = (load_tm_f)find_export("load_tm",NO_SCRIPT,0))) { LOG(L_ERR,"ERROR:"M_NAME":isc_init: cannot import load_tm\n"); goto error; } /* let the auto-loading function load all TM stuff */ if (load_tm(&isc_tmb) == -1) goto error; /* import the SCSCF auto-loading function */ if (!(load_scscf = (load_scscf_f)find_export("load_scscf",NO_SCRIPT,0))) { LOG(L_ERR,"ERROR:"M_NAME":isc_init: cannot import load_scscf\n"); goto error; } /* let the auto-loading function load all TM stuff */ if (load_scscf(&isc_scscfb) == -1) goto error; /* Init the isc_my_uri parameter */ if (!isc_my_uri_c) { LOG( L_CRIT, "ERROR:"M_NAME":isc_init: mandatory parameter \"isc_my_uri\" found empty\n" ); goto error; } isc_my_uri.s = isc_my_uri_c; isc_my_uri.len = strlen(isc_my_uri_c); isc_my_uri_sip.len = 4+isc_my_uri.len; isc_my_uri_sip.s = shm_malloc(isc_my_uri_sip.len+1); memcpy(isc_my_uri_sip.s,"sip:",4); memcpy(isc_my_uri_sip.s+4,isc_my_uri.s,isc_my_uri.len); isc_my_uri_sip.s[isc_my_uri_sip.len]=0; #ifdef WITH_IMS_PM ims_pm_init(isc_my_uri_sip,ims_pm_node_type, ims_pm_logfile); #endif /* WITH_IMS_PM */ return 0; error: return -1; }
static int parse_xlstr(struct xlstr* s) { if (!s->s) return 0; if (!strchr(s->s, '%')) return 0; /* probably xl_log formatting */ if (!xl_print) { xl_print=(xl_print_log_f*)find_export("xprint", NO_SCRIPT, 0); if (!xl_print) { ERR(MODULE_NAME": cannot find \"xprint\", is module xprint loaded?\n"); return E_UNSPEC; } } if (!xl_parse) { xl_parse=(xl_parse_format_f*)find_export("xparse", NO_SCRIPT, 0); if (!xl_parse) { ERR(MODULE_NAME": cannot find \"xparse\", is module xprint loaded?\n"); return E_UNSPEC; } } if (!xl_nul) { xl_getnul=(xl_get_nulstr_f*)find_export("xnulstr", NO_SCRIPT, 0); if (xl_getnul) xl_nul=xl_getnul(); if (!xl_nul){ ERR(MODULE_NAME": cannot find \"xnulstr\", is module xprint loaded?\n"); return E_UNSPEC; } else INFO(MODULE_NAME": xprint null is \"%.*s\"\n", xl_nul->len, xl_nul->s); } if(xl_parse(s->s, &s->xlfmt) < 0) { ERR(MODULE_NAME": wrong format '%s'\n", s->s); return E_UNSPEC; } return 0; }
/* * Initialize parent */ static int mod_init(void) { bind_sl_t bind_sl; bind_usrloc_t bind_usrloc; DBG("registrar - initializing\n"); /* * We will need sl_send_reply from stateless * module for sending replies */ bind_sl = (bind_sl_t)find_export("bind_sl", 0, 0); if (!bind_sl) { ERR("This module requires sl module\n"); return -1; } if (bind_sl(&sl) < 0) return -1; bind_usrloc = (bind_usrloc_t)find_export("ul_bind_usrloc", 1, 0); if (!bind_usrloc) { ERR("Can't bind usrloc\n"); return -1; } /* Normalize default_q parameter */ if (default_q != Q_UNSPECIFIED) { if (default_q > MAX_Q) { DBG("registrar: default_q = %d, lowering to MAX_Q: %d\n", default_q, MAX_Q); default_q = MAX_Q; } else if (default_q < MIN_Q) { DBG("registrar: default_q = %d, raising to MIN_Q: %d\n", default_q, MIN_Q); default_q = MIN_Q; } } if (parse_attr_params() < 0) return -1; if (bind_usrloc(&ul) < 0) { return -1; } return 0; }
/** * init module function */ static int mod_init(void) { bind_xcap_t bind_xcap; xcap_api_t xcap_api; /* load XCAP API */ bind_xcap = (bind_xcap_t)find_export("bind_xcap", 1, 0); if (!bind_xcap) { LM_ERR("Can't bind xcap\n"); return -1; } if (bind_xcap(&xcap_api) < 0) { LM_ERR("Can't bind xcap\n"); return -1; } xcap_db_url = xcap_api.db_url; xcap_db_table = xcap_api.xcap_table; /* binding to mysql module */ if (db_bind_mod(&xcap_db_url, &xcap_dbf)) { LM_ERR("Database module not found\n"); return -1; } if (!DB_CAPABILITY(xcap_dbf, DB_CAP_ALL)) { LM_ERR("Database module does not implement all functions" " needed by the module\n"); return -1; } xcap_db = xcap_dbf.init(&xcap_db_url); if (!xcap_db) { LM_ERR("while connecting to database\n"); return -1; } curl_global_init(CURL_GLOBAL_ALL); if(periodical_query) { register_timer("xcapc-update", query_xcap_update, 0, query_period, TIMER_FLAG_DELAY_ON_DELAY); } if(xcap_db) xcap_dbf.close(xcap_db); xcap_db = NULL; return 0; }
int stats_register() { const char *func = __FUNCTION__; struct stats_funcs f; f.reg_func = (void*) find_export("snmp_register_handler", 2, 0); f.new_func = (void*) find_export("snmp_new_handler", 1, 0); f.free_func = (void*) find_export("snmp_free_handler", 1, 0); if(!f.reg_func || !f.new_func || !f.free_func) { LOG(L_INFO, "%s: Couldn't find SNMP module\n", func); LOG(L_INFO, "%s: Not reporting stats through SNMP\n", func); return 0; } reg(sipSummaryStatsTable); reg(sipMethodStatsTable); reg(sipStatusCodesTable); return 0; }
int mod_register(char *path, int *dlflags, void *p1, void *p2) { pv_register_api_t pvra; pvra = (pv_register_api_t)find_export("pv_register_api", NO_SCRIPT, 0); if (!pvra) { LM_ERR("Cannot import pv functions (pv module must be loaded before this module)\n"); return -1; } pvra(&pv_api); return 0; }