riot_sys::bindgen

Type Alias coap_handler_t

Source
pub type coap_handler_t = Option<unsafe extern "C" fn(pkt: *mut coap_pkt_t, buf: *mut u8, len: size_t, context: *mut coap_request_ctx_t) -> ssize_t>;
Expand description

@brief Resource handler type

Functions that implement this must be prepared to be called multiple times for the same request, as the server implementations do not perform message deduplication. That optimization is described in the CoAP specification.

This should be trivial for requests of the GET, PUT, DELETE, FETCH and iPATCH methods, as they are defined as idempotent methods in CoAP.

For POST, PATCH and other non-idempotent methods, this is an additional requirement introduced by the contract of this type.

@param[in] pkt The request packet @param[out] buf Buffer for the response @param[in] len Size of the response buffer @param[in] context Request context

@return Number of response bytes written on success Negative error on failure

Aliased Type§

enum coap_handler_t {
    None,
    Some(unsafe extern "C" fn(_: *mut coap_pkt_t, _: *mut u8, _: u32, _: *mut _coap_request_ctx) -> i32),
}

Variants§

§1.0.0

None

No value.

§1.0.0

Some(unsafe extern "C" fn(_: *mut coap_pkt_t, _: *mut u8, _: u32, _: *mut _coap_request_ctx) -> i32)

Some value of type T.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 4 bytes

Size for each variant:

  • None: 0 bytes
  • Some: 4 bytes