From cfe82719d3ab49ec9f409e4289fe54f698b8b314 Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Sat, 10 Feb 2018 16:05:14 +0000 Subject: [PATCH] net.h: Add in unknown_resource to coap_context_t Needed to handle "RFC7252: 5.8.3. PUT If no resource exists, then the server MAY create a new resource with that URI, resulting in a 2.01 (Created) Response Code." Needed for support of PUT requests to an unknown resource. Remove structure coap_mid_cache_t as it is not used and refers to the now obsolete coap_key_t. --- include/coap/net.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/include/coap/net.h b/include/coap/net.h index 24d0dc2a..ce763488 100644 --- a/include/coap/net.h +++ b/include/coap/net.h @@ -88,16 +88,13 @@ typedef void (*coap_pong_handler_t)(struct coap_context_t *, coap_pdu_t *received, const coap_tid_t id); -#define COAP_MID_CACHE_SIZE 3 -typedef struct { - unsigned char flags[COAP_MID_CACHE_SIZE]; - coap_key_t item[COAP_MID_CACHE_SIZE]; -} coap_mid_cache_t; - /** The CoAP stack's global state is stored in a coap_context_t object */ typedef struct coap_context_t { coap_opt_filter_t known_options; - struct coap_resource_t *resources; /**< hash table or list of known resources */ + struct coap_resource_t *resources; /**< hash table or list of known + resources */ + struct coap_resource_t *unknown_resource; /**< can be used for handling + unknown resources */ #ifndef WITHOUT_ASYNC /**