From 4b923bc9c879ceda3bb68fffe03d9aa4f9498c88 Mon Sep 17 00:00:00 2001 From: "github-merge-queue[bot]" Date: Mon, 20 Oct 2025 15:53:17 -0700 Subject: [PATCH] deploy: ae719b86d3f285206d51f4088d17c1a1751ee17a --- Escrow_8cpp_source.html | 2 +- Handler_8cpp_source.html | 4 +- Handlers_8h_source.html | 4 +- ServerDefinitions_8cpp_source.html | 461 ++++ ServerDefinitions__test_8cpp_source.html | 275 ++ ServerInfo_8cpp_source.html | 375 +-- ServerInfo__test_8cpp_source.html | 156 +- annotated.html | 117 +- ...d__associative__container__test__base.html | 2 +- classbeast_1_1unit__test_1_1suite.html | 4 +- classes.html | 2 +- classripple_1_1NodeStore_1_1TestBase.html | 2 +- classripple_1_1TestSuite.html | 2 +- ...ripple_1_1detail_1_1ServerDefinitions.html | 14 +- ...st_1_1ServerDefinitions__test-members.html | 119 + ...le_1_1test_1_1ServerDefinitions__test.html | 1153 ++++++++ ..._1ServerDefinitions__test__coll__graph.map | 41 + ..._1ServerDefinitions__test__coll__graph.md5 | 1 + ..._1ServerDefinitions__test__coll__graph.png | Bin 0 -> 86852 bytes ...erverDefinitions__test__inherit__graph.map | 5 + ...erverDefinitions__test__inherit__graph.md5 | 1 + ...erverDefinitions__test__inherit__graph.png | Bin 0 -> 4862 bytes ...e_1_1test_1_1ServerInfo__test-members.html | 15 +- classripple_1_1test_1_1ServerInfo__test.html | 23 +- classripple_1_1test_1_1TestOutputSuite.html | 2 +- classripple_1_1test_1_1jtx_1_1AMMTest.html | 2 +- ...sripple_1_1test_1_1jtx_1_1AMMTestBase.html | 2 +- dir_202f05fcc82d395fac3f43e301f5a49f.html | 2 + dir_9e5c3433ad783ee5f9e7b66541a4db0e.html | 2 + functions_func_r.html | 18 +- functions_func_t.html | 2 +- functions_r.html | 4 +- functions_t.html | 2 +- hierarchy.html | 89 +- inherit_graph_100.map | 2 +- inherit_graph_100.md5 | 2 +- inherit_graph_1001.map | 2 +- inherit_graph_1001.md5 | 2 +- inherit_graph_1002.map | 2 +- inherit_graph_1002.md5 | 2 +- inherit_graph_1004.map | 2 +- inherit_graph_1004.md5 | 2 +- inherit_graph_1005.map | 2 +- inherit_graph_1005.md5 | 2 +- inherit_graph_101.map | 2 +- inherit_graph_101.md5 | 2 +- inherit_graph_1012.map | 2 +- inherit_graph_1012.md5 | 2 +- inherit_graph_1013.map | 8 +- inherit_graph_1013.md5 | 2 +- inherit_graph_1014.map | 2 +- inherit_graph_1014.md5 | 2 +- inherit_graph_1015.map | 2 +- inherit_graph_1015.md5 | 2 +- inherit_graph_1016.map | 4 +- inherit_graph_1016.md5 | 2 +- inherit_graph_1017.map | 2 +- inherit_graph_1017.md5 | 2 +- inherit_graph_1018.map | 2 +- inherit_graph_1018.md5 | 2 +- inherit_graph_1019.map | 34 +- inherit_graph_1019.md5 | 2 +- inherit_graph_102.map | 2 +- inherit_graph_102.md5 | 2 +- inherit_graph_1020.map | 54 +- inherit_graph_1020.md5 | 2 +- inherit_graph_1021.map | 6 +- inherit_graph_1021.md5 | 2 +- inherit_graph_1022.map | 4 +- inherit_graph_1022.md5 | 2 +- inherit_graph_1023.map | 2 +- inherit_graph_1023.md5 | 2 +- inherit_graph_1024.map | 2 +- inherit_graph_1024.md5 | 2 +- inherit_graph_1025.map | 18 +- inherit_graph_1025.md5 | 2 +- inherit_graph_1026.map | 4 +- inherit_graph_1026.md5 | 2 +- inherit_graph_1027.map | 26 +- inherit_graph_1027.md5 | 2 +- inherit_graph_1028.map | 10 +- inherit_graph_1028.md5 | 2 +- inherit_graph_1029.map | 2 +- inherit_graph_1029.md5 | 2 +- inherit_graph_103.map | 2 +- inherit_graph_103.md5 | 2 +- inherit_graph_1031.map | 4 +- inherit_graph_1031.md5 | 2 +- inherit_graph_1032.map | 2 +- inherit_graph_1032.md5 | 2 +- inherit_graph_1033.map | 2 +- inherit_graph_1033.md5 | 2 +- inherit_graph_1034.map | 2 +- inherit_graph_1034.md5 | 2 +- inherit_graph_1035.map | 2 +- inherit_graph_1035.md5 | 2 +- inherit_graph_1036.map | 2 +- inherit_graph_1036.md5 | 2 +- inherit_graph_1037.map | 2 +- inherit_graph_1037.md5 | 2 +- inherit_graph_1038.map | 10 +- inherit_graph_1038.md5 | 2 +- inherit_graph_1039.map | 10 +- inherit_graph_1039.md5 | 2 +- inherit_graph_104.map | 2 +- inherit_graph_104.md5 | 2 +- inherit_graph_1041.map | 2 +- inherit_graph_1041.md5 | 2 +- inherit_graph_1042.map | 2 +- inherit_graph_1042.md5 | 2 +- inherit_graph_1043.map | 38 +- inherit_graph_1043.md5 | 2 +- inherit_graph_1044.map | 2 +- inherit_graph_1044.md5 | 2 +- inherit_graph_1045.map | 30 +- inherit_graph_1045.md5 | 2 +- inherit_graph_1046.map | 2 +- inherit_graph_1046.md5 | 2 +- inherit_graph_1049.map | 4 +- inherit_graph_1049.md5 | 2 +- inherit_graph_117.map | 62 +- inherit_graph_117.md5 | 2 +- inherit_graph_118.map | 8 +- inherit_graph_118.md5 | 2 +- inherit_graph_119.map | 2 +- inherit_graph_119.md5 | 2 +- inherit_graph_122.map | 14 +- inherit_graph_122.md5 | 2 +- inherit_graph_123.map | 2 +- inherit_graph_123.md5 | 2 +- inherit_graph_124.map | 6 +- inherit_graph_124.md5 | 2 +- inherit_graph_125.map | 4 +- inherit_graph_125.md5 | 2 +- inherit_graph_126.map | 20 +- inherit_graph_126.md5 | 2 +- inherit_graph_127.map | 2 +- inherit_graph_127.md5 | 2 +- inherit_graph_128.map | 2 +- inherit_graph_128.md5 | 2 +- inherit_graph_130.map | 6 +- inherit_graph_130.md5 | 2 +- inherit_graph_142.map | 2 +- inherit_graph_142.md5 | 2 +- inherit_graph_143.map | 4 +- inherit_graph_143.md5 | 2 +- inherit_graph_147.map | 4 +- inherit_graph_147.md5 | 2 +- inherit_graph_149.map | 2 +- inherit_graph_149.md5 | 2 +- inherit_graph_150.map | 2 +- inherit_graph_150.md5 | 2 +- inherit_graph_151.map | 2 +- inherit_graph_151.md5 | 2 +- inherit_graph_156.map | 2 +- inherit_graph_156.md5 | 2 +- inherit_graph_168.map | 6 +- inherit_graph_168.md5 | 2 +- inherit_graph_169.map | 4 +- inherit_graph_169.md5 | 2 +- inherit_graph_182.map | 2 +- inherit_graph_182.md5 | 2 +- inherit_graph_202.map | 2 +- inherit_graph_202.md5 | 2 +- inherit_graph_219.map | 2 +- inherit_graph_219.md5 | 2 +- inherit_graph_220.map | 2 +- inherit_graph_220.md5 | 2 +- inherit_graph_221.map | 2 +- inherit_graph_221.md5 | 2 +- inherit_graph_222.map | 2 +- inherit_graph_222.md5 | 2 +- inherit_graph_223.map | 2 +- inherit_graph_223.md5 | 2 +- inherit_graph_224.map | 2 +- inherit_graph_224.md5 | 2 +- inherit_graph_225.map | 30 +- inherit_graph_225.md5 | 2 +- inherit_graph_226.map | 8 +- inherit_graph_226.md5 | 2 +- inherit_graph_227.map | 8 +- inherit_graph_227.md5 | 2 +- inherit_graph_228.map | 2 +- inherit_graph_228.md5 | 2 +- inherit_graph_229.map | 32 +- inherit_graph_229.md5 | 2 +- inherit_graph_230.map | 2 +- inherit_graph_230.md5 | 2 +- inherit_graph_231.map | 2 +- inherit_graph_231.md5 | 2 +- inherit_graph_232.map | 2 +- inherit_graph_232.md5 | 2 +- inherit_graph_234.map | 2 +- inherit_graph_234.md5 | 2 +- inherit_graph_235.map | 8 +- inherit_graph_235.md5 | 2 +- inherit_graph_236.map | 2 +- inherit_graph_236.md5 | 2 +- inherit_graph_237.map | 20 +- inherit_graph_237.md5 | 2 +- inherit_graph_238.map | 2 +- inherit_graph_238.md5 | 2 +- inherit_graph_239.map | 2 +- inherit_graph_239.md5 | 2 +- inherit_graph_240.map | 62 +- inherit_graph_240.md5 | 2 +- inherit_graph_241.map | 2 +- inherit_graph_241.md5 | 2 +- inherit_graph_242.map | 2 +- inherit_graph_242.md5 | 2 +- inherit_graph_243.map | 4 +- inherit_graph_243.md5 | 2 +- inherit_graph_249.map | 2 +- inherit_graph_249.md5 | 2 +- inherit_graph_251.map | 2 +- inherit_graph_251.md5 | 2 +- inherit_graph_276.map | 6 +- inherit_graph_276.md5 | 2 +- inherit_graph_278.map | 4 +- inherit_graph_278.md5 | 2 +- inherit_graph_281.map | 2 +- inherit_graph_281.md5 | 2 +- inherit_graph_283.map | 8 +- inherit_graph_283.md5 | 2 +- inherit_graph_286.map | 2 +- inherit_graph_286.md5 | 2 +- inherit_graph_295.map | 2 +- inherit_graph_295.md5 | 2 +- inherit_graph_297.map | 2 +- inherit_graph_297.md5 | 2 +- inherit_graph_298.map | 2 +- inherit_graph_298.md5 | 2 +- inherit_graph_316.map | 4 +- inherit_graph_316.md5 | 2 +- inherit_graph_319.map | 2 +- inherit_graph_319.md5 | 2 +- inherit_graph_323.map | 2 +- inherit_graph_323.md5 | 2 +- inherit_graph_328.map | 4 +- inherit_graph_328.md5 | 2 +- inherit_graph_329.map | 2 +- inherit_graph_329.md5 | 2 +- inherit_graph_331.map | 4 +- inherit_graph_331.md5 | 2 +- inherit_graph_350.map | 2 +- inherit_graph_350.md5 | 2 +- inherit_graph_353.map | 2 +- inherit_graph_353.md5 | 2 +- inherit_graph_354.map | 2 +- inherit_graph_354.md5 | 2 +- inherit_graph_379.map | 2 +- inherit_graph_379.md5 | 2 +- inherit_graph_382.map | 6 +- inherit_graph_382.md5 | 2 +- inherit_graph_411.map | 2 +- inherit_graph_411.md5 | 2 +- inherit_graph_413.map | 6 +- inherit_graph_413.md5 | 2 +- inherit_graph_416.map | 6 +- inherit_graph_416.md5 | 2 +- inherit_graph_419.map | 6 +- inherit_graph_419.md5 | 2 +- inherit_graph_422.map | 2 +- inherit_graph_422.md5 | 2 +- inherit_graph_425.map | 4 +- inherit_graph_425.md5 | 2 +- inherit_graph_427.map | 2 +- inherit_graph_427.md5 | 2 +- inherit_graph_449.map | 24 +- inherit_graph_449.md5 | 2 +- inherit_graph_481.map | 2 +- inherit_graph_481.md5 | 2 +- inherit_graph_493.map | 2 +- inherit_graph_493.md5 | 2 +- inherit_graph_496.map | 4 +- inherit_graph_496.md5 | 2 +- inherit_graph_498.map | 4 +- inherit_graph_498.md5 | 2 +- inherit_graph_504.map | 6 +- inherit_graph_504.md5 | 2 +- inherit_graph_505.map | 4 +- inherit_graph_505.md5 | 2 +- inherit_graph_510.map | 4 +- inherit_graph_510.md5 | 2 +- inherit_graph_552.map | 4 +- inherit_graph_552.md5 | 2 +- inherit_graph_573.map | 4 +- inherit_graph_573.md5 | 2 +- inherit_graph_607.map | 2 +- inherit_graph_607.md5 | 2 +- inherit_graph_612.map | 2 +- inherit_graph_612.md5 | 2 +- inherit_graph_619.map | 2 +- inherit_graph_619.md5 | 2 +- inherit_graph_621.map | 8 +- inherit_graph_621.md5 | 2 +- inherit_graph_628.map | 4 +- inherit_graph_628.md5 | 2 +- inherit_graph_629.map | 12 +- inherit_graph_629.md5 | 2 +- inherit_graph_651.map | 4 +- inherit_graph_651.md5 | 2 +- inherit_graph_674.map | 6 +- inherit_graph_674.md5 | 2 +- inherit_graph_694.map | 2 +- inherit_graph_694.md5 | 2 +- inherit_graph_771.map | 2 +- inherit_graph_771.md5 | 2 +- inherit_graph_806.map | 2 +- inherit_graph_806.md5 | 2 +- inherit_graph_807.map | 2 +- inherit_graph_807.md5 | 2 +- inherit_graph_808.map | 2 +- inherit_graph_808.md5 | 2 +- inherit_graph_809.map | 2 +- inherit_graph_809.md5 | 2 +- inherit_graph_812.map | 2 +- inherit_graph_812.md5 | 2 +- inherit_graph_920.map | 2 +- inherit_graph_920.md5 | 2 +- inherit_graph_921.map | 2 +- inherit_graph_921.md5 | 2 +- inherit_graph_930.map | 6 +- inherit_graph_930.md5 | 2 +- inherit_graph_931.map | 2 +- inherit_graph_931.md5 | 2 +- inherit_graph_932.map | 2 +- inherit_graph_932.md5 | 2 +- inherit_graph_94.map | 594 ++-- inherit_graph_94.md5 | 2 +- inherit_graph_94.png | Bin 2442555 -> 2453445 bytes inherit_graph_941.map | 128 +- inherit_graph_941.md5 | 2 +- inherit_graph_963.map | 2 +- inherit_graph_963.md5 | 2 +- inherit_graph_999.map | 4 +- inherit_graph_999.md5 | 2 +- inherits.html | 534 ++-- namespacemembers_b.html | 4 +- namespacemembers_func_b.html | 2 +- namespaceripple.html | 4 +- namespaceripple_1_1test.html | 246 +- namespaces.html | 117 +- search/all_19.js | 10 +- search/all_1a.js | 2421 +++++++++-------- search/all_1b.js | 2 +- search/all_9.js | 136 +- search/classes_12.js | 637 ++--- search/functions_12.js | 8 +- search/functions_14.js | 2 +- search/functions_2.js | 4 +- 351 files changed, 5288 insertions(+), 3672 deletions(-) create mode 100644 ServerDefinitions_8cpp_source.html create mode 100644 ServerDefinitions__test_8cpp_source.html create mode 100644 classripple_1_1test_1_1ServerDefinitions__test-members.html create mode 100644 classripple_1_1test_1_1ServerDefinitions__test.html create mode 100644 classripple_1_1test_1_1ServerDefinitions__test__coll__graph.map create mode 100644 classripple_1_1test_1_1ServerDefinitions__test__coll__graph.md5 create mode 100644 classripple_1_1test_1_1ServerDefinitions__test__coll__graph.png create mode 100644 classripple_1_1test_1_1ServerDefinitions__test__inherit__graph.map create mode 100644 classripple_1_1test_1_1ServerDefinitions__test__inherit__graph.md5 create mode 100644 classripple_1_1test_1_1ServerDefinitions__test__inherit__graph.png diff --git a/Escrow_8cpp_source.html b/Escrow_8cpp_source.html index 89602f8dc1..dc7cf8f950 100644 --- a/Escrow_8cpp_source.html +++ b/Escrow_8cpp_source.html @@ -1333,7 +1333,7 @@ $(document).ready(function() { init_codefold(0); });
1205 {
1206 // LCOV_EXCL_START
1207 JLOG(j_.fatal()) << "Unable to delete Escrow from recipient.";
-
1208 return tefBAD_LEDGER; // LCOV_EXCL_LINE
+
1208 return tefBAD_LEDGER;
1209 // LCOV_EXCL_STOP
1210 }
1211 }
diff --git a/Handler_8cpp_source.html b/Handler_8cpp_source.html index ed1925e112..57220b78cd 100644 --- a/Handler_8cpp_source.html +++ b/Handler_8cpp_source.html @@ -460,7 +460,7 @@ $(document).ready(function() { init_codefold(0); });
Json::Value doTxJson(RPC::JsonContext &)
Definition Tx.cpp:286
Json::Value doAMMInfo(RPC::JsonContext &context)
Definition AMMInfo.cpp:76
Json::Value doPeerReservationsList(RPC::JsonContext &)
-
Json::Value doServerInfo(RPC::JsonContext &)
+
Json::Value doServerInfo(RPC::JsonContext &)
Json::Value doFee(RPC::JsonContext &context)
Definition Fee1.cpp:30
Json::Value doConnect(RPC::JsonContext &context)
Definition Connect.cpp:39
Json::Value doNFTSellOffers(RPC::JsonContext &)
@@ -469,7 +469,7 @@ $(document).ready(function() { init_codefold(0); });
Json::Value doLedgerClosed(RPC::JsonContext &)
Json::Value doLogLevel(RPC::JsonContext &)
Definition LogLevel.cpp:34
Json::Value doSubmit(RPC::JsonContext &)
Definition Submit.cpp:45
-
Json::Value doServerDefinitions(RPC::JsonContext &)
+
Json::Value doServerDefinitions(RPC::JsonContext &)
Json::Value doSubscribe(RPC::JsonContext &)
Definition Subscribe.cpp:38
Json::Value doAccountObjects(RPC::JsonContext &context)
Json::Value doFeature(RPC::JsonContext &context)
Definition Feature1.cpp:36
diff --git a/Handlers_8h_source.html b/Handlers_8h_source.html index 9642e0cb8d..744f659251 100644 --- a/Handlers_8h_source.html +++ b/Handlers_8h_source.html @@ -283,7 +283,7 @@ $(document).ready(function() { init_codefold(0); });
Json::Value doTxJson(RPC::JsonContext &)
Definition Tx.cpp:286
Json::Value doAMMInfo(RPC::JsonContext &context)
Definition AMMInfo.cpp:76
Json::Value doPeerReservationsList(RPC::JsonContext &)
-
Json::Value doServerInfo(RPC::JsonContext &)
+
Json::Value doServerInfo(RPC::JsonContext &)
Json::Value doFee(RPC::JsonContext &context)
Definition Fee1.cpp:30
Json::Value doConnect(RPC::JsonContext &context)
Definition Connect.cpp:39
Json::Value doNFTSellOffers(RPC::JsonContext &)
@@ -292,7 +292,7 @@ $(document).ready(function() { init_codefold(0); });
Json::Value doLedgerClosed(RPC::JsonContext &)
Json::Value doLogLevel(RPC::JsonContext &)
Definition LogLevel.cpp:34
Json::Value doSubmit(RPC::JsonContext &)
Definition Submit.cpp:45
-
Json::Value doServerDefinitions(RPC::JsonContext &)
+
Json::Value doServerDefinitions(RPC::JsonContext &)
Json::Value doSubscribe(RPC::JsonContext &)
Definition Subscribe.cpp:38
Json::Value doAccountObjects(RPC::JsonContext &context)
Json::Value doFeature(RPC::JsonContext &context)
Definition Feature1.cpp:36
diff --git a/ServerDefinitions_8cpp_source.html b/ServerDefinitions_8cpp_source.html new file mode 100644 index 0000000000..259e8502c3 --- /dev/null +++ b/ServerDefinitions_8cpp_source.html @@ -0,0 +1,461 @@ + + + + + + + +rippled: ServerDefinitions.cpp Source File + + + + + + + + + +
+
+ + + + + + +
+
rippled +
+
+
+ + + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
ServerDefinitions.cpp
+
+
+
1//------------------------------------------------------------------------------
+
2/*
+
3 This file is part of rippled: https://github.com/ripple/rippled
+
4 Copyright (c) 2023 Ripple Labs Inc.
+
5
+
6 Permission to use, copy, modify, and/or distribute this software for any
+
7 purpose with or without fee is hereby granted, provided that the above
+
8 copyright notice and this permission notice appear in all copies.
+
9
+
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
17*/
+
18//==============================================================================
+
19
+
20#include <xrpld/rpc/Context.h>
+
21#include <xrpld/rpc/Role.h>
+
22
+
23#include <xrpl/json/json_value.h>
+
24#include <xrpl/json/json_writer.h>
+
25#include <xrpl/protocol/LedgerFormats.h>
+
26#include <xrpl/protocol/SField.h>
+
27#include <xrpl/protocol/TER.h>
+
28#include <xrpl/protocol/TxFormats.h>
+
29#include <xrpl/protocol/digest.h>
+
30#include <xrpl/protocol/jss.h>
+
31
+
32#include <boost/algorithm/string.hpp>
+
33
+
34#include <unordered_map>
+
35
+
36namespace ripple {
+
37
+
38namespace detail {
+
39
+
+ +
41{
+
42private:
+ +
44 // translate e.g. STI_LEDGERENTRY to LedgerEntry
+
45 translate(std::string const& inp);
+
46
+ + +
49
+
50public:
+ +
52
+
53 bool
+
+
54 hashMatches(uint256 hash) const
+
55 {
+
56 return defsHash_ == hash;
+
57 }
+
+
58
+
59 Json::Value const&
+
+
60 get() const
+
61 {
+
62 return defs_;
+
63 }
+
+
64};
+
+
65
+ +
+ +
68{
+
69 auto replace = [&](char const* oldStr, char const* newStr) -> std::string {
+
70 std::string out = inp;
+
71 boost::replace_all(out, oldStr, newStr);
+
72 return out;
+
73 };
+
74
+
75 auto contains = [&](char const* s) -> bool {
+
76 return inp.find(s) != std::string::npos;
+
77 };
+
78
+
79 if (contains("UINT"))
+
80 {
+
81 if (contains("512") || contains("384") || contains("256") ||
+
82 contains("192") || contains("160") || contains("128"))
+
83 return replace("UINT", "Hash");
+
84 else
+
85 return replace("UINT", "UInt");
+
86 }
+
87
+ +
89 {"OBJECT", "STObject"},
+
90 {"ARRAY", "STArray"},
+
91 {"ACCOUNT", "AccountID"},
+
92 {"LEDGERENTRY", "LedgerEntry"},
+
93 {"NOTPRESENT", "NotPresent"},
+
94 {"PATHSET", "PathSet"},
+
95 {"VL", "Blob"},
+
96 {"XCHAIN_BRIDGE", "XChainBridge"},
+
97 };
+
98
+
99 if (auto const& it = replacements.find(inp); it != replacements.end())
+
100 {
+
101 return it->second;
+
102 }
+
103
+ +
105 size_t pos = 0;
+
106 std::string inpToProcess = inp;
+
107
+
108 // convert snake_case to CamelCase
+
109 for (;;)
+
110 {
+
111 pos = inpToProcess.find("_");
+
112 if (pos == std::string::npos)
+
113 pos = inpToProcess.size();
+
114 std::string token = inpToProcess.substr(0, pos);
+
115 if (token.size() > 1)
+
116 {
+
117 boost::algorithm::to_lower(token);
+
118 token.data()[0] -= ('a' - 'A');
+
119 out += token;
+
120 }
+
121 else
+
122 out += token;
+
123 if (pos == inpToProcess.size())
+
124 break;
+
125 inpToProcess = inpToProcess.substr(pos + 1);
+
126 }
+
127 return out;
+
128};
+
+
129
+
+ +
131{
+
132 // populate SerializedTypeID names and values
+
133 defs_[jss::TYPES] = Json::objectValue;
+
134
+
135 defs_[jss::TYPES]["Done"] = -1;
+
136 std::map<int32_t, std::string> typeMap{{-1, "Done"}};
+
137 for (auto const& [rawName, typeValue] : sTypeMap)
+
138 {
+
139 std::string typeName =
+
140 translate(std::string(rawName).substr(4) /* remove STI_ */);
+
141 defs_[jss::TYPES][typeName] = typeValue;
+
142 typeMap[typeValue] = typeName;
+
143 }
+
144
+
145 // populate LedgerEntryType names and values
+
146 defs_[jss::LEDGER_ENTRY_TYPES] = Json::objectValue;
+
147 defs_[jss::LEDGER_ENTRY_TYPES][jss::Invalid] = -1;
+
148
+
149 for (auto const& f : LedgerFormats::getInstance())
+
150 {
+
151 defs_[jss::LEDGER_ENTRY_TYPES][f.getName()] = f.getType();
+
152 }
+
153
+
154 // populate SField serialization data
+
155 defs_[jss::FIELDS] = Json::arrayValue;
+
156
+
157 uint32_t i = 0;
+
158 {
+ +
160 a[0U] = "Generic";
+ +
162 v[jss::nth] = 0;
+
163 v[jss::isVLEncoded] = false;
+
164 v[jss::isSerialized] = false;
+
165 v[jss::isSigningField] = false;
+
166 v[jss::type] = "Unknown";
+
167 a[1U] = v;
+
168 defs_[jss::FIELDS][i++] = a;
+
169 }
+
170
+
171 {
+ +
173 a[0U] = "Invalid";
+ +
175 v[jss::nth] = -1;
+
176 v[jss::isVLEncoded] = false;
+
177 v[jss::isSerialized] = false;
+
178 v[jss::isSigningField] = false;
+
179 v[jss::type] = "Unknown";
+
180 a[1U] = v;
+
181 defs_[jss::FIELDS][i++] = a;
+
182 }
+
183
+
184 {
+ +
186 a[0U] = "ObjectEndMarker";
+ +
188 v[jss::nth] = 1;
+
189 v[jss::isVLEncoded] = false;
+
190 v[jss::isSerialized] = true;
+
191 v[jss::isSigningField] = true;
+
192 v[jss::type] = "STObject";
+
193 a[1U] = v;
+
194 defs_[jss::FIELDS][i++] = a;
+
195 }
+
196
+
197 {
+ +
199 a[0U] = "ArrayEndMarker";
+ +
201 v[jss::nth] = 1;
+
202 v[jss::isVLEncoded] = false;
+
203 v[jss::isSerialized] = true;
+
204 v[jss::isSigningField] = true;
+
205 v[jss::type] = "STArray";
+
206 a[1U] = v;
+
207 defs_[jss::FIELDS][i++] = a;
+
208 }
+
209
+
210 {
+ +
212 a[0U] = "taker_gets_funded";
+ +
214 v[jss::nth] = 258;
+
215 v[jss::isVLEncoded] = false;
+
216 v[jss::isSerialized] = false;
+
217 v[jss::isSigningField] = false;
+
218 v[jss::type] = "Amount";
+
219 a[1U] = v;
+
220 defs_[jss::FIELDS][i++] = a;
+
221 }
+
222
+
223 {
+ +
225 a[0U] = "taker_pays_funded";
+ +
227 v[jss::nth] = 259;
+
228 v[jss::isVLEncoded] = false;
+
229 v[jss::isSerialized] = false;
+
230 v[jss::isSigningField] = false;
+
231 v[jss::type] = "Amount";
+
232 a[1U] = v;
+
233 defs_[jss::FIELDS][i++] = a;
+
234 }
+
235
+
236 for (auto const& [code, f] : ripple::SField::getKnownCodeToField())
+
237 {
+
238 if (f->fieldName == "")
+
239 continue;
+
240
+ +
242
+
243 uint32_t type = f->fieldType;
+
244
+
245 innerObj[jss::nth] = f->fieldValue;
+
246
+
247 // whether the field is variable-length encoded
+
248 // this means that the length is included before the content
+
249 innerObj[jss::isVLEncoded] =
+
250 (type == 7U /* Blob */ || type == 8U /* AccountID */ ||
+
251 type == 19U /* Vector256 */);
+
252
+
253 // whether the field is included in serialization
+
254 innerObj[jss::isSerialized] =
+
255 (type < 10000 && f->fieldName != "hash" &&
+
256 f->fieldName != "index"); /* hash, index, TRANSACTION,
+
257 LEDGER_ENTRY, VALIDATION, METADATA */
+
258
+
259 // whether the field is included in serialization when signing
+
260 innerObj[jss::isSigningField] = f->shouldInclude(false);
+
261
+
262 innerObj[jss::type] = typeMap[type];
+
263
+
264 Json::Value innerArray = Json::arrayValue;
+
265 innerArray[0U] = f->fieldName;
+
266 innerArray[1U] = innerObj;
+
267
+
268 defs_[jss::FIELDS][i++] = innerArray;
+
269 }
+
270
+
271 // populate TER code names and values
+
272 defs_[jss::TRANSACTION_RESULTS] = Json::objectValue;
+
273
+
274 for (auto const& [code, terInfo] : transResults())
+
275 {
+
276 defs_[jss::TRANSACTION_RESULTS][terInfo.first] = code;
+
277 }
+
278
+
279 // populate TxType names and values
+
280 defs_[jss::TRANSACTION_TYPES] = Json::objectValue;
+
281 defs_[jss::TRANSACTION_TYPES][jss::Invalid] = -1;
+
282 for (auto const& f : TxFormats::getInstance())
+
283 {
+
284 defs_[jss::TRANSACTION_TYPES][f.getName()] = f.getType();
+
285 }
+
286
+
287 // generate hash
+
288 {
+ + +
291 defs_[jss::hash] = to_string(defsHash_);
+
292 }
+
293}
+
+
294
+
295} // namespace detail
+
296
+ +
+ +
299{
+
300 auto& params = context.params;
+
301
+
302 uint256 hash;
+
303 if (params.isMember(jss::hash))
+
304 {
+
305 if (!params[jss::hash].isString() ||
+
306 !hash.parseHex(params[jss::hash].asString()))
+
307 return RPC::invalid_field_error(jss::hash);
+
308 }
+
309
+
310 static detail::ServerDefinitions const defs{};
+
311 if (defs.hashMatches(hash))
+
312 {
+ +
314 jv[jss::hash] = to_string(hash);
+
315 return jv;
+
316 }
+
317 return defs.get();
+
318}
+
+
319
+
320} // namespace ripple
+ +
Outputs a Value in JSON format without formatting (not human friendly).
Definition json_writer.h:54
+
std::string write(Value const &root) override
+
Represents a JSON value.
Definition json_value.h:149
+
Value get(UInt index, Value const &defaultValue) const
If the array contains at least index+1 elements, returns the element value, otherwise returns default...
+
static LedgerFormats const & getInstance()
+
static std::unordered_map< int, SField const * > const & getKnownCodeToField()
Definition SField.h:306
+
An immutable linear range of bytes.
Definition Slice.h:46
+
std::uint8_t const * data() const noexcept
Return a pointer to beginning of the storage.
Definition Slice.h:98
+
static TxFormats const & getInstance()
Definition TxFormats.cpp:71
+ +
constexpr bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
Definition base_uint.h:503
+ +
std::string translate(std::string const &inp)
+ +
bool hashMatches(uint256 hash) const
+ + +
Json::Value const & get() const
+
T data(T... args)
+
T find(T... args)
+ +
JSON (JavaScript Object Notation).
Definition json_errors.h:25
+
@ arrayValue
array value (ordered list)
Definition json_value.h:44
+
@ objectValue
object value (collection of name/value pairs).
Definition json_value.h:45
+
Json::Value invalid_field_error(std::string const &name)
Definition ErrorCodes.h:325
+
static std::string to_string(TableType type)
to_string Returns the name of a table according to its TableType.
Definition Node.cpp:47
+
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
+
static std::map< std::string, int > const sTypeMap
Definition SField.h:112
+
Json::Value doServerDefinitions(RPC::JsonContext &)
+ +
std::string to_string(base_uint< Bits, Tag > const &a)
Definition base_uint.h:630
+
std::unordered_map< TERUnderlyingType, std::pair< char const *const, char const *const > > const & transResults()
Definition TER.cpp:35
+
sha512_half_hasher::result_type sha512Half(Args const &... args)
Returns the SHA512-Half of a series of objects.
Definition digest.h:224
+
T size(T... args)
+ + +
T substr(T... args)
+ +
+ + + + diff --git a/ServerDefinitions__test_8cpp_source.html b/ServerDefinitions__test_8cpp_source.html new file mode 100644 index 0000000000..a09be16cc3 --- /dev/null +++ b/ServerDefinitions__test_8cpp_source.html @@ -0,0 +1,275 @@ + + + + + + + +rippled: ServerDefinitions_test.cpp Source File + + + + + + + + + +
+
+ + + + + + +
+
rippled +
+
+
+ + + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
ServerDefinitions_test.cpp
+
+
+
1//------------------------------------------------------------------------------
+
2/*
+
3 This file is part of rippled: https://github.com/ripple/rippled
+
4 Copyright (c) 2023 Ripple Labs Inc.
+
5
+
6 Permission to use, copy, modify, and/or distribute this software for any
+
7 purpose with or without fee is hereby granted, provided that the above
+
8 copyright notice and this permission notice appear in all copies.
+
9
+
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
17*/
+
18//==============================================================================
+
19
+
20#include <test/jtx.h>
+
21
+
22#include <xrpl/beast/unit_test.h>
+
23#include <xrpl/protocol/jss.h>
+
24
+
25namespace ripple {
+
26
+
27namespace test {
+
28
+
+ +
30{
+
31public:
+
32 void
+
+ +
34 {
+
35 testcase("server_definitions");
+
36
+
37 using namespace test::jtx;
+
38
+
39 {
+
40 Env env(*this);
+
41 auto const result = env.rpc("server_definitions");
+
42 BEAST_EXPECT(!result[jss::result].isMember(jss::error));
+
43 BEAST_EXPECT(result[jss::result][jss::status] == "success");
+
44 BEAST_EXPECT(result[jss::result].isMember(jss::FIELDS));
+
45 BEAST_EXPECT(result[jss::result].isMember(jss::LEDGER_ENTRY_TYPES));
+
46 BEAST_EXPECT(
+
47 result[jss::result].isMember(jss::TRANSACTION_RESULTS));
+
48 BEAST_EXPECT(result[jss::result].isMember(jss::TRANSACTION_TYPES));
+
49 BEAST_EXPECT(result[jss::result].isMember(jss::TYPES));
+
50 BEAST_EXPECT(result[jss::result].isMember(jss::hash));
+
51
+
52 // test a random element of each result
+
53 // (testing the whole output would be difficult to maintain)
+
54
+
55 {
+
56 auto const firstField = result[jss::result][jss::FIELDS][0u];
+
57 BEAST_EXPECT(firstField[0u].asString() == "Generic");
+
58 BEAST_EXPECT(
+
59 firstField[1][jss::isSerialized].asBool() == false);
+
60 BEAST_EXPECT(
+
61 firstField[1][jss::isSigningField].asBool() == false);
+
62 BEAST_EXPECT(firstField[1][jss::isVLEncoded].asBool() == false);
+
63 BEAST_EXPECT(firstField[1][jss::nth].asUInt() == 0);
+
64 BEAST_EXPECT(firstField[1][jss::type].asString() == "Unknown");
+
65 }
+
66
+
67 BEAST_EXPECT(
+
68 result[jss::result][jss::LEDGER_ENTRY_TYPES]["AccountRoot"]
+
69 .asUInt() == 97);
+
70 BEAST_EXPECT(
+
71 result[jss::result][jss::TRANSACTION_RESULTS]["tecDIR_FULL"]
+
72 .asUInt() == 121);
+
73 BEAST_EXPECT(
+
74 result[jss::result][jss::TRANSACTION_TYPES]["Payment"]
+
75 .asUInt() == 0);
+
76 BEAST_EXPECT(
+
77 result[jss::result][jss::TYPES]["AccountID"].asUInt() == 8);
+
78
+
79 // check exception SFields
+
80 {
+
81 auto const fieldExists = [&](std::string name) {
+
82 for (auto& field : result[jss::result][jss::FIELDS])
+
83 {
+
84 if (field[0u].asString() == name)
+
85 {
+
86 return true;
+
87 }
+
88 }
+
89 return false;
+
90 };
+
91 BEAST_EXPECT(fieldExists("Generic"));
+
92 BEAST_EXPECT(fieldExists("Invalid"));
+
93 BEAST_EXPECT(fieldExists("ObjectEndMarker"));
+
94 BEAST_EXPECT(fieldExists("ArrayEndMarker"));
+
95 BEAST_EXPECT(fieldExists("taker_gets_funded"));
+
96 BEAST_EXPECT(fieldExists("taker_pays_funded"));
+
97 BEAST_EXPECT(fieldExists("hash"));
+
98 BEAST_EXPECT(fieldExists("index"));
+
99 }
+
100
+
101 // test that base_uint types are replaced with "Hash" prefix
+
102 {
+
103 auto const types = result[jss::result][jss::TYPES];
+
104 BEAST_EXPECT(types["Hash128"].asUInt() == 4);
+
105 BEAST_EXPECT(types["Hash160"].asUInt() == 17);
+
106 BEAST_EXPECT(types["Hash192"].asUInt() == 21);
+
107 BEAST_EXPECT(types["Hash256"].asUInt() == 5);
+
108 BEAST_EXPECT(types["Hash384"].asUInt() == 22);
+
109 BEAST_EXPECT(types["Hash512"].asUInt() == 23);
+
110 }
+
111 }
+
112
+
113 // test providing the same hash
+
114 {
+
115 Env env(*this);
+
116 auto const firstResult = env.rpc("server_definitions");
+
117 auto const hash = firstResult[jss::result][jss::hash].asString();
+
118 auto const hashParam =
+
119 std::string("{ ") + "\"hash\": \"" + hash + "\"}";
+
120
+
121 auto const result =
+
122 env.rpc("json", "server_definitions", hashParam);
+
123 BEAST_EXPECT(!result[jss::result].isMember(jss::error));
+
124 BEAST_EXPECT(result[jss::result][jss::status] == "success");
+
125 BEAST_EXPECT(!result[jss::result].isMember(jss::FIELDS));
+
126 BEAST_EXPECT(
+
127 !result[jss::result].isMember(jss::LEDGER_ENTRY_TYPES));
+
128 BEAST_EXPECT(
+
129 !result[jss::result].isMember(jss::TRANSACTION_RESULTS));
+
130 BEAST_EXPECT(!result[jss::result].isMember(jss::TRANSACTION_TYPES));
+
131 BEAST_EXPECT(!result[jss::result].isMember(jss::TYPES));
+
132 BEAST_EXPECT(result[jss::result].isMember(jss::hash));
+
133 }
+
134
+
135 // test providing a different hash
+
136 {
+
137 Env env(*this);
+
138 std::string const hash =
+
139 "54296160385A27154BFA70A239DD8E8FD4CC2DB7BA32D970BA3A5B132CF749"
+
140 "D1";
+
141 auto const hashParam =
+
142 std::string("{ ") + "\"hash\": \"" + hash + "\"}";
+
143
+
144 auto const result =
+
145 env.rpc("json", "server_definitions", hashParam);
+
146 BEAST_EXPECT(!result[jss::result].isMember(jss::error));
+
147 BEAST_EXPECT(result[jss::result][jss::status] == "success");
+
148 BEAST_EXPECT(result[jss::result].isMember(jss::FIELDS));
+
149 BEAST_EXPECT(result[jss::result].isMember(jss::LEDGER_ENTRY_TYPES));
+
150 BEAST_EXPECT(
+
151 result[jss::result].isMember(jss::TRANSACTION_RESULTS));
+
152 BEAST_EXPECT(result[jss::result].isMember(jss::TRANSACTION_TYPES));
+
153 BEAST_EXPECT(result[jss::result].isMember(jss::TYPES));
+
154 BEAST_EXPECT(result[jss::result].isMember(jss::hash));
+
155 }
+
156 }
+
+
157
+
158 void
+
+
159 run() override
+
160 {
+ +
162 }
+
+
163};
+
+
164
+
165BEAST_DEFINE_TESTSUITE(ServerDefinitions, rpc, ripple);
+
166
+
167} // namespace test
+
168} // namespace ripple
+ +
std::string asString() const
Returns the unquoted string value.
+
A testsuite class.
Definition suite.h:55
+
testcase_t testcase
Memberspace for declaring test cases.
Definition suite.h:155
+ + + +
A transaction testing environment.
Definition Env.h:121
+
Json::Value rpc(unsigned apiVersion, std::unordered_map< std::string, std::string > const &headers, std::string const &cmd, Args &&... args)
Execute an RPC command.
Definition Env.h:791
+
Set the expected result code for a JTx The test will fail if the code doesn't match.
Definition rpc.h:35
+
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
+
+ + + + diff --git a/ServerInfo_8cpp_source.html b/ServerInfo_8cpp_source.html index 155282a556..ad3729c090 100644 --- a/ServerInfo_8cpp_source.html +++ b/ServerInfo_8cpp_source.html @@ -106,376 +106,39 @@ $(document).ready(function() { init_codefold(0); });
23
24#include <xrpl/json/json_value.h>
25#include <xrpl/json/json_writer.h>
-
26#include <xrpl/protocol/LedgerFormats.h>
-
27#include <xrpl/protocol/SField.h>
-
28#include <xrpl/protocol/TER.h>
-
29#include <xrpl/protocol/TxFormats.h>
-
30#include <xrpl/protocol/digest.h>
-
31#include <xrpl/protocol/jss.h>
-
32
-
33#include <boost/algorithm/string.hpp>
+
26#include <xrpl/protocol/jss.h>
+
27
+
28namespace ripple {
+
29
+
30Json::Value
+
+ +
32{
+
34
-
35#include <unordered_map>
-
36
-
37namespace ripple {
-
38
-
39namespace detail {
+
35 ret[jss::info] = context.netOps.getServerInfo(
+
36 true,
+
37 context.role == Role::ADMIN,
+
38 context.params.isMember(jss::counters) &&
+
39 context.params[jss::counters].asBool());
40
-
- -
42{
-
43private:
- -
45 // translate e.g. STI_LEDGERENTRY to LedgerEntry
-
46 translate(std::string const& inp);
-
47
- - -
50
-
51public:
- -
53
-
54 bool
-
-
55 hashMatches(uint256 hash) const
-
56 {
-
57 return defsHash_ == hash;
-
58 }
+
41 return ret;
+
42}
-
59
-
60 Json::Value const&
-
-
61 get() const
-
62 {
-
63 return defs_;
-
64 }
-
-
65};
-
-
66
- -
- -
69{
-
70 auto replace = [&](char const* oldStr, char const* newStr) -> std::string {
-
71 std::string out = inp;
-
72 boost::replace_all(out, oldStr, newStr);
-
73 return out;
-
74 };
-
75
-
76 auto contains = [&](char const* s) -> bool {
-
77 return inp.find(s) != std::string::npos;
-
78 };
-
79
-
80 if (contains("UINT"))
-
81 {
-
82 if (contains("512") || contains("384") || contains("256") ||
-
83 contains("192") || contains("160") || contains("128"))
-
84 return replace("UINT", "Hash");
-
85 else
-
86 return replace("UINT", "UInt");
-
87 }
-
88
- -
90 {"OBJECT", "STObject"},
-
91 {"ARRAY", "STArray"},
-
92 {"ACCOUNT", "AccountID"},
-
93 {"LEDGERENTRY", "LedgerEntry"},
-
94 {"NOTPRESENT", "NotPresent"},
-
95 {"PATHSET", "PathSet"},
-
96 {"VL", "Blob"},
-
97 {"XCHAIN_BRIDGE", "XChainBridge"},
-
98 };
-
99
-
100 if (auto const& it = replacements.find(inp); it != replacements.end())
-
101 {
-
102 return it->second;
-
103 }
-
104
- -
106 size_t pos = 0;
-
107 std::string inpToProcess = inp;
-
108
-
109 // convert snake_case to CamelCase
-
110 for (;;)
-
111 {
-
112 pos = inpToProcess.find("_");
-
113 if (pos == std::string::npos)
-
114 pos = inpToProcess.size();
-
115 std::string token = inpToProcess.substr(0, pos);
-
116 if (token.size() > 1)
-
117 {
-
118 boost::algorithm::to_lower(token);
-
119 token.data()[0] -= ('a' - 'A');
-
120 out += token;
-
121 }
-
122 else
-
123 out += token;
-
124 if (pos == inpToProcess.size())
-
125 break;
-
126 inpToProcess = inpToProcess.substr(pos + 1);
-
127 }
-
128 return out;
-
129};
-
-
130
-
- -
132{
-
133 // populate SerializedTypeID names and values
-
134 defs_[jss::TYPES] = Json::objectValue;
-
135
-
136 defs_[jss::TYPES]["Done"] = -1;
-
137 std::map<int32_t, std::string> typeMap{{-1, "Done"}};
-
138 for (auto const& [rawName, typeValue] : sTypeMap)
-
139 {
-
140 std::string typeName =
-
141 translate(std::string(rawName).substr(4) /* remove STI_ */);
-
142 defs_[jss::TYPES][typeName] = typeValue;
-
143 typeMap[typeValue] = typeName;
-
144 }
-
145
-
146 // populate LedgerEntryType names and values
-
147 defs_[jss::LEDGER_ENTRY_TYPES] = Json::objectValue;
-
148 defs_[jss::LEDGER_ENTRY_TYPES][jss::Invalid] = -1;
-
149
-
150 for (auto const& f : LedgerFormats::getInstance())
-
151 {
-
152 defs_[jss::LEDGER_ENTRY_TYPES][f.getName()] = f.getType();
-
153 }
-
154
-
155 // populate SField serialization data
-
156 defs_[jss::FIELDS] = Json::arrayValue;
-
157
-
158 uint32_t i = 0;
-
159 {
- -
161 a[0U] = "Generic";
- -
163 v[jss::nth] = 0;
-
164 v[jss::isVLEncoded] = false;
-
165 v[jss::isSerialized] = false;
-
166 v[jss::isSigningField] = false;
-
167 v[jss::type] = "Unknown";
-
168 a[1U] = v;
-
169 defs_[jss::FIELDS][i++] = a;
-
170 }
-
171
-
172 {
- -
174 a[0U] = "Invalid";
- -
176 v[jss::nth] = -1;
-
177 v[jss::isVLEncoded] = false;
-
178 v[jss::isSerialized] = false;
-
179 v[jss::isSigningField] = false;
-
180 v[jss::type] = "Unknown";
-
181 a[1U] = v;
-
182 defs_[jss::FIELDS][i++] = a;
-
183 }
-
184
-
185 {
- -
187 a[0U] = "ObjectEndMarker";
- -
189 v[jss::nth] = 1;
-
190 v[jss::isVLEncoded] = false;
-
191 v[jss::isSerialized] = true;
-
192 v[jss::isSigningField] = true;
-
193 v[jss::type] = "STObject";
-
194 a[1U] = v;
-
195 defs_[jss::FIELDS][i++] = a;
-
196 }
-
197
-
198 {
- -
200 a[0U] = "ArrayEndMarker";
- -
202 v[jss::nth] = 1;
-
203 v[jss::isVLEncoded] = false;
-
204 v[jss::isSerialized] = true;
-
205 v[jss::isSigningField] = true;
-
206 v[jss::type] = "STArray";
-
207 a[1U] = v;
-
208 defs_[jss::FIELDS][i++] = a;
-
209 }
-
210
-
211 {
- -
213 a[0U] = "taker_gets_funded";
- -
215 v[jss::nth] = 258;
-
216 v[jss::isVLEncoded] = false;
-
217 v[jss::isSerialized] = false;
-
218 v[jss::isSigningField] = false;
-
219 v[jss::type] = "Amount";
-
220 a[1U] = v;
-
221 defs_[jss::FIELDS][i++] = a;
-
222 }
-
223
-
224 {
- -
226 a[0U] = "taker_pays_funded";
- -
228 v[jss::nth] = 259;
-
229 v[jss::isVLEncoded] = false;
-
230 v[jss::isSerialized] = false;
-
231 v[jss::isSigningField] = false;
-
232 v[jss::type] = "Amount";
-
233 a[1U] = v;
-
234 defs_[jss::FIELDS][i++] = a;
-
235 }
-
236
-
237 for (auto const& [code, f] : ripple::SField::getKnownCodeToField())
-
238 {
-
239 if (f->fieldName == "")
-
240 continue;
-
241
- -
243
-
244 uint32_t type = f->fieldType;
-
245
-
246 innerObj[jss::nth] = f->fieldValue;
-
247
-
248 // whether the field is variable-length encoded
-
249 // this means that the length is included before the content
-
250 innerObj[jss::isVLEncoded] =
-
251 (type == 7U /* Blob */ || type == 8U /* AccountID */ ||
-
252 type == 19U /* Vector256 */);
-
253
-
254 // whether the field is included in serialization
-
255 innerObj[jss::isSerialized] =
-
256 (type < 10000 && f->fieldName != "hash" &&
-
257 f->fieldName != "index"); /* hash, index, TRANSACTION,
-
258 LEDGER_ENTRY, VALIDATION, METADATA */
-
259
-
260 // whether the field is included in serialization when signing
-
261 innerObj[jss::isSigningField] = f->shouldInclude(false);
-
262
-
263 innerObj[jss::type] = typeMap[type];
-
264
-
265 Json::Value innerArray = Json::arrayValue;
-
266 innerArray[0U] = f->fieldName;
-
267 innerArray[1U] = innerObj;
-
268
-
269 defs_[jss::FIELDS][i++] = innerArray;
-
270 }
-
271
-
272 // populate TER code names and values
-
273 defs_[jss::TRANSACTION_RESULTS] = Json::objectValue;
-
274
-
275 for (auto const& [code, terInfo] : transResults())
-
276 {
-
277 defs_[jss::TRANSACTION_RESULTS][terInfo.first] = code;
-
278 }
-
279
-
280 // populate TxType names and values
-
281 defs_[jss::TRANSACTION_TYPES] = Json::objectValue;
-
282 defs_[jss::TRANSACTION_TYPES][jss::Invalid] = -1;
-
283 for (auto const& f : TxFormats::getInstance())
-
284 {
-
285 defs_[jss::TRANSACTION_TYPES][f.getName()] = f.getType();
-
286 }
-
287
-
288 // generate hash
-
289 {
- - -
292 defs_[jss::hash] = to_string(defsHash_);
-
293 }
-
294}
-
-
295
-
296} // namespace detail
-
297
- -
- -
300{
-
301 auto& params = context.params;
-
302
-
303 uint256 hash;
-
304 if (params.isMember(jss::hash))
-
305 {
-
306 if (!params[jss::hash].isString() ||
-
307 !hash.parseHex(params[jss::hash].asString()))
-
308 return RPC::invalid_field_error(jss::hash);
-
309 }
-
310
-
311 static detail::ServerDefinitions const defs{};
-
312 if (defs.hashMatches(hash))
-
313 {
- -
315 jv[jss::hash] = to_string(hash);
-
316 return jv;
-
317 }
-
318 return defs.get();
-
319}
-
-
320
- -
- -
323{
- -
325
-
326 ret[jss::info] = context.netOps.getServerInfo(
-
327 true,
-
328 context.role == Role::ADMIN,
-
329 context.params.isMember(jss::counters) &&
-
330 context.params[jss::counters].asBool());
-
331
-
332 return ret;
-
333}
-
-
334
-
335} // namespace ripple
- -
Outputs a Value in JSON format without formatting (not human friendly).
Definition json_writer.h:54
-
std::string write(Value const &root) override
+
43
+
44} // namespace ripple
Represents a JSON value.
Definition json_value.h:149
bool asBool() const
bool isMember(char const *key) const
Return true if the object has a member named key.
-
Value get(UInt index, Value const &defaultValue) const
If the array contains at least index+1 elements, returns the element value, otherwise returns default...
-
static LedgerFormats const & getInstance()
virtual Json::Value getServerInfo(bool human, bool admin, bool counters)=0
-
static std::unordered_map< int, SField const * > const & getKnownCodeToField()
Definition SField.h:306
-
An immutable linear range of bytes.
Definition Slice.h:46
-
std::uint8_t const * data() const noexcept
Return a pointer to beginning of the storage.
Definition Slice.h:98
-
static TxFormats const & getInstance()
Definition TxFormats.cpp:71
- -
constexpr bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
Definition base_uint.h:503
- -
std::string translate(std::string const &inp)
- -
bool hashMatches(uint256 hash) const
- - -
Json::Value const & get() const
-
T data(T... args)
-
T find(T... args)
- -
JSON (JavaScript Object Notation).
Definition json_errors.h:25
-
@ arrayValue
array value (ordered list)
Definition json_value.h:44
@ objectValue
object value (collection of name/value pairs).
Definition json_value.h:45
-
Json::Value invalid_field_error(std::string const &name)
Definition ErrorCodes.h:325
-
static std::string to_string(TableType type)
to_string Returns the name of a table according to its TableType.
Definition Node.cpp:47
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
-
static std::map< std::string, int > const sTypeMap
Definition SField.h:112
-
Json::Value doServerInfo(RPC::JsonContext &)
-
Json::Value doServerDefinitions(RPC::JsonContext &)
- -
std::string to_string(base_uint< Bits, Tag > const &a)
Definition base_uint.h:630
-
std::unordered_map< TERUnderlyingType, std::pair< char const *const, char const *const > > const & transResults()
Definition TER.cpp:35
+
Json::Value doServerInfo(RPC::JsonContext &)
-
sha512_half_hasher::result_type sha512Half(Args const &... args)
Returns the SHA512-Half of a series of objects.
Definition digest.h:224
-
T size(T... args)
NetworkOPs & netOps
Definition Context.h:43
-
T substr(T... args)
-