ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
Video chat in your terminal
Loading...
Searching...
No Matches
packet_header_t Struct Reference

Fixed prefix shared by every ACIP packet on the wire. More...

#include <include/ascii-chat/network/packet/packet.h>

Data Fields

uint64_t magic
 Magic number (PACKET_MAGIC = 0xA5C11C4A1 "ASCIICHAT" in hex) 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

Fixed prefix shared by every ACIP packet on the wire.

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 628 of file packet.h.

Field Documentation

◆ client_id

uint32_t packet_header_t::client_id

Client ID (0 = server, >0 = client identifier).

Definition at line 638 of file packet.h.

◆ crc32

uint32_t packet_header_t::crc32

CRC32 checksum of payload data (0 if length == 0).

Definition at line 636 of file packet.h.

Referenced by acds_receive_packet(), and packet_queue_validate_packet().

◆ length

uint32_t packet_header_t::length

Payload data length in bytes (0 for header-only packets).

Definition at line 634 of file packet.h.

Referenced by packet_queue_validate_packet().

◆ magic

uint64_t packet_header_t::magic

Magic number (PACKET_MAGIC = 0xA5C11C4A1 "ASCIICHAT" in hex) for packet validation.

Definition at line 630 of file packet.h.

Referenced by acds_receive_packet(), and packet_queue_validate_packet().

◆ type

uint16_t packet_header_t::type

Packet type (packet_type_t enumeration).

Definition at line 632 of file packet.h.

Referenced by packet_queue_validate_packet(), and packet_receive_via_transport().


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