Bitcoin Core 29.99.0
P2P Digital Currency
Classes | Functions | Variables
server.cpp File Reference
#include <bitcoin-build-config.h>
#include <rpc/server.h>
#include <common/args.h>
#include <common/system.h>
#include <logging.h>
#include <node/context.h>
#include <node/kernel_notifications.h>
#include <rpc/server_util.h>
#include <rpc/util.h>
#include <sync.h>
#include <util/signalinterrupt.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/time.h>
#include <validation.h>
#include <algorithm>
#include <cassert>
#include <chrono>
#include <memory>
#include <mutex>
#include <unordered_map>
Include dependency graph for server.cpp:

Go to the source code of this file.

Classes

struct  RPCCommandExecutionInfo
 
struct  RPCServerInfo
 
struct  RPCCommandExecution
 

Functions

static bool fRPCInWarmup GUARDED_BY (g_rpc_warmup_mutex) = "RPC server started"
 
static bool ExecuteCommand (const CRPCCommand &command, const JSONRPCRequest &request, UniValue &result, bool last_handler)
 
static RPCHelpMan help ()
 
static RPCHelpMan stop ()
 
static RPCHelpMan uptime ()
 
static RPCHelpMan getrpcinfo ()
 
void StartRPC ()
 
void InterruptRPC ()
 
void StopRPC ()
 
bool IsRPCRunning ()
 Query whether RPC is running. More...
 
void RpcInterruptionPoint ()
 Throw JSONRPCError if RPC is not running. More...
 
void SetRPCWarmupStatus (const std::string &newStatus)
 Set the RPC warmup status. More...
 
void SetRPCWarmupStarting ()
 
void SetRPCWarmupFinished ()
 
bool RPCIsInWarmup (std::string *outStatus)
 
bool IsDeprecatedRPCEnabled (const std::string &method)
 
UniValue JSONRPCExec (const JSONRPCRequest &jreq, bool catch_errors)
 
static JSONRPCRequest transformNamedArguments (const JSONRPCRequest &in, const std::vector< std::pair< std::string, bool > > &argNames)
 Process named arguments into a vector of positional arguments, based on the passed-in specification for the RPC call's arguments. More...
 
static bool ExecuteCommands (const std::vector< const CRPCCommand * > &commands, const JSONRPCRequest &request, UniValue &result)
 

Variables

static GlobalMutex g_rpc_warmup_mutex
 
static std::atomic< bool > g_rpc_running {false}
 
static RPCServerInfo g_rpc_server_info
 
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 504 of file server.cpp.

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

◆ ExecuteCommands()

static bool ExecuteCommands ( const std::vector< const CRPCCommand * > &  commands,
const JSONRPCRequest request,
UniValue result 
)
static

Definition at line 474 of file server.cpp.

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

◆ getrpcinfo()

static RPCHelpMan getrpcinfo ( )
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 ( g_rpc_warmup_mutex  ) = "RPC server started"
static

◆ help()

static RPCHelpMan help ( )
static

Definition at line 118 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 281 of file server.cpp.

Here is the caller graph for this function:

◆ IsDeprecatedRPCEnabled()

bool IsDeprecatedRPCEnabled ( const std::string &  method)

Definition at line 341 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 304 of file server.cpp.

Here is the caller graph for this function:

◆ JSONRPCExec()

UniValue JSONRPCExec ( const JSONRPCRequest jreq,
bool  catch_errors 
)

Definition at line 348 of file server.cpp.

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

◆ RpcInterruptionPoint()

void RpcInterruptionPoint ( )

Throw JSONRPCError if RPC is not running.

Definition at line 309 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 333 of file server.cpp.

Here is the caller graph for this function:

◆ SetRPCWarmupFinished()

void SetRPCWarmupFinished ( )

Definition at line 326 of file server.cpp.

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

◆ SetRPCWarmupStarting()

void SetRPCWarmupStarting ( )

Definition at line 320 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 314 of file server.cpp.

Here is the caller graph for this function:

◆ StartRPC()

void StartRPC ( )

Definition at line 275 of file server.cpp.

Here is the caller graph for this function:

◆ stop()

static RPCHelpMan stop ( )
static

Definition at line 147 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 292 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::pair< std::string, bool > > &  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 370 of file server.cpp.

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

◆ uptime()

static RPCHelpMan uptime ( )
static

Definition at line 174 of file server.cpp.

Here is the call graph for this function:

Variable Documentation

◆ g_rpc_running

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

Definition at line 34 of file server.cpp.

◆ g_rpc_server_info

RPCServerInfo g_rpc_server_info
static

Definition at line 51 of file server.cpp.

◆ g_rpc_warmup_mutex

GlobalMutex g_rpc_warmup_mutex
static

Definition at line 33 of file server.cpp.

◆ tableRPC

CRPCTable tableRPC

Definition at line 546 of file server.cpp.

◆ vRPCCommands

const CRPCCommand vRPCCommands[]
static
Initial value:
{
{"control", &getrpcinfo},
{"control", &help},
{"control", &stop},
{"control", &uptime},
}
static RPCHelpMan uptime()
Definition: server.cpp:174
static RPCHelpMan getrpcinfo()
Definition: server.cpp:194
static RPCHelpMan stop()
Definition: server.cpp:147
static RPCHelpMan help()
Definition: server.cpp:118

Definition at line 240 of file server.cpp.