ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
packet_header_t Struct Reference

Network packet header structure. More...

#include <lib/network/packet.h>

Data Fields

uint32_t magic
 Magic number (PACKET_MAGIC) for packet validation.
 
uint16_t type
 Packet type (packet_type_t enumeration)
 
uint32_t length
 Payload data length in bytes (0 for header-only packets)
 
uint32_t crc32
 CRC32 checksum of payload data (0 if length == 0)
 
uint32_t client_id
 Client ID (0 = server, >0 = client identifier)
 

Detailed Description

Network packet header structure.

Standard header for all network packets. Contains magic number for validation, packet type, payload length, CRC32 checksum, and client ID.

PACKET HEADER FIELDS:

  • magic: PACKET_MAGIC constant for packet detection/validation
  • type: Packet type enumeration (packet_type_t)
  • length: Payload data length in bytes (0 for header-only packets)
  • crc32: CRC32 checksum of payload data (0 if length == 0)
  • client_id: Client identifier (0 = server, >0 = client ID)
Note
Structure is packed for wire format compatibility (no padding).
Magic number must be PACKET_MAGIC or packet is considered invalid.
CRC32 is computed over payload data, not including header.

Definition at line 490 of file packet.h.


The documentation for this struct was generated from the following file: