Fabcoin Core  0.16.2
P2P Digital Currency
Public Member Functions | Static Public Member Functions | List of all members
TestHandshake Class Reference
Inheritance diagram for TestHandshake:
[legend]
Collaboration diagram for TestHandshake:
[legend]

Public Member Functions

 TestHandshake (Host *_host, std::shared_ptr< RLPXSocket > const &_socket)
 
 TestHandshake (Host *_host, std::shared_ptr< RLPXSocket > const &_socket, NodeID _remote)
 
virtual void transition (boost::system::error_code _ec)
 transition is overridden to stop after key establishment. More...
 
bool completedKeyEstablishment ()
 Reports whether we made it through the key establishment without error. More...
 
void checkAuthValuesEIP8 (uint64_t _expectedRemoteVersion)
 Checks whether Auth-related members match the values in the EIP-8 test vectors. More...
 
void checkAckValuesEIP8 (uint64_t _expectedRemoteVersion)
 Checks whether Ack-related members match the values in the EIP-8 test vectors. More...
 
- Public Member Functions inherited from dev::p2p::RLPXHandshake
 RLPXHandshake (Host *_host, std::shared_ptr< RLPXSocket > const &_socket)
 Setup incoming connection. More...
 
 RLPXHandshake (Host *_host, std::shared_ptr< RLPXSocket > const &_socket, NodeID _remote)
 Setup outbound connection. More...
 
 ~RLPXHandshake ()
 
void start ()
 Start handshake. More...
 
void cancel ()
 Aborts the handshake. More...
 

Static Public Member Functions

static shared_ptr< TestHandshakerunWithInput (Secret _hostAlias, bytes _packet, NodeID _remoteID=NodeID())
 Creates a handshake attached to a Host with the given alias, then runs it through the key establishment, supplying packet as the input on the socket. More...
 

Additional Inherited Members

- Protected Types inherited from dev::p2p::RLPXHandshake
enum  State {
  Error = -1, New, AckAuth, AckAuthEIP8,
  WriteHello, ReadHello, StartSession
}
 Sequential states of handshake. More...
 
- Protected Member Functions inherited from dev::p2p::RLPXHandshake
void writeAuth ()
 Write Auth message to socket and transitions to AckAuth. More...
 
void readAuth ()
 Reads Auth message from socket and transitions to AckAuth. More...
 
void readAuthEIP8 ()
 Continues reading Auth message in EIP-8 format and transitions to AckAuthEIP8. More...
 
void setAuthValues (Signature const &sig, Public const &remotePubk, h256 const &remoteNonce, uint64_t remoteVersion)
 Derives ephemeral secret from signature and sets members after Auth has been decrypted. More...
 
void writeAck ()
 Write Ack message to socket and transitions to WriteHello. More...
 
void writeAckEIP8 ()
 Write Ack message in EIP-8 format to socket and transitions to WriteHello. More...
 
void readAck ()
 Reads Auth message from socket and transitions to WriteHello. More...
 
void readAckEIP8 ()
 Continues reading Ack message in EIP-8 format and transitions to WriteHello. More...
 
void error ()
 Closes connection and ends transitions. More...
 
- Protected Attributes inherited from dev::p2p::RLPXHandshake
boost::posix_time::milliseconds const c_timeout = boost::posix_time::milliseconds(1800)
 Timeout for remote to respond to transition events. Enforced by m_idleTimer and refreshed by transition(). More...
 
State m_nextState = New
 Current or expected state of transition. More...
 
bool m_cancel = false
 Will be set to true if connection was canceled. More...
 
Hostm_host
 Host which provides m_alias, protocolVersion(), m_clientVersion, caps(), and TCP listenPort(). More...
 
NodeID m_remote
 Node id of remote host for socket. More...
 
bool m_originated = false
 True if connection is outbound. More...
 
bytes m_auth
 Buffers for encoded and decoded handshake phases. More...
 
bytes m_authCipher
 Ciphertext of egress or ingress Auth message. More...
 
bytes m_ack
 Plaintext of egress or ingress Ack message. More...
 
bytes m_ackCipher
 Ciphertext of egress or ingress Ack message. More...
 
bytes m_handshakeOutBuffer
 Frame buffer for egress Hello packet. More...
 
bytes m_handshakeInBuffer
 Frame buffer for ingress Hello packet. More...
 
crypto::ECDHE m_ecdhe
 Ephemeral ECDH secret and agreement. More...
 
h256 m_nonce
 Nonce generated by this host for handshake. More...
 
Public m_remoteEphemeral
 Remote ephemeral public key. More...
 
h256 m_remoteNonce
 Nonce generated by remote host for handshake. More...
 
uint64_t m_remoteVersion
 
std::unique_ptr< RLPXFrameCoderm_io
 Used to read and write RLPx encrypted frames for last step of handshake authentication. More...
 
std::shared_ptr< RLPXSocketm_socket
 Socket. More...
 
boost::asio::deadline_timer m_idleTimer
 Timer which enforces c_timeout. More...
 

Detailed Description

Definition at line 122 of file eip-8.cpp.

Constructor & Destructor Documentation

TestHandshake::TestHandshake ( Host _host,
std::shared_ptr< RLPXSocket > const &  _socket 
)
inline

Definition at line 125 of file eip-8.cpp.

TestHandshake::TestHandshake ( Host _host,
std::shared_ptr< RLPXSocket > const &  _socket,
NodeID  _remote 
)
inline

Definition at line 127 of file eip-8.cpp.

Member Function Documentation

void TestHandshake::checkAckValuesEIP8 ( uint64_t  _expectedRemoteVersion)

Checks whether Ack-related members match the values in the EIP-8 test vectors.

Definition at line 340 of file eip-8.cpp.

void TestHandshake::checkAuthValuesEIP8 ( uint64_t  _expectedRemoteVersion)

Checks whether Auth-related members match the values in the EIP-8 test vectors.

Definition at line 332 of file eip-8.cpp.

bool TestHandshake::completedKeyEstablishment ( )
inline

Reports whether we made it through the key establishment without error.

Definition at line 141 of file eip-8.cpp.

shared_ptr< TestHandshake > TestHandshake::runWithInput ( Secret  _hostAlias,
bytes  _packet,
NodeID  _remoteID = NodeID() 
)
static

Creates a handshake attached to a Host with the given alias, then runs it through the key establishment, supplying packet as the input on the socket.

If remoteID is supplied, the handshake runs in initiator mode.

Definition at line 350 of file eip-8.cpp.

Here is the caller graph for this function:

void TestHandshake::transition ( boost::system::error_code  _ec)
virtual

transition is overridden to stop after key establishment.

Reimplemented from dev::p2p::RLPXHandshake.

Definition at line 389 of file eip-8.cpp.


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