UDP transport, packet and message framing, sequence tracking and connection management (lib/Network).
More...
|
|
using | MessageId = std::uint16_t |
| | Numeric identifier of a message type.
|
| |
|
|
constexpr std::size_t | MAX_PACKET_SIZE = 576 |
| | Largest IPv4 datagram every host is required to accept, in bytes.
|
| |
|
constexpr std::size_t | IP_HEADER_SIZE = 20 |
| | Size of an IPv4 header without options, in bytes.
|
| |
|
constexpr std::size_t | UDP_HEADER_SIZE = 8 |
| | Size of a UDP header, in bytes.
|
| |
| constexpr std::size_t | MAX_PAYLOAD_SIZE |
| | Largest UDP payload sent or accepted by the network layer, in bytes.
|
| |
|
constexpr std::size_t | PACKET_HEADER_SIZE = 16 |
| | Size of the PacketHeader that starts every connected packet, in bytes.
|
| |
| constexpr std::size_t | MAX_MESSAGE_SIZE |
| | Room left for messages after the packet header, in bytes.
|
| |
|
constexpr std::uint32_t | MAGIC = 0x52545950 |
| | Magic number that starts every handshake datagram, "RTYP" in ASCII.
|
| |
|
constexpr std::uint8_t | VERSION = 1 |
| | Protocol version announced and expected during the handshake.
|
| |
|
constexpr MessageId | systemMessage::Ping = 0x03 |
| | Latency probe sent by a client.
|
| |
|
constexpr MessageId | systemMessage::Disconnect = 0x04 |
| | Client closes its connection.
|
| |
|
constexpr MessageId | systemMessage::Pong = 0x86 |
| | Server answer to a Ping.
|
| |
UDP transport, packet and message framing, sequence tracking and connection management (lib/Network).
See Networking for an overview.
◆ HandshakeType
Kind of handshake datagram.
| Enumerator |
|---|
| Hello | Client asks the server to open a connection.
|
| Welcome | Server accepts the client and gives its connection id.
|
| Rejected | Server refuses the connection.
|
◆ PacketReceiveRes
Classification of a received packet sequence number.
| Enumerator |
|---|
| New | Newer than every packet received so far.
|
| Dup | Already received.
|
| Out | Older than the latest one but inside the 32 packet window.
|
| TooOld | Older than the 32 packet window.
|
◆ updateRttMetrics()
Adds a round trip time sample and updates smoothing and jitter.
- Parameters
-
| metrics | Counters to update. |
| newRtt | New round trip time sample. |
◆ updatePacketMetrics()
Recomputes the packet loss percentage.
- Parameters
-
| metrics | Counters to update. |
◆ onPacketSend()
| void onPacketSend |
( |
NetworkMetrics & | metrics, |
|
|
std::size_t | packetSize ) |
Counts a sent datagram.
- Parameters
-
| metrics | Counters to update. |
| packetSize | Size of the datagram in bytes. |
◆ onPacketReceived()
| void onPacketReceived |
( |
NetworkMetrics & | metrics, |
|
|
std::size_t | packetSize ) |
Counts a received datagram.
- Parameters
-
| metrics | Counters to update. |
| packetSize | Size of the datagram in bytes. |
◆ onPacketDuplicated()
Counts a duplicated datagram.
- Parameters
-
| metrics | Counters to update. |
◆ onPacketOut()
Counts a datagram received out of order.
- Parameters
-
| metrics | Counters to update. |
◆ onRetransmission()
Counts a retransmitted datagram.
- Parameters
-
| metrics | Counters to update. |
◆ MAX_PAYLOAD_SIZE
| std::size_t MAX_PAYLOAD_SIZE |
|
inlineconstexpr |
Initial value:=
constexpr std::size_t MAX_PACKET_SIZE
Largest IPv4 datagram every host is required to accept, in bytes.
Definition NetworkConfig.hpp:11
constexpr std::size_t IP_HEADER_SIZE
Size of an IPv4 header without options, in bytes.
Definition NetworkConfig.hpp:13
constexpr std::size_t UDP_HEADER_SIZE
Size of a UDP header, in bytes.
Definition NetworkConfig.hpp:15
Largest UDP payload sent or accepted by the network layer, in bytes.
◆ MAX_MESSAGE_SIZE
| std::size_t MAX_MESSAGE_SIZE |
|
inlineconstexpr |
Initial value:=
constexpr std::size_t PACKET_HEADER_SIZE
Size of the PacketHeader that starts every connected packet, in bytes.
Definition NetworkConfig.hpp:20
constexpr std::size_t MAX_PAYLOAD_SIZE
Largest UDP payload sent or accepted by the network layer, in bytes.
Definition NetworkConfig.hpp:17
Room left for messages after the packet header, in bytes.