group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
net Namespace Reference

Classes

class  FragmentReassembler
struct  PacketHeader
 16-byte header at the start of every UDP datagram we send. More...
struct  UdpEndpointAddr
 A UDP datagram address (server's view of a remote peer). More...
struct  UdpReceivedMessage
 One framed UDP message ready to dispatch to upper layers. More...
class  UdpEndpoint
 Wraps a NET_DatagramSocket with header-prefixed I/O. More...

Enumerations

enum class  PacketKind : uint8_t {
  Payload = 0 , ConnectionRequest = 1 , ConnectionAccepted = 2 , Disconnect = 3 ,
  KeepAlive = 4
}
 Packet kind discriminator (PacketHeader::kind field). More...
enum class  ChannelId : uint8_t {
  Unreliable = 0 , UnreliableSequenced = 1 , ReliableOrdered = 2 , ReliableUnordered = 3 ,
  Count = 4
}
 Per-channel reliability + ordering semantics. More...

Variables

constexpr uint16_t k_protocolMagic = 0x3247
 Magic bytes identifying our protocol. ASCII "G2" little-endian.
constexpr uint8_t k_protocolVersion = 1
 Wire-format version. Bump on any layout change.
constexpr int k_maxPacketBytes = 1200
 Maximum total UDP payload (header + data) in bytes.
constexpr int k_maxPayloadBytes = k_maxPacketBytes - static_cast<int>(sizeof(PacketHeader))
 Maximum payload bytes a single (non-fragmented) datagram can carry.

Enumeration Type Documentation

◆ ChannelId

enum class net::ChannelId : uint8_t
strong

Per-channel reliability + ordering semantics.

Stage 3d-1 ships only the enum; each channel's actual behaviour arrives with the packet types that use it.

Enumerator
Unreliable 

No reliability.

Drop stale by sequence comparison. Used for: snapshots, inputs (with redundancy at app layer).

UnreliableSequenced 

No retransmit, but receiver discards packets older than the newest sequence already seen.

Future: VFX bursts.

ReliableOrdered 

Retransmit until acked, in-order delivery.

Future: match-state, kill events, score updates.

ReliableUnordered 

Retransmit until acked, no ordering required. Future: RPC.

Count 

◆ PacketKind

enum class net::PacketKind : uint8_t
strong

Packet kind discriminator (PacketHeader::kind field).

Enumerator
Payload 

Application data ride this — snapshots, inputs, events.

ConnectionRequest 

Future: connection handshake, keep-alive, disconnect.

Stage 3d-1 doesn't use these yet — connectionId is established over the existing TCP path until handshake-over-UDP lands.

ConnectionAccepted 
Disconnect 
KeepAlive 

Variable Documentation

◆ k_maxPacketBytes

int net::k_maxPacketBytes = 1200
inlineconstexpr

Maximum total UDP payload (header + data) in bytes.

1200 is the safe MTU floor for the public Internet. Routers can fragment or drop bigger datagrams. Stage 3d-4 adds application-layer fragmentation for messages that exceed this.

◆ k_maxPayloadBytes

int net::k_maxPayloadBytes = k_maxPacketBytes - static_cast<int>(sizeof(PacketHeader))
inlineconstexpr

Maximum payload bytes a single (non-fragmented) datagram can carry.

◆ k_protocolMagic

uint16_t net::k_protocolMagic = 0x3247
inlineconstexpr

Magic bytes identifying our protocol. ASCII "G2" little-endian.

◆ k_protocolVersion

uint8_t net::k_protocolVersion = 1
inlineconstexpr

Wire-format version. Bump on any layout change.