Bitcoin Core  0.19.99
P2P Digital Currency
Classes | Functions | Variables
server.cpp File Reference
#include <rpc/server.h>
#include <rpc/util.h>
#include <shutdown.h>
#include <sync.h>
#include <util/strencodings.h>
#include <util/system.h>
#include <boost/signals2/signal.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <memory>
#include <unordered_map>
Include dependency graph for server.cpp:

Go to the source code of this file.

Classes

struct  RPCCommandExecutionInfo
 
struct  RPCServerInfo
 
struct  RPCCommandExecution
 
struct  CRPCSignals
 

Functions

static bool fRPCInWarmup GUARDED_BY (cs_rpcWarmup) = "RPC server started"
 
static bool ExecuteCommand (const CRPCCommand &command, const JSONRPCRequest &request, UniValue &result, bool last_handler)
 
UniValue help (const JSONRPCRequest &jsonRequest)
 
UniValue stop (const JSONRPCRequest &jsonRequest)
 
static UniValue uptime (const JSONRPCRequest &jsonRequest)
 
static UniValue getrpcinfo (const JSONRPCRequest &request)
 
void StartRPC ()
 
void InterruptRPC ()
 
void StopRPC ()
 
bool IsRPCRunning ()
 Query whether RPC is running. More...
 
void SetRPCWarmupStatus (const std::string &newStatus)
 Set the RPC warmup status. More...
 
void SetRPCWarmupFinished ()
 
bool RPCIsInWarmup (std::string *outStatus)
 
bool IsDeprecatedRPCEnabled (const std::string &method)
 
static UniValue JSONRPCExecOne (JSONRPCRequest jreq, const UniValue &req)
 
std::string JSONRPCExecBatch (const JSONRPCRequest &jreq, const UniValue &vReq)
 
static JSONRPCRequest transformNamedArguments (const JSONRPCRequest &in, const std::vector< std::string > &argNames)
 Process named arguments into a vector of positional arguments, based on the passed-in specification for the RPC call's arguments. More...
 
void RPCSetTimerInterfaceIfUnset (RPCTimerInterface *iface)
 Set the factory function for timer, but only, if unset. More...
 
void RPCSetTimerInterface (RPCTimerInterface *iface)
 Set the factory function for timers. More...
 
void RPCUnsetTimerInterface (RPCTimerInterface *iface)
 Unset factory function for timers. More...
 
void RPCRunLater (const std::string &name, std::function< void()> func, int64_t nSeconds)
 Run func nSeconds from now. More...
 
int RPCSerializationFlags ()
 

Variables

static RecursiveMutex cs_rpcWarmup
 
static std::atomic< bool > g_rpc_running {false}
 
static RPCTimerInterfacetimerInterface = nullptr
 
static std::map< std::string, std::unique_ptr< RPCTimerBase > > deadlineTimers
 
static RPCServerInfo g_rpc_server_info
 
static struct CRPCSignals g_rpcSignals
 
static const CRPCCommand vRPCCommands []
 
CRPCTable tableRPC
 

Function Documentation

◆ ExecuteCommand()

static bool ExecuteCommand ( const CRPCCommand command,
const JSONRPCRequest request,
UniValue result,
bool  last_handler 
)
static

Definition at line 440 of file server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getrpcinfo()

static UniValue getrpcinfo ( const JSONRPCRequest request)
static

Definition at line 194 of file server.cpp.

Here is the call graph for this function:

◆ GUARDED_BY()

static std::string rpcWarmupStatus GUARDED_BY ( cs_rpcWarmup  ) = "RPC server started"
static

◆ help()

UniValue help ( const JSONRPCRequest jsonRequest)

Definition at line 130 of file server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InterruptRPC()

void InterruptRPC ( )

Definition at line 288 of file server.cpp.

Here is the caller graph for this function:

◆ IsDeprecatedRPCEnabled()

bool IsDeprecatedRPCEnabled ( const std::string &  method)

Definition at line 329 of file server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsRPCRunning()

bool IsRPCRunning ( )

Query whether RPC is running.

Definition at line 303 of file server.cpp.

Here is the caller graph for this function:

◆ JSONRPCExecBatch()

std::string JSONRPCExecBatch ( const JSONRPCRequest jreq,
const UniValue vReq 
)

