Protocol for messages delimited by a specific sequence of bytes (a string literal).
More...
|
|
| bytes_terminated ()=delete |
| | Default constructor (deleted)
|
|
virtual | ~bytes_terminated ()=default |
| | Virtual destructor.
|
| | bytes_terminated (_IO_ &io) noexcept |
| | Constructor with I/O reference.
|
| std::size_t | shiftSize (std::size_t const size) const noexcept |
| | Calculates the message size without the delimiter.
|
| std::size_t | getMessageSize () |
| | Determines the size of the next complete message.
|
| void | reset () noexcept final |
| | Resets the protocol state.
|
| virtual | ~IProtocol ()=default |
| | Virtual destructor.
|
| bool | ok () const noexcept |
| | Checks if the protocol is in a valid operational state.
|
| void | not_ok () noexcept |
| | Marks the protocol as being in an invalid or non-operational state.
|
| void | set_should_flush (bool should_flush) noexcept |
| | Sets the flag indicating whether the protocol should flush the input buffer after processing a message.
|
| bool | should_flush () const noexcept |
| | Gets the flag indicating whether the protocol should flush the input buffer after processing a message.
|
template<typename _IO_, typename _Trait>
class qb::protocol::base::bytes_terminated< _IO_, _Trait >
Protocol for messages delimited by a specific sequence of bytes (a string literal).
This class implements a protocol where messages are framed by a specific sequence of bytes, defined via a trait struct providing the _EndBytes sequence. For example, it can be used for HTTP-like messages ending in "\r\n\r\n". It inherits from qb::io::async::AProtocol.
- Template Parameters
-
| _IO_ | The I/O component type that will use this protocol. It needs to provide an in() method for input buffer access. |
| _Trait | A trait class that must define a static constexpr char array _EndBytes representing the termination sequence (e.g., struct CRLF { static constexpr char _EndBytes[] = "\r\n"; };). |