rippled
Classes | Public Types | Public Member Functions | Public Attributes | Private Attributes | Static Private Attributes | List of all members
ripple::PeerFinder::SlotImp Class Reference
Inheritance diagram for ripple::PeerFinder::SlotImp:
Inheritance graph
[legend]
Collaboration diagram for ripple::PeerFinder::SlotImp:
Collaboration graph
[legend]

Classes

class  recent_t
 

Public Types

using ptr = std::shared_ptr< SlotImp >
 
enum  State {
  accept, connect, connected, active,
  closing
}
 

Public Member Functions

 SlotImp (beast::IP::Endpoint const &local_endpoint, beast::IP::Endpoint const &remote_endpoint, bool fixed, clock_type &clock)
 
 SlotImp (beast::IP::Endpoint const &remote_endpoint, bool fixed, clock_type &clock)
 
bool inbound () const override
 Returns true if this is an inbound connection. More...
 
bool fixed () const override
 Returns true if this is a fixed connection. More...
 
bool reserved () const override
 Returns true if this is a reserved connection. More...
 
State state () const override
 Returns the state of the connection. More...
 
beast::IP::Endpoint const & remote_endpoint () const override
 The remote endpoint of socket. More...
 
std::optional< beast::IP::Endpoint > const & local_endpoint () const override
 The local endpoint of the socket, when known. More...
 
std::optional< PublicKey > const & public_key () const override
 The peer's public key, when known. More...
 
std::optional< std::uint16_tlistening_port () const override
 
void set_listening_port (std::uint16_t port)
 
void local_endpoint (beast::IP::Endpoint const &endpoint)
 
void remote_endpoint (beast::IP::Endpoint const &endpoint)
 
void public_key (PublicKey const &key)
 
void reserved (bool reserved_)
 
void state (State state_)
 
void activate (clock_type::time_point const &now)
 
void expire ()
 

Public Attributes

class ripple::PeerFinder::SlotImp::recent_t recent
 
bool checked
 
bool canAccept
 
bool connectivityCheckInProgress
 
clock_type::time_point whenAcceptEndpoints
 

Private Attributes

const bool m_inbound
 
const bool m_fixed
 
bool m_reserved
 
State m_state
 
beast::IP::Endpoint m_remote_endpoint
 
std::optional< beast::IP::Endpointm_local_endpoint
 
std::optional< PublicKeym_public_key
 
std::atomic< std::int32_tm_listening_port
 

Static Private Attributes

static constexpr std::int32_t unknownPort = -1
 

Detailed Description

Definition at line 33 of file SlotImp.h.

Member Typedef Documentation

◆ ptr

Definition at line 36 of file SlotImp.h.

Member Enumeration Documentation

◆ State

Enumerator
accept 
connect 
connected 
active 
closing 

Definition at line 37 of file peerfinder/Slot.h.

Constructor & Destructor Documentation

◆ SlotImp() [1/2]

ripple::PeerFinder::SlotImp::SlotImp ( beast::IP::Endpoint const &  local_endpoint,
beast::IP::Endpoint const &  remote_endpoint,
bool  fixed,
clock_type clock 
)

Definition at line 27 of file SlotImp.cpp.

◆ SlotImp() [2/2]

ripple::PeerFinder::SlotImp::SlotImp ( beast::IP::Endpoint const &  remote_endpoint,
bool  fixed,
clock_type clock 
)

Definition at line 46 of file SlotImp.cpp.

Member Function Documentation

◆ inbound()

bool ripple::PeerFinder::SlotImp::inbound ( ) const
overridevirtual

Returns true if this is an inbound connection.

Implements ripple::PeerFinder::Slot.

Definition at line 52 of file SlotImp.h.

◆ fixed()

bool ripple::PeerFinder::SlotImp::fixed ( ) const
overridevirtual

Returns true if this is a fixed connection.

A connection is fixed if its remote endpoint is in the list of remote endpoints for fixed connections.

Implements ripple::PeerFinder::Slot.

Definition at line 58 of file SlotImp.h.

◆ reserved() [1/2]

bool ripple::PeerFinder::SlotImp::reserved ( ) const
overridevirtual

Returns true if this is a reserved connection.

It might be a cluster peer, or a peer with a reservation. This is only known after then handshake completes.

Implements ripple::PeerFinder::Slot.

Definition at line 64 of file SlotImp.h.

◆ state() [1/2]

State ripple::PeerFinder::SlotImp::state ( ) const
overridevirtual

Returns the state of the connection.

Implements ripple::PeerFinder::Slot.

Definition at line 70 of file SlotImp.h.

◆ remote_endpoint() [1/2]

