CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
NetMessage Struct Reference

A received packet, as delivered to a handler. More...

#include <net_shared.h>

Data Fields

Buffer buf
 Message data (NULL for stream data, which is buffered in the socket's ring)
 
NetAddr addr
 Source / destination address.
 
NetPktInfo info
 What the IP layer carried with this datagram, where the platform could report it.
 

Detailed Description

A received packet, as delivered to a handler.

Arrives as NetEvent.recv.msg (a complete datagram), NetEvent.refused.msg (a packet from a source with no flow), or through a netsocketRecvMsgs() callback. Read the payload from buf and the peer's address from addr. The message itself is only valid until the handler returns – to keep the payload without copying it, take ownership of the buffer (see buf).

Definition at line 361 of file net_shared.h.

Field Documentation

◆ buf

Buffer NetMessage::buf

Message data (NULL for stream data, which is buffered in the socket's ring)

For a delivered datagram, set to NULL to take ownership of the payload; otherwise it is returned to the pool when the handler returns.

Definition at line 368 of file net_shared.h.

◆ info

NetPktInfo NetMessage::info

What the IP layer carried with this datagram, where the platform could report it.

Unused for stream sockets. On a datagram this is the local address it arrived on and its ECN mark, each present only if the platform reported it and the socket asked for it with netsocketRecvInfo().

Definition at line 381 of file net_shared.h.


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