xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
xrpld
rpc
handlers
admin
peer
PeerReservationsList.cpp
1
#include <xrpld/rpc/Context.h>
2
#include <xrpld/rpc/handlers/Handlers.h>
3
4
#include <xrpl/core/PeerReservationTable.h>
5
#include <xrpl/json/json_value.h>
6
#include <xrpl/protocol/jss.h>
7
8
namespace
xrpl
{
9
10
json::Value
11
doPeerReservationsList
(
rpc::JsonContext
& context)
12
{
13
auto
const
& reservations = context.
app
.
getPeerReservations
().
list
();
14
// Enumerate the reservations in context.app.getPeerReservations()
15
// as a json::Value.
16
json::Value
result{
json::ValueType::Object
};
17
json::Value
& jaReservations = result[jss::reservations] =
json::ValueType::Array
;
18
for
(
auto
const
& reservation : reservations)
19
{
20
jaReservations.
append
(reservation.toJson());
21
}
22
return
result;
23
}
24
25
}
// namespace xrpl
json::Value
Represents a JSON value.
Definition
json_value.h:117
json::Value::append
Value & append(Value const &value)
Append value to array at the end.
Definition
json_value.cpp:997
xrpl::PeerReservationTable::list
std::vector< PeerReservation > list() const
Definition
PeerReservationTable.cpp:31
xrpl::ServiceRegistry::getPeerReservations
virtual PeerReservationTable & getPeerReservations()=0
json::ValueType::Array
@ Array
array value (ordered list)
Definition
json_value.h:28
json::ValueType::Object
@ Object
object value (collection of name/value pairs).
Definition
json_value.h:29
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::doPeerReservationsList
json::Value doPeerReservationsList(rpc::JsonContext &context)
Definition
PeerReservationsList.cpp:11
xrpl::rpc::Context::app
Application & app
Definition
Context.h:29
xrpl::rpc::JsonContext
Definition
Context.h:41
Generated by
1.17.0