beast::IP::Endpoint const& ripple::PeerFinder::SlotImp::remote_endpoint ( ) const
overridevirtual

The remote endpoint of socket.

Implements ripple::PeerFinder::Slot.

Definition at line 76 of file SlotImp.h.

◆ local_endpoint() [1/2]

std::optional<beast::IP::Endpoint> const& ripple::PeerFinder::SlotImp::local_endpoint ( ) const
overridevirtual

The local endpoint of the socket, when known.

Implements ripple::PeerFinder::Slot.

Definition at line 82 of file SlotImp.h.

◆ public_key() [1/2]

std::optional<PublicKey> const& ripple::PeerFinder::SlotImp::public_key ( ) const
overridevirtual

The peer's public key, when known.

The public key is established when the handshake is complete.

Implements ripple::PeerFinder::Slot.

Definition at line 88 of file SlotImp.h.

◆ listening_port()

std::optional<std::uint16_t> ripple::PeerFinder::SlotImp::listening_port ( ) const
overridevirtual

Implements ripple::PeerFinder::Slot.

Definition at line 94 of file SlotImp.h.

◆ set_listening_port()

void ripple::PeerFinder::SlotImp::set_listening_port ( std::uint16_t  port)

Definition at line 103 of file SlotImp.h.

◆ local_endpoint() [2/2]

void ripple::PeerFinder::SlotImp::local_endpoint ( beast::IP::Endpoint const &  endpoint)

Definition at line 109 of file SlotImp.h.

◆ remote_endpoint() [2/2]

void ripple::PeerFinder::SlotImp::remote_endpoint ( beast::IP::Endpoint const &  endpoint)

Definition at line 115 of file SlotImp.h.

◆ public_key() [2/2]

void ripple::PeerFinder::SlotImp::public_key ( PublicKey const &  key)

Definition at line 121 of file SlotImp.h.

◆ reserved() [2/2]

void ripple::PeerFinder::SlotImp::reserved ( bool  reserved_)

Definition at line 127 of file SlotImp.h.

◆ state() [2/2]

void ripple::PeerFinder::SlotImp::state ( State  state_)

Definition at line 64 of file SlotImp.cpp.

◆ activate()

void ripple::PeerFinder::SlotImp::activate ( clock_type::time_point const &  now)

Definition at line 85 of file SlotImp.cpp.

◆ expire()

void ripple::PeerFinder::SlotImp::expire ( )

Definition at line 170 of file SlotImp.h.

Member Data Documentation

◆ recent

class ripple::PeerFinder::SlotImp::recent_t ripple::PeerFinder::SlotImp::recent

◆ m_inbound

const bool ripple::PeerFinder::SlotImp::m_inbound
private

Definition at line 176 of file SlotImp.h.

◆ m_fixed

const bool ripple::PeerFinder::SlotImp::m_fixed
private

Definition at line 177 of file SlotImp.h.

◆ m_reserved

bool ripple::PeerFinder::SlotImp::m_reserved
private

Definition at line 178 of file SlotImp.h.

◆ m_state

State ripple::PeerFinder::SlotImp::m_state
private

Definition at line 179 of file SlotImp.h.

◆ m_remote_endpoint

beast::IP::Endpoint ripple::PeerFinder::SlotImp::m_remote_endpoint
private

Definition at line 180 of file SlotImp.h.

◆ m_local_endpoint

std::optional<beast::IP::Endpoint> ripple::PeerFinder::SlotImp::m_local_endpoint
private

Definition at line 181 of file SlotImp.h.

◆ m_public_key

std::optional<PublicKey> ripple::PeerFinder::SlotImp::m_public_key
private

Definition at line 182 of file SlotImp.h.

◆ unknownPort

constexpr std::int32_t ripple::PeerFinder::SlotImp::unknownPort = -1
staticconstexprprivate

Definition at line 184 of file SlotImp.h.

◆ m_listening_port

std::atomic<std::int32_t> ripple::PeerFinder::SlotImp::m_listening_port
private

Definition at line 185 of file SlotImp.h.

◆ checked

bool ripple::PeerFinder::SlotImp::checked

Definition at line 192 of file SlotImp.h.

◆ canAccept

bool ripple::PeerFinder::SlotImp::canAccept

Definition at line 196 of file SlotImp.h.

◆ connectivityCheckInProgress

bool ripple::PeerFinder::SlotImp::connectivityCheckInProgress

Definition at line 200 of file SlotImp.h.

◆ whenAcceptEndpoints

clock_type::time_point ripple::PeerFinder::SlotImp::whenAcceptEndpoints

Definition at line 206 of file SlotImp.h.