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

Service for managing protocol handshake between client and server. More...

#include <handshake_service.hpp>

Collaboration diagram for handshake_service:
Collaboration graph

Static Public Member Functions

static boost::asio::awaitable< messaging::compression_typeperform_client_handshake (net::connection &conn, const std::function< std::uint32_t()> &sequence_generator, const std::string &client_identifier, std::uint8_t supported_compression=0)
 Perform client-side handshake.
 
static boost::asio::awaitable< std::optional< messaging::compression_type > > perform_server_handshake (net::connection &conn, std::uint32_t sequence, const std::string &server_identifier)
 Perform server-side handshake.
 

Detailed Description

Service for managing protocol handshake between client and server.

Encapsulates the handshake protocol logic for both client and server sides, handling the three-way handshake:

  1. Client sends handshake_request
  2. Server responds with handshake_response (including version compatibility)
  3. Client sends handshake_ack to complete

Member Function Documentation

◆ perform_client_handshake()

boost::asio::awaitable< messaging::compression_type > perform_client_handshake ( net::connection conn,
const std::function< std::uint32_t()> &  sequence_generator,
const std::string &  client_identifier,
std::uint8_t  supported_compression = 0 
)
static

Perform client-side handshake.

Sends handshake request, waits for response, validates compatibility, and sends acknowledgment.

Parameters
connConnection to perform handshake on
sequence_generatorFunction that generates sequence numbers
client_identifierClient identifier string
supported_compressionBitmask of supported compression types (default: 0 = no compression support)
Returns
The compression type selected by the server for this session
Exceptions
connection_errorif handshake fails

◆ perform_server_handshake()

boost::asio::awaitable< std::optional< messaging::compression_type > > perform_server_handshake ( net::connection conn,
std::uint32_t  sequence,
const std::string &  server_identifier 
)
static

Perform server-side handshake.

Reads handshake request, validates version, sends response, and waits for acknowledgment.

Parameters
connConnection to perform handshake on
sequenceSequence number for response frame
server_identifierServer identifier string
Returns
The negotiated compression type on success, std::nullopt on failure