TARAXA
dev::p2p::CapabilityFace Class Referenceabstract

The Capability interface. This interface has to be implemented to support any devp2p subprotocol. More...

#include <Capability.h>

Public Member Functions

virtual ~CapabilityFace ()=default
 
virtual std::string name () const =0
 Subprotocol name, used in negotiating common capabilities with the peers. More...
 
virtual unsigned version () const =0
 
virtual unsigned messageCount () const =0
 Number of messages supported by the subprotocol version. More...
 
virtual std::string packetTypeToString (unsigned _packetType) const =0
 Convert supplied packet type to string - used for logging purposes. More...
 
virtual void onConnect (std::weak_ptr< Session > session, u256 const &_peerCapabilityVersion)=0
 
virtual void interpretCapabilityPacket (std::weak_ptr< Session > session, unsigned packet_type, RLP const &payload)=0
 
virtual void onDisconnect (NodeID const &_nodeID)=0
 

Detailed Description

The Capability interface. This interface has to be implemented to support any devp2p subprotocol.

Constructor & Destructor Documentation

◆ ~CapabilityFace()

virtual dev::p2p::CapabilityFace::~CapabilityFace ( )
virtualdefault

Member Function Documentation

◆ interpretCapabilityPacket()

virtual void dev::p2p::CapabilityFace::interpretCapabilityPacket ( std::weak_ptr< Session session,
unsigned  packet_type,
RLP const &  payload 
)
pure virtual

Called by the Host when the messaege is received from the peer

Returns
true if the message was interpreted, false if the message had not supported type.

Implemented in taraxa::network::tarcap::TaraxaCapability.

◆ messageCount()

virtual unsigned dev::p2p::CapabilityFace::messageCount ( ) const
pure virtual

Number of messages supported by the subprotocol version.

Implemented in taraxa::network::tarcap::TaraxaCapability.

◆ name()

virtual std::string dev::p2p::CapabilityFace::name ( ) const
pure virtual

Subprotocol name, used in negotiating common capabilities with the peers.

Implemented in taraxa::network::tarcap::TaraxaCapability.

◆ onConnect()

virtual void dev::p2p::CapabilityFace::onConnect ( std::weak_ptr< Session session,
u256 const &  _peerCapabilityVersion 
)
pure virtual

Called by the Host when new peer is connected. Guaranteed to be called first before any interpretCapabilityPacket for this peer.

Implemented in taraxa::network::tarcap::TaraxaCapability.

◆ onDisconnect()

virtual void dev::p2p::CapabilityFace::onDisconnect ( NodeID const &  _nodeID)
pure virtual

Called by the Host when the peer is disconnected. Guaranteed to be called last after any interpretCapabilityPacket for this peer.

Implemented in taraxa::network::tarcap::TaraxaCapability.

◆ packetTypeToString()

virtual std::string dev::p2p::CapabilityFace::packetTypeToString ( unsigned  _packetType) const
pure virtual

Convert supplied packet type to string - used for logging purposes.

Implemented in taraxa::network::tarcap::TaraxaCapability.

◆ version()

virtual unsigned dev::p2p::CapabilityFace::version ( ) const
pure virtual

Subprotocol version, used in negotiating common capabilities with the peers.

Implemented in taraxa::network::tarcap::TaraxaCapability.


The documentation for this class was generated from the following file: