qb
2.0.0.0
C++17 Actor Framework
|
Protocol for handling the handshake of a new connection. More...
#include <handshake.h>
Public Types | |
using | message = qb::io::async::event::handshake |
Type alias for the handshake event. |
Public Member Functions | |
handshake ()=delete | |
Default constructor is deleted as an I/O component reference is required. | |
handshake (_IO_ &io) noexcept | |
Constructor with I/O reference. | |
std::size_t | getMessageSize () noexcept final |
Checks if the handshake is done. | |
void | onMessage (std::size_t) noexcept final |
Triggers the handshake event. | |
void | reset () noexcept final |
Resets the protocol state. | |
Public Member Functions inherited from qb::io::async::IProtocol | |
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. |
Additional Inherited Members | |
Protected Member Functions inherited from qb::io::async::AProtocol< _IO_ > | |
AProtocol ()=delete | |
Default constructor is deleted to ensure an I/O component is always associated. | |
AProtocol (_IO_ &io) noexcept | |
Constructor that associates the protocol with an I/O component. | |
virtual | ~AProtocol ()=default |
Virtual destructor. | |
Protected Attributes inherited from qb::io::async::AProtocol< _IO_ > | |
_IO_ & | _io |
Reference to the I/O component instance that this protocol is associated with. |
Protocol for handling the handshake of a new connection.
This template class implements the AProtocol interface specifically for handshake components (like qb::io::tcp::ssl::socket).
using qb::io::protocol::handshake< _IO_ >::message = qb::io::async::event::handshake |
Type alias for the handshake event.
The type of message this protocol produces, which is the handshake event.
|
inlinenoexcept |
Constructor with I/O reference.
io | Reference to the I/O component (e.g., an acceptor) that will use this protocol. |
|
inlinefinalvirtualnoexcept |
Checks if the handshake is done.
This method determines if the handshake is done by checking if the handshake is done.
Implements qb::io::async::AProtocol< _IO_ >.
|
inlinefinalvirtualnoexcept |
Triggers the handshake event.
This method is called when getMessageSize() returns a non-zero value (i.e., an open socket was found). It then calls the I/O component's on() handler, passing the handshake event.
size | Ignored parameter (required by AProtocol interface, but its value is not used here as getMessageSize() for this protocol effectively returns a boolean status). |
Implements qb::io::async::AProtocol< _IO_ >.
|
inlinefinalvirtualnoexcept |
Resets the protocol state.
This protocol is stateless regarding message parsing (it only checks handshake status), so this method is a no-op.
Implements qb::io::async::AProtocol< _IO_ >.