libcoap 4.3.5-develop-146e0bb
Loading...
Searching...
No Matches
coap_cache_internal.h
Go to the documentation of this file.
1/*
2 * coap_cache_internal.h -- Cache functions for libcoap
3 *
4 * Copyright (C) 2019--2026 Olaf Bergmann <bergmann@tzi.org> and others
5 *
6 * SPDX-License-Identifier: BSD-2-Clause
7 *
8 * This file is part of the CoAP library libcoap. Please see README for terms
9 * of use.
10 */
11
17#ifndef COAP_CACHE_INTERNAL_H_
18#define COAP_CACHE_INTERNAL_H_
19
20#include "coap_uthash_internal.h"
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#if COAP_SERVER_SUPPORT
34/* Holds a digest in binary typically sha256 except for notls */
35typedef struct coap_digest_t {
36 uint8_t key[32];
37} coap_digest_t;
38
39struct coap_cache_key_t {
40 uint8_t key[32];
41};
42
43struct coap_cache_entry_t {
44 UT_hash_handle hh;
45 coap_cache_key_t *cache_key;
46 coap_session_t *session;
47 coap_pdu_t *pdu;
48 void *app_data;
49 coap_tick_t expire_ticks;
50 unsigned int idle_timeout;
52};
53
61void coap_expire_cache_entries(coap_context_t *context);
62
75coap_cache_entry_t *coap_cache_get_by_key_lkd(coap_context_t *context,
76 const coap_cache_key_t *cache_key);
77
92coap_cache_entry_t *coap_cache_get_by_pdu_lkd(coap_session_t *session,
93 const coap_pdu_t *pdu,
94 coap_cache_session_based_t session_based);
95
110int coap_cache_ignore_options_lkd(coap_context_t *context,
111 const uint16_t *options, size_t count);
112
138coap_cache_entry_t *coap_new_cache_entry_lkd(coap_session_t *session,
139 const coap_pdu_t *pdu,
140 coap_cache_record_pdu_t record_pdu,
141 coap_cache_session_based_t session_based,
142 unsigned int idle_time);
143
162void *coap_cache_set_app_data2_lkd(coap_cache_entry_t *cache_entry,
163 void *data,
165
166typedef void coap_digest_ctx_t;
167
175coap_digest_ctx_t *coap_digest_setup(void);
176
185void coap_digest_free(coap_digest_ctx_t *digest_ctx);
186
198int coap_digest_update(coap_digest_ctx_t *digest_ctx,
199 const uint8_t *data,
200 size_t data_len
201 );
202
214int coap_digest_final(coap_digest_ctx_t *digest_ctx,
215 coap_digest_t *digest_buffer);
216
219#endif /* COAP_SERVER_SUPPORT */
220
221#ifdef __cplusplus
222}
223#endif
224
225#endif /* COAP_CACHE_INTERNAL_H_ */
struct coap_cache_key_t coap_cache_key_t
struct coap_cache_entry_t coap_cache_entry_t
coap_cache_record_pdu_t
Definition coap_cache.h:44
coap_cache_session_based_t
Definition coap_cache.h:39
uint64_t coap_tick_t
This data type represents internal timer ticks with COAP_TICKS_PER_SECOND resolution.
Definition coap_time.h:149
void(* coap_app_data_free_callback_t)(void *data)
Callback to free off the app data when the entry is being deleted / freed off.
The CoAP stack's global state is stored in a coap_context_t object.
structure for CoAP PDUs
Abstraction of virtual session that can be attached to coap_context_t (client) or coap_endpoint_t (se...