Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/server.cpp
Show First 20 Lines • Show All 216 Lines • ▼ Show 20 Lines | std::vector<uint8_t> ParseHexV(const UniValue &v, std::string strName) { | ||||
} | } | ||||
return ParseHex(strHex); | return ParseHex(strHex); | ||||
} | } | ||||
std::vector<uint8_t> ParseHexO(const UniValue &o, std::string strKey) { | std::vector<uint8_t> ParseHexO(const UniValue &o, std::string strKey) { | ||||
return ParseHexV(find_value(o, strKey), strKey); | return ParseHexV(find_value(o, strKey), strKey); | ||||
} | } | ||||
/** | |||||
* Note: This interface may still be subject to change. | |||||
*/ | |||||
std::string CRPCTable::help(Config &config, const std::string &strCommand, | std::string CRPCTable::help(Config &config, const std::string &strCommand, | ||||
const JSONRPCRequest &helpreq) const { | const JSONRPCRequest &helpreq) const { | ||||
std::string strRet; | std::string strRet; | ||||
std::string category; | std::string category; | ||||
std::set<const ContextFreeRPCCommand *> setDone; | std::set<const ContextFreeRPCCommand *> setDone; | ||||
std::vector<std::pair<std::string, const ContextFreeRPCCommand *>> | std::vector<std::pair<std::string, const ContextFreeRPCCommand *>> | ||||
vCommands; | vCommands; | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
static UniValue help(Config &config, const JSONRPCRequest &jsonRequest) { | static UniValue help(Config &config, const JSONRPCRequest &jsonRequest) { | ||||
if (jsonRequest.fHelp || jsonRequest.params.size() > 1) { | if (jsonRequest.fHelp || jsonRequest.params.size() > 1) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"help", | "help", | ||||
"\nList all commands, or get help for a specified command.\n", | "\nList all commands, or get help for a specified command.\n", | ||||
{ | { | ||||
{"command", RPCArg::Type::STR, true}, | {"command", RPCArg::Type::STR, /* opt */ true, | ||||
/* default_val */ "", "The command to get help on"}, | |||||
}} | }} | ||||
.ToString() + | .ToString() + | ||||
"\nArguments:\n" | |||||
"1. \"command\" (string, optional) The command to get help on\n" | |||||
"\nResult:\n" | "\nResult:\n" | ||||
"\"text\" (string) The help text\n"); | "\"text\" (string) The help text\n"); | ||||
} | } | ||||
std::string strCommand; | std::string strCommand; | ||||
if (jsonRequest.params.size() > 0) { | if (jsonRequest.params.size() > 0) { | ||||
strCommand = jsonRequest.params[0].get_str(); | strCommand = jsonRequest.params[0].get_str(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | static UniValue getrpcinfo(const Config &config, | ||||
} | } | ||||
UniValue result(UniValue::VOBJ); | UniValue result(UniValue::VOBJ); | ||||
result.pushKV("active_commands", active_commands); | result.pushKV("active_commands", active_commands); | ||||
return result; | return result; | ||||
} | } | ||||
/** | |||||
* Call Table | |||||
*/ | |||||
// clang-format off | // clang-format off | ||||
static const ContextFreeRPCCommand vRPCCommands[] = { | static const ContextFreeRPCCommand vRPCCommands[] = { | ||||
// category name actor (function) argNames | // category name actor (function) argNames | ||||
// ------------------- ------------------------ ---------------------- ---------- | // ------------------- ------------------------ ---------------------- ---------- | ||||
/* Overall control/query calls */ | /* Overall control/query calls */ | ||||
{ "control", "getrpcinfo", getrpcinfo, {} }, | { "control", "getrpcinfo", getrpcinfo, {} }, | ||||
{ "control", "help", help, {"command"} }, | { "control", "help", help, {"command"} }, | ||||
{ "control", "stop", stop, {"wait"} }, | { "control", "stop", stop, {"wait"} }, | ||||
▲ Show 20 Lines • Show All 263 Lines • Show Last 20 Lines |