Bitcoin Core 32.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 <rpc/protocol.h>
#include <rpc/server_util.h>
#include <rpc/util.h>
#include <sync.h>
#include <tinyformat.h>
#include <util/check.h>
#include <util/fs.h>
#include <util/overloaded.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/time.h>
#include <algorithm>
#include <atomic>
#include <cstddef>
#include <exception>
#include <list>
#include <mutex>
#include <optional>
#include <set>
#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 879 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 849 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 571 of file server.cpp.

Here is the call graph for this function:

◆ getrpcinfo()

static RPCMethod getrpcinfo ( )
static

Definition at line 203 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 127 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 656 of file server.cpp.

Here is the caller graph for this function:

◆ IsDeprecatedRPCEnabled()

bool IsDeprecatedRPCEnabled ( const std::string &  method)

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

Here is the caller graph for this function:

◆ JSONRPCExec()

UniValue JSONRPCExec ( const JSONRPCRequest jreq,
bool  catch_errors 
)

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

Here is the caller graph for this function:

◆ rpc_discover()

static RPCMethod rpc_discover ( )
static

Definition at line 592 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 684 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 708 of file server.cpp.

Here is the caller graph for this function:

◆ SetRPCWarmupFinished()

void SetRPCWarmupFinished ( )

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

Here is the caller graph for this function:

◆ StartRPC()

void StartRPC ( )

Definition at line 650 of file server.cpp.

Here is the caller graph for this function:

◆ stop()

static RPCMethod stop ( )
static

Definition at line 156 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 667 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 745 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 183 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 43 of file server.cpp.

◆ g_rpc_server_info

RPCServerInfo g_rpc_server_info
static

Definition at line 60 of file server.cpp.

◆ g_rpc_warmup_mutex

GlobalMutex g_rpc_warmup_mutex
static

Definition at line 42 of file server.cpp.

◆ tableRPC

CRPCTable tableRPC

Definition at line 1003 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:156
static RPCMethod help()
Definition: server.cpp:127
static RPCMethod getrpcinfo()
Definition: server.cpp:203
static RPCMethod getopenrpcinfo()
Definition: server.cpp:571
static RPCMethod uptime()
Definition: server.cpp:183
static RPCMethod rpc_discover()
Definition: server.cpp:592

Definition at line 610 of file server.cpp.