Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/server.h
Show All 12 Lines | |||||
#include "uint256.h" | #include "uint256.h" | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <functional> | #include <functional> | ||||
#include <list> | #include <list> | ||||
#include <map> | #include <map> | ||||
#include <string> | #include <string> | ||||
#include <boost/noncopyable.hpp> | |||||
#include <univalue.h> | #include <univalue.h> | ||||
static const unsigned int DEFAULT_RPC_SERIALIZE_VERSION = 1; | static const unsigned int DEFAULT_RPC_SERIALIZE_VERSION = 1; | ||||
class ContextFreeRPCCommand; | class ContextFreeRPCCommand; | ||||
namespace RPCServerSignals { | namespace RPCServerSignals { | ||||
void OnStarted(std::function<void()> slot); | void OnStarted(std::function<void()> slot); | ||||
Show All 13 Lines | |||||
struct UniValueType { | struct UniValueType { | ||||
UniValueType(UniValue::VType _type) : typeAny(false), type(_type) {} | UniValueType(UniValue::VType _type) : typeAny(false), type(_type) {} | ||||
UniValueType() : typeAny(true) {} | UniValueType() : typeAny(true) {} | ||||
bool typeAny; | bool typeAny; | ||||
UniValue::VType type; | UniValue::VType type; | ||||
}; | }; | ||||
/** | /** | ||||
* Class for registering and managing all RPC calls. | |||||
*/ | |||||
class RPCServer : public boost::noncopyable { | |||||
public: | |||||
RPCServer() {} | |||||
/** | |||||
* Attempts to execute an RPC command from the given request. | |||||
* If no RPC command exists that matches the request, an error is returned. | |||||
*/ | |||||
UniValue ExecuteCommand(Config &config, | |||||
const JSONRPCRequest &request) const; | |||||
}; | |||||
/** | |||||
* Query whether RPC is running | * Query whether RPC is running | ||||
*/ | */ | ||||
bool IsRPCRunning(); | bool IsRPCRunning(); | ||||
/** | /** | ||||
* Set the RPC warmup status. When this is done, all RPC calls will error out | * Set the RPC warmup status. When this is done, all RPC calls will error out | ||||
* immediately with RPC_IN_WARMUP. | * immediately with RPC_IN_WARMUP. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 190 Lines • ▼ Show 20 Lines | |||||
extern std::string HelpExampleCli(const std::string &methodname, | extern std::string HelpExampleCli(const std::string &methodname, | ||||
const std::string &args); | const std::string &args); | ||||
extern std::string HelpExampleRpc(const std::string &methodname, | extern std::string HelpExampleRpc(const std::string &methodname, | ||||
const std::string &args); | const std::string &args); | ||||
bool StartRPC(); | bool StartRPC(); | ||||
void InterruptRPC(); | void InterruptRPC(); | ||||
void StopRPC(); | void StopRPC(); | ||||
std::string JSONRPCExecBatch(Config &config, const JSONRPCRequest &req, | std::string JSONRPCExecBatch(Config &config, RPCServer &rpcServer, | ||||
const UniValue &vReq); | const JSONRPCRequest &req, const UniValue &vReq); | ||||
void RPCNotifyBlockChange(bool ibd, const CBlockIndex *); | void RPCNotifyBlockChange(bool ibd, const CBlockIndex *); | ||||
/** | /** | ||||
* Retrieves any serialization flags requested in command line argument | * Retrieves any serialization flags requested in command line argument | ||||
*/ | */ | ||||
int RPCSerializationFlags(); | int RPCSerializationFlags(); | ||||
#endif // BITCOIN_RPC_SERVER_H | #endif // BITCOIN_RPC_SERVER_H |