Definition at line 359 of file server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ JSONRPCExecOne()

static UniValue JSONRPCExecOne ( JSONRPCRequest  jreq,
const UniValue req 
)
static

Definition at line 336 of file server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RPCIsInWarmup()

bool RPCIsInWarmup ( std::string *  outStatus)

Definition at line 321 of file server.cpp.

Here is the caller graph for this function:

◆ RPCRunLater()

void RPCRunLater ( const std::string &  name,
std::function< void()>  func,
int64_t  nSeconds 
)

Run func nSeconds from now.

Overrides previous timer <name> (if any).

Definition at line 482 of file server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RPCSerializationFlags()

int RPCSerializationFlags ( )

Definition at line 491 of file server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RPCSetTimerInterface()

void RPCSetTimerInterface ( RPCTimerInterface iface)

Set the factory function for timers.

Definition at line 471 of file server.cpp.

Here is the caller graph for this function:

◆ RPCSetTimerInterfaceIfUnset()

void RPCSetTimerInterfaceIfUnset ( RPCTimerInterface iface)

Set the factory function for timer, but only, if unset.

Definition at line 465 of file server.cpp.

Here is the caller graph for this function:

◆ RPCUnsetTimerInterface()

void RPCUnsetTimerInterface ( RPCTimerInterface iface)

Unset factory function for timers.

Definition at line 476 of file server.cpp.

Here is the caller graph for this function:

◆ SetRPCWarmupFinished()

void SetRPCWarmupFinished ( )

Definition at line 314 of file server.cpp.

Here is the caller graph for this function:

◆ SetRPCWarmupStatus()

void SetRPCWarmupStatus ( const std::string &  newStatus)

Set the RPC warmup status.

When this is done, all RPC calls will error out immediately with RPC_IN_WARMUP.

Definition at line 308 of file server.cpp.

Here is the caller graph for this function:

◆ StartRPC()

void StartRPC ( )

Definition at line 281 of file server.cpp.

Here is the caller graph for this function:

◆ stop()

UniValue stop ( const JSONRPCRequest jsonRequest)

Definition at line 154 of file server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StopRPC()

void StopRPC ( )

Definition at line 295 of file server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ transformNamedArguments()

static JSONRPCRequest transformNamedArguments ( const JSONRPCRequest in,
const std::vector< std::string > &  argNames 
)
inlinestatic

Process named arguments into a vector of positional arguments, based on the passed-in specification for the RPC call's arguments.

Definition at line 372 of file server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uptime()

static UniValue uptime ( const JSONRPCRequest jsonRequest)
static

Definition at line 177 of file server.cpp.

Here is the call graph for this function:

Variable Documentation

◆ cs_rpcWarmup

RecursiveMutex cs_rpcWarmup
static

Definition at line 21 of file server.cpp.

◆ deadlineTimers

std::map<std::string, std::unique_ptr<RPCTimerBase> > deadlineTimers
static

Definition at line 28 of file server.cpp.

◆ g_rpc_running

std::atomic<bool> g_rpc_running {false}
static

Definition at line 22 of file server.cpp.

◆ g_rpc_server_info

RPCServerInfo g_rpc_server_info
static

Definition at line 43 of file server.cpp.

◆ g_rpcSignals

struct CRPCSignals g_rpcSignals
static

◆ tableRPC

CRPCTable tableRPC

Definition at line 499 of file server.cpp.

◆ timerInterface

RPCTimerInterface* timerInterface = nullptr
static

Definition at line 26 of file server.cpp.

◆ vRPCCommands

const CRPCCommand vRPCCommands[]
static
Initial value:
=
{
{ "control", "getrpcinfo", &getrpcinfo, {} },
{ "control", "help", &help, {"command"} },
{ "control", "stop", &stop, {"wait"} },
{ "control", "uptime", &uptime, {} },
}
static UniValue uptime(const JSONRPCRequest &jsonRequest)
Definition: server.cpp:177
static UniValue getrpcinfo(const JSONRPCRequest &request)
Definition: server.cpp:194
UniValue help(const JSONRPCRequest &jsonRequest)
Definition: server.cpp:130
UniValue stop(const JSONRPCRequest &jsonRequest)
Definition: server.cpp:154

Definition at line 236 of file server.cpp.