qb  2.0.0.0
C++17 Actor Framework
qb Issue Watch Star Fork Follow @isndev
Loading...
Searching...
No Matches
Protocol Handling

Message framing and parsing implementations. More...

Collaboration diagram for Protocol Handling:

Classes

interface  qb::io::async::IProtocol
 Base interface for all message processing protocols. More...
class  qb::io::async::AProtocol< _IO_ >
 Abstract base class for I/O-component-aware protocols (CRTP). More...
class  qb::io::protocol::accept< _IO_, _Socket >
 Protocol for handling the acceptance of new network connections. More...
class  qb::protocol::base::byte_terminated< _IO_, _EndByte >
 Protocol for messages delimited by a specific single byte character. More...
class  qb::protocol::base::bytes_terminated< _IO_, _Trait >
 Protocol for messages delimited by a specific sequence of bytes (a string literal). More...
class  qb::protocol::base::size_as_header< _IO_, _Size >
 Protocol for messages where the payload is preceded by a fixed-size header indicating its length. More...
class  qb::io::protocol::handshake< _IO_ >
 Protocol for handling the handshake of a new connection. More...
class  qb::protocol::json< IO_ >
 Protocol for parsing null-terminated JSON messages. More...
class  qb::protocol::json_packed< IO_ >
 Protocol for parsing null-terminated, MessagePack encoded JSON messages. More...
class  qb::protocol::text::basic_text< _IO_, _StringTrait, _Sep >
 Protocol for text messages delimited by a specific character, yielding a specified string type. More...
class  qb::protocol::text::basic_binary< _IO_, _SizeHeader >
 Protocol for binary messages where the payload is preceded by a fixed-size header indicating its length. More...

Typedefs

template<typename _IO_>
using qb::protocol::text::binary8 = basic_binary<_IO_, uint8_t>
 Binary protocol with an 8-bit (uint8_t) size header.
template<typename _IO_>
using qb::protocol::text::binary16 = basic_binary<_IO_, uint16_t>
 Binary protocol with a 16-bit (uint16_t) size header.
template<typename _IO_>
using qb::protocol::text::binary32 = basic_binary<_IO_, uint32_t>
 Binary protocol with a 32-bit (uint32_t) size header.
template<typename _IO_>
using qb::protocol::text::string = basic_text<_IO_, std::string, '\0'>
 Protocol for NULL-terminated (\0) strings, yielding std::string.
template<typename _IO_>
using qb::protocol::text::command = basic_text<_IO_, std::string, '\n'>
 Protocol for newline-terminated (\n) commands, yielding std::string.
template<typename _IO_>
using qb::protocol::text::string_view = basic_text<_IO_, const std::string_view, '\0'>
 Protocol for NULL-terminated (\0) strings, yielding std::string_view (zero-copy read).
template<typename _IO_>
using qb::protocol::text::command_view = basic_text<_IO_, const std::string_view, '\n'>
 Protocol for newline-terminated (\n) commands, yielding std::string_view (zero-copy read).

Detailed Description

Message framing and parsing implementations.

Defines `qb::io::async::AProtocol` and built-in protocols like text-based, binary, and JSON.

Typedef Documentation

◆ binary8

template<typename _IO_>
using qb::protocol::text::binary8 = basic_binary<_IO_, uint8_t>

Binary protocol with an 8-bit (uint8_t) size header.

Specialization of basic_binary using a uint8_t size header, suitable for messages with payloads up to 255 bytes.

Template Parameters
_IO_The I/O component type that will use this protocol.

◆ binary16

template<typename _IO_>
using qb::protocol::text::binary16 = basic_binary<_IO_, uint16_t>

Binary protocol with a 16-bit (uint16_t) size header.

Specialization of basic_binary using a uint16_t size header, suitable for messages with payloads up to 65535 bytes. Handles network byte order for the header.

Template Parameters
_IO_The I/O component type that will use this protocol.

◆ binary32

template<typename _IO_>
using qb::protocol::text::binary32 = basic_binary<_IO_, uint32_t>

Binary protocol with a 32-bit (uint32_t) size header.

Specialization of basic_binary using a uint32_t size header, suitable for messages with payloads up to 4GB. Handles network byte order for the header.

Template Parameters
_IO_The I/O component type that will use this protocol.

◆ string

template<typename _IO_>
using qb::protocol::text::string = basic_text<_IO_, std::string, '\0'>

Protocol for NULL-terminated (\0) strings, yielding std::string.

Specialization of basic_text for handling standard C-style null-terminated strings. The received message payload (excluding the terminator) is provided as std::string.

Template Parameters
_IO_The I/O component type that will use this protocol.

◆ command

template<typename _IO_>
using qb::protocol::text::command = basic_text<_IO_, std::string, '\n'>

Protocol for newline-terminated (\n) commands, yielding std::string.

Specialization of basic_text for handling line-based commands or messages where each message is terminated by a newline character. The received message payload (excluding the newline) is provided as std::string.

Template Parameters
_IO_The I/O component type that will use this protocol.

◆ string_view

template<typename _IO_>
using qb::protocol::text::string_view = basic_text<_IO_, const std::string_view, '\0'>

Protocol for NULL-terminated (\0) strings, yielding std::string_view (zero-copy read).

Specialization of basic_text for handling null-terminated strings where the payload is provided as a std::string_view. This allows for reading the string data without an additional copy, provided the underlying buffer remains valid during the view's lifetime.

Template Parameters
_IO_The I/O component type that will use this protocol.

◆ command_view

template<typename _IO_>
using qb::protocol::text::command_view = basic_text<_IO_, const std::string_view, '\n'>

Protocol for newline-terminated (\n) commands, yielding std::string_view (zero-copy read).

Specialization of basic_text for handling newline-terminated messages where the payload is provided as a std::string_view. This offers zero-copy reading of line-based commands.

Template Parameters
_IO_The I/O component type that will use this protocol.