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

Packet envelope containing received packet data. More...

#include <lib/network/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 980 of file packet.h.


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