1#ifndef XRPL_OVERLAY_OVERLAY_H_INCLUDED
2#define XRPL_OVERLAY_OVERLAY_H_INCLUDED
4#include <xrpld/overlay/Peer.h>
6#include <xrpl/beast/utility/PropertyStream.h>
7#include <xrpl/json/json_value.h>
8#include <xrpl/server/Handoff.h>
10#include <boost/asio/ip/tcp.hpp>
11#include <boost/asio/ssl/context.hpp>
12#include <boost/beast/core/tcp_stream.hpp>
13#include <boost/beast/ssl/ssl_stream.hpp>
76 boost::asio::ip::tcp::endpoint remote_address) = 0;
138 protocol::TMProposeSet& m,
150 protocol::TMValidation& m,
174 template <
class Function>
176 foreach(Function f)
const
A version-independent IP address and port combination.
Subclasses can be called to write to a stream and have children.
Source(std::string const &name)
Manages the set of connected peers.
boost::beast::ssl_stream< socket_type > stream_type
virtual void relay(uint256 const &hash, std::optional< std::reference_wrapper< protocol::TMTransaction > > m, std::set< Peer::id_t > const &toSkip)=0
Relay a transaction.
virtual void broadcast(protocol::TMProposeSet &m)=0
Broadcast a proposal.
virtual void broadcast(protocol::TMValidation &m)=0
Broadcast a validation.
virtual std::shared_ptr< Peer > findPeerByPublicKey(PublicKey const &pubKey)=0
Returns the peer with the matching public key, or null.
virtual int limit()=0
Returns the maximum number of peers we are configured to allow.
virtual PeerSequence getActivePeers() const =0
Returns a sequence representing the current list of peers.
virtual std::shared_ptr< Peer > findPeerByShortID(Peer::id_t const &id) const =0
Returns the peer with the matching short id, or null.
virtual Json::Value json()=0
Return diagnostics on the status of all peers.
virtual std::set< Peer::id_t > relay(protocol::TMProposeSet &m, uint256 const &uid, PublicKey const &validator)=0
Relay a proposal.
virtual std::optional< std::uint32_t > networkID() const =0
Returns the ID of the network this server is configured for, if any.
boost::beast::tcp_stream socket_type
virtual void checkTracking(std::uint32_t index)=0
Calls the checkTracking function on each peer.
virtual Json::Value txMetrics() const =0
Returns tx reduce-relay metrics.
virtual std::uint64_t getPeerDisconnect() const =0
virtual std::size_t size() const =0
Returns the number of active peers.
virtual ~Overlay()=default
virtual void incPeerDisconnect()=0
Increment and retrieve counters for total peer disconnects, and disconnects we initiate for excessive...
virtual Handoff onHandoff(std::unique_ptr< stream_type > &&bundle, http_request_type &&request, boost::asio::ip::tcp::endpoint remote_address)=0
Conditionally accept an incoming HTTP request.
virtual std::uint64_t getJqTransOverflow() const =0
virtual std::set< Peer::id_t > relay(protocol::TMValidation &m, uint256 const &uid, PublicKey const &validator)=0
Relay a validation.
virtual void connect(beast::IP::Endpoint const &address)=0
Establish a peer connection to the specified endpoint.
virtual void incJqTransOverflow()=0
Increment and retrieve counter for transaction job queue overflows.
virtual void incPeerDisconnectCharges()=0
virtual std::uint64_t getPeerDisconnectCharges() const =0
boost::asio::ip::address Address
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
boost::beast::http::request< boost::beast::http::dynamic_body > http_request_type
Used to indicate the result of a server connection handoff.
beast::IP::Address public_ip
std::uint32_t crawlOptions
std::shared_ptr< boost::asio::ssl::context > context
std::optional< std::uint32_t > networkID