libcoap
4.3.5
Toggle main menu visibility
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--2024 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
16
17
#ifndef COAP_CACHE_INTERNAL_H_
18
#define COAP_CACHE_INTERNAL_H_
19
20
#include "
coap_internal.h
"
21
#include "
coap_io.h
"
22
#include "coap_uthash_internal.h"
23
24
#if COAP_SERVER_SUPPORT
31
32
/* Holds a digest in binary typically sha256 except for notls */
33
typedef
struct
coap_digest_t
{
34
uint8_t
key
[32];
35
}
coap_digest_t
;
36
37
struct
coap_cache_key_t
{
38
uint8_t
key
[32];
39
};
40
41
struct
coap_cache_entry_t
{
42
UT_hash_handle
hh
;
43
coap_cache_key_t
*
cache_key
;
44
coap_session_t
*
session
;
45
coap_pdu_t
*
pdu
;
46
void
*
app_data
;
47
coap_tick_t
expire_ticks
;
48
unsigned
int
idle_timeout
;
49
coap_cache_app_data_free_callback_t
callback
;
50
};
51
59
void
coap_expire_cache_entries
(
coap_context_t
*context);
60
73
coap_cache_entry_t
*
coap_cache_get_by_key_lkd
(
coap_context_t
*context,
74
const
coap_cache_key_t
*cache_key);
75
90
coap_cache_entry_t
*
coap_cache_get_by_pdu_lkd
(
coap_session_t
*session,
91
const
coap_pdu_t
*pdu,
92
coap_cache_session_based_t
session_based);
93
108
int
coap_cache_ignore_options_lkd
(
coap_context_t
*context,
109
const
uint16_t *options,
size_t
count);
110
136
coap_cache_entry_t
*
coap_new_cache_entry_lkd
(
coap_session_t
*session,
137
const
coap_pdu_t
*pdu,
138
coap_cache_record_pdu_t
record_pdu,
139
coap_cache_session_based_t
session_based,
140
unsigned
int
idle_time);
141
142
typedef
void
coap_digest_ctx_t
;
143
151
coap_digest_ctx_t
*
coap_digest_setup
(
void
);
152
161
void
coap_digest_free
(
coap_digest_ctx_t
*digest_ctx);
162
174
int
coap_digest_update
(
coap_digest_ctx_t
*digest_ctx,
175
const
uint8_t *data,
176
size_t
data_len
177
);
178
190
int
coap_digest_final
(
coap_digest_ctx_t
*digest_ctx,
191
coap_digest_t
*digest_buffer);
192
194
195
#endif
/* COAP_SERVER_SUPPORT */
196
197
#endif
/* COAP_CACHE_INTERNAL_H_ */
coap_internal.h
Pulls together all the internal only header files.
coap_io.h
Default network I/O functions.
coap_cache_get_by_pdu_lkd
coap_cache_entry_t * coap_cache_get_by_pdu_lkd(coap_session_t *session, const coap_pdu_t *pdu, coap_cache_session_based_t session_based)
Searches for a cache-entry corresponding to pdu.
coap_digest_free
void coap_digest_free(coap_digest_ctx_t *digest_ctx)
Free off coap_digest_ctx_t.
coap_cache_ignore_options_lkd
int coap_cache_ignore_options_lkd(coap_context_t *context, const uint16_t *options, size_t count)
Define the CoAP options that are not to be included when calculating the cache-key.
coap_cache_get_by_key_lkd
coap_cache_entry_t * coap_cache_get_by_key_lkd(coap_context_t *context, const coap_cache_key_t *cache_key)
Searches for a cache-entry identified by cache_key.
coap_new_cache_entry_lkd
coap_cache_entry_t * coap_new_cache_entry_lkd(coap_session_t *session, const coap_pdu_t *pdu, coap_cache_record_pdu_t record_pdu, coap_cache_session_based_t session_based, unsigned int idle_time)
Create a new cache-entry hash keyed by cache-key derived from the PDU.
coap_digest_final
int coap_digest_final(coap_digest_ctx_t *digest_ctx, coap_digest_t *digest_buffer)
Finalize the coap_digest information into the provided digest_buffer.
coap_digest_update
int coap_digest_update(coap_digest_ctx_t *digest_ctx, const uint8_t *data, size_t data_len)
Update the coap_digest information with the next chunk of data.
coap_digest_ctx_t
void coap_digest_ctx_t
Definition
coap_cache_internal.h:142
coap_expire_cache_entries
void coap_expire_cache_entries(coap_context_t *context)
Expire coap_cache_entry_t entries.
coap_digest_setup
coap_digest_ctx_t * coap_digest_setup(void)
Initialize a coap_digest.
coap_cache_record_pdu_t
coap_cache_record_pdu_t
Definition
coap_cache.h:42
coap_cache_app_data_free_callback_t
void(* coap_cache_app_data_free_callback_t)(void *data)
Callback to free off the app data when the cache-entry is being deleted / freed off.
Definition
coap_cache.h:35
coap_cache_session_based_t
coap_cache_session_based_t
Definition
coap_cache.h:37
coap_tick_t
uint64_t coap_tick_t
This data type represents internal timer ticks with COAP_TICKS_PER_SECOND resolution.
Definition
coap_time.h:143
coap_cache_entry_t
Definition
coap_cache_internal.h:41
coap_cache_entry_t::session
coap_session_t * session
Definition
coap_cache_internal.h:44
coap_cache_entry_t::callback
coap_cache_app_data_free_callback_t callback
Definition
coap_cache_internal.h:49
coap_cache_entry_t::expire_ticks
coap_tick_t expire_ticks
Definition
coap_cache_internal.h:47
coap_cache_entry_t::app_data
void * app_data
Definition
coap_cache_internal.h:46
coap_cache_entry_t::idle_timeout
unsigned int idle_timeout
Definition
coap_cache_internal.h:48
coap_cache_entry_t::cache_key
coap_cache_key_t * cache_key
Definition
coap_cache_internal.h:43
coap_cache_entry_t::pdu
coap_pdu_t * pdu
Definition
coap_cache_internal.h:45
coap_cache_entry_t::hh
UT_hash_handle hh
Definition
coap_cache_internal.h:42
coap_cache_key_t
Definition
coap_cache_internal.h:37
coap_cache_key_t::key
uint8_t key[32]
Definition
coap_cache_internal.h:38
coap_context_t
The CoAP stack's global state is stored in a coap_context_t object.
Definition
coap_net_internal.h:50
coap_digest_t
Definition
coap_cache_internal.h:33
coap_digest_t::key
uint8_t key[32]
Definition
coap_cache_internal.h:34
coap_pdu_t
structure for CoAP PDUs
Definition
coap_pdu_internal.h:135
coap_session_t
Abstraction of virtual session that can be attached to coap_context_t (client) or coap_endpoint_t (se...
Definition
coap_session_internal.h:68
include
coap3
coap_cache_internal.h
Generated on
for libcoap by
1.17.0