TARAXA
Loading...
Searching...
No Matches
dev::p2p Namespace Reference

Classes

struct  Capability
 
class  CapabilityFace
 The Capability interface. This interface has to be implemented to support any devp2p subprotocol. More...
 
struct  DiscoveryDatagram
 
struct  ECDHEError
 The ECDHE agreement failed during RLPx handshake. More...
 
class  EndpointTracker
 
class  ENR
 Class representing Ethereum Node Record - see EIP-778. More...
 
struct  ENRRequest
 
struct  ENRResponse
 
struct  FindNode
 
struct  Host
 The Host class Capabilities should be registered prior to startNetwork, since m_capabilities is not thread-safe. More...
 
class  IdentitySchemeV4
 
struct  InvalidPublicIPAddress
 
struct  Neighbours
 
class  Network
 Network Class Static network operations and interface(s). More...
 
struct  NetworkConfig
 
struct  NetworkRestartNotSupported
 
struct  NetworkStartRequired
 
class  Node
 
struct  NodeEntry
 Entry in Node Table. More...
 
struct  NodeInfo
 
class  NodeIPEndpoint
 IPv4,UDP/TCP endpoints. More...
 
struct  NodeSpec
 
class  NodeTable
 
class  NodeTableEventHandler
 
class  Peer
 Representation of connectivity state and all other pertinent Peer metadata. A Peer represents connectivity between two nodes, which in this case, are the host and remote nodes. More...
 
struct  PeerSessionInfo
 
struct  PingNode
 
struct  Pong
 
struct  RLPXDatagramFace
 RLPX Datagram which can be signed. More...
 
class  RLPXFrameCoder
 Encoder/decoder transport for RLPx connection established by RLPXHandshake. More...
 
class  RLPXFrameCoderImpl
 
struct  RLPXFrameInfo
 Encapsulation of Frame. More...
 
struct  RLPXHandshake
 Setup inbound or outbound connection for communication over RLPXFrameCoder. RLPx Spec: https://github.com/ethereum/devp2p/blob/master/rlpx.md#encrypted-handshake. More...
 
struct  RLPXInvalidPacket
 
class  RLPXPacket
 
class  RLPXSocket
 Shared pointer wrapper for ASIO TCP socket. More...
 
struct  Session
 The Session class. More...
 
struct  SessionCapability
 
struct  TaraxaNetworkConfig
 
class  UDPDatagram
 
class  UDPSocket
 UDP Interface Handler must implement UDPSocketEvents. More...
 
struct  UDPSocketEvents
 Interface which a UDPSocket's owner must implement. More...
 
struct  UDPSocketFace
 Interface which UDPSocket will implement. More...
 
class  UPnP
 

Typedefs

using NodeID = h512
 
using CapDesc = std::pair< std::string, unsigned >
 
using CapDescs = std::vector< CapDesc >
 
using PeerSessionInfos = std::vector< PeerSessionInfo >
 
using CapabilityNameAndVersion = CapDesc
 
using Capabilities = std::map< CapabilityNameAndVersion, Capability >
 
using SessionCapabilities = std::map< std::string, SessionCapability >
 

Enumerations

enum  P2pPacketType {
  HelloPacket = 0 , DisconnectPacket , PingPacket , PongPacket ,
  UserPacket = 0x10
}
 
enum  DisconnectReason {
  DisconnectRequested = 0 , TCPError , BadProtocol , UselessPeer ,
  TooManyPeers , DuplicatePeer , IncompatibleProtocol , NullIdentity ,
  ClientQuit , UnexpectedIdentity , LocalIdentity , PingTimeout ,
  UserReason = 0x10 , NoDisconnect = 0xffff
}
 
enum class  HandshakeFailureReason {
  NoFailure = 0 , UnknownFailure , Timeout , TCPError ,
  FrameDecryptionFailure , InternalError , ProtocolError , DisconnectRequested
}
 
enum class  PeerType { Optional , Required }
 
enum  NodeTableEventType { NodeEntryAdded , NodeEntryDropped , NodeEntryScheduledForEviction }
 

Functions

char constp2pPacketTypeToString (P2pPacketType _packetType)
 
bool isPublicAddress (string const &_addressToCheck)
 
bool isPublicAddress (bi::address const &_addressToCheck)
 
bool isAllowedAddress (bool _allowLocalDiscovery, bi::address const &_addressToCheck)
 
bool isAllowedEndpoint (bool _allowLocalDiscovery, NodeIPEndpoint const &_endpointToCheck)
 
bool isPrivateAddress (bi::address const &_addressToCheck)
 
bool isPrivateAddress (string const &_addressToCheck)
 
bool isLocalHostAddress (bi::address const &_addressToCheck)
 
bool isLocalHostAddress (string const &_addressToCheck)
 
