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

Function ipc_register_handler

ipc.c:149–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147
148
149ipc_handler_type ipc_register_handler( ipc_handler_f *hdl, char *name)
150{
151 ipc_handler *new;
152
153 /* allocate an n+1 new buffer to accomodate the new handler */
154 new = (ipc_handler*)
155 pkg_malloc( (ipc_handlers_no+1)*sizeof(ipc_handler) );
156 if (new==NULL) {
157 LM_ERR("failed to alloctes IPC handler array for size %d\n",
158 ipc_handlers_no+1);
159 return -1;
160 }
161
162 /* copy previous records, if any */
163 if (ipc_handlers) {
164 memcpy( new, ipc_handlers, ipc_handlers_no*sizeof(ipc_handler) );
165 pkg_free( ipc_handlers );
166 }
167
168 /* copy handler function */
169 new[ipc_handlers_no].func = hdl;
170
171 /* copy the name, trunkate it needed, but keep it null terminated */
172 strncpy( new[ipc_handlers_no].name , name, IPC_HANDLER_NAME_MAX);
173 new[ipc_handlers_no].name[IPC_HANDLER_NAME_MAX] = 0;
174
175 ipc_handlers = new;
176
177 LM_DBG("IPC type %d [%s] registered with handler %p\n",
178 ipc_handlers_no, ipc_handlers[ipc_handlers_no].name, hdl );
179
180 return ipc_handlers_no++;
181}
182
183
184static inline int __ipc_send_job(int fd, int dst_proc, ipc_handler_type type,

Callers 6

init_ipcFunction · 0.85
fs_ipc_initFunction · 0.85
mod_initFunction · 0.85
dm_init_ipcFunction · 0.85
fss_ipc_initFunction · 0.85
janus_ipc_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected