rippled
Loading...
Searching...
No Matches
peerfinder/Slot.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_PEERFINDER_SLOT_H_INCLUDED
21#define RIPPLE_PEERFINDER_SLOT_H_INCLUDED
22
23#include <xrpl/beast/net/IPEndpoint.h>
24#include <xrpl/protocol/PublicKey.h>
25
26#include <optional>
27
28namespace ripple {
29namespace PeerFinder {
30
32class Slot
33{
34public:
36
38
39 virtual ~Slot() = 0;
40
42 virtual bool
43 inbound() const = 0;
44
49 virtual bool
50 fixed() const = 0;
51
56 virtual bool
57 reserved() const = 0;
58
60 virtual State
61 state() const = 0;
62
64 virtual beast::IP::Endpoint const&
65 remote_endpoint() const = 0;
66
69 local_endpoint() const = 0;
70
72 listening_port() const = 0;
73
77 virtual std::optional<PublicKey> const&
78 public_key() const = 0;
79};
80
81} // namespace PeerFinder
82} // namespace ripple
83
84#endif
A version-independent IP address and port combination.
Definition: IPEndpoint.h:39
Properties and state associated with a peer to peer overlay connection.
virtual bool inbound() const =0
Returns true if this is an inbound connection.
virtual beast::IP::Endpoint const & remote_endpoint() const =0
The remote endpoint of socket.
virtual bool fixed() const =0
Returns true if this is a fixed connection.
virtual std::optional< std::uint16_t > listening_port() const =0
virtual State state() const =0
Returns the state of the connection.
virtual bool reserved() const =0
Returns true if this is a reserved connection.
virtual std::optional< PublicKey > const & public_key() const =0
The peer's public key, when known.
virtual std::optional< beast::IP::Endpoint > const & local_endpoint() const =0
The local endpoint of the socket, when known.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26