qb  2.0.0.0
C++17 Actor Framework
qb Issue Watch Star Fork Follow @isndev
Loading...
Searching...
No Matches
qb::io::transport::stcp Class Reference

Secure TCP (SSL/TLS) transport providing encrypted stream communication. More...

#include <stcp.h>

Inheritance diagram for qb::io::transport::stcp:
Collaboration diagram for qb::io::transport::stcp:

Public Member Functions

constexpr bool is_secure () const noexcept
 Indicates that this transport implementation is secure.
int read () noexcept
 Read data from the secure TCP socket.
Public Member Functions inherited from qb::io::stream< io::tcp::ssl::socket >
output_buffer_typeout () noexcept
 Get the output buffer.
std::size_t pendingWrite () const noexcept
 Get the number of bytes pending for writing.
int write (std::enable_if_t< has_method_write< io::tcp::ssl::socket, int, const char *, std::size_t >::value, Available > *=nullptr) noexcept
 Write data from the output buffer to the transport.
char * publish (char const *data, std::size_t size) noexcept
 Add data to the output buffer for later writing.
void close () noexcept
 Close the stream.
Public Member Functions inherited from qb::io::istream< io::tcp::ssl::socket >
 ~istream () noexcept
 Destructor.
io::tcp::ssl::sockettransport () noexcept
 Get the underlying transport object.
input_buffer_typein () noexcept
 Get the input buffer.
std::size_t pendingRead () const noexcept
 Get the number of bytes available for reading.
int read (std::enable_if_t< has_method_read< io::tcp::ssl::socket, int, char *, std::size_t >::value, Available > *=nullptr) noexcept
 Read data from the transport into the input buffer.
void flush (std::size_t size) noexcept
 Remove data from the front of the input buffer.
void eof () noexcept
 Handle end-of-file condition.
void close () noexcept
 Close the stream.

Additional Inherited Members

Public Types inherited from qb::io::stream< io::tcp::ssl::socket >
using transport_io_type
 Type of the underlying transport IO.
using output_buffer_type
 Type of the output buffer.
Public Types inherited from qb::io::istream< io::tcp::ssl::socket >
using transport_io_type
 Type of the underlying transport IO.
using input_buffer_type
 Type of the input buffer.
Static Public Attributes inherited from qb::io::stream< io::tcp::ssl::socket >
static constexpr const bool has_reset_on_pending_read
 Flag indicating whether the implementation resets pending reads.
Protected Attributes inherited from qb::io::stream< io::tcp::ssl::socket >
output_buffer_type _out_buffer
 Buffer for outgoing data.
Protected Attributes inherited from qb::io::istream< io::tcp::ssl::socket >
io::tcp::ssl::socket _in
 The underlying IO object.
input_buffer_type _in_buffer
 Buffer for incoming data.

Detailed Description

Secure TCP (SSL/TLS) transport providing encrypted stream communication.

This class implements a transport layer for secure (SSL/TLS) TCP sockets by extending the generic qb::io::stream class, specializing it with qb::io::tcp::ssl::socket as the underlying I/O mechanism. It handles SSL-specific behavior such as managing pending encrypted data in the SSL buffer during read operations to ensure all application data is retrieved.

Member Function Documentation

◆ read()

int qb::io::transport::stcp::read ( )
inlinenodiscardnoexcept

Read data from the secure TCP socket.

Returns
Number of bytes read on success, error code on failure

Reads data from the secure socket in chunks, ensuring that any pending data in the SSL buffer is also retrieved. This is important for SSL sockets where decrypted data might be buffered by the SSL implementation even after a socket read.