ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
connection Class Referencefinal

SSL connection wrapper for frame-based communication. More...

#include <connection.hpp>

Collaboration diagram for connection:
Collaboration graph

Public Types

using ssl_socket = boost::asio::ssl::stream< boost::asio::ip::tcp::socket >
 

Public Member Functions

 connection (ssl_socket socket)
 Construct connection from an SSL socket.
 
boost::asio::awaitable< void > ssl_handshake_server (boost::asio::cancellation_slot cancel_slot={})
 Perform SSL handshake as server.
 
boost::asio::awaitable< void > ssl_handshake_client (boost::asio::cancellation_slot cancel_slot={})
 Perform SSL handshake as client.
 
boost::asio::awaitable< std::expected< messaging::frame, messaging::error_code > > read_frame (bool skip_version_check=false, boost::asio::cancellation_slot cancel_slot={})
 Read a complete frame from the connection.
 
boost::asio::awaitable< void > write_frame (const messaging::frame &frame, boost::asio::cancellation_slot cancel_slot={})
 Write a frame to the connection.
 
bool is_open () const
 Check if the connection is open.
 
void close ()
 Close the connection.
 
std::string remote_address () const
 Get the remote endpoint address.
 

Detailed Description

SSL connection wrapper for frame-based communication.

Provides async read/write operations for protocol frames over SSL/TLS.

Member Function Documentation

◆ ssl_handshake_server()

boost::asio::awaitable< void > ssl_handshake_server ( boost::asio::cancellation_slot  cancel_slot = {})

Perform SSL handshake as server.

Parameters
cancel_slotOptional cancellation slot for graceful shutdown

◆ ssl_handshake_client()

boost::asio::awaitable< void > ssl_handshake_client ( boost::asio::cancellation_slot  cancel_slot = {})

Perform SSL handshake as client.

Parameters
cancel_slotOptional cancellation slot for graceful shutdown

◆ read_frame()

boost::asio::awaitable< std::expected< messaging::frame, messaging::error_code > > read_frame ( bool  skip_version_check = false,
boost::asio::cancellation_slot  cancel_slot = {} 
)

Read a complete frame from the connection.

Reads the frame header first, then reads the payload based on the size specified in the header.

Parameters
skip_version_checkIf true, skips protocol version validation. This is useful during handshake to allow the server to send a proper version mismatch response instead of rejecting the frame immediately.
cancel_slotOptional cancellation slot for graceful shutdown

◆ write_frame()

boost::asio::awaitable< void > write_frame ( const messaging::frame frame,
boost::asio::cancellation_slot  cancel_slot = {} 
)

Write a frame to the connection.

Serializes the frame and writes it to the socket.

Parameters
frameThe frame to write
cancel_slotOptional cancellation slot for graceful shutdown