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

Function mi_tm_hash

modules/tm/mi.c:621–656  ·  view source on GitHub ↗

Syntax of "t_hash" : no nodes */

Source from the content-addressed store, hash-verified

619 no nodes
620*/
621mi_response_t *mi_tm_hash(const mi_params_t *params,
622 struct mi_handler *async_hdl)
623{
624 mi_response_t *resp;
625 mi_item_t *resp_arr, *resp_item;
626 struct s_table* tm_t;
627 int i;
628
629 resp = init_mi_result_array(&resp_arr);
630 if (!resp)
631 return 0;
632
633 tm_t = get_tm_table();
634
635 for (i=0; i<TM_TABLE_ENTRIES; i++) {
636 resp_item = add_mi_object(resp_arr, NULL, 0);
637 if (!resp_item)
638 goto error;
639
640 if (add_mi_number(resp_item, MI_SSTR("index"), i) < 0)
641 goto error;
642
643 if (add_mi_number(resp_item, MI_SSTR("Current"),
644 tm_t->entrys[i].cur_entries) < 0)
645 goto error;
646 if (add_mi_number(resp_item, MI_SSTR("Total"),
647 tm_t->entrys[i].acc_entries) < 0)
648 goto error;
649 }
650
651 return resp;
652
653error:
654 free_mi_response(resp);
655 return init_mi_error(500, MI_SSTR("Internal error"));
656}
657
658
659/*

Callers

nothing calls this directly

Calls 6

init_mi_result_arrayFunction · 0.85
get_tm_tableFunction · 0.85
add_mi_objectFunction · 0.85
add_mi_numberFunction · 0.85
free_mi_responseFunction · 0.85
init_mi_errorFunction · 0.85

Tested by

no test coverage detected