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

Namespaces

namespace  chat
namespace  crypto
namespace  discovery
namespace  shotdebug
namespace  voice

Classes

struct  RelayToken
class  FragmentReassembler
struct  PacketHeader
 36-byte header at the start of every UDP datagram. 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...
class  UdpSessionTransport

Enumerations

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

Functions

bool hasRelayToken (const RelayToken &token)
void writeU16Le (std::uint8_t *out, std::uint16_t v)
void writeU32Le (std::uint8_t *out, std::uint32_t v)
void writeU64Le (std::uint8_t *out, std::uint64_t v)
std::uint16_t readU16Le (const std::uint8_t *in)
std::uint32_t readU32Le (const std::uint8_t *in)
std::uint64_t readU64Le (const std::uint8_t *in)
void encodePacketHeader (const PacketHeader &hdr, std::uint8_t *out)
bool decodePacketHeader (const std::uint8_t *data, std::size_t len, PacketHeader &out)
std::vector< std::uint8_t > makeDatagram (PacketHeader hdr, const void *payload, int payloadLen)

Variables

constexpr std::size_t k_relayTokenMacBytes = 32
constexpr std::uint16_t k_protocolMagic = 0x3247
 Magic bytes identifying our protocol. ASCII "G2" little-endian.
constexpr std::uint8_t k_protocolVersion = 2
 Wire-format version. Bump on any incompatible layout change.
constexpr int k_maxPacketBytes = 1200
 Maximum total UDP datagram bytes we intentionally emit.
constexpr std::uint8_t k_flagFragmented = 0x01
constexpr std::uint8_t k_flagEncrypted = 0x02
constexpr std::uint8_t k_flagRelayPreferred = 0x04
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 : std::uint8_t
strong

Per-channel reliability + ordering semantics.

Enumerator
InputUnreliable 
SnapshotUnreliableSequenced 
ControlReliableOrdered 
EventReliableOrdered 
VoiceUnreliableSequenced 
Count 
Unreliable 
UnreliableSequenced 
ReliableOrdered 
ReliableUnordered 

◆ PacketKind

enum class net::PacketKind : std::uint8_t
strong

Packet kind discriminator (PacketHeader::kind field).

Enumerator
Payload 
ConnectionRequest 
ConnectionAccepted 
Disconnect 
KeepAlive 
RelayPayload 
DirectoryControl 

Function Documentation

◆ decodePacketHeader()

bool net::decodePacketHeader ( const std::uint8_t * data,
std::size_t len,
PacketHeader & out )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ encodePacketHeader()

void net::encodePacketHeader ( const PacketHeader & hdr,
std::uint8_t * out )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasRelayToken()

bool net::hasRelayToken ( const RelayToken & token)
inline
Here is the caller graph for this function:

◆ makeDatagram()

std::vector< std::uint8_t > net::makeDatagram ( PacketHeader hdr,
const void * payload,
int payloadLen )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readU16Le()

std::uint16_t net::readU16Le ( const std::uint8_t * in)
inline
Here is the caller graph for this function:

◆ readU32Le()

std::uint32_t net::readU32Le ( const std::uint8_t * in)
inline
Here is the caller graph for this function:

◆ readU64Le()

std::uint64_t net::readU64Le ( const std::uint8_t * in)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeU16Le()

void net::writeU16Le ( std::uint8_t * out,
std::uint16_t v )
inline
Here is the caller graph for this function:

◆ writeU32Le()

void net::writeU32Le ( std::uint8_t * out,
std::uint32_t v )
inline
Here is the caller graph for this function:

◆ writeU64Le()

void net::writeU64Le ( std::uint8_t * out,
std::uint64_t v )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ k_flagEncrypted

std::uint8_t net::k_flagEncrypted = 0x02
inlineconstexpr

◆ k_flagFragmented

std::uint8_t net::k_flagFragmented = 0x01
inlineconstexpr

◆ k_flagRelayPreferred

std::uint8_t net::k_flagRelayPreferred = 0x04
inlineconstexpr

◆ k_maxPacketBytes

int net::k_maxPacketBytes = 1200
inlineconstexpr

Maximum total UDP datagram bytes we intentionally emit.

1200 bytes is the safe MTU floor for public Internet paths. Larger logical messages are fragmented above UDP by the transport layer.

◆ 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

std::uint16_t net::k_protocolMagic = 0x3247
inlineconstexpr

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

◆ k_protocolVersion

std::uint8_t net::k_protocolVersion = 2
inlineconstexpr

Wire-format version. Bump on any incompatible layout change.

◆ k_relayTokenMacBytes

std::size_t net::k_relayTokenMacBytes = 32
inlineconstexpr