rippled
Loading...
Searching...
No Matches
xrpld/overlay/Peer.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012, 2013 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#ifndef RIPPLE_OVERLAY_PEER_H_INCLUDED
21#define RIPPLE_OVERLAY_PEER_H_INCLUDED
22
23#include <xrpld/overlay/Message.h>
24#include <xrpl/basics/base_uint.h>
25#include <xrpl/beast/net/IPEndpoint.h>
26#include <xrpl/json/json_value.h>
27#include <xrpl/protocol/PublicKey.h>
28
29namespace ripple {
30
31namespace Resource {
32class Charge;
33}
34
35enum class ProtocolFeature {
39};
40
42class Peer
43{
44public:
46
53
54 virtual ~Peer() = default;
55
56 //
57 // Network
58 //
59
60 virtual void
62
64 getRemoteAddress() const = 0;
65
67 virtual void
69
71 virtual void
72 addTxQueue(uint256 const&) = 0;
73
75 virtual void
77
79 virtual void
80 charge(Resource::Charge const& fee) = 0;
81
82 //
83 // Identity
84 //
85
86 virtual id_t
87 id() const = 0;
88
90 virtual bool
91 cluster() const = 0;
92
93 virtual bool
94 isHighLatency() const = 0;
95
96 virtual int
97 getScore(bool) const = 0;
98
99 virtual PublicKey const&
100 getNodePublic() const = 0;
101
102 virtual Json::Value
103 json() = 0;
104
105 virtual bool
107
110
111 virtual void
113
114 //
115 // Ledger
116 //
117
118 virtual uint256 const&
120 virtual bool
121 hasLedger(uint256 const& hash, std::uint32_t seq) const = 0;
122 virtual void
123 ledgerRange(std::uint32_t& minSeq, std::uint32_t& maxSeq) const = 0;
124 virtual bool
125 hasTxSet(uint256 const& hash) const = 0;
126 virtual void
128 virtual bool
130
131 virtual bool
133
134 virtual bool
136};
137
138} // namespace ripple
139
140#endif
Represents a JSON value.
Definition: json_value.h:147
A version-independent IP address and port combination.
Definition: IPEndpoint.h:39
Represents a peer connection in the overlay.
virtual bool isHighLatency() const =0
virtual bool txReduceRelayEnabled() const =0
virtual ~Peer()=default
virtual bool supportsFeature(ProtocolFeature f) const =0
virtual int getScore(bool) const =0
virtual beast::IP::Endpoint getRemoteAddress() const =0
virtual Json::Value json()=0
virtual void send(std::shared_ptr< Message > const &m)=0
virtual bool compressionEnabled() const =0
virtual void cycleStatus()=0
virtual std::optional< std::size_t > publisherListSequence(PublicKey const &) const =0
virtual void charge(Resource::Charge const &fee)=0
Adjust this peer's load balance based on the type of load imposed.
virtual bool hasLedger(uint256 const &hash, std::uint32_t seq) const =0
virtual bool cluster() const =0
Returns true if this connection is a member of the cluster.
virtual void addTxQueue(uint256 const &)=0
Aggregate transaction's hash.
virtual bool hasRange(std::uint32_t uMin, std::uint32_t uMax)=0
virtual void sendTxQueue()=0
Send aggregated transactions' hashes.
virtual PublicKey const & getNodePublic() const =0
virtual void ledgerRange(std::uint32_t &minSeq, std::uint32_t &maxSeq) const =0
virtual void removeTxQueue(uint256 const &)=0
Remove hash from the transactions' hashes queue.
virtual uint256 const & getClosedLedgerHash() const =0
virtual void setPublisherListSequence(PublicKey const &, std::size_t const)=0
virtual bool hasTxSet(uint256 const &hash) const =0
virtual id_t id() const =0
A public key.
Definition: PublicKey.h:62
A consumption charge.
Definition: Charge.h:31
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26