Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/server.h
Show All 9 Lines | |||||
#include <amount.h> | #include <amount.h> | ||||
#include <rpc/command.h> | #include <rpc/command.h> | ||||
#include <rpc/request.h> | #include <rpc/request.h> | ||||
#include <rwcollection.h> | #include <rwcollection.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <univalue.h> | #include <univalue.h> | ||||
#include <boost/noncopyable.hpp> | |||||
#include <cstdint> | #include <cstdint> | ||||
#include <functional> | #include <functional> | ||||
#include <map> | #include <map> | ||||
#include <string> | #include <string> | ||||
static const unsigned int DEFAULT_RPC_SERIALIZE_VERSION = 1; | static const unsigned int DEFAULT_RPC_SERIALIZE_VERSION = 1; | ||||
class CRPCCommand; | class CRPCCommand; | ||||
namespace RPCServerSignals { | namespace RPCServerSignals { | ||||
void OnStarted(std::function<void()> slot); | void OnStarted(std::function<void()> slot); | ||||
void OnStopped(std::function<void()> slot); | void OnStopped(std::function<void()> slot); | ||||
} // namespace RPCServerSignals | } // namespace RPCServerSignals | ||||
class Config; | class Config; | ||||
typedef std::map<std::string, std::unique_ptr<RPCCommand>> RPCCommandMap; | typedef std::map<std::string, std::unique_ptr<RPCCommand>> RPCCommandMap; | ||||
/** | /** | ||||
* Class for registering and managing all RPC calls. | * Class for registering and managing all RPC calls. | ||||
*/ | */ | ||||
class RPCServer : public boost::noncopyable { | class RPCServer { | ||||
private: | private: | ||||
RWCollection<RPCCommandMap> commands; | RWCollection<RPCCommandMap> commands; | ||||
public: | public: | ||||
RPCServer() {} | RPCServer() {} | ||||
RPCServer(const RPCServer &) = delete; | |||||
RPCServer &operator=(const RPCServer &) = delete; | |||||
/** | /** | ||||
* Attempts to execute an RPC command from the given request. | * Attempts to execute an RPC command from the given request. | ||||
* If no RPC command exists that matches the request, an error is returned. | * If no RPC command exists that matches the request, an error is returned. | ||||
*/ | */ | ||||
UniValue ExecuteCommand(Config &config, | UniValue ExecuteCommand(Config &config, | ||||
const JSONRPCRequest &request) const; | const JSONRPCRequest &request) const; | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 198 Lines • Show Last 20 Lines |