CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
host_api_nvs.cpp File Reference

Plugin-namespaced NVS key/value storage. More...

#include "plugin_manager/host_api.h"
#include "plugin_manager/Plugin.h"
#include "cdc_core/Raii.h"
#include "nvs.h"
#include "nvs_flash.h"
#include <cstring>
#include <string>

Go to the source code of this file.

Functions

void * plg_get_active_plugin (void)
void plg_log_warn (const char *msg)
int host_nvs_get_blob (const char *key, uint8_t *buf, size_t *len)
 Read a binary blob from NVS.
int host_nvs_set_blob (const char *key, const uint8_t *buf, size_t len)
 Write a binary blob to NVS.
int host_nvs_get_u32 (const char *key, uint32_t *out)
 Read a uint32 value.
int host_nvs_set_u32 (const char *key, uint32_t value)
 Write a uint32 value.
int host_nvs_get_str (const char *key, char *buf, size_t buf_size)
 Read a NUL-terminated string.
int host_nvs_set_str (const char *key, const char *value)
 Write a NUL-terminated string.
int host_nvs_erase (const char *key)
 Delete a single key.
int host_nvs_erase_all (void)
 Erase every key in the plugin's namespace.
int host_nvs_list_keys (char *out, size_t *out_len)
 Enumerate the keys in the plugin's namespace.

Detailed Description

Plugin-namespaced NVS key/value storage.

Each plugin gets its own NVS namespace plugin_<id> derived from the active plugin's manifest. Cross-plugin reads are physically impossible - the namespace is selected by the host, not by the plugin.

Definition in file host_api_nvs.cpp.

Function Documentation

◆ plg_get_active_plugin()

void * plg_get_active_plugin ( void )

Definition at line 24 of file plugin_log_bridge.cpp.

◆ plg_log_warn()

void plg_log_warn ( const char * msg)

Definition at line 20 of file plugin_log_bridge.cpp.