From 83c889320d4258ed777401b04b5438e940a3b684 Mon Sep 17 00:00:00 2001 From: chrysn Date: Tue, 11 Feb 2020 11:12:08 +0100 Subject: [PATCH] nanocoap: State handler idempotentcy requirement Closes: https://github.com/RIOT-OS/RIOT/issues/12938 --- sys/include/net/nanocoap.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/include/net/nanocoap.h b/sys/include/net/nanocoap.h index 1c6180283e..cf5d7fc64b 100644 --- a/sys/include/net/nanocoap.h +++ b/sys/include/net/nanocoap.h @@ -194,6 +194,17 @@ typedef struct { /** * @brief Resource handler type + * + * Functions that implement this must be prepared to be called multiple times + * for the same request, as the server implementations do not perform message + * deduplication. That optimization is [described in the CoAP + * specification](https://tools.ietf.org/html/rfc7252#section-4.5). + * + * This should be trivial for requests of the GET, PUT, DELETE, FETCH and + * iPATCH methods, as they are defined as idempotent methods in CoAP. + * + * For POST, PATCH and other non-idempotent methods, this is an additional + * requirement introduced by the contract of this type. */ typedef ssize_t (*coap_handler_t)(coap_pkt_t *pkt, uint8_t *buf, size_t len, void *context);