268#ifndef NET_SOCK_UDP_H
269#define NET_SOCK_UDP_H
275#include <sys/types.h>
279#if defined (__clang__)
280# pragma clang diagnostic push
281# pragma clang diagnostic ignored "-Wtypedef-redefinition"
303#if defined (__clang__)
304# pragma clang diagnostic pop
311#if defined(MODULE_SOCK_AUX_LOCAL) || defined(DOXYGEN)
319#if defined(MODULE_SOCK_AUX_TIMESTAMP) || defined(DOXYGEN)
327#if defined(MODULE_SOCK_AUX_RSSI) || defined(DOXYGEN)
335#if defined(MODULE_SOCK_AUX_TTL) || defined(DOXYGEN)
350#if defined(MODULE_SOCK_AUX_LOCAL) || defined(DOXYGEN)
358#if defined(MODULE_SOCK_AUX_TIMESTAMP) || defined(DOXYGEN)
531 void *data,
size_t max_len,
628 void **data,
void **buf_ctx,
708 const void *data,
size_t len,
755 const void *data,
size_t len,
834#if !defined(SOCK_HAS_IPV6)
837#elif !defined(SOCK_HAS_IPV4)
845#include "sock_types.h"
Global UNIX address family definitions.
#define AF_INET
internetwork address family: UDP, TCP, etc.
#define AF_INET6
internetwork address family with IPv6: UDP, TCP, etc.
POSIX.1-2008 compliant version of the assert macro.
#define assert(cond)
abort the program if assertion is false
static bool ipv4_addr_is_multicast(const ipv4_addr_t *addr)
Check if addr is a multicast address.
static bool ipv6_addr_is_multicast(const ipv6_addr_t *addr)
Check if addr is a multicast address.
ssize_t sock_udp_recv_aux(sock_udp_t *sock, void *data, size_t max_len, uint32_t timeout, sock_udp_ep_t *remote, sock_udp_aux_rx_t *aux)
Receives a UDP message from a remote end point.
int sock_udp_get_local(sock_udp_t *sock, sock_udp_ep_t *ep)
Gets the local end point of a UDP sock object.
int sock_udp_create(sock_udp_t *sock, const sock_udp_ep_t *local, const sock_udp_ep_t *remote, uint16_t flags)
Creates a new UDP sock object.
static bool sock_udp_ep_is_v6(const sock_udp_ep_t *ep)
Checks if the IP address of an endpoint is an IPv6 address.
ssize_t sock_udp_sendv_aux(sock_udp_t *sock, const iolist_t *snips, const sock_udp_ep_t *remote, sock_udp_aux_tx_t *aux)
Sends a UDP message to remote end point with non-continous payload.
static ssize_t sock_udp_recv_buf(sock_udp_t *sock, void **data, void **buf_ctx, uint32_t timeout, sock_udp_ep_t *remote)
Provides stack-internal buffer space containing a UDP message from a remote end point.
static ssize_t sock_udp_send_aux(sock_udp_t *sock, const void *data, size_t len, const sock_udp_ep_t *remote, sock_udp_aux_tx_t *aux)
Sends a UDP message to remote end point.
int sock_udp_get_remote(sock_udp_t *sock, sock_udp_ep_t *ep)
Gets the remote end point of a UDP sock object.
static ssize_t sock_udp_sendv(sock_udp_t *sock, const iolist_t *snips, const sock_udp_ep_t *remote)
Sends a UDP message to remote end point with non-continous payload.
void sock_udp_close(sock_udp_t *sock)
Closes a UDP sock object.
ssize_t sock_udp_recv_buf_aux(sock_udp_t *sock, void **data, void **buf_ctx, uint32_t timeout, sock_udp_ep_t *remote, sock_udp_aux_rx_t *aux)
Provides stack-internal buffer space containing a UDP message from a remote end point.
static bool sock_udp_ep_is_multicast(const sock_udp_ep_t *ep)
Checks if the IP address of an endpoint is multicast.
static ssize_t sock_udp_send(sock_udp_t *sock, const void *data, size_t len, const sock_udp_ep_t *remote)
Sends a UDP message to remote end point.
static ssize_t sock_udp_recv(sock_udp_t *sock, void *data, size_t max_len, uint32_t timeout, sock_udp_ep_t *remote)
Receives a UDP message from a remote end point.
uint8_t sock_aux_flags_t
Type holding the flags used to request specific auxiliary data.
IPv4 address type and helper functions definitions.
Definitions for IPv6 addresses.
Common sock API definitions.
Common IP-based transport layer end point.
union _sock_tl_ep::@384 addr
address
int family
family of sock_ip_ep_t::addr
uint8_t ipv4[4]
IPv4 address mode.
uint8_t ipv6[16]
IPv6 address mode.
iolist structure definition
Auxiliary data provided when receiving using an UDP sock object.
sock_udp_ep_t local
The local endpoint the datagram was received on.
uint8_t ttl
TTL value of the received frame.
int16_t rssi
RSSI value of the received frame.
uint64_t timestamp
System time the datagram was received.
sock_aux_flags_t flags
Flags used request information.
Auxiliary data provided when sending using an UDP sock object.
uint64_t timestamp
System time the datagram was send.
sock_udp_ep_t local
The local endpoint from which the datagram will be sent.
sock_aux_flags_t flags
Flags used request information.
Data type to represent an IPv4 address.
Data type to represent an IPv6 address.