Syntax of "t_hash" : no nodes */
| 619 | no nodes |
| 620 | */ |
| 621 | mi_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 | |
| 653 | error: |
| 654 | free_mi_response(resp); |
| 655 | return init_mi_error(500, MI_SSTR("Internal error")); |
| 656 | } |
| 657 | |
| 658 | |
| 659 | /* |
nothing calls this directly
no test coverage detected