xrpld
Loading...
Searching...
No Matches
xrpl::RPCParser Class Reference
Collaboration diagram for xrpl::RPCParser:

Public Member Functions

 RPCParser (unsigned apiVersion, beast::Journal j)
json::Value parseCommand (std::string_view strMethod, json::Value const &jvParams, bool allowAnyCommand)

Static Public Member Functions

static std::span< std::string_view const > methodNames ()
 Names of every method the command line accepts.
static constexpr bool commandsValid ()
 Whether the command table is well formed.

Private Types

using ParseFuncPtr = json::Value (RPCParser::*)(json::Value const& jvParams)

Private Member Functions

json::Value parseAsIs (json::Value const &jvParams)
json::Value parseInternal (json::Value const &jvParams)
json::Value parseManifest (json::Value const &jvParams)
json::Value parseFetchInfo (json::Value const &jvParams)
json::Value parseAccountTransactions (json::Value const &jvParams)
json::Value parseBookOffers (json::Value const &jvParams)
json::Value parseCanDelete (json::Value const &jvParams)
json::Value parseConnect (json::Value const &jvParams)
json::Value parseDepositAuthorized (json::Value const &jvParams)
json::Value parseEvented (json::Value const &jvParams)
json::Value parseFeature (json::Value const &jvParams)
json::Value parseGetCounts (json::Value const &jvParams)
json::Value parseSignFor (json::Value const &jvParams)
json::Value parseJson (json::Value const &jvParams)
bool isValidJson2 (json::Value const &jv)
json::Value parseJson2 (json::Value const &jvParams)
json::Value parseLedger (json::Value const &jvParams)
json::Value parseLedgerId (json::Value const &jvParams)
json::Value parseLedgerEntry (json::Value const &jvParams)
json::Value parseLogLevel (json::Value const &jvParams)
json::Value parseAccountItems (json::Value const &jvParams)
json::Value parseAccountCurrencies (json::Value const &jvParams)
json::Value parseAccountLines (json::Value const &jvParams)
json::Value parseAccountChannels (json::Value const &jvParams)
json::Value parseChannelAuthorize (json::Value const &jvParams)
json::Value parseChannelVerify (json::Value const &jvParams)
json::Value parseAccountRaw2 (json::Value const &jvParams, char const *const acc2Field)
json::Value parseAccountRaw1 (json::Value const &jvParams)
json::Value parseVault (json::Value const &jvParams)
json::Value parsePeerReservationsAdd (json::Value const &jvParams)
json::Value parsePeerReservationsDel (json::Value const &jvParams)
json::Value parseRipplePathFind (json::Value const &jvParams)
json::Value parseSimulate (json::Value const &jvParams)
json::Value parseSignSubmit (json::Value const &jvParams)
json::Value parseSubmitMultiSigned (json::Value const &jvParams)
json::Value parseTransactionEntry (json::Value const &jvParams)
json::Value parseTx (json::Value const &jvParams)
json::Value parseTxHistory (json::Value const &jvParams)
json::Value parseValidationCreate (json::Value const &jvParams)
json::Value parseWalletPropose (json::Value const &jvParams)
json::Value parseGatewayBalances (json::Value const &jvParams)
json::Value parseServerDefinitions (json::Value const &jvParams)
json::Value parseServerInfo (json::Value const &jvParams)

Static Private Member Functions

static bool jvParseLedger (json::Value &jvRequest, std::string const &strLedger)
static json::Value jvParseCurrencyIssuer (std::string const &strCurrencyIssuer)
static bool validPublicKey (std::string const &strPk, TokenType type=TokenType::AccountPublic)

Private Attributes

unsigned const apiVersion_
beast::Journal const j_

Static Private Attributes

static constexpr auto kCommandArray
static constexpr auto kSortedCommands
static constexpr auto kCommandNames

Detailed Description

Definition at line 169 of file RPCCall.cpp.

Member Typedef Documentation

◆ ParseFuncPtr

using xrpl::RPCParser::ParseFuncPtr = json::Value (RPCParser::*)(json::Value const& jvParams)
private

Definition at line 248 of file RPCCall.cpp.

Constructor & Destructor Documentation

◆ RPCParser()

xrpl::RPCParser::RPCParser ( unsigned apiVersion,
beast::Journal j )
explicit

Definition at line 1742 of file RPCCall.cpp.

Member Function Documentation

◆ jvParseLedger()

bool xrpl::RPCParser::jvParseLedger ( json::Value & jvRequest,
std::string const & strLedger )
staticprivate

Definition at line 178 of file RPCCall.cpp.

◆ jvParseCurrencyIssuer()

json::Value xrpl::RPCParser::jvParseCurrencyIssuer ( std::string const & strCurrencyIssuer)
staticprivate

Definition at line 199 of file RPCCall.cpp.

◆ validPublicKey()

bool xrpl::RPCParser::validPublicKey ( std::string const & strPk,
TokenType type = TokenType::AccountPublic )
staticprivate

Definition at line 232 of file RPCCall.cpp.

