UDP¶
GNRC’s implementation of the UDP protocol.
-
int
gnrc_udp_calc_csum(include/net/gnrc/pkt.h::gnrc_pktsnip_t* hdr,include/net/gnrc/pkt.h::gnrc_pktsnip_t* pseudo_hdr)¶ Calculate the checksum for the given packet.
Parameters
hdr: Pointer to the UDP header pseudo_hdr: Pointer to the network layer header Return values
- 0 on success
- -EBADMSG if
hdris not of type GNRC_NETTYPE_UDP - -EFAULT if
hdrorpseudo_hdris NULL - -ENOENT if
include/net/gnrc/pkt.h::gnrc_pktsnip::typeofpseudo_hdris not known
-
include/net/gnrc/pkt.h::gnrc_pktsnip_t*gnrc_udp_hdr_build(include/net/gnrc/pkt.h::gnrc_pktsnip_t* payload, uint16_t src, uint16_t dst)¶ Allocate and initialize a fresh UDP header in the packet buffer.
Parameters
payload: Payload contained in the UDP packet src: Source port in host byte order dst: Destination port in host byte order Return values
- pointer to the newly created (and allocated) header
- NULL on
src == NULL,dst == NULL,src_len != 2,dst_len != 2or on allocation error
-
int
gnrc_udp_init(void)¶ Initialize and start UDP.
Return values
- PID of the UDP thread
- negative value on error
-
GNRC_UDP_MSG_QUEUE_SIZE¶ Default message queue size for the UDP thread.
1
(8U)
-
GNRC_UDP_PRIO¶ Priority of the UDP thread.
1
(THREAD_PRIORITY_MAIN - 2)
-
GNRC_UDP_STACK_SIZE¶ Default stack size to use for the UDP thread.
1
(THREAD_STACKSIZE_DEFAULT)