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

Function mod_init

modules/qos/qos.c:115–147  ·  view source on GitHub ↗

* The initialization function, called when the module is loaded by * the script. This function is called only once. * * Bind to the dialog module and setup the callbacks. Also initialize * the shared memory to store our interninal information in. */

Source from the content-addressed store, hash-verified

113 * the shared memory to store our interninal information in.
114 */
115static int mod_init(void)
116{
117 qos_flag = get_flag_id_by_name(FLAG_TYPE_MSG, qos_flag_str, 0);
118
119 if (qos_flag == -1) {
120 LM_ERR("no qos flag set!!\n");
121 return -1;
122 }
123 else if (qos_flag > MAX_FLAG) {
124 LM_ERR("invalid qos flag %d!!\n", qos_flag);
125 return -1;
126 }
127
128 /* init callbacks */
129 if (init_qos_callbacks()!=0) {
130 LM_ERR("cannot init callbacks\n");
131 return -1;
132 }
133
134 /* Register the main (static) dialog call back. */
135 if (load_dlg_api(&dialog_st) != 0) {
136 LM_ERR("Can't load dialog hooks\n");
137 return(-1);
138 }
139
140 /* Load dialog hooks */
141 dialog_st.register_dlgcb(NULL, DLGCB_CREATED, qos_dialog_created_CB, NULL, NULL);
142
143 /*
144 * We are GOOD-TO-GO.
145 */
146 return 0;
147}
148
149static void mod_destroy(void)
150{

Callers

nothing calls this directly

Calls 3

get_flag_id_by_nameFunction · 0.85
init_qos_callbacksFunction · 0.85
load_dlg_apiFunction · 0.85

Tested by

no test coverage detected