21 #define SEARCH_PAIR(head,out,field1,val1,field2,val2,field3,val3) \
22 SEARCH_PAIR3(head,out,field1,val1,field2,val2,field3,val3,next)
24 #define SEARCH_PAIR3(head,out,field1,val1,field2,val2,field3,val3,next) \
26 LL_FOREACH2(head,out,next) { \
27 if ((out)->field1 == (val1) && (out)->field2 == (val2) && \
28 ((val2) == 0 || memcmp((out)->field3, (val3), (val2)) == 0)) break; \
51 pdu->token, request->
token);
55 "asynchronous state for mid=0x%x already registered\n", mid);
69 request->
token, NULL);
92 assert(async != NULL);
96 async->
delay += delay;
113 pdu->token_length, token.
length,
114 pdu->token, token.
s);
142 LL_FOREACH_SAFE(context->
async_state, astate, tmp) {
#define SEARCH_PAIR(head, out, field1, val1, field2, val2, field3, val3)
static void coap_free_async_sub(coap_context_t *context, coap_async_t *s)
Pulls together all the internal only header files.
void coap_ticks(coap_tick_t *t)
Sets t to the internal time with COAP_TICKS_PER_SECOND resolution.
uint64_t coap_tick_t
This data type represents internal timer ticks with COAP_TICKS_PER_SECOND resolution.
#define COAP_TICKS_PER_SECOND
Use ms resolution on POSIX systems.
void coap_delete_all_async(coap_context_t *context)
Removes and frees off all of the async entries for the given context.
void coap_free_async(coap_session_t *session, coap_async_t *s)
Releases the memory that was allocated by coap_register_async() for the object async.
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.
void * coap_async_get_app_data(const coap_async_t *async)
Gets the application data pointer held in async.
void coap_async_set_delay(coap_async_t *async, coap_tick_t delay)
Update the delay timeout, so changing when the registered async triggers.
void coap_async_set_app_data(coap_async_t *async, void *app_data)
Set the application data pointer held in async.
int coap_async_is_supported(void)
Returns 1 if libcoap was built with separate messages enabled, 0 otherwise.
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 register...
const char * coap_session_str(const coap_session_t *session)
Get session description.
#define coap_log(level,...)
Logging function.
#define COAP_PDU_IS_REQUEST(pdu)
coap_pdu_t * coap_pdu_duplicate(const coap_pdu_t *old_pdu, coap_session_t *session, size_t token_length, const uint8_t *token, coap_opt_filter_t *drop_options)
Duplicate an existing PDU.
void coap_delete_pdu(coap_pdu_t *pdu)
Dispose of an CoAP PDU and frees associated storage.
int coap_mid_t
coap_mid_t is used to store the CoAP Message ID of a CoAP PDU.
int coap_get_data(const coap_pdu_t *pdu, size_t *len, const uint8_t **data)
Retrieves the length and data pointer of specified PDU.
int coap_add_data(coap_pdu_t *pdu, size_t len, const uint8_t *data)
Adds given data to the pdu that is passed as first parameter.
coap_session_t * coap_session_reference(coap_session_t *session)
Increment reference counter on a session.
void coap_session_release(coap_session_t *session)
Decrement reference counter on a session.
COAP_STATIC_INLINE void * coap_malloc(size_t size)
Wrapper function to coap_malloc_type() for backwards compatibility.
COAP_STATIC_INLINE void coap_free(void *object)
Wrapper function to coap_free_type() for backwards compatibility.
coap_session_t * session
transaction session
coap_pdu_t * pdu
copy of request pdu
coap_tick_t delay
When to delay to before triggering the response 0 indicates never trigger.
CoAP binary data definition with const data.
size_t length
length of binary data
const uint8_t * s
read-only binary data
The CoAP stack's global state is stored in a coap_context_t object.
coap_async_t * async_state
list of asynchronous message ids
structure for CoAP PDUs token, if any, follows the fixed size header, then options until payload mark...
uint8_t * token
first byte of token, if any, or options
uint8_t token_length
length of Token
coap_mid_t mid
message id, if any, in regular host byte order
Abstraction of virtual session that can be attached to coap_context_t (client) or coap_endpoint_t (se...
coap_context_t * context
session's context