|
R-Type 0.1
|
Header placed in front of every message inside a connected packet. More...
#include <protocol/MessageHeader.hpp>
Public Member Functions | |
| bool | serialize (PacketWriter &writer) const |
| Writes the header in network byte order. | |
| bool | deserialize (PacketReader &reader) |
| Reads the header from a buffer. | |
| MessageId | getType () const |
| Returns the message type. | |
| void | setType (MessageId type) |
| Sets the message type. | |
Public Attributes | |
| std::uint16_t | size = 0 |
| Payload size in bytes, header excluded. | |
Static Public Attributes | |
| static constexpr std::size_t | HEADER_SIZE = 4 |
| Encoded size of the header, in bytes. | |
Header placed in front of every message inside a connected packet.
| Offset | Size | Field | Description |
|---|---|---|---|
| 0 | 2 | type | Message type identifier. |
| 2 | 2 | size | Size of the payload that follows. |
| bool MessageHeader::serialize | ( | PacketWriter & | writer | ) | const |
Writes the header in network byte order.
| writer | Destination buffer. |
| bool MessageHeader::deserialize | ( | PacketReader & | reader | ) |
Reads the header from a buffer.
| reader | Source buffer. |
| MessageId MessageHeader::getType | ( | ) | const |
Returns the message type.
| void MessageHeader::setType | ( | MessageId | type | ) |
Sets the message type.
| type | The message type identifier. |