|
group2 0.1.0
CSE 125 Group 2
|
Wire format helpers for the UDP-first transport layer. More...
#include <SDL3/SDL_stdinc.h>#include <cstddef>#include <cstdint>#include <cstring>#include <vector>Go to the source code of this file.
Classes | |
| struct | net::PacketHeader |
| 36-byte header at the start of every UDP datagram. More... | |
Namespaces | |
| namespace | net |
Enumerations | |
| enum class | net::PacketKind : std::uint8_t { net::Payload = 0 , net::ConnectionRequest = 1 , net::ConnectionAccepted = 2 , net::Disconnect = 3 , net::KeepAlive = 4 , net::RelayPayload = 5 , net::DirectoryControl = 6 } |
| Packet kind discriminator (PacketHeader::kind field). More... | |
| enum class | net::ChannelId : std::uint8_t { net::InputUnreliable = 0 , net::SnapshotUnreliableSequenced = 1 , net::ControlReliableOrdered = 2 , net::EventReliableOrdered = 3 , net::VoiceUnreliableSequenced = 4 , net::Count = 5 , net::Unreliable = InputUnreliable , net::UnreliableSequenced = SnapshotUnreliableSequenced , net::ReliableOrdered = EventReliableOrdered , net::ReliableUnordered = ControlReliableOrdered } |
| Per-channel reliability + ordering semantics. More... | |
Functions | |
| void | net::writeU16Le (std::uint8_t *out, std::uint16_t v) |
| void | net::writeU32Le (std::uint8_t *out, std::uint32_t v) |
| void | net::writeU64Le (std::uint8_t *out, std::uint64_t v) |
| std::uint16_t | net::readU16Le (const std::uint8_t *in) |
| std::uint32_t | net::readU32Le (const std::uint8_t *in) |
| std::uint64_t | net::readU64Le (const std::uint8_t *in) |
| void | net::encodePacketHeader (const PacketHeader &hdr, std::uint8_t *out) |
| bool | net::decodePacketHeader (const std::uint8_t *data, std::size_t len, PacketHeader &out) |
| std::vector< std::uint8_t > | net::makeDatagram (PacketHeader hdr, const void *payload, int payloadLen) |
Variables | |
| constexpr std::uint16_t | net::k_protocolMagic = 0x3247 |
| Magic bytes identifying our protocol. ASCII "G2" little-endian. | |
| constexpr std::uint8_t | net::k_protocolVersion = 2 |
| Wire-format version. Bump on any incompatible layout change. | |
| constexpr int | net::k_maxPacketBytes = 1200 |
| Maximum total UDP datagram bytes we intentionally emit. | |
| constexpr std::uint8_t | net::k_flagFragmented = 0x01 |
| constexpr std::uint8_t | net::k_flagEncrypted = 0x02 |
| constexpr std::uint8_t | net::k_flagRelayPreferred = 0x04 |
| constexpr int | net::k_maxPayloadBytes = k_maxPacketBytes - static_cast<int>(sizeof(PacketHeader)) |
| Maximum payload bytes a single non-fragmented datagram can carry. | |
Wire format helpers for the UDP-first transport layer.
Protocol v2 puts session identity, route selection, channel sequence, selective ack state, and fragmentation metadata in every UDP datagram. The wire format is explicitly little-endian so future Steam / relay backends can share the same payload contract without relying on host endianness.