initialize function */
| 212 | |
| 213 | /* initialize function */ |
| 214 | static 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; |
nothing calls this directly
no test coverage detected