riot_sys

Function sock_ip_recv_aux

Source
pub unsafe extern "C" fn sock_ip_recv_aux(
    sock: *mut sock_ip_t,
    data: *mut c_void,
    max_len: size_t,
    timeout: u32,
    remote: *mut sock_ip_ep_t,
    aux: *mut sock_ip_aux_rx_t,
) -> ssize_t
Expand description

@brief Receives a message over IPv4/IPv6 from remote end point

@pre (sock != NULL) && (data != NULL) && (max_len > 0)

@param[in] sock A raw IPv4/IPv6 sock object. @param[out] data Pointer where the received data should be stored. @param[in] max_len Maximum space available at @p data. @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 of the reception. May be NULL, if it is not required by the application.

@note Function blocks if no packet is currently waiting.

@return The number of bytes received on success. @return 0, if no received data is available, but everything is in order. @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_ip_recv() blocks). @return -ENOBUFS, if buffer space is not large enough to store received data. @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.