6 #ifndef BITCOIN_RPC_SERVER_H
7 #define BITCOIN_RPC_SERVER_H
25 void OnStarted(std::function<
void ()> slot);
26 void OnStopped(std::function<
void ()> slot);
64 virtual const char *
Name() = 0;
85 void RPCRunLater(
const std::string&
name, std::function<
void()> func, int64_t nSeconds);
109 [fn](const
JSONRPCRequest& request,
UniValue& result, bool) { result = fn().HandleRequest(request);
return true; },
127 std::vector<std::pair<std::string, bool>>
argNames;
137 std::map<std::string, std::vector<const CRPCCommand*>>
mapCommands;
std::vector< std::pair< std::string, bool > > argNames
List of method arguments and whether they are named-only.
CRPCCommand(std::string category, std::string name, Actor actor, std::vector< std::pair< std::string, bool >> args, intptr_t unique_id)
Constructor taking Actor callback supporting multiple handlers.
std::function< bool(const JSONRPCRequest &request, UniValue &result, bool last_handler)> Actor
RPC method handler reading request and assigning result.
CRPCCommand(std::string category, RpcMethodFnType fn)
Simplified constructor taking plain RpcMethodFnType function pointer.
std::map< std::string, std::vector< const CRPCCommand * > > mapCommands
bool removeCommand(const std::string &name, const CRPCCommand *pcmd)
std::vector< std::string > listCommands() const
Returns a list of registered commands.
UniValue execute(const JSONRPCRequest &request) const
Execute a method.
void appendCommand(const std::string &name, const CRPCCommand *pcmd)
Appends a CRPCCommand to the dispatch table.
std::string help(const std::string &name, const JSONRPCRequest &helpreq) const
UniValue dumpArgMap(const JSONRPCRequest &request) const
Return all named arguments that need to be converted by the client from string to another JSON type.
Opaque base class for timers returned by NewTimerFunc.
virtual RPCTimerBase * NewTimer(std::function< void()> &func, int64_t millis)=0
Factory function for timers.
virtual ~RPCTimerInterface()
virtual const char * Name()=0
Implementation name.
void OnStarted(std::function< void()> slot)
void OnStopped(std::function< void()> slot)
void RPCSetTimerInterfaceIfUnset(RPCTimerInterface *iface)
Set the factory function for timer, but only, if unset.
bool IsDeprecatedRPCEnabled(const std::string &method)
void SetRPCWarmupFinished()
static const unsigned int DEFAULT_RPC_SERIALIZE_VERSION
void RPCUnsetTimerInterface(RPCTimerInterface *iface)
Unset factory function for timers.
void RPCRunLater(const std::string &name, std::function< void()> func, int64_t nSeconds)
Run func nSeconds from now.
bool RPCIsInWarmup(std::string *outStatus)
RPCHelpMan(* RpcMethodFnType)()
bool IsRPCRunning()
Query whether RPC is running.
std::string JSONRPCExecBatch(const JSONRPCRequest &jreq, const UniValue &vReq)
int RPCSerializationFlags()
void SetRPCWarmupStatus(const std::string &newStatus)
Set the RPC warmup status.
void RPCSetTimerInterface(RPCTimerInterface *iface)
Set the factory function for timers.
void RpcInterruptionPoint()
Throw JSONRPCError if RPC is not running.