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

Function mi_get_sizes

modules/mqueue/mqueue_mod.c:340–376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338}
339
340mi_response_t *mi_get_sizes(const mi_params_t *params,
341 struct mi_handler *async_hdl)
342{
343 mi_response_t *resp;
344 mi_item_t *resp_obj, *mq_array, *mq_item;
345 mq_head_t *mh = mq_head_get(NULL);
346 int size;
347
348 resp = init_mi_result_object(&resp_obj);
349 if (!resp)
350 return NULL;
351
352 mq_array = add_mi_array(resp_obj, MI_SSTR("Queue"));
353 if (!mq_array)
354 goto error;
355
356 while(mh != NULL) {
357 lock_get(&mh->lock);
358 size = mh->csize;
359 lock_release(&mh->lock);
360 mq_item = add_mi_object(mq_array, MI_SSTR(""));
361 if (!mq_item)
362 goto error;
363 if (add_mi_string_fmt(mq_item, MI_SSTR("name"), mh->name.s, mh->name.len) < 0)
364 goto error;
365 if (add_mi_number(mq_item, MI_SSTR("size"), size) < 0)
366 goto error;
367 mh = mh->next;
368 }
369
370 return resp;
371
372error:
373 LM_ERR("Unable to create reply\n");
374 free_mi_response(resp);
375 return NULL;
376}
377
378mi_response_t *mi_fetch(const mi_params_t *params,
379 struct mi_handler *async_hdl)

Callers

nothing calls this directly

Calls 9

mq_head_getFunction · 0.85
init_mi_result_objectFunction · 0.85
add_mi_arrayFunction · 0.85
lock_getFunction · 0.85
lock_releaseFunction · 0.85
add_mi_objectFunction · 0.85
add_mi_string_fmtFunction · 0.85
add_mi_numberFunction · 0.85
free_mi_responseFunction · 0.85

Tested by

no test coverage detected