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

Function mod_init

modules/rtpengine/rtpengine.c:1585–1782  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1583}
1584
1585static int
1586mod_init(void)
1587{
1588 int i;
1589 pv_spec_t avp_spec;
1590 unsigned short avp_flags;
1591 str s;
1592 int count = count_child_processes();
1593
1594 rtpe_ctx_idx = context_register_ptr(CONTEXT_GLOBAL, rtpe_ctx_free);
1595
1596 rtpe_no = (unsigned int*)shm_malloc(sizeof(unsigned int));
1597 list_version = (unsigned int*)shm_malloc(sizeof(unsigned int));
1598 child_versions=(unsigned int*)shm_malloc(count * sizeof(unsigned int));
1599 child_versions_no = (unsigned int*)shm_malloc(sizeof(unsigned int));
1600 rtpe_versions = (struct rtpe_version_head **)shm_malloc(sizeof(struct rtpe_version_head *));
1601
1602 if(!rtpe_no || !list_version || !child_versions || !child_versions_no || !rtpe_versions) {
1603 LM_ERR("No more shared memory\n");
1604 return -1;
1605 }
1606
1607 *rtpe_no = 0;
1608 *list_version = 0;
1609 *child_versions_no = count;
1610 *rtpe_versions = 0;
1611 my_version = 0;
1612
1613 memset(child_versions, 0, *child_versions_no * sizeof(unsigned int));
1614
1615 if (!(rtpe_set_list = (struct rtpe_set_head **)
1616 shm_malloc(sizeof(struct rtpe_set_head *)))) {
1617 LM_ERR("no more shm mem\n");
1618 return -1;
1619 }
1620 *rtpe_set_list = 0;
1621
1622 rtpengine_status_event = evi_publish_event(rtpengine_status_event_name);
1623 if (rtpengine_status_event == EVI_ERROR) {
1624 LM_ERR("cannot register RTPEngine Status event\n");
1625 return -1;
1626 }
1627
1628 rtpengine_status_event_params = pkg_malloc(sizeof(evi_params_t));
1629 if (rtpengine_status_event_params == NULL) {
1630 LM_ERR("no more pkg mem\n");
1631 return -1;
1632 }
1633 memset(rtpengine_status_event_params, 0, sizeof(evi_params_t));
1634 if ((rtpengine_status_event_socket = evi_param_create(rtpengine_status_event_params,
1635 &rtpengine_status_event_socket_s)) == NULL) {
1636 LM_ERR("could not create RTPEngine Status socket param\n");
1637 return -1;
1638 }
1639 if ((rtpengine_status_event_status = evi_param_create(rtpengine_status_event_params,
1640 &rtpengine_status_event_status_s)) == NULL) {
1641 LM_ERR("could not create RTPEngine Status status param\n");
1642 return -1;

Callers

nothing calls this directly

Calls 15

count_child_processesFunction · 0.85
context_register_ptrFunction · 0.85
shm_mallocFunction · 0.85
evi_publish_eventFunction · 0.85
evi_param_createFunction · 0.85
db_bind_modFunction · 0.85
db_check_table_versionFunction · 0.85
lock_init_rwFunction · 0.85
pv_parse_formatFunction · 0.85
pv_parse_specFunction · 0.85

Tested by

no test coverage detected