R-Type 0.1
Loading...
Searching...
No Matches
PongMessage Struct Reference

Payload of a Pong message, 4 bytes, sent by the server in answer to a Ping. More...

#include <protocol/PongMessage.hpp>

Public Member Functions

bool serialize (PacketWriter &writer) const
 Writes the payload in network byte order.
 
bool deserialize (PacketReader &reader)
 Reads the payload from a buffer.
 

Public Attributes

std::uint32_t timestamp = 0
 Value copied from the Ping.
 

Static Public Attributes

static constexpr std::size_t SIZE = 4
 Encoded size of the payload, in bytes.
 

Detailed Description

Payload of a Pong message, 4 bytes, sent by the server in answer to a Ping.

Offset Size Field Description
0 4 timestamp Value copied from the matching Ping.

Member Function Documentation

◆ serialize()

bool PongMessage::serialize ( PacketWriter & writer) const

Writes the payload in network byte order.

Parameters
writerDestination buffer.
Returns
True on success, false if the buffer is full.

◆ deserialize()

bool PongMessage::deserialize ( PacketReader & reader)

Reads the payload from a buffer.

Parameters
readerSource buffer.
Returns
True on success, false if fewer than 4 bytes remain.