|
libcoap 4.3.5-develop-379c7f4
|
API for delayed "separate" messages. More...
Functions | |
| COAP_API void | coap_context_set_async_limits (coap_context_t *context, size_t max_pending, size_t max_per_session) |
| Set the maximum number of pending asynchronous requests for the context and for each session. | |
| COAP_API coap_async_t * | coap_register_async (coap_session_t *session, const coap_pdu_t *request, coap_tick_t delay) |
Allocates a new coap_async_t object and fills its fields according to the given request. | |
| COAP_API void | coap_async_set_delay (coap_async_t *async, coap_tick_t delay) |
Update the delay timeout, so changing when the registered async triggers. | |
| COAP_API void | coap_async_trigger (coap_async_t *async) |
Trigger the registered async. | |
| COAP_API void | coap_free_async (coap_session_t *session, coap_async_t *async) |
Releases the memory that was allocated by coap_register_async() for the object async. | |
| COAP_API coap_async_t * | coap_find_async (coap_session_t *session, coap_bin_const_t token) |
Retrieves the object identified by token from the list of asynchronous transactions that are registered with context. | |
| COAP_DEPRECATED void | coap_async_set_app_data (coap_async_t *async, void *app_data) |
Set the application data pointer held in async. | |
| void * | coap_async_get_app_data (const coap_async_t *async) |
Gets the application data pointer held in async. | |
| COAP_API void * | coap_async_set_app_data2 (coap_async_t *async_entry, void *data, coap_app_data_free_callback_t callback) |
Stores data with the given async, returning the previously stored value or NULL. | |
API for delayed "separate" messages.
A coap_context_t object holds a list of coap_async_t objects that can be used to generate a separate response in the case a result of a request cannot be delivered immediately.
| void * coap_async_get_app_data | ( | const coap_async_t * | async | ) |
Gets the application data pointer held in async.
| async | The async state object. |
Definition at line 333 of file coap_async.c.
| COAP_DEPRECATED void coap_async_set_app_data | ( | coap_async_t * | async, |
| void * | app_data ) |
Set the application data pointer held in async.
This overwrites any existing data pointer.
| async | The async state object. |
| app_data | The pointer to the data. |
Definition at line 318 of file coap_async.c.
| COAP_API void * coap_async_set_app_data2 | ( | coap_async_t * | async_entry, |
| void * | data, | ||
| coap_app_data_free_callback_t | callback ) |
Stores data with the given async, returning the previously stored value or NULL.
The data callback can be defined if the data is to be released when the cache_entry is deleted.
Note: It is the responsibility of the caller to free off (if appropriate) any returned data.
| async_entry | The async state object. |
| data | The pointer to the data to store or NULL to just clear out the previous data. |
| callback | The optional release call-back for data on async removal or NULL. |
Definition at line 324 of file coap_async.c.
| COAP_API void coap_async_set_delay | ( | coap_async_t * | async, |
| coap_tick_t | delay ) |
Update the delay timeout, so changing when the registered async triggers.
When the new delay expires, a copy of the original request will get sent to the appropriate request handler.
| async | The object to update. |
| delay | The amount of time to delay before sending response, 0 means wait forever. |
Definition at line 298 of file coap_async.c.
| COAP_API void coap_async_trigger | ( | coap_async_t * | async | ) |
Trigger the registered async.
A copy of the original request will get sent to the appropriate request handler.
| async | The async object to trigger. |
| COAP_API void coap_context_set_async_limits | ( | coap_context_t * | context, |
| size_t | max_pending, | ||
| size_t | max_per_session ) |
Set the maximum number of pending asynchronous requests for the context and for each session.
Each limit can be disabled independently by setting it to zero. Existing requests remain pending when a limit is lowered. The library defaults to 64 per context and 8 per session unless overridden at build time.
| context | The CoAP context. |
| max_pending | Maximum pending across the context. |
| max_per_session | Maximum pending on one session. |
Definition at line 19 of file coap_async.c.
| COAP_API coap_async_t * coap_find_async | ( | coap_session_t * | session, |
| coap_bin_const_t | token ) |
Retrieves the object identified by token from the list of asynchronous transactions that are registered with context.
This function returns a pointer to that object or NULL if not found.
| session | The session that is used for asynchronous transmissions. |
| token | The PDU's token of the object to retrieve. |
token or NULL if not found. Definition at line 310 of file coap_async.c.
| COAP_API void coap_free_async | ( | coap_session_t * | session, |
| coap_async_t * | async ) |
Releases the memory that was allocated by coap_register_async() for the object async.
| session | The session to use. |
| async | The object to delete. |
Definition at line 304 of file coap_async.c.
| COAP_API coap_async_t * coap_register_async | ( | coap_session_t * | session, |
| const coap_pdu_t * | request, | ||
| coap_tick_t | delay ) |
Allocates a new coap_async_t object and fills its fields according to the given request.
This function returns a pointer to the registered coap_async_t object or NULL on error. Note that this function will return NULL in case that an object with the same identifier is already registered or a configured limit has been reached.
When the delay expires, a copy of the request will get sent to the appropriate request handler.
| session | The session that is used for asynchronous transmissions. |
| request | The request that is handled asynchronously. |
| delay | The amount of time to delay before sending response, 0 means wait forever. |
NULL in case of an error. Definition at line 288 of file coap_async.c.