string reasonOf (DisconnectReason _r)
 
ostreamoperator<< (ostream &_out, NodeIPEndpoint const &_ep)
 
bool isPrivateAddress (std::string const &_addressToCheck)
 
bool isLocalHostAddress (std::string const &_addressToCheck)
 
bool isPublicAddress (std::string const &_addressToCheck)
 
boost::log::formatting_ostream & operator<< (boost::log::formatting_ostream &_strm, Node const &_node)
 
boost::log::formatting_ostream & operator<< (boost::log::formatting_ostream &_strm, Node &_node)
 
std::ostream & operator<< (std::ostream &_strm, NodeID const &_id)
 
boost::log::formatting_ostream & operator<< (boost::log::formatting_ostream &_strm, PeerSessionInfo const &_peerSessionInfo)
 
std::ostream & operator<< (std::ostream &_out, NodeIPEndpoint const &_ep)
 Simple stream output for a NodeIPEndpoint.
 
std::ostream & operator<< (std::ostream &_out, ENR const &_enr)
 
 DEV_SIMPLE_EXCEPTION (ENRIsTooBig)
 
 DEV_SIMPLE_EXCEPTION (ENRSignatureIsInvalid)
 
 DEV_SIMPLE_EXCEPTION (ENRKeysAreNotUniqueSorted)
 
 DEV_SIMPLE_EXCEPTION (ENRUnknownIdentityScheme)
 
 DEV_SIMPLE_EXCEPTION (ENRSecp256k1NotFound)
 
 DEV_SIMPLE_EXCEPTION (ENRInvalidAddress)
 
bool operator== (std::weak_ptr< NodeEntry > const &_weak, std::shared_ptr< NodeEntry > const &_shared)
 
std::ostream & operator<< (std::ostream &_out, NodeTable const &_nodeTable)
 
static bytesConstRef nextRLP (bytesConstRef _b)
 

Variables

const NodeIPEndpoint UnspecifiedNodeIPEndpoint = NodeIPEndpoint{{}, 0, 0}
 
const Node UnspecifiedNode = Node{{}, UnspecifiedNodeIPEndpoint}
 
constexpr unsigned c_protocolVersion = 1029
 Peer network protocol version.
 
constexpr const charc_localhostIp = "127.0.0.1"
 
constexpr unsigned short c_defaultListenPort = 30303
 

Class Documentation

◆ dev::p2p::PeerSessionInfo

struct dev::p2p::PeerSessionInfo
Collaboration diagram for dev::p2p::PeerSessionInfo:
Class Members
set< CapDesc > caps
string clientVersion
string host
NodeID id
duration lastPing
unsigned short port

◆ dev::p2p::TaraxaNetworkConfig

struct dev::p2p::TaraxaNetworkConfig
Class Members
unsigned chain_id = 0
uint expected_parallelism = 1
unsigned ideal_peer_count = 11
bool is_boot_node = false
seconds log_active_peers_interval {30}
milliseconds main_loop_interval {100}
seconds peer_healthcheck_interval {30}
seconds peer_healthcheck_timeout {1}
unsigned peer_stretch = 7

Typedef Documentation

◆ Capabilities

◆ CapabilityNameAndVersion

◆ CapDesc

using dev::p2p::CapDesc = typedef std::pair<std::string, unsigned>

◆ CapDescs

◆ NodeID

◆ PeerSessionInfos

◆ SessionCapabilities

Enumeration Type Documentation

◆ DisconnectReason

Enumerator
DisconnectRequested 
TCPError 
BadProtocol 
UselessPeer 
TooManyPeers 
DuplicatePeer 
IncompatibleProtocol 
NullIdentity 
ClientQuit 
UnexpectedIdentity 
LocalIdentity 
PingTimeout 
UserReason 
NoDisconnect 

◆ HandshakeFailureReason

Enumerator
NoFailure 
UnknownFailure 
Timeout 
TCPError 
FrameDecryptionFailure 
InternalError 
ProtocolError 
DisconnectRequested 

◆ NodeTableEventType

Enumerator
NodeEntryAdded 
NodeEntryDropped 
NodeEntryScheduledForEviction 

◆ P2pPacketType

Enumerator
HelloPacket 
DisconnectPacket 
PingPacket 
PongPacket 
UserPacket 

◆ PeerType

Enumerator
Optional 
Required 

Function Documentation

◆ DEV_SIMPLE_EXCEPTION() [1/6]

dev::p2p::DEV_SIMPLE_EXCEPTION ( ENRInvalidAddress  )

◆ DEV_SIMPLE_EXCEPTION() [2/6]

dev::p2p::DEV_SIMPLE_EXCEPTION ( ENRIsTooBig  )

◆ DEV_SIMPLE_EXCEPTION() [3/6]

