98 #ifndef SUIT_STORAGE_H
99 #define SUIT_STORAGE_H
150 uint8_t *buf,
size_t offset,
size_t len);
190 const uint8_t **buf,
size_t *len);
417 return storage->
driver->
start(storage, manifest, len);
434 const uint8_t *buf,
size_t offset,
437 return storage->
driver->
write(storage, manifest, buf, offset, len);
467 size_t offset,
size_t len)
469 return storage->
driver->
read(storage, buf, offset, len);
528 const char *location)
571 const char *location)
int(* read_ptr)(suit_storage_t *storage, const uint8_t **buf, size_t *len)
retrieve a direct read pointer for this storage backend
int(* init)(suit_storage_t *storage)
One-time initialization function.
int(* erase)(suit_storage_t *storage)
Erase the previously loaded payload.
int suit_storage_set_seq_no_all(uint32_t seq_no)
Set the new sequence number on all available backends.
int suit_storage_get_highest_seq_no(uint32_t *seq_no)
Get the highest sequence number among available backends.
int(* start)(suit_storage_t *storage, const suit_manifest_t *manifest, size_t len)
Start a new payload write sequence.
int(* finish)(suit_storage_t *storage, const suit_manifest_t *manifest)
Signal that the payload write stage done to the storage backend.
static int suit_storage_install(suit_storage_t *storage, const suit_manifest_t *manifest)
Install the payload or mark the payload as valid.
int(* set_active_location)(suit_storage_t *storage, const char *location)
Set the active location of the storage handler.
bool(* match_offset)(const suit_storage_t *storage, size_t offset)
Checks if the supplied offset is true or false for the current location.
Generic storage backend state.
int(* write)(suit_storage_t *storage, const suit_manifest_t *manifest, const uint8_t *buf, size_t offset, size_t len)
Write a new chunk of the payload to the storage backend.
bool(* has_location)(const suit_storage_t *storage, const char *location)
Check if this storage backend services a location.
int(* get_seq_no)(const suit_storage_t *storage, uint32_t *seq_no)
Retrieve the sequence number from the storage backend.
static int suit_storage_erase(suit_storage_t *storage)
Erase the previously loaded payload.
static int suit_storage_finish(suit_storage_t *storage, const suit_manifest_t *manifest)
Signal that the payload write stage done to the storage backend.
suit_storage_t * suit_storage_find_by_id(const char *id)
retrieve a storage backend based on the location ID string
int(* install)(suit_storage_t *storage, const suit_manifest_t *manifest)
Install the payload or mark the payload as valid.
char separator
Component ID separator used by this storage driver.
static int suit_storage_start(suit_storage_t *storage, const suit_manifest_t *manifest, size_t len)
Start a new payload write sequence.
static int suit_storage_read_ptr(suit_storage_t *storage, const uint8_t **buf, size_t *len)
retrieve a direct read pointer for this storage backend
int(* set_seq_no)(suit_storage_t *storage, uint32_t seq_no)
Set a new sequence number in the storage backend.
const suit_storage_driver_t * driver
Storage driver functions.
static int suit_storage_read(suit_storage_t *storage, uint8_t *buf, size_t offset, size_t len)
Read a chunk of previously written data back.
static bool suit_storage_has_offset(const suit_storage_t *storage)
Check if the storage backend implements the suit_storage_driver_t::match_offset function.
static int suit_storage_set_seq_no(suit_storage_t *storage, uint32_t seq_no)
Set a new sequence number in the storage backend.
int(* read)(suit_storage_t *storage, uint8_t *buf, size_t offset, size_t len)
Read a chunk of previously written data back.
static bool suit_storage_has_readptr(const suit_storage_t *storage)
Check if the storage backend implements the suit_storage_driver_t::read_ptr function.
static int suit_storage_get_seq_no(const suit_storage_t *storage, uint32_t *seq_no)
Retrieve the sequence number from the storage backend.
suit_storage_t * suit_storage_find_by_component(const suit_manifest_t *manifest, const suit_component_t *component)
retrieve a storage backend based on the suit component
static int suit_storage_write(suit_storage_t *storage, const suit_manifest_t *manifest, const uint8_t *buf, size_t offset, size_t len)
Write a new chunk of the payload to the storage backend.
SUIT component struct as decoded from the manifest.
SUIT storage backend driver struct.
struct suit_storage_driver suit_storage_driver_t
SUIT storage backend driver struct.
static bool suit_storage_has_location(suit_storage_t *storage, const char *location)
Check if this storage backend services a location.
void suit_storage_init_all(void)
initialize all storage backends
static int suit_storage_init(suit_storage_t *storage)
One-time initialization function.
static int suit_storage_set_active_location(suit_storage_t *storage, const char *location)
Set the active location of the storage handler.
static char suit_storage_get_separator(const suit_storage_t *storage)
get the separator for a storage backend
static int suit_storage_match_offset(const suit_storage_t *storage, size_t offset)
Checks if the supplied offset is true or false for the current location.