20 #ifndef RIPPLE_OVERLAY_OVERLAY_H_INCLUDED
21 #define RIPPLE_OVERLAY_OVERLAY_H_INCLUDED
23 #include <ripple/json/json_value.h>
24 #include <ripple/overlay/Peer.h>
25 #include <ripple/overlay/PeerSet.h>
26 #include <ripple/server/Handoff.h>
27 #include <boost/asio/ip/tcp.hpp>
28 #include <boost/asio/ssl/context.hpp>
29 #include <boost/asio/ssl/stream.hpp>
30 #include <boost/beast/http/message.hpp>
31 #include <boost/beast/core/tcp_stream.hpp>
32 #include <boost/beast/ssl/ssl_stream.hpp>
33 #include <ripple/core/Stoppable.h>
34 #include <ripple/beast/utility/PropertyStream.h>
37 #include <boost/asio/buffer.hpp>
38 #include <boost/asio/ip/tcp.hpp>
39 #include <boost/optional.hpp>
42 namespace boost {
namespace asio {
namespace ssl {
class context; } } }
75 explicit Setup() =
default;
95 boost::asio::ip::tcp::endpoint remote_address) = 0;
158 send (protocol::TMProposeSet& m) = 0;
163 send (protocol::TMValidation& m) = 0;
168 relay (protocol::TMProposeSet& m,
174 relay (protocol::TMValidation& m,
191 template <
typename UnaryFunc>
193 typename UnaryFunc::return_type>::value,
194 typename UnaryFunc::return_type>
195 foreach (UnaryFunc f)
211 template <
class Function>
214 typename Function::return_type
274 boost::optional<std::uint32_t>
virtual ~Overlay()=default
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.
boost::beast::ssl_stream< socket_type > stream_type
virtual int limit()=0
Returns the maximum number of peers we are configured to allow.
boost::beast::http::request< boost::beast::http::dynamic_body > http_request_type
virtual std::uint64_t getJqTransOverflow() const =0
Subclasses can be called to write to a stream and have children.
std::uint32_t crawlOptions
virtual PeerSequence getActivePeers()=0
Returns a sequence representing the current list of peers.
boost::beast::tcp_stream socket_type
virtual void incPeerDisconnectCharges()=0
Provides an interface for starting and stopping.
beast::IP::Address public_ip
boost::asio::ip::address Address
ScoreHasTxSet(uint256 const &hash)
virtual void incJqTransOverflow()=0
Increment and retrieve counter for transaction job queue overflows.
virtual void relay(protocol::TMProposeSet &m, uint256 const &uid)=0
Relay a proposal.
bool set(T &target, std::string const &name, Section const §ion)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
virtual void checkSanity(std::uint32_t index)=0
Calls the checkSanity function on each peer.
virtual void send(protocol::TMProposeSet &m)=0
Broadcast a proposal.
virtual std::size_t selectPeers(PeerSet &set, std::size_t limit, std::function< bool(std::shared_ptr< Peer > const &)> score)=0
Select from active peers.
virtual std::shared_ptr< Peer > findPeerByPublicKey(PublicKey const &pubKey)=0
Returns the peer with the matching public key, or null.
virtual void incPeerDisconnect()=0
Increment and retrieve counters for total peer disconnects, and disconnects we initiate for excessive...
virtual Json::Value crawlShards(bool pubKey, std::uint32_t hops)=0
Returns information reported to the crawl shard RPC command.
virtual std::size_t size()=0
Returns the number of active peers.
virtual void connect(beast::IP::Endpoint const &address)=0
Establish a peer connection to the specified endpoint.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Overlay(Stoppable &parent)
Source(std::string const &name)
Manages the set of connected peers.
virtual Json::Value json()=0
Return diagnostics on the status of all peers.
Supports data retrieval by managing a set of peers.
boost::optional< std::uint32_t > networkID
bool operator()(std::shared_ptr< Peer > const &) const
Used to indicate the result of a server connection handoff.
bool operator()(std::shared_ptr< Peer > const &) const
A version-independent IP address and port combination.
std::shared_ptr< boost::asio::ssl::context > context
virtual std::uint64_t getPeerDisconnect() const =0
virtual boost::optional< std::uint32_t > networkID() const =0
Returns the ID of the network this server is configured for, if any.
virtual std::uint64_t getPeerDisconnectCharges() const =0
virtual std::shared_ptr< Peer > findPeerByShortID(Peer::id_t const &id)=0
Returns the peer with the matching short id, or null.
virtual void check()=0
Calls the check function on each peer.
ScoreHasLedger(uint256 const &hash, std::uint32_t seq)