41 WRITE_ONCE_FLAG = (1 << 0),
42 REQUIRE_CONFIDENTIALITY_FLAG = (1 << 1),
43 RESERVED_FLAG = (1 << 2),
44 REQUIRE_REPLAY_PROTECTION_FLAG = (1 << 3),
47 static const uint32_t MAX_KEY_SIZE = 128;
49 typedef struct _opaque_set_handle *set_handle_t;
51 typedef struct _opaque_key_iterator *iterator_t;
104 virtual int set(
const char *key,
const void *buffer,
size_t size, uint32_t create_flags) = 0;
117 virtual int get(
const char *key,
void *buffer,
size_t buffer_size,
size_t *actual_size = NULL,
size_t offset = 0) = 0;
149 virtual int set_start(set_handle_t *handle,
const char *key,
size_t final_data_size, uint32_t create_flags) = 0;
160 virtual int set_add_data(set_handle_t handle,
const void *value_data,
size_t data_size) = 0;
210 if (!key || !strlen(key) || (strlen(key) > MAX_KEY_SIZE)) {
214 if (strpbrk(key,
" */?:;\"|<>\\")) {
struct mbed::KVStore::info info_t
Holds key information.
virtual int remove(const char *key)=0
Remove a KVStore item, given key.
virtual int set(const char *key, const void *buffer, size_t size, uint32_t create_flags)=0
Set one KVStore item, given key and value.
bool is_valid_key(const char *key) const
Convenience function for checking key validity.
virtual int set_finalize(set_handle_t handle)=0
Finalize an incremental KVStore set sequence.
virtual int deinit()=0
Deinitialize KVStore.
virtual int get_info(const char *key, info_t *info=NULL)=0
Get information of a given key.
virtual int iterator_next(iterator_t it, char *key, size_t key_size)=0
Get next key in iteration.
virtual int set_start(set_handle_t *handle, const char *key, size_t final_data_size, uint32_t create_flags)=0
Start an incremental KVStore set sequence.
virtual int iterator_open(iterator_t *it, const char *prefix=NULL)=0
Start an iteration over KVStore keys.
virtual int get(const char *key, void *buffer, size_t buffer_size, size_t *actual_size=NULL, size_t offset=0)=0
Get one KVStore item, given key.
virtual int reset()=0
Reset KVStore contents (clear all keys)
virtual int init()=0
Initialize KVStore.
virtual int iterator_close(iterator_t it)=0
Close iteration.
virtual int set_add_data(set_handle_t handle, const void *value_data, size_t data_size)=0
Add data to incremental KVStore set sequence.