dev::p2p::DEV_SIMPLE_EXCEPTION ( ENRKeysAreNotUniqueSorted  )

◆ DEV_SIMPLE_EXCEPTION() [4/6]

dev::p2p::DEV_SIMPLE_EXCEPTION ( ENRSecp256k1NotFound  )

◆ DEV_SIMPLE_EXCEPTION() [5/6]

dev::p2p::DEV_SIMPLE_EXCEPTION ( ENRSignatureIsInvalid  )

◆ DEV_SIMPLE_EXCEPTION() [6/6]

dev::p2p::DEV_SIMPLE_EXCEPTION ( ENRUnknownIdentityScheme  )

◆ isAllowedAddress()

bool dev::p2p::isAllowedAddress ( bool  _allowLocalDiscovery,
bi::address const _addressToCheck 
)

◆ isAllowedEndpoint()

bool dev::p2p::isAllowedEndpoint ( bool  _allowLocalDiscovery,
NodeIPEndpoint const _endpointToCheck 
)

◆ isLocalHostAddress() [1/3]

bool dev::p2p::isLocalHostAddress ( bi::address const _addressToCheck)

◆ isLocalHostAddress() [2/3]

bool dev::p2p::isLocalHostAddress ( std::string const _addressToCheck)

◆ isLocalHostAddress() [3/3]

bool dev::p2p::isLocalHostAddress ( string const _addressToCheck)

◆ isPrivateAddress() [1/3]

bool dev::p2p::isPrivateAddress ( bi::address const _addressToCheck)

◆ isPrivateAddress() [2/3]

bool dev::p2p::isPrivateAddress ( std::string const _addressToCheck)

◆ isPrivateAddress() [3/3]

bool dev::p2p::isPrivateAddress ( string const _addressToCheck)

◆ isPublicAddress() [1/3]

bool dev::p2p::isPublicAddress ( bi::address const _addressToCheck)

◆ isPublicAddress() [2/3]

bool dev::p2p::isPublicAddress ( std::string const _addressToCheck)

◆ isPublicAddress() [3/3]

bool dev::p2p::isPublicAddress ( string const _addressToCheck)

◆ nextRLP()

static bytesConstRef dev::p2p::nextRLP ( bytesConstRef  _b)
static

◆ operator<<() [1/8]

boost::log::formatting_ostream & dev::p2p::operator<< ( boost::log::formatting_ostream &  _strm,
Node _node 
)
inline

◆ operator<<() [2/8]

boost::log::formatting_ostream & dev::p2p::operator<< ( boost::log::formatting_ostream &  _strm,
Node const _node 
)
inline

◆ operator<<() [3/8]

boost::log::formatting_ostream & dev::p2p::operator<< ( boost::log::formatting_ostream &  _strm,
PeerSessionInfo const _peerSessionInfo 
)
inline

◆ operator<<() [4/8]

ostream & dev::p2p::operator<< ( ostream _out,
NodeIPEndpoint const _ep 
)

◆ operator<<() [5/8]

std::ostream & dev::p2p::operator<< ( std::ostream &  _out,
ENR const _enr 
)

◆ operator<<() [6/8]

std::ostream & dev::p2p::operator<< ( std::ostream &  _out,
NodeIPEndpoint const _ep 
)

Simple stream output for a NodeIPEndpoint.

◆ operator<<() [7/8]

std::ostream & dev::p2p::operator<< ( std::ostream &  _out,
NodeTable const _nodeTable 
)
inline

◆ operator<<() [8/8]

std::ostream & dev::p2p::operator<< ( std::ostream &  _strm,
NodeID const _id 
)
inline

◆ operator==()

bool dev::p2p::operator== ( std::weak_ptr< NodeEntry > const _weak,
std::shared_ptr< NodeEntry > const _shared 
)
inline

◆ p2pPacketTypeToString()

char const * dev::p2p::p2pPacketTypeToString ( P2pPacketType  _packetType)

◆ reasonOf()

std::string dev::p2p::reasonOf ( DisconnectReason  _r)
Returns
the string form of the given disconnection reason.

Variable Documentation

◆ c_defaultListenPort

constexpr unsigned short dev::p2p::c_defaultListenPort = 30303
constexpr

◆ c_localhostIp

constexpr const char* dev::p2p::c_localhostIp = "127.0.0.1"
constexpr

◆ c_protocolVersion

constexpr unsigned dev::p2p::c_protocolVersion = 1029
constexpr

Peer network protocol version.

◆ UnspecifiedNode

const Node dev::p2p::UnspecifiedNode = Node{{}, UnspecifiedNodeIPEndpoint}

◆ UnspecifiedNodeIPEndpoint

const NodeIPEndpoint dev::p2p::UnspecifiedNodeIPEndpoint = NodeIPEndpoint{{}, 0, 0}