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

Function mod_init

modules/proto_ws/proto_ws.c:199–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197
198
199static int mod_init(void)
200{
201 LM_INFO("initializing WebSocket protocol\n");
202
203 ws_resource.len = strlen(ws_resource.s);
204
205 if (trace_destination_name.s) {
206 if ( !net_trace_api ) {
207 if ( trace_prot_bind( WS_TRACE_PROTO, &tprot) < 0 ) {
208 LM_ERR( "can't bind trace protocol <%s>\n", WS_TRACE_PROTO );
209 return -1;
210 }
211
212 net_trace_api = &tprot;
213 } else {
214 tprot = *net_trace_api;
215 }
216
217 trace_destination_name.len = strlen( trace_destination_name.s );
218
219 if ( net_trace_proto_id == -1 )
220 net_trace_proto_id = tprot.get_message_id( WS_TRANS_TRACE_PROTO_ID );
221
222 t_dst = tprot.get_trace_dest_by_name( &trace_destination_name );
223 }
224
225 /* fix route name */
226 if ( !(trace_is_on = shm_malloc(sizeof(int))) ) {
227 LM_ERR("no more shared memory!\n");
228 return -1;
229 }
230
231 *trace_is_on = trace_is_on_tmp;
232 if ( trace_filter_route ) {
233 trace_filter_route_ref =
234 ref_script_route_by_name( trace_filter_route,
235 sroutes->request, RT_NO, REQUEST_ROUTE, 0);
236 }
237
238 return 0;
239}
240
241
242static int ws_conn_init(struct tcp_connection* c)

Callers

nothing calls this directly

Calls 3

trace_prot_bindFunction · 0.85
shm_mallocFunction · 0.85
ref_script_route_by_nameFunction · 0.85

Tested by

no test coverage detected