Bitcoin Core 31.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/overloaded.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 <span>
#include <string_view>
#include <unordered_map>
#include <unordered_set>
#include <variant>
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 RPCMethod help ()
 
static RPCMethod stop ()
 
static RPCMethod uptime ()
 
static RPCMethod getrpcinfo ()
 
static RPCResult OpenRPCDocResult ()
 
static RPCMethod getopenrpcinfo ()
 
static RPCMethod rpc_discover ()
 
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 867 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 837 of file server.cpp.

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

◆ getopenrpcinfo()

static RPCMethod getopenrpcinfo ( )
static

Definition at line 559 of file server.cpp.

Here is the call graph for this function:

◆ getrpcinfo()

static RPCMethod getrpcinfo ( )
static

Definition at line 199 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 RPCMethod help ( void  )
static

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

Here is the caller graph for this function:

◆ IsDeprecatedRPCEnabled()

bool IsDeprecatedRPCEnabled ( const std::string &  method)

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

Here is the caller graph for this function:

◆ JSONRPCExec()

UniValue JSONRPCExec ( const JSONRPCRequest jreq,
bool  catch_errors 
)

Definition at line 711 of file server.cpp.

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

◆ OpenRPCDocResult()

static RPCResult OpenRPCDocResult ( )
static

Definition at line 519 of file server.cpp.

Here is the caller graph for this function:

◆ rpc_discover()

static RPCMethod rpc_discover ( )
static

Definition at line 580 of file server.cpp.

Here is the call graph for this function:

◆ RpcInterruptionPoint()

void RpcInterruptionPoint ( )

Throw JSONRPCError if RPC is not running.

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

Here is the caller graph for this function:

◆ SetRPCWarmupFinished()

void SetRPCWarmupFinished ( )

Definition at line 689 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 683 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 677 of file server.cpp.

Here is the caller graph for this function:

◆ StartRPC()

void StartRPC ( )

Definition at line 638 of file server.cpp.

Here is the caller graph for this function:

◆ stop()

static RPCMethod stop ( )
static

Definition at line 152 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 655 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 733 of file server.cpp.

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

◆ uptime()

static RPCMethod uptime ( )
static

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

◆ g_rpc_server_info

RPCServerInfo g_rpc_server_info
static

Definition at line 56 of file server.cpp.

◆ g_rpc_warmup_mutex

GlobalMutex g_rpc_warmup_mutex
static

Definition at line 38 of file server.cpp.

◆ tableRPC

CRPCTable tableRPC

Definition at line 991 of file server.cpp.

◆ vRPCCommands

const CRPCCommand vRPCCommands[]
static
Initial value:
{
{"control", &getopenrpcinfo},
{"control", &rpc_discover},
{"control", &getrpcinfo},
{"control", &help},
{"control", &stop},
{"control", &uptime},
}
static RPCMethod stop()
Definition: server.cpp:152
static RPCMethod help()
Definition: server.cpp:123
static RPCMethod getrpcinfo()
Definition: server.cpp:199
static RPCMethod getopenrpcinfo()
Definition: server.cpp:559
static RPCMethod uptime()
Definition: server.cpp:179
static RPCMethod rpc_discover()
Definition: server.cpp:580

Definition at line 598 of file server.cpp.