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

Function mod_init

modules/pua/pua.c:162–279  ·  view source on GitHub ↗

* init module function */

Source from the content-addressed store, hash-verified

160 * init module function
161 */
162static int mod_init(void)
163{
164 load_tm_f load_tm;
165
166 LM_DBG("...\n");
167
168 if(min_expires< 0)
169 min_expires= 0;
170
171 if(default_expires< 600)
172 default_expires= 3600;
173
174 /* import the TM auto-loading function */
175 if((load_tm=(load_tm_f)find_export("load_tm", 0))==NULL)
176 {
177 LM_ERR("can't import load_tm\n");
178 return -1;
179 }
180 /* let the auto-loading function load all TM stuff */
181
182 if(load_tm(&tmb)==-1)
183 {
184 LM_ERR("can't load tm functions\n");
185 return -1;
186 }
187
188 init_db_url( db_url , 0 /*cannot be null*/);
189 db_table.len = strlen(db_table.s);
190
191 /* binding to database module */
192 if (db_bind_mod(&db_url, &pua_dbf))
193 {
194 LM_ERR("Database module not found\n");
195 return -1;
196 }
197 if (!DB_CAPABILITY(pua_dbf, DB_CAP_ALL)) {
198 LM_ERR("Database module does not implement all functions needed"
199 " by the module\n");
200 return -1;
201 }
202
203 pua_db = pua_dbf.init(&db_url);
204 if (!pua_db)
205 {
206 LM_ERR("while connecting database\n");
207 return -1;
208 }
209 /* verify table version */
210 if(db_check_table_version(&pua_dbf, pua_db, &db_table, PUA_TABLE_VERSION) < 0) {
211 LM_ERR("error during table version check.\n");
212 return -1;
213 }
214
215 if(HASH_SIZE<=1)
216 HASH_SIZE= 512;
217 else {
218 /* must fit in half of "long" when building the pres_id */
219 if ( HASH_SIZE > (sizeof(long)*8/2) ) {

Callers

nothing calls this directly

Calls 11

find_exportFunction · 0.85
load_tmFunction · 0.85
db_bind_modFunction · 0.85
db_check_table_versionFunction · 0.85
new_htableFunction · 0.85
init_pua_clusteringFunction · 0.85
db_restoreFunction · 0.85
init_puacb_listFunction · 0.85
init_pua_evlistFunction · 0.85
pua_add_eventsFunction · 0.85
register_timerFunction · 0.85

Tested by

no test coverage detected