R-Type 0.1
Loading...
Searching...
No Matches
PingMessage.hpp
1#pragma once
2
8#include "PacketReader.hpp"
9#include "PacketWriter.hpp"
10#include <cstddef>
11#include <cstdint>
12
22 std::uint32_t timestamp = 0;
23
25 static constexpr std::size_t SIZE = 4;
26
32 bool serialize(PacketWriter &writer) const;
33
39 bool deserialize(PacketReader &reader);
40};
41
Bounds checked reader of big-endian values over a byte buffer.
Definition PacketReader.hpp:15
Growable buffer of big-endian values, capped at MAX_PAYLOAD_SIZE.
Definition PacketWriter.hpp:16
Payload of a Ping message, 4 bytes, sent by a client to measure latency.
Definition PingMessage.hpp:21
bool serialize(PacketWriter &writer) const
Writes the payload in network byte order.
Definition PingMessage.cpp:5
std::uint32_t timestamp
Sender defined time value.
Definition PingMessage.hpp:22
bool deserialize(PacketReader &reader)
Reads the payload from a buffer.
Definition PingMessage.cpp:9
static constexpr std::size_t SIZE
Encoded size of the payload, in bytes.
Definition PingMessage.hpp:25