libcoap 4.3.5-develop-19cef11
|
API for delayed "separate" messages. More...
Functions | |
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 . More... | |
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. More... | |
COAP_API void | coap_async_trigger (coap_async_t *async) |
Trigger the registered async . More... | |
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 . More... | |
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 . More... | |
void | coap_async_set_app_data (coap_async_t *async, void *app_data) |
Set the application data pointer held in async . More... | |
void * | coap_async_get_app_data (const coap_async_t *async) |
Gets the application data pointer held in async . More... | |
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 272 of file coap_async.c.
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 266 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 246 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 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 258 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 252 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.
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 236 of file coap_async.c.