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

Function w_mi_help_1

mi/mi.c:976–1020  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

974}
975
976mi_response_t *w_mi_help_1(const mi_params_t *params,
977 struct mi_handler *async_hdl)
978{
979 mi_response_t *resp;
980 mi_item_t *resp_obj;
981 struct mi_cmd *cmd;
982 str cmd_s;
983
984 if (get_mi_string_param(params, "mi_cmd", &cmd_s.s, &cmd_s.len) < 0)
985 return init_mi_param_error();
986
987 /* search the command */
988 cmd = lookup_mi_cmd(cmd_s.s, cmd_s.len);
989 if (!cmd)
990 return init_mi_error(404, MI_SSTR(MI_UNKNOWN_CMD));
991
992 resp = init_mi_result_object(&resp_obj);
993 if (!resp)
994 return 0;
995
996 if (cmd->help.s) {
997 if (add_mi_string(resp_obj, MI_SSTR("Help"), cmd->help.s, cmd->help.len)
998 < 0) {
999 LM_ERR("cannot add mi item\n");
1000 goto error;
1001 }
1002 } else {
1003 if (add_mi_string(resp_obj, MI_SSTR("Help"), MI_SSTR(MI_NO_HELP)) < 0) {
1004 LM_ERR("cannot add mi item\n");
1005 goto error;
1006 }
1007 }
1008
1009 if (cmd->module.len && cmd->module.s && add_mi_string(resp_obj,
1010 MI_SSTR("Exported by"), cmd->module.s, cmd->module.len) < 0) {
1011 LM_ERR("cannot add mi item\n");
1012 goto error;
1013 }
1014
1015 return resp;
1016
1017error:
1018 free_mi_response(resp);
1019 return 0;
1020}

Callers

nothing calls this directly

Calls 7

get_mi_string_paramFunction · 0.85
init_mi_param_errorFunction · 0.85
lookup_mi_cmdFunction · 0.85
init_mi_errorFunction · 0.85
init_mi_result_objectFunction · 0.85
add_mi_stringFunction · 0.85
free_mi_responseFunction · 0.85

Tested by

no test coverage detected