Loading...
Searching...
No Matches

GNRC's implementation of the UDP protocol. More...

Detailed Description

GNRC's implementation of the UDP protocol.

Modules

 GNRC UDP compile configurations
 

Files

file  udp.h
 UDP GNRC definition.
 

Macros

#define GNRC_UDP_MSG_QUEUE_SIZE   (1 << CONFIG_GNRC_UDP_MSG_QUEUE_SIZE_EXP)
 Message queue size to use for the UDP thread.
 

Functions

int gnrc_udp_calc_csum (gnrc_pktsnip_t *hdr, gnrc_pktsnip_t *pseudo_hdr)
 Calculate the checksum for the given packet.
 
gnrc_pktsnip_tgnrc_udp_hdr_build (gnrc_pktsnip_t *payload, uint16_t src, uint16_t dst)
 Allocate and initialize a fresh UDP header in the packet buffer.
 
int gnrc_udp_init (void)
 Initialize and start UDP.
 

Macro Definition Documentation

◆ GNRC_UDP_MSG_QUEUE_SIZE

#define GNRC_UDP_MSG_QUEUE_SIZE   (1 << CONFIG_GNRC_UDP_MSG_QUEUE_SIZE_EXP)

Message queue size to use for the UDP thread.

Definition at line 74 of file udp.h.

Function Documentation

◆ gnrc_udp_calc_csum()

int gnrc_udp_calc_csum ( gnrc_pktsnip_t hdr,
gnrc_pktsnip_t pseudo_hdr 
)

Calculate the checksum for the given packet.

Parameters
[in]hdrPointer to the UDP header
[in]pseudo_hdrPointer to the network layer header
Returns
0 on success
-EBADMSG if hdr is not of type GNRC_NETTYPE_UDP
-EFAULT if hdr or pseudo_hdr is NULL
-ENOENT if gnrc_pktsnip_t::type of pseudo_hdr is not known

◆ gnrc_udp_hdr_build()

gnrc_pktsnip_t * gnrc_udp_hdr_build ( gnrc_pktsnip_t payload,
uint16_t  src,
uint16_t  dst 
)

Allocate and initialize a fresh UDP header in the packet buffer.

Parameters
[in]payloadPayload contained in the UDP packet
[in]srcSource port in host byte order
[in]dstDestination port in host byte order
Returns
pointer to the newly created (and allocated) header
NULL on src == NULL, dst == NULL, src_len != 2, dst_len != 2 or on allocation error
Precondition
src > 0 and dst > 0

◆ gnrc_udp_init()

int gnrc_udp_init ( void  )

Initialize and start UDP.

Returns
PID of the UDP thread
negative value on error