90#if DEVELHELP || defined (DOXYGEN)
98} unicoap_scheduled_event_t;
124#define UNICOAP_CLOCK ZTIMER_MSEC
149 uint32_t duration,
const char* name);
182#define UNICOAP_HAVE_MESSAGING_STATE \
183 IS_USED(MODULE_UNICOAP_DRIVER_RFC7252_COMMON)
189#define UNICOAP_HAVE_CLIENT_STATE \
190 IS_USED(MODULE_UNICOAP_CLIENT) && CONFIG_UNICOAP_CLIENT_MEMOS_CAPACITY > 0
221#if UNICOAP_HAVE_MESSAGING_STATE || defined(DOXYGEN)
244#if UNICOAP_HAVE_MESSAGING_STATE
296#define UNICOAP_LAYER_NOTIFICATION_ASYNC_FAILURE (~(~0U >> 1))
325#define UNICOAP_LAYER_NOTIFICATION_STATE_RELEASE (0)
332#define UNICOAP_LAYER_NOTIFICATION_STATE_ALLOC (1)
409 return callback._any != NULL;
428#if IS_USED(MODULE_UNICOAP_CLIENT_CANCELLATION)
429 uint16_t reference_id;
501 const uint8_t* token,
size_t token_length);
#define assert(cond)
abort the program if assertion is false
Common macros and compiler attributes/pragmas configuration.
#define container_of(PTR, TYPE, MEMBER)
Returns the container of a pointer to a member.
int(* unicoap_response_callback_t)(const unicoap_message_t *response, const unicoap_aux_t *aux, int error, void *arg)
Response or error callback.
unicoap_request_flags_t
Flags for enabling advanced features in client exchanges.
#define CONFIG_UNICOAP_GENERATED_TOKEN_LENGTH
Length of tokens generated by the unicoap client API.
uint32_t unicoap_block_option_t
Block1 and Block2 option value
static unicoap_client_memo_t * unicoap_client_memo_of_timeout(unicoap_scheduled_event_t *timeout)
Returns client memo of scheduled event.
void unicoap_event_cancel(unicoap_scheduled_event_t *event)
Cancels the event.
void unicoap_messaging_notify(void *state, unicoap_layer_notification_t type, void *arg, unicoap_proto_t proto)
Informs messaging layer of event.
void unicoap_exchange_notify(void *state, unicoap_layer_notification_t type, void *arg)
Informs exchange layer of event.
void unicoap_client_memo_free(unicoap_client_memo_t *memo, int error)
Frees memo and associated buffers.
int unicoap_layer_notification_t
A signal sent from one layer to another indicating a change to a state object.
#define UNICOAP_LAYER_NOTIFICATION_ASYNC_FAILURE
Event indicating a failure on the layer this message is sent from.
void unicoap_event_reschedule(unicoap_scheduled_event_t *event, uint32_t duration)
Discards the currently set timeout, and reschedules the event to be posted in duration ms.
void unicoap_event_schedule(unicoap_scheduled_event_t *event, unicoap_event_callback_t callback, uint32_t duration, const char *name)
Schedules an event on the internal unicoap queue.
static unicoap_client_memo_t * unicoap_client_memo_of_event(event_t *event)
Returns client memo of event.
unicoap_client_memo_t * unicoap_client_memo_find_refno(int refno)
Tries to find client state object based on reference number.
static unicoap_memo_t * unicoap_memo_of_timeout(unicoap_scheduled_event_t *timeout)
Returns memo of scheduled event.
static unicoap_memo_t * unicoap_memo_of_event(event_t *event)
Returns memo of scheduled event.
static unicoap_scheduled_event_t * unicoap_scheduled_event_of_event(event_t *event)
Returns scheduled event subclass of event.
static const char * unicoap_scheduled_event_name(unicoap_scheduled_event_t *event)
Name of scheduled event.
void(* unicoap_event_callback_t)(unicoap_scheduled_event_t *event)
Scheduled event callback.
static bool unicoap_callback_is_present(const unicoap_callback_t callback)
Determines whether the given callback is not NULL
static unicoap_layer_notification_t unicoap_layer_notification_async_failure_from_errno(int error)
Converts error number into notification.
void unicoap_exchange_notify_all(const unicoap_endpoint_t *endpoint, unicoap_layer_notification_t type, void *arg)
Informs exchange layer of event that applies to all exchange state objects associated with given endp...
int unicoap_client_memo_assign_refno(unicoap_client_memo_t *memo)
Assigns a refno to the given client memo.
unicoap_client_memo_t * unicoap_client_memo_create(const unicoap_endpoint_t *endpoint)
Allocates and sets up a new memo.
static unicoap_client_memo_t * unicoap_client_memo_of_super(unicoap_memo_t *memo)
Returns client memo of common memo state object.
int unicoap_client_callback_success(unicoap_client_memo_t *memo, const unicoap_packet_t *packet, unicoap_block_option_t block)
Invokes the client callback.
static void * unicoap_memo_messaging_state(unicoap_memo_t *memo)
Returns messaging state associated with memo.
void unicoap_client_callback_failure(unicoap_client_memo_t *memo, int error)
Invokes the client callback indicating an error occurred.
unicoap_client_memo_t * unicoap_client_memo_find_token(const unicoap_endpoint_t *endpoint, const uint8_t *token, size_t token_length)
Tries to find a client exchange memo by endpoint and token.
static int unicoap_layer_notification_async_failure_to_errno(unicoap_layer_notification_t type)
Converts notification to negative error number.
unicoap_proto_t
Transport protocol CoAP is used over.
struct event event_t
event structure forward declaration
Common interface to the software PRNG.
unicoap_callback_t callback
Callback function registered by the client API.
unicoap_memo_t super
Common client/server memo super struct.
void * callback_arg
Argument to be passed to callback.
uint8_t token[CONFIG_UNICOAP_GENERATED_TOKEN_LENGTH]
Request token generated by unicoap.
unicoap_request_flags_t flags
Request flags from application, from the original call to unicoap_send_request_*
A type used to retain state spanning across a single or multiple message exchanges.
unicoap_endpoint_t endpoint
The remote CoAP endpoint unicoap maintains an exchange with (client/server) or stores messaging state...
void * state
Messaging state.
unicoap_scheduled_event_t timeout
Timeout.
union unicoap_memo_t::@101272157352214111246162252141132147115334324007 messaging
Messaging state.
A type acting as an envelope for a message and data connected, like endpoints.