riot_sys

Function nanocoap_sock_request_cb

Source
pub unsafe extern "C" fn nanocoap_sock_request_cb(
    sock: *mut nanocoap_sock_t,
    pkt: *mut coap_pkt_t,
    cb: coap_request_cb_t,
    arg: *mut c_void,
) -> ssize_t
Expand description

@brief Simple synchronous CoAP request with callback

     The response will be handled by a callback, which avoids copying the
     response packet out of the network stack internal buffer.

@param[in] sock socket to use for the request @param[in,out] pkt Packet struct containing the request. Is reused for the response @param[in] cb Callback executed for response packet @param[in] arg Optional callback argumnent

@returns length of response on success @returns 0 for a request for which no response is expected, indicated by @p cb == NULL, or for a 2.xx response @returns -ETIMEDOUT, if no matching ACK or no response was received @returns -EBADMSG, if a matching RST was received @returns -ENXIO, if @p cb == NULL and the response indicates a 4.xx client error @returns -ENETRESET, if @p cb == NULL and the response indicates a 5.xx server error @returns any error on @see sock_udp_sendv or @see sock_dtls_sendv @returns any error on @see sock_udp_recv_buf or @see sock_dtls_recv_buf @returns any return value of @p cb for a matching response