rippled
Loading...
Searching...
No Matches
PeerReservationsList.cpp
1#include <xrpld/rpc/Context.h>
2#include <xrpld/rpc/handlers/Handlers.h>
3
4#include <xrpl/json/json_value.h>
5#include <xrpl/protocol/jss.h>
6
7namespace xrpl {
8
11{
12 auto const& reservations = context.app.getPeerReservations().list();
13 // Enumerate the reservations in context.app.getPeerReservations()
14 // as a Json::Value.
16 Json::Value& jaReservations = result[jss::reservations] = Json::arrayValue;
17 for (auto const& reservation : reservations)
18 {
19 jaReservations.append(reservation.toJson());
20 }
21 return result;
22}
23
24} // namespace xrpl
Represents a JSON value.
Definition json_value.h:130
Value & append(Value const &value)
Append value to array at the end.
std::vector< PeerReservation > list() const
virtual PeerReservationTable & getPeerReservations()=0
@ arrayValue
array value (ordered list)
Definition json_value.h:25
@ objectValue
object value (collection of name/value pairs).
Definition json_value.h:26
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
Json::Value doPeerReservationsList(RPC::JsonContext &context)
Application & app
Definition Context.h:21