18#if COAP_SERVER_SUPPORT
21#ifdef COAP_EPOLL_SUPPORT
23#include <sys/timerfd.h>
26#define COAP_PRINT_STATUS_MAX (~COAP_PRINT_STATUS_MASK)
29#define min(a,b) ((a) < (b) ? (a) : (b))
40#define PRINT_WITH_OFFSET(Buf,Offset,Char) \
41 if ((Offset) == 0) { \
42 (*(Buf)++) = (Char); \
50#define PRINT_COND_WITH_OFFSET(Buf,Bufend,Offset,Char,Result) { \
51 if ((Buf) < (Bufend)) { \
52 PRINT_WITH_OFFSET(Buf,Offset,Char); \
62#define COPY_COND_WITH_OFFSET(Buf,Bufend,Offset,Str,Length,Result) { \
64 for (i = 0; i < (Length); i++) { \
65 PRINT_COND_WITH_OFFSET((Buf), (Bufend), (Offset), (Str)[i], (Result)); \
79 if (match_substring) {
80 const uint8_t *next_token = text->
s;
81 size_t remaining_length = text->
length;
82 while (remaining_length) {
84 const uint8_t *token = next_token;
85 next_token = (
unsigned char *)memchr(token,
' ', remaining_length);
88 token_length = next_token - token;
89 remaining_length -= (token_length + 1);
92 token_length = remaining_length;
96 if ((match_prefix || pattern->
length == token_length) &&
97 memcmp(token, pattern->
s, pattern->
length) == 0)
103 return (match_prefix || pattern->
length == text->
length) &&
104 memcmp(text->
s, pattern->
s, pattern->
length) == 0;
128#if defined(__GNUC__) && defined(WITHOUT_QUERY_FILTER)
138 size_t output_length = 0;
139 unsigned char *p = buf;
140 const uint8_t *bufend = buf + *buflen;
141 size_t left, written = 0;
143 const size_t old_offset = offset;
144 int subsequent_resource = 0;
145#ifndef WITHOUT_QUERY_FILTER
148#define MATCH_URI 0x01
149#define MATCH_PREFIX 0x02
150#define MATCH_SUBSTRING 0x04
152 {2, (
const uint8_t *)
"rt"},
153 {2, (
const uint8_t *)
"if"},
154 {3, (
const uint8_t *)
"rel"},
159#ifndef WITHOUT_QUERY_FILTER
162 resource_param.
s = query_filter->
s;
164 resource_param.
s[resource_param.
length] !=
'=')
169 if (resource_param.
length == 4 &&
170 memcmp(resource_param.
s,
"href", 4) == 0)
173 for (rt_attributes = _rt_attributes; rt_attributes->
s; rt_attributes++) {
175 memcmp(resource_param.
s, rt_attributes->
s, rt_attributes->
length) == 0) {
176 flags |= MATCH_SUBSTRING;
183 query_filter->
s + resource_param.
length + 1;
185 assert((resource_param.
length + 1) <= query_filter->
length);
186 query_pattern.length =
189 if ((query_pattern.s[0] ==
'/') && ((flags & MATCH_URI) == MATCH_URI)) {
191 query_pattern.length--;
194 if (query_pattern.length &&
195 query_pattern.s[query_pattern.length-1] ==
'*') {
196 query_pattern.length--;
197 flags |= MATCH_PREFIX;
205#ifndef WITHOUT_QUERY_FILTER
206 if (resource_param.
length) {
208 if (flags & MATCH_URI) {
209 if (!match(r->uri_path, &query_pattern, (flags & MATCH_PREFIX) != 0,
210 (flags & MATCH_SUBSTRING) != 0))
216 if (!attr || !attr->
value)
218 unquoted_val = *attr->
value;
219 if (attr->
value->
s[0] ==
'"') {
223 if (!(match(&unquoted_val, &query_pattern,
224 (flags & MATCH_PREFIX) != 0,
225 (flags & MATCH_SUBSTRING) != 0)))
231 if (!subsequent_resource) {
232 subsequent_resource = 1;
234 PRINT_COND_WITH_OFFSET(p, bufend, offset,
',', written);
251 output_length = p - buf;
253 if (output_length > COAP_PRINT_STATUS_MAX) {
259 if (result + old_offset - offset < *buflen) {
282 }
else if (!uri_path) {
299static const uint8_t coap_unknown_resource_uri[] =
326static const uint8_t coap_proxy_resource_uri[] =
331 size_t host_name_count,
332 const char *host_name_list[],
int flags) {
335 if (host_name_count == 0) {
336 coap_log_err(
"coap_resource_proxy_uri_init: Must have one or more host names defined\n");
347 for (i = 0; i < (
sizeof(r->
handler) /
sizeof(r->
handler[0])); i++) {
350 if (host_name_count) {
354 for (i = 0; i < host_name_count; i++) {
357 strlen(host_name_list[i]));
359 coap_log_err(
"coap_resource_proxy_uri_init: unable to add host name\n");
372 coap_log_debug(
"coap_resource_proxy_uri_init2: no memory left\n");
380 size_t host_name_count,
const char *host_name_list[]) {
392 if (!resource || !name)
426 if (!resource || !name)
457typedef enum coap_deleting_resource_t {
458 COAP_DELETING_RESOURCE,
459 COAP_NOT_DELETING_RESOURCE
460} coap_deleting_resource_t;
463 coap_deleting_resource_t deleting);
474 coap_notify_observers(resource->
context, resource, COAP_DELETING_RESOURCE);
491 LL_FOREACH_SAFE(resource->
subscribers, obs, otmp) {
527 coap_log_warn(
"coap_add_resource: Duplicate uri_path '%*.*s', old resource deleted\n",
533#if COAP_WITH_OBSERVE_PERSIST
534 if (context->unknown_pdu && context->dyn_resource_save_file &&
538 raw_packet.
s = context->unknown_pdu->token -
539 context->unknown_pdu->hdr_size;
540 raw_packet.
length = context->unknown_pdu->used_size +
541 context->unknown_pdu->hdr_size;
547 assert(resource->
context == NULL);
569 }
else if (context) {
575 coap_free_resource(resource);
588 HASH_ITER(hh, context->
resources, res, rtmp) {
589 HASH_DELETE(hh, context->
resources, res);
590 coap_free_resource(res);
616 unsigned char *buf,
size_t *len,
size_t *offset) {
617 unsigned char *p = buf;
618 const uint8_t *bufend = buf + *len;
621 size_t output_length = 0;
622 const size_t old_offset = *offset;
625 PRINT_COND_WITH_OFFSET(p, bufend, *offset,
'<', *len);
626 PRINT_COND_WITH_OFFSET(p, bufend, *offset,
'/', *len);
628 COPY_COND_WITH_OFFSET(p, bufend, *offset,
631 PRINT_COND_WITH_OFFSET(p, bufend, *offset,
'>', *len);
635 PRINT_COND_WITH_OFFSET(p, bufend, *offset,
';', *len);
637 COPY_COND_WITH_OFFSET(p, bufend, *offset,
641 PRINT_COND_WITH_OFFSET(p, bufend, *offset,
'=', *len);
643 COPY_COND_WITH_OFFSET(p, bufend, *offset,
649 COPY_COND_WITH_OFFSET(p, bufend, *offset,
";obs", 4, *len);
652#if COAP_OSCORE_SUPPORT
655 COPY_COND_WITH_OFFSET(p, bufend, *offset,
";osc", 4, *len);
658 output_length = p - buf;
660 if (output_length > COAP_PRINT_STATUS_MAX) {
666 if (result + old_offset - *offset < *len) {
685 assert(method > 0 && (
size_t)(method-1) <
687 resource->
handler[method-1] = handler;
750 cache_ignore_options,
751 sizeof(cache_ignore_options)/
sizeof(cache_ignore_options[0]));
753 s = coap_find_observer_cache_key(resource, session, cache_key);
768#if (COAP_RESOURCE_MAX_SUBSCRIBER > 0)
769 uint32_t subscriber_count = 0;
770 LL_COUNT(resource->
subscribers, s, subscriber_count);
771 if (subscriber_count >= COAP_RESOURCE_MAX_SUBSCRIBER) {
787 if (s->
pdu == NULL) {
797 if (cache_key == NULL) {
800 cache_ignore_options,
801 sizeof(cache_ignore_options)/
sizeof(cache_ignore_options[0]));
802 if (cache_key == NULL) {
815 coap_log_debug(
"create new subscription %p key 0x%02x%02x%02x%02x\n",
816 (
void *)s, s->cache_key->key[0], s->cache_key->key[1],
817 s->cache_key->key[2], s->cache_key->key[3]);
822#if COAP_OSCORE_SUPPORT
825 if (session->recipient_ctx && session->recipient_ctx->recipient_id) {
839 uint8_t info_buffer[60];
840 uint8_t *info_buf = info_buffer;
841 size_t info_len =
sizeof(info_buffer);
848 session->recipient_ctx->recipient_id->s,
849 session->recipient_ctx->recipient_id->length);
850 if (session->recipient_ctx->osc_ctx &&
851 session->recipient_ctx->osc_ctx->id_context) {
854 session->recipient_ctx->osc_ctx->id_context->s,
855 session->recipient_ctx->osc_ctx->id_context->length);
861 if (association->
aad) {
877 if (association->
nonce) {
904#if COAP_OSCORE_SUPPORT
939 char outbuf[2 * 8 + 1] =
"";
943 size_t size = strlen(outbuf);
945 snprintf(&outbuf[size],
sizeof(outbuf)-size,
"%02x",
948 coap_log_debug(
"removed subscription %p with token '%s' key 0x%02x%02x%02x%02x\n",
949 (
void *)s, outbuf, s->cache_key->key[0], s->cache_key->key[1],
950 s->cache_key->key[2], s-> cache_key->
key[3]);
987 coap_deleting_resource_t deleting) {
1012 (obs->
non_cnt >= COAP_OBS_MAX_NON))) {
1038 coap_log_debug(
"coap_check_notify: pdu init failed, resource stays "
1039 "partially dirty\n");
1048 coap_log_debug(
"coap_check_notify: cannot add token, resource stays "
1049 "partially dirty\n");
1059 obs->
non_cnt < COAP_OBS_MAX_NON)) {
1065 case COAP_NOT_DELETING_RESOURCE:
1081#if COAP_Q_BLOCK_SUPPORT
1103 h(r, obs->
session, obs->
pdu, query, response);
1115 case COAP_DELETING_RESOURCE:
1131#if COAP_Q_BLOCK_SUPPORT
1138 block, response, 1);
1146#if COAP_Q_BLOCK_SUPPORT
1151 coap_log_debug(
"coap_check_notify: sending failed, resource stays "
1152 "partially dirty\n");
1196#ifdef COAP_EPOLL_SUPPORT
1243 coap_notify_observers(context, r, COAP_NOT_DELETING_RESOURCE);
1250 uint32_t start_observe_no) {
1254 resource->
observe = start_observe_no & 0xffffff;
1274 LL_FOREACH_SAFE(resource->
subscribers, obs, otmp) {
1275 if (obs->
session == session &&
1280 if (obs->
fail_cnt >= COAP_OBS_MAX_FAIL) {
1296 coap_remove_failed_observers(context, r, session, token);
Pulls together all the internal only header files.
void coap_update_epoll_timer(coap_context_t *context, coap_tick_t delay)
Update the epoll timer fd as to when it is to trigger.
void * coap_malloc_type(coap_memory_tag_t type, size_t size)
Allocates a chunk of size bytes and returns a pointer to the newly allocated memory.
void coap_free_type(coap_memory_tag_t type, void *p)
Releases the memory that was allocated by coap_malloc_type().
COAP_DEPRECATED int coap_resource_set_dirty(coap_resource_t *r, const coap_string_t *query)
void coap_check_code_lg_xmit(const coap_session_t *session, const coap_pdu_t *request, coap_pdu_t *response, const coap_resource_t *resource, const coap_string_t *query)
The function checks that the code in a newly formed lg_xmit created by coap_add_data_large_response()...
int coap_get_block_b(const coap_session_t *session, const coap_pdu_t *pdu, coap_option_num_t number, coap_block_b_t *block)
Initializes block from pdu.
void coap_delete_cache_key(coap_cache_key_t *cache_key)
Delete the cache-key.
coap_cache_key_t * coap_cache_derive_key_w_ignore(const coap_session_t *session, const coap_pdu_t *pdu, coap_cache_session_based_t session_based, const uint16_t *ignore_options, size_t ignore_count)
Calculates a cache-key for the given CoAP PDU.
@ COAP_CACHE_IS_SESSION_BASED
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.
#define RESOURCES_ADD(r, obj)
coap_print_status_t coap_print_wellknown(coap_context_t *, unsigned char *, size_t *, size_t, const coap_string_t *)
void coap_delete_all_resources(coap_context_t *context)
Deletes all resources from given context and frees their storage.
void coap_delete_attr(coap_attr_t *attr)
Deletes an attribute.
#define RESOURCES_FIND(r, k, res)
#define RESOURCES_DELETE(r, obj)
#define RESOURCES_ITER(r, tmp)
#define COAP_RESOURCE_FLAGS_NOTIFY_NON
Observe Notifications will be sent non-confirmable by default.
coap_resource_t * coap_resource_proxy_uri_init(coap_method_handler_t handler, size_t host_name_count, const char *host_name_list[])
Creates a new resource object for handling proxy URIs.
coap_attr_t * coap_add_attr(coap_resource_t *resource, coap_str_const_t *name, coap_str_const_t *value, int flags)
Registers a new attribute with the given resource.
#define COAP_ATTR_FLAGS_RELEASE_VALUE
coap_print_status_t coap_print_link(const coap_resource_t *resource, unsigned char *buf, size_t *len, size_t *offset)
Writes a description of this resource in link-format to given text buffer.
coap_resource_t * coap_resource_proxy_uri_init2(coap_method_handler_t handler, size_t host_name_count, const char *host_name_list[], int flags)
Creates a new resource object for handling proxy URIs with configurable control over multicast reques...
#define COAP_RESOURCE_FLAGS_NOTIFY_NON_ALWAYS
Observe Notifications will always be sent non-confirmable.
#define COAP_ATTR_FLAGS_RELEASE_NAME
void coap_resource_set_mode(coap_resource_t *resource, int mode)
Sets the notification message type of resource resource to given mode.
coap_resource_t * coap_get_resource_from_uri_path(coap_context_t *context, coap_str_const_t *uri_path)
Returns the resource identified by the unique string uri_path.
#define COAP_PRINT_STATUS_TRUNC
void coap_resource_release_userdata_handler(coap_context_t *context, coap_resource_release_userdata_handler_t callback)
Defines the context wide callback to use to when the resource is deleted to release the data held in ...
#define COAP_RESOURCE_FLAGS_OSCORE_ONLY
Define this resource as an OSCORE enabled access only.
#define COAP_RESOURCE_FLAGS_MCAST_LIST
#define COAP_RESOURCE_FLAGS_NOTIFY_CON
Observe Notifications will be sent confirmable.
void coap_register_handler(coap_resource_t *resource, coap_request_t method, coap_method_handler_t handler)
Registers the specified handler as message handler for the request type method.
unsigned int coap_print_status_t
Status word to encode the result of conditional print or copy operations such as coap_print_link().
void(* coap_method_handler_t)(coap_resource_t *, coap_session_t *, const coap_pdu_t *, const coap_string_t *, coap_pdu_t *)
Definition of message handler function.
void(* coap_resource_release_userdata_handler_t)(void *user_data)
Definition of release resource user_data callback function.
void coap_add_resource(coap_context_t *context, coap_resource_t *resource)
Registers the given resource for context.
void coap_register_request_handler(coap_resource_t *resource, coap_request_t method, coap_method_handler_t handler)
Registers the specified handler as message handler for the request type method.
coap_resource_t * coap_resource_init(coap_str_const_t *uri_path, int flags)
Creates a new resource object and initializes the link field to the string uri_path.
void coap_resource_set_userdata(coap_resource_t *resource, void *data)
Sets the user_data.
#define COAP_PRINT_STATUS_ERROR
coap_str_const_t * coap_resource_get_uri_path(coap_resource_t *resource)
Get the uri_path from a resource.
coap_resource_t * coap_resource_unknown_init2(coap_method_handler_t put_handler, int flags)
Creates a new resource object for the unknown resource handler with support for PUT and configurable ...
coap_str_const_t * coap_attr_get_value(coap_attr_t *attribute)
Returns attribute's value.
#define COAP_PRINT_OUTPUT_LENGTH(v)
int coap_delete_resource(coap_context_t *context, coap_resource_t *resource)
Deletes a resource identified by resource.
coap_attr_t * coap_find_attr(coap_resource_t *resource, coap_str_const_t *name)
Returns resource's coap_attr_t object with given name if found, NULL otherwise.
void * coap_resource_get_userdata(coap_resource_t *resource)
Gets the user_data.
#define COAP_RESOURCE_FLAGS_RELEASE_URI
The URI passed to coap_resource_init() is free'd by coap_delete_resource().
coap_resource_t * coap_resource_unknown_init(coap_method_handler_t put_handler)
Creates a new resource object for the unknown resource handler with support for PUT.
coap_mid_t coap_send_internal(coap_session_t *session, coap_pdu_t *pdu)
Sends a CoAP message to given peer.
void coap_cancel_all_messages(coap_context_t *context, coap_session_t *session, coap_bin_const_t *token)
Cancels all outstanding messages for session session that have the specified token.
uint16_t coap_new_message_id(coap_session_t *session)
Returns a new message id and updates session->tx_mid accordingly.
void coap_ticks(coap_tick_t *)
Returns the current value of an internal tick counter.
unsigned int coap_encode_var_safe(uint8_t *buf, size_t length, unsigned int val)
Encodes multiple-length byte sequences.
#define coap_log_debug(...)
coap_log_t coap_get_log_level(void)
Get the current logging level.
void coap_show_pdu(coap_log_t level, const coap_pdu_t *pdu)
Display the contents of the specified pdu.
#define coap_log_warn(...)
#define coap_log_err(...)
int coap_resource_notify_observers(coap_resource_t *resource, const coap_string_t *query)
Initiate the sending of an Observe packet for all observers of resource, optionally matching query if...
void coap_persist_set_observe_num(coap_resource_t *resource, uint32_t observe_num)
Sets the current observe number value.
void coap_resource_set_get_observable(coap_resource_t *resource, int mode)
Set whether a resource is observable.
size_t oscore_cbor_put_nil(uint8_t **buffer, size_t *buf_size)
size_t oscore_cbor_put_bytes(uint8_t **buffer, size_t *buf_size, const uint8_t *bytes, size_t bytes_len)
size_t oscore_cbor_put_array(uint8_t **buffer, size_t *buf_size, size_t elements)
oscore_association_t * oscore_find_association(coap_session_t *session, coap_bin_const_t *token)
int coap_remove_option(coap_pdu_t *pdu, coap_option_num_t number)
Removes (first) option of given number from the pdu.
size_t coap_add_option_internal(coap_pdu_t *pdu, coap_option_num_t number, size_t len, const uint8_t *data)
Adds option of given number to pdu that is passed as first parameter.
#define COAP_OPTION_BLOCK2
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.
coap_request_t
CoAP PDU Request methods.
#define COAP_RESPONSE_CODE(N)
#define COAP_RESPONSE_CLASS(C)
#define COAP_OPTION_OSCORE
int coap_add_token(coap_pdu_t *pdu, size_t len, const uint8_t *data)
Adds token of length len to pdu.
#define COAP_OPTION_Q_BLOCK2
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.
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.
coap_pdu_t * coap_pdu_init(coap_pdu_type_t type, coap_pdu_code_t code, coap_mid_t mid, size_t size)
Creates a new CoAP PDU with at least enough storage space for the given size maximum message size.
#define COAP_INVALID_MID
Indicates an invalid message id.
#define COAP_OPTION_OBSERVE
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.
size_t coap_session_max_pdu_size(const coap_session_t *session)
Get maximum acceptable PDU size.
#define COAP_PROTO_NOT_RELIABLE(p)
void coap_session_release(coap_session_t *session)
Decrement reference counter on a session.
coap_session_t * coap_session_reference(coap_session_t *session)
Increment reference counter on a session.
void coap_delete_bin_const(coap_bin_const_t *s)
Deletes the given const binary data and releases any memory allocated.
void coap_delete_str_const(coap_str_const_t *s)
Deletes the given const string and releases any memory allocated.
coap_bin_const_t * coap_new_bin_const(const uint8_t *data, size_t size)
Take the specified byte array (text) and create a coap_bin_const_t * Returns a new const binary objec...
#define coap_binary_equal(binary1, binary2)
Compares the two binary data for equality.
coap_str_const_t * coap_new_str_const(const uint8_t *data, size_t size)
Returns a new const string object with at least size+1 bytes storage allocated, and the provided data...
void coap_delete_string(coap_string_t *s)
Deletes the given string and releases any memory allocated.
int coap_delete_observer(coap_resource_t *resource, coap_session_t *session, const coap_bin_const_t *token)
Removes any subscription for observer from resource and releases the allocated storage.
coap_subscription_t * coap_find_observer(coap_resource_t *resource, coap_session_t *session, const coap_bin_const_t *token)
Returns a subscription object for given peer.
void coap_delete_observers(coap_context_t *context, coap_session_t *session)
Removes any subscription for session and releases the allocated storage.
void coap_check_notify(coap_context_t *context)
Checks all known resources to see if they are dirty and then notifies subscribed observers.
void coap_handle_failed_notify(coap_context_t *context, coap_session_t *session, const coap_bin_const_t *token)
Handles a failed observe notify.
void coap_subscription_init(coap_subscription_t *)
coap_subscription_t * coap_add_observer(coap_resource_t *resource, coap_session_t *session, const coap_bin_const_t *token, const coap_pdu_t *pdu)
Adds the specified peer as observer for resource.
void coap_touch_observer(coap_context_t *context, coap_session_t *session, const coap_bin_const_t *token)
Flags that data is ready to be sent to observers.
coap_string_t * coap_get_query(const coap_pdu_t *request)
Extract query string from request PDU according to escape rules in 6.5.8.
Limits the number of subscribers for each resource that this server support.
coap_str_const_t * value
Value of the attribute (can be NULL)
coap_str_const_t * name
Name of the attribute.
CoAP binary data definition with const data.
size_t length
length of binary data
const uint8_t * s
read-only binary data
Structure of Block options with BERT support.
unsigned int aszx
block size (0-7 including BERT
unsigned int m
1 if more blocks follow, 0 otherwise
unsigned int szx
block size (0-6)
The CoAP stack's global state is stored in a coap_context_t object.
coap_observe_added_t observe_added
Called when there is a new observe subscription request.
coap_resource_t * resources
hash table or list of known resources
coap_dyn_resource_added_t dyn_resource_added
Callback to save dynamic resource when created.
coap_resource_release_userdata_handler_t release_userdata
function to release user_data when resource is deleted
void * observe_user_data
App provided data for use in observe_added or observe_deleted.
coap_track_observe_value_t track_observe_value
Callback to save observe value when updated.
uint8_t observe_pending
Observe response pending.
uint32_t observe_save_freq
How frequently to update observe value.
uint8_t observe_no_clear
Observe 4.04 not to be sent on deleting resource.
coap_resource_t * proxy_uri_resource
can be used for handling proxy URI resources
coap_observe_deleted_t observe_deleted
Called when there is a observe subscription de-register request.
coap_resource_t * unknown_resource
can be used for handling unknown resources
coap_resource_deleted_t resource_deleted
Invoked when resource is deleted.
coap_address_t bind_addr
local interface address
coap_tick_t last_all_sent
Last time all data sent or 0.
coap_tick_t last_obs
Last time used (Observe tracking) or 0.
uint8_t * token
first byte of token (or extended length bytes prefix), if any, or options
size_t max_size
maximum size for token, options and payload, or zero for variable size pdu
coap_pdu_code_t code
request method (value 1–31) or response code (value 64-255)
uint8_t hdr_size
actual size used for protocol-specific header (0 until header is encoded)
coap_bin_const_t actual_token
Actual token in pdu.
coap_mid_t mid
message id, if any, in regular host byte order
size_t used_size
used bytes of storage for token, options and payload
coap_pdu_type_t type
message type
Abstraction of resource that can be attached to coap_context_t.
unsigned int dirty
set to 1 if resource has changed
unsigned int partiallydirty
set to 1 if some subscribers have not yet been notified of the last change
coap_subscription_t * subscribers
list of observers for this resource
void * user_data
This pointer is under user control.
coap_str_const_t ** proxy_name_list
Array valid names this host is known by (proxy support)
coap_str_const_t * uri_path
Request URI Path for this resource.
unsigned int observe
The next value for the Observe option.
coap_context_t * context
Pointer back to the context that 'owns' this resource.
coap_method_handler_t handler[7]
Used to store handlers for the seven coap methods GET, POST, PUT, DELETE, FETCH, PATCH and IPATCH.
unsigned int is_proxy_uri
resource created for proxy URI handler
unsigned int is_unknown
resource created for unknown handler
coap_attr_t * link_attr
attributes to be included with the link format
unsigned int observable
can be observed
size_t proxy_name_count
Count of valid names this host is known by (proxy support)
int flags
zero or more COAP_RESOURCE_FLAGS_* or'd together
Abstraction of virtual session that can be attached to coap_context_t (client) or coap_endpoint_t (se...
coap_lg_xmit_t * lg_xmit
list of large transmissions
coap_endpoint_t * endpoint
session's endpoint
coap_addr_tuple_t addr_info
remote/local address info
coap_proto_t proto
protocol used
uint8_t con_active
Active CON request sent.
coap_context_t * context
session's context
CoAP string data definition with const data.
const uint8_t * s
read-only string data
size_t length
length of string
CoAP string data definition.
size_t length
length of string
Number of notifications that may be sent non-confirmable before a confirmable message is sent to dete...
uint8_t dirty
set if the notification temporarily could not be sent (in that case, the resource's partially dirty f...
uint8_t non_cnt
up to 255 non-confirmable notifies allowed
coap_cache_key_t * cache_key
struct coap_session_t * session
subscriber session
uint8_t fail_cnt
up to 255 confirmable notifies can fail
coap_pdu_t * pdu
cache_key to identify requester
coap_bin_const_t * partial_iv