UDPConnection
A network connection implementation over UDP
Loading...
Searching...
No Matches
Data Fields
UDPC_PacketInfo Struct Reference

Data representing a received/sent packet. More...

#include <UDPC.h>

Data Fields

char * data
 
uint32_t flags
 Flags indication some additional information about the received packet. More...
 
uint32_t id
 The packet's id. More...
 
uint16_t dataSize
 The size in bytes of the received packet's data inside the data pointer member variable. More...
 
uint16_t rtt
 
UDPC_ConnectionId sender
 The UDPC_ConnectionId of the sender.
 
UDPC_ConnectionId receiver
 The UDPC_ConnectionId of the receiver.
 

Detailed Description

Data representing a received/sent packet.

If data is NULL or dataSize is 0, then this packet is invalid.

Warning
This struct must be free'd with a call to UDPC_free_PacketInfo_ptr or UDPC_free_PacketInfo to avoid a memory leak.

Field Documentation

◆ data

char* UDPC_PacketInfo::data

A char array of size dataSize. Will be NULL if this UDPC_PacketInfo is invalid.

◆ dataSize

uint16_t UDPC_PacketInfo::dataSize

The size in bytes of the received packet's data inside the data pointer member variable.

UDPC does not return an empty packet when calling UDPC_get_received(), so in such a packet dataSize shouldn't be zero. (UDPC only stores received packets that do have a payload.) This means that if this variable is 0, then this UDPC_PacketInfo is invalid.

◆ flags

uint32_t UDPC_PacketInfo::flags

Flags indication some additional information about the received packet.

The following list indicates what each used bit in flags refers to.

  • 0x1: Is an initiate-connection packet
  • 0x2: Is a ping packet
  • 0x4: Is a packet that will not be re-sent if not received
  • 0x8: Is a packet that was re-sent

◆ id

uint32_t UDPC_PacketInfo::id

The packet's id.

Packets start with id = 0, and will wrap around. This can be used to determine specifically how out of order a packet may be.


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