|
R-Type 0.1
|
Header of the datagrams exchanged before a connection exists. More...
#include <protocol/HandshakeHeader.hpp>
Public Member Functions | |
| bool | serialize (PacketWriter &writer) const |
| Writes the header in network byte order. | |
| bool | deserialize (PacketReader &reader) |
| Reads and validates the magic number and handshake type. | |
Public Attributes | |
| std::uint32_t | magic = MAGIC |
| Protocol magic number. | |
| std::uint8_t | version = VERSION |
| Protocol version. | |
| HandshakeType | type = HandshakeType::Hello |
| Handshake step. | |
Static Public Attributes | |
| static constexpr std::size_t | HEADER_SIZE = 6 |
| Encoded size of the header, in bytes. | |
Header of the datagrams exchanged before a connection exists.
| Offset | Size | Field | Description |
|---|---|---|---|
| 0 | 4 | magic | Always 0x52545950. |
| 4 | 1 | version | Protocol version, currently 1. |
| 5 | 1 | type | A HandshakeType value. |
A Welcome datagram is followed by the 4 byte connection id.
| bool HandshakeHeader::serialize | ( | PacketWriter & | writer | ) | const |
Writes the header in network byte order.
| writer | Destination buffer. |
| bool HandshakeHeader::deserialize | ( | PacketReader & | reader | ) |
Reads and validates the magic number and handshake type.
| reader | Source buffer. |