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

Function mi_reset_stats

statistics.c:934–962  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

932}
933
934static mi_response_t *mi_reset_stats(const mi_params_t *params,
935 struct mi_handler *async_hdl)
936{
937 mi_item_t *params_arr;
938 int i, no_params;
939 str val;
940 stat_var *stat;
941 int found = 0;
942
943 if (get_mi_array_param(params, "statistics", &params_arr, &no_params) < 0)
944 return init_mi_param_error();
945
946 for (i = 0; i < no_params; i++) {
947 if (get_mi_arr_param_string(params_arr, i, &val.s, &val.len) < 0)
948 return init_mi_param_error();
949
950 stat = get_stat(&val);
951 if (stat==0)
952 continue;
953
954 reset_stat( stat );
955 found = 1;
956 }
957
958 if (!found)
959 return init_mi_error(404, MI_SSTR("Statistics Not Found"));
960
961 return init_mi_result_ok();
962}
963
964static mi_response_t *mi_reset_all_stats(const mi_params_t *params,
965 struct mi_handler *async_hdl)

Callers

nothing calls this directly

Calls 5

get_mi_array_paramFunction · 0.85
init_mi_param_errorFunction · 0.85
get_mi_arr_param_stringFunction · 0.85
get_statFunction · 0.85
init_mi_errorFunction · 0.85

Tested by

no test coverage detected