Skip to content

rlpx::RlpxSession

RLPx session managing encrypted P2P communication.

#include <rlpx_session.hpp>

Inherits from std::enable_shared_from_this< RlpxSession >

Public Classes

Name
class MessageChannel

Public Functions

Name
Result< std::shared_ptr< RlpxSession > > connect(const SessionConnectParams & params, boost::asio::yield_context yield)
Factory for outbound connections.
Result< std::shared_ptr< RlpxSession > > accept(const SessionAcceptParams & params, boost::asio::yield_context yield)
Factory for inbound connections.
~RlpxSession()
RlpxSession(const RlpxSession & ) =delete
RlpxSession & operator=(const RlpxSession & ) =delete
RlpxSession(RlpxSession && other)
RlpxSession & operator=(RlpxSession && other)
VoidResult post_message(framing::Message message)
Send message (takes ownership via move).
Result< framing::Message > receive_message(boost::asio::yield_context yield)
Receive message (stackful coroutine pull model).
VoidResult disconnect(DisconnectReason reason)
Graceful disconnect (sync, callable from callbacks).
VoidResult disconnect(DisconnectReason reason, boost::asio::yield_context yield)
Graceful disconnect (coroutine overload).
void set_hello_handler(HelloHandler handler)
void set_disconnect_handler(DisconnectHandler handler)
void set_ping_handler(PingHandler handler)
void set_pong_handler(PongHandler handler)
void set_generic_handler(MessageHandler handler)
SessionState state() const
bool is_active() const
const PeerInfo & peer_info() const
uint8_t negotiated_eth_version() const
Return the negotiated ETH subprotocol version from HELLO capability matching.
const auth::FrameSecrets & cipher_secrets() const

Public Functions Documentation

function connect

static Result< std::shared_ptr< RlpxSession > > connect(
    const SessionConnectParams & params,
    boost::asio::yield_context yield
)

Factory for outbound connections.

Parameters:

  • params Session connection parameters.
  • yield Boost.Asio stackful coroutine context.

Return: Constructed session on success, SessionError on failure.

function accept

static Result< std::shared_ptr< RlpxSession > > accept(
    const SessionAcceptParams & params,
    boost::asio::yield_context yield
)

Factory for inbound connections.

Parameters:

  • params Session accept parameters.
  • yield Boost.Asio stackful coroutine context.

Return: Constructed session on success, SessionError on failure.

function ~RlpxSession

~RlpxSession()

function RlpxSession

RlpxSession(
    const RlpxSession & 
) =delete

function operator=

RlpxSession & operator=(
    const RlpxSession & 
) =delete

function RlpxSession

RlpxSession(
    RlpxSession && other
)

function operator=

RlpxSession & operator=(
    RlpxSession && other
)

function post_message

VoidResult post_message(
    framing::Message message
)

Send message (takes ownership via move).

function receive_message

Result< framing::Message > receive_message(
    boost::asio::yield_context yield
)

Receive message (stackful coroutine pull model).

Parameters:

  • yield Boost.Asio stackful coroutine context.

Return: Next message on success, SessionError on failure.

function disconnect

VoidResult disconnect(
    DisconnectReason reason
)

Graceful disconnect (sync, callable from callbacks).

Parameters:

  • reason Disconnect reason code.

function disconnect

VoidResult disconnect(
    DisconnectReason reason,
    boost::asio::yield_context yield
)

Graceful disconnect (coroutine overload).

Parameters:

  • reason Disconnect reason code.
  • yield Boost.Asio stackful coroutine context.

function set_hello_handler

inline void set_hello_handler(
    HelloHandler handler
)

function set_disconnect_handler

inline void set_disconnect_handler(
    DisconnectHandler handler
)

function set_ping_handler

inline void set_ping_handler(
    PingHandler handler
)

function set_pong_handler

inline void set_pong_handler(
    PongHandler handler
)

function set_generic_handler

inline void set_generic_handler(
    MessageHandler handler
)

function state

inline SessionState state() const

function is_active

inline bool is_active() const

function peer_info

inline const PeerInfo & peer_info() const

function negotiated_eth_version

inline uint8_t negotiated_eth_version() const

Return the negotiated ETH subprotocol version from HELLO capability matching.

Return: 66, 67, 68, or 69 when a common ETH capability was negotiated; 0 otherwise.

function cipher_secrets

const auth::FrameSecrets & cipher_secrets() const

Updated on 2026-04-13 at 23:22:46 -0700