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

Detailed Description

Files

file  gnrc/udp.h
 UDP GNRC definition.
 

Macros

#define GNRC_UDP_MSG_QUEUE_SIZE   (8U)
 Default message queue size for the UDP thread.
 
#define GNRC_UDP_PRIO   (THREAD_PRIORITY_MAIN - 2)
 Priority of the UDP thread.
 
#define GNRC_UDP_STACK_SIZE   (THREAD_STACKSIZE_DEFAULT)
 Default stack 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. More...
 
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. More...
 
int gnrc_udp_init (void)
 Initialize and start UDP. More...
 

Function Documentation

int gnrc_udp_calc_csum ( gnrc_pktsnip_t hdr,
gnrc_pktsnip_t pseudo_hdr 
)
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_pktsnip_t* gnrc_udp_hdr_build ( gnrc_pktsnip_t payload,
uint16_t  src,
uint16_t  dst 
)
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
int gnrc_udp_init ( void  )
Returns
PID of the UDP thread
negative value on error