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_envelope_t Struct Reference

Packet envelope containing received packet data. More...

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

Data Fields

packet_type_t type
 Packet type (from packet_types.h).
void * data
 Packet payload data (decrypted and decompressed if applicable).
size_t len
 Length of payload data in bytes.
bool was_encrypted
 True if packet was encrypted (decrypted before envelope creation).
bool consumed
 Shared security control; never dispatch to the application.
void * allocated_buffer
 Buffer that needs to be freed by caller (may be NULL if not allocated).
size_t allocated_size
 Size of allocated buffer in bytes.

Detailed Description

Packet envelope containing received packet data.

Represents a complete received packet with all metadata. The envelope includes packet type, payload data, encryption status, and buffer ownership information for proper memory management.

MEMORY MANAGEMENT:

  • allocated_buffer points to buffer that needs to be freed
  • allocated_size indicates size of allocated buffer
  • Caller must free allocated_buffer when done with packet
Note
If was_encrypted is true, data has already been decrypted before being placed in the envelope.
allocated_buffer may be different from data if packet was encrypted/compressed (data points into allocated_buffer).

Definition at line 1185 of file packet.h.

Field Documentation

◆ allocated_buffer

void* packet_envelope_t::allocated_buffer

Buffer that needs to be freed by caller (may be NULL if not allocated).

Definition at line 1196 of file packet.h.

◆ allocated_size

size_t packet_envelope_t::allocated_size

Size of allocated buffer in bytes.

Definition at line 1198 of file packet.h.

◆ consumed

bool packet_envelope_t::consumed

Shared security control; never dispatch to the application.

Definition at line 1194 of file packet.h.

◆ data

void* packet_envelope_t::data

Packet payload data (decrypted and decompressed if applicable).

Definition at line 1189 of file packet.h.

◆ len

size_t packet_envelope_t::len

Length of payload data in bytes.

Definition at line 1191 of file packet.h.

◆ type

packet_type_t packet_envelope_t::type

Packet type (from packet_types.h).

Definition at line 1187 of file packet.h.

◆ was_encrypted

bool packet_envelope_t::was_encrypted

True if packet was encrypted (decrypted before envelope creation).

Definition at line 1193 of file packet.h.


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