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

Function mod_init

modules/event_flatstore/event_flatstore.c:214–352  ·  view source on GitHub ↗

initialize function */

Source from the content-addressed store, hash-verified

212
213/* initialize function */
214static int mod_init(void) {
215 int i;
216
217 opened_fds = NULL;
218 rotate_version = NULL;
219 buff = NULL;
220 buff_convert_len = 0;
221 io_param = NULL;
222 cap_params = 20;
223 dirc = NULL;
224
225 LM_NOTICE("initializing module ...\n");
226
227 if (file_rotate_period && file_rotate_period < 0) {
228 LM_WARN("\"rotate_period\" parameter needs to be a positive integer (%d)! "
229 "Disabling auto-rotate!\n", file_rotate_period);
230 file_rotate_period = 0;
231 }
232
233 if (file_suffix.s) {
234 file_suffix.len = strlen(file_suffix.s);
235 if (pv_parse_format(&file_suffix, &file_suffix_format) < 0) {
236 LM_ERR("could not parse file suffix format!\n");
237 return -1;
238 }
239 }
240
241 if (register_event_mod(&trans_export_flat)) {
242 LM_ERR("cannot register transport functions for SCRIPTROUTE\n");
243 return -1;
244 }
245
246 flatstore_evi_id = evi_publish_event(flatstore_event);
247 if (flatstore_evi_id == EVI_ERROR) {
248 LM_ERR("cannot register %.*s event\n", flatstore_event.len, flatstore_event.s);
249 return -1;
250 }
251
252 list_files = shm_malloc(sizeof(struct flat_file*));
253 if (!list_files) {
254 LM_ERR("oom!\n");
255 return -1;
256 }
257 *list_files = NULL;
258
259 list_delete = shm_malloc(sizeof(struct flat_delete*));
260 if (!list_delete) {
261 LM_ERR("oom!\n");
262 return -1;
263 }
264 *list_delete = NULL;
265
266 list_sockets = shm_malloc(sizeof(struct flat_socket*));
267 if (!list_sockets) {
268 LM_ERR("oom!\n");
269 return -1;
270 }
271 *list_sockets = NULL;

Callers

nothing calls this directly

Calls 6

pv_parse_formatFunction · 0.85
register_event_modFunction · 0.85
evi_publish_eventFunction · 0.85
shm_mallocFunction · 0.85
lock_initFunction · 0.85
register_timerFunction · 0.85

Tested by

no test coverage detected