◆ parseAsIs()

json::Value xrpl::RPCParser::parseAsIs ( json::Value const & jvParams)
private

Definition at line 252 of file RPCCall.cpp.

◆ parseInternal()

json::Value xrpl::RPCParser::parseInternal ( json::Value const & jvParams)
private

Definition at line 264 of file RPCCall.cpp.

◆ parseManifest()

json::Value xrpl::RPCParser::parseManifest ( json::Value const & jvParams)
private

Definition at line 281 of file RPCCall.cpp.

◆ parseFetchInfo()

json::Value xrpl::RPCParser::parseFetchInfo ( json::Value const & jvParams)
private

Definition at line 302 of file RPCCall.cpp.

◆ parseAccountTransactions()

json::Value xrpl::RPCParser::parseAccountTransactions ( json::Value const & jvParams)
private

Definition at line 317 of file RPCCall.cpp.

◆ parseBookOffers()

json::Value xrpl::RPCParser::parseBookOffers ( json::Value const & jvParams)
private

Definition at line 393 of file RPCCall.cpp.

◆ parseCanDelete()

json::Value xrpl::RPCParser::parseCanDelete ( json::Value const & jvParams)
private

Definition at line 460 of file RPCCall.cpp.

◆ parseConnect()

json::Value xrpl::RPCParser::parseConnect ( json::Value const & jvParams)
private

Definition at line 483 of file RPCCall.cpp.

◆ parseDepositAuthorized()

json::Value xrpl::RPCParser::parseDepositAuthorized ( json::Value const & jvParams)
private

Definition at line 512 of file RPCCall.cpp.

◆ parseEvented()

json::Value xrpl::RPCParser::parseEvented ( json::Value const & jvParams)
private

Definition at line 535 of file RPCCall.cpp.

◆ parseFeature()

json::Value xrpl::RPCParser::parseFeature ( json::Value const & jvParams)
private

Definition at line 543 of file RPCCall.cpp.

◆ parseGetCounts()

json::Value xrpl::RPCParser::parseGetCounts ( json::Value const & jvParams)
private

Definition at line 577 of file RPCCall.cpp.

◆ parseSignFor()

json::Value xrpl::RPCParser::parseSignFor ( json::Value const & jvParams)
private

Definition at line 591 of file RPCCall.cpp.

◆ parseJson()

json::Value xrpl::RPCParser::parseJson ( json::Value const & jvParams)
private

Definition at line 619 of file RPCCall.cpp.

◆ isValidJson2()

bool xrpl::RPCParser::isValidJson2 ( json::Value const & jv)
private

Definition at line 641 of file RPCCall.cpp.

◆ parseJson2()

json::Value xrpl::RPCParser::parseJson2 ( json::Value const & jvParams)
private

Definition at line 667 of file RPCCall.cpp.

◆ parseLedger()

json::Value xrpl::RPCParser::parseLedger ( json::Value const & jvParams)
private

Definition at line 719 of file RPCCall.cpp.

◆ parseLedgerId()

json::Value xrpl::RPCParser::parseLedgerId ( json::Value const & jvParams)
private

Definition at line 749 of file RPCCall.cpp.

◆ parseLedgerEntry()

json::Value xrpl::RPCParser::parseLedgerEntry ( json::Value const & jvParams)
private

Definition at line 770 of file RPCCall.cpp.

◆ parseLogLevel()

json::Value xrpl::RPCParser::parseLogLevel ( json::Value const & jvParams)
private

Definition at line 788 of file RPCCall.cpp.

◆ parseAccountItems()

json::Value xrpl::RPCParser::parseAccountItems ( json::Value const & jvParams)
private

Definition at line 809 of file RPCCall.cpp.

◆ parseAccountCurrencies()

json::Value xrpl::RPCParser::parseAccountCurrencies ( json::Value const & jvParams)
private

Definition at line 815 of file RPCCall.cpp.

◆ parseAccountLines()

json::Value xrpl::RPCParser::parseAccountLines ( json::Value const & jvParams)
private

Definition at line 822 of file RPCCall.cpp.

◆ parseAccountChannels()

json::Value xrpl::RPCParser::parseAccountChannels ( json::Value const & jvParams)
private

Definition at line 829 of file RPCCall.cpp.

◆ parseChannelAuthorize()

json::Value xrpl::RPCParser::parseChannelAuthorize ( json::Value const & jvParams)
private

Definition at line 837 of file RPCCall.cpp.

◆ parseChannelVerify()

json::Value xrpl::RPCParser::parseChannelVerify ( json::Value const & jvParams)
private

Definition at line 881 of file RPCCall.cpp.

◆ parseAccountRaw2()

json::Value xrpl::RPCParser::parseAccountRaw2 ( json::Value const & jvParams,
char const *const acc2Field )
private

Definition at line 910 of file RPCCall.cpp.

◆ parseAccountRaw1()

json::Value xrpl::RPCParser::parseAccountRaw1 ( json::Value const & jvParams)
private

Definition at line 952 of file RPCCall.cpp.

