libcoap 4.3.5-develop-19cef11
|
Internal API for Cache-Key and Cache-Entry support. More...
Data Structures | |
struct | coap_digest_t |
struct | coap_cache_key_t |
struct | coap_cache_entry_t |
Typedefs | |
typedef struct coap_digest_t | coap_digest_t |
typedef void | coap_digest_ctx_t |
Functions | |
void | coap_expire_cache_entries (coap_context_t *context) |
Expire coap_cache_entry_t entries. More... | |
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 . More... | |
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 . More... | |
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. More... | |
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. More... | |
coap_digest_ctx_t * | coap_digest_setup (void) |
Initialize a coap_digest. More... | |
void | coap_digest_free (coap_digest_ctx_t *digest_ctx) |
Free off coap_digest_ctx_t. More... | |
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. More... | |
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 . More... | |
Internal API for Cache-Key and Cache-Entry support.
typedef void coap_digest_ctx_t |
Definition at line 142 of file coap_cache_internal.h.
typedef struct coap_digest_t coap_digest_t |
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
.
This function returns the corresponding cache-entry or NULL
if not found.
Note: This function must be called in the locked state.
context | The context to use. |
cache_key | The cache-key to get the hashed coap-entry. |
cache_key
or NULL
if not found. 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
.
This function returns the corresponding cache-entry or NULL
if not found.
Note: This function must be called in the locked state.
session | The session to use. |
pdu | The CoAP request to search for. |
session_based | COAP_CACHE_IS_SESSION_BASED if session based cache-key to be used, else COAP_CACHE_NOT_SESSION_BASED. |
request
or NULL
if not found. 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.
Options that are defined as Non-Cache and the Observe option are always ignored.
Note: This function must be called in the locked state.
context | The context to save the ignored options information in. |
options | The array of options to ignore. |
count | The number of options to ignore. Use 0 to reset the options matching. |
1
if successful, else 0
. 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
.
Internal function.
digest_ctx | The coap_digest context. |
digest_buffer | Pointer to digest buffer to update |
1
success, 0
failure. void coap_digest_free | ( | coap_digest_ctx_t * | digest_ctx | ) |
Free off coap_digest_ctx_t.
Always done by coap_digest_final()
Internal function.
digest_ctx | The coap_digest context. |
coap_digest_ctx_t * coap_digest_setup | ( | void | ) |
Initialize a coap_digest.
Internal function.
NULL
if failure. 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.
Internal function.
digest_ctx | The coap_digest context. |
data | Pointer to data. |
data_len | Number of bytes. |
1
success, 0
failure. void coap_expire_cache_entries | ( | coap_context_t * | context | ) |
Expire coap_cache_entry_t entries.
Internal function.
context | The context holding the coap-entries to exire |
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.
If session_based
is set, then this cache-entry will get deleted when the session is freed off. If record_pdu
is set, then the copied PDU will get freed off when this cache-entry is deleted.
The cache-entry is maintained on a context hash list.
Note: This function must be called in the locked state.
session | The session to use to derive the context from. |
pdu | The pdu to use to generate the cache-key. |
record_pdu | COAP_CACHE_RECORD_PDU if to take a copy of the PDU for later use, else COAP_CACHE_NOT_RECORD_PDU. |
session_based | COAP_CACHE_IS_SESSION_BASED if to associate this cache-entry with the the session (which is embedded in the cache-entry), else COAP_CACHE_NOT_SESSION_BASED. |
idle_time | Idle time in seconds before cache-entry is expired. If set to 0, it does not expire (but will get deleted if the session is deleted and it is session_based). |
NULL
if failure.