|
group2 0.1.0
CSE 125 Group 2
|
Wire format for the UDP transport layer. More...
#include <SDL3/SDL_stdinc.h>#include <cstdint>Go to the source code of this file.
Classes | |
| struct | net::PacketHeader |
| 16-byte header at the start of every UDP datagram we send. More... | |
Namespaces | |
| namespace | net |
Enumerations | |
| enum class | net::PacketKind : uint8_t { net::Payload = 0 , net::ConnectionRequest = 1 , net::ConnectionAccepted = 2 , net::Disconnect = 3 , net::KeepAlive = 4 } |
| Packet kind discriminator (PacketHeader::kind field). More... | |
| enum class | net::ChannelId : uint8_t { net::Unreliable = 0 , net::UnreliableSequenced = 1 , net::ReliableOrdered = 2 , net::ReliableUnordered = 3 , net::Count = 4 } |
| Per-channel reliability + ordering semantics. More... | |
Variables | |
| constexpr uint16_t | net::k_protocolMagic = 0x3247 |
| Magic bytes identifying our protocol. ASCII "G2" little-endian. | |
| constexpr uint8_t | net::k_protocolVersion = 1 |
| Wire-format version. Bump on any layout change. | |
| constexpr int | net::k_maxPacketBytes = 1200 |
| Maximum total UDP payload (header + data) in bytes. | |
| constexpr int | net::k_maxPayloadBytes = k_maxPacketBytes - static_cast<int>(sizeof(PacketHeader)) |
| Maximum payload bytes a single (non-fragmented) datagram can carry. | |
Wire format for the UDP transport layer.
Phase 3d: every UDP datagram begins with this 16-byte header so the receiver can demux by channel, drop stale snapshots by sequence number, reassemble fragments, and route to the right connection.
Layout — 16 bytes, little-endian on the wire (matches all our target platforms; saves a byte-swap on send/recv).
Stage 3d-1 ships only the struct + magic numbers; later stages populate sequence/channel/fragmentation as those features land.