nanocoap-cache API More...
nanocoap-cache API
Definition in file cache.h.
#include <assert.h>#include <stdbool.h>#include <stdint.h>#include "clist.h"#include "net/nanocoap.h"#include "hashes/sha256.h"#include "ztimer.h"
Include dependency graph for cache.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | nanocoap_cache_entry_t |
Cache container that holds a coap_pkt_t struct. More... | |
Macros | |
| #define | CONFIG_NANOCOAP_CACHE_ENTRIES (8) |
| The number of maximum cache entries. | |
| #define | CONFIG_NANOCOAP_CACHE_KEY_LENGTH (8) |
| The length of the cache key in bytes. | |
| #define | CONFIG_NANOCOAP_CACHE_RESPONSE_SIZE (128) |
| Size of the buffer to store responses in the cache. | |
Typedefs | |
| typedef int(* | nanocoap_cache_replacement_strategy_t) (void) |
| Typedef for the cache replacement strategy on full cache list. More... | |
| typedef int(* | nanocoap_cache_update_strategy_t) (clist_node_t *node) |
| Typedef for the cache update strategy on element access. More... | |
Functions | |
| static void | nanocoap_cache_init (void) |
| Initializes the internal state of the nanocoap cache. | |
| size_t | nanocoap_cache_used_count (void) |
| Returns the number of cached entries. More... | |
| size_t | nanocoap_cache_free_count (void) |
| Returns the number of unused cache entries. More... | |
| nanocoap_cache_entry_t * | nanocoap_cache_process (const uint8_t *cache_key, unsigned request_method, const coap_pkt_t *resp, size_t resp_len) |
| Determines if a response is cacheable and modifies the cache as reflected in RFC7252, Section 5.9. More... | |
| nanocoap_cache_entry_t * | nanocoap_cache_add_by_req (const coap_pkt_t *req, const coap_pkt_t *resp, size_t resp_len) |
| Creates a new or gets an existing cache entry using the request packet. More... | |
| nanocoap_cache_entry_t * | nanocoap_cache_add_by_key (const uint8_t *cache_key, unsigned request_method, const coap_pkt_t *resp, size_t resp_len) |
| Creates a new or gets an existing cache entry using the cache key. More... | |
| nanocoap_cache_entry_t * | nanocoap_cache_request_lookup (const coap_pkt_t *req) |
Performs a cache lookup based on the req. More... | |
| nanocoap_cache_entry_t * | nanocoap_cache_key_lookup (const uint8_t *cache_key) |
| Performs a cache lookup based on the cache key of a request. More... | |
| int | nanocoap_cache_del (const nanocoap_cache_entry_t *ce) |
Deletes the provided cache entry ce. More... | |
| void | nanocoap_cache_key_generate (const coap_pkt_t *req, uint8_t *cache_key) |
Generates a cache key based on the request req. More... | |
| void | nanocoap_cache_key_options_generate (const coap_pkt_t *req, void *cache_key) |
Generates a cache key based on only the options in req. More... | |
| void | nanocoap_cache_key_blockreq_options_generate (const coap_pkt_t *req, void *cache_key) |
Generates a cache key based on only the options in req without any of the blockwise options included in the key. More... | |
| ssize_t | nanocoap_cache_key_compare (uint8_t *cache_key1, uint8_t *cache_key2) |
| Compares two cache keys. More... | |
| static bool | nanocoap_cache_entry_is_stale (const nanocoap_cache_entry_t *ce, uint32_t now) |
| Check if the Max-Age of a cache entry has passed. More... | |