Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/server.cpp
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | |||||
void RPCServerSignals::OnStarted(std::function<void()> slot) { | void RPCServerSignals::OnStarted(std::function<void()> slot) { | ||||
g_rpcSignals.Started.connect(slot); | g_rpcSignals.Started.connect(slot); | ||||
} | } | ||||
void RPCServerSignals::OnStopped(std::function<void()> slot) { | void RPCServerSignals::OnStopped(std::function<void()> slot) { | ||||
g_rpcSignals.Stopped.connect(slot); | g_rpcSignals.Stopped.connect(slot); | ||||
} | } | ||||
void RPCServerSignals::OnPreCommand( | |||||
std::function<void(const ContextFreeRPCCommand &)> slot) { | |||||
g_rpcSignals.PreCommand.connect(boost::bind(slot, _1)); | |||||
} | |||||
void RPCTypeCheck(const UniValue ¶ms, | void RPCTypeCheck(const UniValue ¶ms, | ||||
const std::list<UniValue::VType> &typesExpected, | const std::list<UniValue::VType> &typesExpected, | ||||
bool fAllowNull) { | bool fAllowNull) { | ||||
unsigned int i = 0; | unsigned int i = 0; | ||||
for (UniValue::VType t : typesExpected) { | for (UniValue::VType t : typesExpected) { | ||||
if (params.size() <= i) { | if (params.size() <= i) { | ||||
break; | break; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 233 Lines • ▼ Show 20 Lines | static UniValue uptime(const Config &config, | ||||
return GetTime() - GetStartupTime(); | return GetTime() - GetStartupTime(); | ||||
} | } | ||||
/** | /** | ||||
* Call Table | * Call Table | ||||
*/ | */ | ||||
// clang-format off | // clang-format off | ||||
static const ContextFreeRPCCommand vRPCCommands[] = { | static const ContextFreeRPCCommand vRPCCommands[] = { | ||||
// category name actor (function) okSafe argNames | // category name actor (function) argNames | ||||
// ------------------- ------------------------ ---------------------- ------ ---------- | // ------------------- ------------------------ ---------------------- ---------- | ||||
/* Overall control/query calls */ | /* Overall control/query calls */ | ||||
{ "control", "help", help, true, {"command"} }, | { "control", "help", help, {"command"} }, | ||||
{ "control", "stop", stop, true, {} }, | { "control", "stop", stop, {} }, | ||||
{ "control", "uptime", uptime, true, {} }, | { "control", "uptime", uptime, {} }, | ||||
}; | }; | ||||
// clang-format on | // clang-format on | ||||
CRPCTable::CRPCTable() { | CRPCTable::CRPCTable() { | ||||
unsigned int vcidx; | unsigned int vcidx; | ||||
for (vcidx = 0; vcidx < (sizeof(vRPCCommands) / sizeof(vRPCCommands[0])); | for (vcidx = 0; vcidx < (sizeof(vRPCCommands) / sizeof(vRPCCommands[0])); | ||||
vcidx++) { | vcidx++) { | ||||
const ContextFreeRPCCommand *pcmd; | const ContextFreeRPCCommand *pcmd; | ||||
▲ Show 20 Lines • Show All 241 Lines • Show Last 20 Lines |