SEcube
SEcube Open Source Library - Device
|
Key management. More...
#include "se3_flash.h"
Go to the source code of this file.
Data Structures | |
struct | se3_flash_key_ |
Flash key structure. More... | |
Macros | |
#define | SE3_TYPE_KEY 100 |
Typedefs | |
typedef struct se3_flash_key_ | se3_flash_key |
Flash key structure. More... | |
Functions | |
bool | se3_key_find (uint32_t id, se3_flash_it *it) |
Find a key. More... | |
bool | se3_key_remove (se3_flash_it *it) |
Remove a key. More... | |
bool | se3_key_new (se3_flash_it *it, se3_flash_key *key) |
Add a new key. More... | |
void | se3_key_read (se3_flash_it *it, se3_flash_key *key) |
Read a key. More... | |
bool | se3_key_equal (se3_flash_it *it, se3_flash_key *key) |
Check if key is equal. More... | |
void | se3_key_read_data (se3_flash_it *it, uint16_t data_size, uint8_t *data) |
Read data from key node. More... | |
bool | se3_key_write (se3_flash_it *it, se3_flash_key *key) |
Write key data. More... | |
Key management.
typedef struct se3_flash_key_ se3_flash_key |
Flash key structure.
Disposition of the fields within the flash node: 0:3 id 4:7 validity 8:9 data_size 10:11 name_size 12:(12+data_size-1) data (12+data_size):(12+data_size+name_size-1) name
anonymous enum |
Flash key fields
bool se3_key_equal | ( | se3_flash_it * | it, |
se3_flash_key * | key | ||
) |
Check if key is equal.
Check if the supplied key is equal to a key stored in the flash.
it | a flash iterator pointing to a key |
key | a flash key structure to compare |
bool se3_key_find | ( | uint32_t | id, |
se3_flash_it * | it | ||
) |
Find a key.
Find a key in the flash memory
id | identifier of the key |
it | a flash iterator that will be set to the key's position |
bool se3_key_new | ( | se3_flash_it * | it, |
se3_flash_key * | key | ||
) |
Add a new key.
Create a new node with the necessary amount of space for the key, then write the key.
it | a flash iterator which will receive the position of the new node |
key | a flash key structure containing the key information The data and name fields must point to a valid memory region, unless their size (data_size, name_size) is zero. |
void se3_key_read | ( | se3_flash_it * | it, |
se3_flash_key * | key | ||
) |
Read a key.
Read a key from a flash node
it | a flash iterator pointing to the key |
key | a flash key structure which will receive the key's information. The data and name fields will be filled only if not NULL. |
void se3_key_read_data | ( | se3_flash_it * | it, |
uint16_t | data_size, | ||
uint8_t * | data | ||
) |
Read data from key node.
Read the key's data from a ket node
it | a flash iterator pointing to the key |
data_size | the number of bytes to read |
data | output data buffer |
bool se3_key_remove | ( | se3_flash_it * | it | ) |
Remove a key.
Delete a key from the flash
it | a flash iterator pointing to the key |
bool se3_key_write | ( | se3_flash_it * | it, |
se3_flash_key * | key | ||
) |
Write key data.
Write key data to a flash node
it | a flash iterator pointing to a newly created flash node of key type |
key | a flash key structure containing the key information The data and name fields must point to a valid memory region, unless their size (data_size, name_size) is zero. |