◆ parseVault()

json::Value xrpl::RPCParser::parseVault ( json::Value const & jvParams)
private

Definition at line 973 of file RPCCall.cpp.

◆ parsePeerReservationsAdd()

json::Value xrpl::RPCParser::parsePeerReservationsAdd ( json::Value const & jvParams)
private

Definition at line 992 of file RPCCall.cpp.

◆ parsePeerReservationsDel()

json::Value xrpl::RPCParser::parsePeerReservationsDel ( json::Value const & jvParams)
private

Definition at line 1006 of file RPCCall.cpp.

◆ parseRipplePathFind()

json::Value xrpl::RPCParser::parseRipplePathFind ( json::Value const & jvParams)
private

Definition at line 1015 of file RPCCall.cpp.

◆ parseSimulate()

json::Value xrpl::RPCParser::parseSimulate ( json::Value const & jvParams)
private

Definition at line 1042 of file RPCCall.cpp.

◆ parseSignSubmit()

json::Value xrpl::RPCParser::parseSignSubmit ( json::Value const & jvParams)
private

Definition at line 1074 of file RPCCall.cpp.

◆ parseSubmitMultiSigned()

json::Value xrpl::RPCParser::parseSubmitMultiSigned ( json::Value const & jvParams)
private

Definition at line 1124 of file RPCCall.cpp.

◆ parseTransactionEntry()

json::Value xrpl::RPCParser::parseTransactionEntry ( json::Value const & jvParams)
private

Definition at line 1144 of file RPCCall.cpp.

◆ parseTx()

json::Value xrpl::RPCParser::parseTx ( json::Value const & jvParams)
private

Definition at line 1170 of file RPCCall.cpp.

◆ parseTxHistory()

json::Value xrpl::RPCParser::parseTxHistory ( json::Value const & jvParams)
private

Definition at line 1203 of file RPCCall.cpp.

◆ parseValidationCreate()

json::Value xrpl::RPCParser::parseValidationCreate ( json::Value const & jvParams)
private

Definition at line 1220 of file RPCCall.cpp.

◆ parseWalletPropose()

json::Value xrpl::RPCParser::parseWalletPropose ( json::Value const & jvParams)
private

Definition at line 1235 of file RPCCall.cpp.

◆ parseGatewayBalances()

json::Value xrpl::RPCParser::parseGatewayBalances ( json::Value const & jvParams)
private

Definition at line 1251 of file RPCCall.cpp.

◆ parseServerDefinitions()

json::Value xrpl::RPCParser::parseServerDefinitions ( json::Value const & jvParams)
private

Definition at line 1294 of file RPCCall.cpp.

◆ parseServerInfo()

json::Value xrpl::RPCParser::parseServerInfo ( json::Value const & jvParams)
private

Definition at line 1309 of file RPCCall.cpp.

◆ methodNames()

std::span< std::string_view const > xrpl::RPCParser::methodNames ( )
static

Names of every method the command line accepts.

Definition at line 1706 of file RPCCall.cpp.

◆ commandsValid()

constexpr bool xrpl::RPCParser::commandsValid ( )
staticconstexpr

Whether the command table is well formed.

A name must select exactly one command, and must name a method the server can dispatch, or the command line would accept a command it cannot answer. RPCCall_test checks the second property, because it can see the handler table. This checks the first, and the parameter range.

The parser is not checked: Parse has no default constructor, so an entry that omits it does not compile.

This is a function the static_assert below the class calls, rather than the assert itself, because the table names members of RPCParser, and that is only a constant expression once RPCParser is complete.

Definition at line 1727 of file RPCCall.cpp.

◆ parseCommand()

json::Value xrpl::RPCParser::parseCommand ( std::string_view strMethod,
json::Value const & jvParams,
bool allowAnyCommand )

Definition at line 1751 of file RPCCall.cpp.

Member Data Documentation

◆ apiVersion_

unsigned const xrpl::RPCParser::apiVersion_
private

Definition at line 172 of file RPCCall.cpp.

◆ j_

beast::Journal const xrpl::RPCParser::j_
private

Definition at line 173 of file RPCCall.cpp.

◆ kCommandArray

auto xrpl::RPCParser::kCommandArray
staticconstexprprivate

Definition at line 1322 of file RPCCall.cpp.

◆ kSortedCommands

auto xrpl::RPCParser::kSortedCommands
staticconstexprprivate
Initial value:
= [] {
auto commands = kCommandArray;
std::ranges::sort(commands, {}, &Command::name);
return commands;
}()
static constexpr auto kCommandArray
Definition RPCCall.cpp:1322
T sort(T... args)

Definition at line 1682 of file RPCCall.cpp.

◆ kCommandNames

auto xrpl::RPCParser::kCommandNames
staticconstexprprivate
Initial value:
= [] {
std::ranges::transform(kSortedCommands, names.begin(), &Command::name);
return names;
}()
static constexpr auto kSortedCommands
Definition RPCCall.cpp:1682
T transform(T... args)

Definition at line 1695 of file RPCCall.cpp.