riot_sys

Function sock_udp_recv_buf_aux

Source
pub unsafe extern "C" fn sock_udp_recv_buf_aux(
    sock: *mut sock_udp_t,
    data: *mut *mut c_void,
    buf_ctx: *mut *mut c_void,
    timeout: u32,
    remote: *mut sock_udp_ep_t,
    aux: *mut sock_udp_aux_rx_t,
) -> ssize_t
Expand description

@brief Provides stack-internal buffer space containing a UDP message from a remote end point

@pre (sock != NULL) && (data != NULL) && (buf_ctx != NULL)

@param[in] sock A UDP sock object. @param[out] data Pointer to a stack-internal buffer space containing the received data. @param[in,out] buf_ctx Stack-internal buffer context. If it points to a NULL pointer, the stack returns a new buffer space for a new packet. If it does not point to a NULL pointer, an existing context is assumed to get a next segment in a buffer. @param[in] timeout Timeout for receive in microseconds. If 0 and no data is available, the function returns immediately. May be @ref SOCK_NO_TIMEOUT for no timeout (wait until data is available). @param[out] remote Remote end point of the received data. May be NULL, if it is not required by the application. @param[out] aux Auxiliary data about the received datagram. May be NULL, if it is not required by the application.

@experimental This function is quite new, not implemented for all stacks yet, and may be subject to sudden API changes. Do not use in production if this is unacceptable.

@note Function blocks if no packet is currently waiting.

@return The number of bytes received on success. May not be the complete payload. Continue calling with the returned buf_ctx to get more buffers until result is 0 or an error. @return 0, if no received data is available, but everything is in order. If @p buf_ctx was provided, it was released. @return -EADDRNOTAVAIL, if local of @p sock is not given. @return -EAGAIN, if @p timeout is 0 and no data is available. @return -EINVAL, if @p remote is invalid or @p sock is not properly initialized (or closed while sock_udp_recv() blocks). @return -ENOMEM, if no memory was available to receive @p data. @return -EPROTO, if source address of received packet did not equal the remote of @p sock. @return -ETIMEDOUT, if @p timeout expired.