Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
CRPCCommand Class Reference

#include <server.h>

Public Types

using Actor = std::function<bool(const JSONRPCRequest& request, UniValue& result, bool last_handler)>

Public Member Functions

 CRPCCommand (std::string category, std::string name, Actor actor, std::vector< std::pair< std::string, bool > > args, intptr_t unique_id)
 Constructor taking Actor callback supporting multiple handlers.
 CRPCCommand (std::string category, RpcMethodFnType fn)
 Simplified constructor taking plain RpcMethodFnType function pointer.

Public Attributes

std::string category
std::string name
Actor actor
std::vector< std::pair< std::string, bool > > argNames
intptr_t unique_id

Detailed Description

Definition at line 41 of file server.h.

Member Typedef Documentation

◆ Actor

using CRPCCommand::Actor = std::function<bool(const JSONRPCRequest& request, UniValue& result, bool last_handler)>

RPC method handler reading request and assigning result. Should return true if request is fully handled, false if it should be passed on to subsequent handlers.

Definition at line 47 of file server.h.

Constructor & Destructor Documentation

◆ CRPCCommand() [1/2]

CRPCCommand::CRPCCommand ( std::string category,
std::string name,
Actor actor,
std::vector< std::pair< std::string, bool > > args,
intptr_t unique_id )
inline

Constructor taking Actor callback supporting multiple handlers.

Definition at line 50 of file server.h.

Here is the caller graph for this function:

◆ CRPCCommand() [2/2]

CRPCCommand::CRPCCommand ( std::string category,
RpcMethodFnType fn )
inline

Simplified constructor taking plain RpcMethodFnType function pointer.

Definition at line 57 of file server.h.

Here is the call graph for this function:

Member Data Documentation

◆ actor

Actor CRPCCommand::actor

Definition at line 69 of file server.h.

◆ argNames

std::vector<std::pair<std::string, bool> > CRPCCommand::argNames

List of method arguments and whether they are named-only. Incoming RPC requests contain a "params" field that can either be an array containing unnamed arguments or an object containing named arguments. The "argNames" vector is used in the latter case to transform the params object into an array. Each argument in "argNames" gets mapped to a unique position in the array, based on the order it is listed, unless the argument is a named-only argument with argNames[x].second set to true. Named-only arguments are combined into a JSON object that is appended after other arguments, see transformNamedArguments for details.

Definition at line 79 of file server.h.

◆ category

std::string CRPCCommand::category

Definition at line 67 of file server.h.

◆ name

std::string CRPCCommand::name

Definition at line 68 of file server.h.

◆ unique_id

intptr_t CRPCCommand::unique_id

Definition at line 80 of file server.h.


The documentation for this class was generated from the following file: