ascii-chat 0.11.33
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)
 
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 1129 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 1139 of file packet.h.

Referenced by acip_client_receive_and_dispatch(), acip_server_receive_and_dispatch(), add_client(), packet_decrypt_envelope(), and receive_packet_secure_with_timeout().

◆ allocated_size

size_t packet_envelope_t::allocated_size

◆ data

void* packet_envelope_t::data

Packet payload data (decrypted and decompressed if applicable)

Definition at line 1133 of file packet.h.

Referenced by acip_client_receive_and_dispatch(), acip_server_receive_and_dispatch(), add_client(), packet_decrypt_envelope(), and receive_packet_secure_with_timeout().

◆ len

size_t packet_envelope_t::len

◆ type

packet_type_t packet_envelope_t::type

◆ was_encrypted

bool packet_envelope_t::was_encrypted

True if packet was encrypted (decrypted before envelope creation)

Definition at line 1137 of file packet.h.

Referenced by acip_client_receive_and_dispatch().


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