|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
#include <cstddef>#include <cstdint>Go to the source code of this file.
Classes | |
| struct | vcard_data_t |
| Structured representation of an own vCard for editor/wizard use. More... | |
Macros | |
| #define | VCARD_MAX_LEN 768 |
| #define | VCARD_MAX_CARDS 100 |
Functions | |
| bool | vcard_store_set_own (const char *vcard, size_t len, char *err, size_t err_len) |
| Stores local own-vCard after validation and field filtering. | |
| size_t | vcard_store_get_own (char *out, size_t max_len) |
| Retrieves local own-vCard text. | |
| size_t | vcard_filter_empty_fields (char *vcard, size_t len) |
| Removes empty optional fields from vCard text in-place. | |
| bool | vcard_store_has_own (void) |
| Returns whether local own-vCard exists. | |
| bool | vcard_store_clear_own (void) |
| Deletes local own-vCard from storage. | |
| bool | vcard_store_get_display_own (char *out, size_t max_len) |
| Retrieves display name derived from local own-vCard. | |
| void | vcard_store_init (void) |
| Initializes metadata cache for stored peer vCards. | |
| uint16_t | vcard_store_count (void) |
| Returns number of stored peer vCards. | |
| bool | vcard_store_add (const char *vcard, size_t len, char *err, size_t err_len) |
| Adds peer vCard to first free slot after validation and duplicate check. | |
| bool | vcard_store_contains (const char *vcard, size_t len) |
| Reports whether an exact-text vCard is already stored. | |
| bool | vcard_store_delete (uint16_t slot) |
| Deletes peer vCard at slot index. | |
| bool | vcard_store_update (uint16_t slot, const char *vcard, size_t len, char *err, size_t err_len) |
Overwrites the vCard stored at slot in place after validation. | |
| size_t | vcard_store_get (uint16_t slot, char *out, size_t max_len) |
| Retrieves raw vCard text from slot. | |
| bool | vcard_store_get_display (uint16_t slot, char *out, size_t max_len) |
| Retrieves cached display label for slot. | |
| uint16_t | vcard_store_get_sorted (uint16_t *out_slots, uint16_t max_slots) |
| Returns slot indices of stored cards sorted by last name. | |
| bool | vcard_parse_to_struct (const char *raw, vcard_data_t *out) |
| Parses vCard 4.0 raw text into a structured vcard_data_t. | |
| size_t | vcard_generate_from_struct (const vcard_data_t *data, char *out_buf, size_t buf_len) |
| Generates vCard 4.0 text from a structured vcard_data_t. Empty fields are omitted. FN falls back to "given family" when empty. | |
| #define VCARD_MAX_CARDS 100 |
Definition at line 7 of file vcard_store.h.
Referenced by cdc::mod_vcard::cmdVcardDelete(), cdc::mod_vcard::cmdVcardGet(), cdc::mod_vcard::cmdVcardList(), cdc::mod_vcard::cmdVcardSet(), cdc::mod_vcard::VcardModule::exportBackup(), cdc::mod_vcard::rebuildReceivedList(), vcard_is_duplicate(), vcard_store_add(), vcard_store_delete(), vcard_store_get(), vcard_store_get_display(), vcard_store_get_sorted(), vcard_store_init(), and vcard_store_update().
| #define VCARD_MAX_LEN 768 |
Definition at line 6 of file vcard_store.h.
Referenced by cdc::mod_vcard::cmdVcardGet(), cdc::mod_vcard::ctxReceivedForward(), cdc::mod_vcard::ctxReceivedQr(), cdc::mod_vcard::deliverVcard(), cdc::mod_vcard::VcardWizard::edit(), cdc::mod_vcard::VcardWizard::editReceived(), cdc::mod_vcard::VcardModule::exportBackup(), cdc::mod_vcard::onMainMenuSelect(), cdc::mod_vcard::onMyVcardLockscreenSelect(), cdc::mod_vcard::onReceivedSelect(), vcard_filter_empty_fields(), vcard_is_duplicate(), vcard_store_add(), vcard_store_init(), vcard_store_set_own(), vcard_store_update(), vcard_validate(), and cdc::mod_vcard::wizardFinish().
| size_t vcard_filter_empty_fields | ( | char * | vcard, |
| size_t | len ) |
Removes empty optional fields from vCard text in-place.
| vcard | Mutable vCard buffer. |
| len | Input length. |
Definition at line 126 of file vcard_store.cpp.
References vcard_line_has_content(), and VCARD_MAX_LEN.
Referenced by vcard_store_add(), vcard_store_set_own(), and vcard_store_update().
| size_t vcard_generate_from_struct | ( | const vcard_data_t * | data, |
| char * | out_buf, | ||
| size_t | buf_len ) |
Generates vCard 4.0 text from a structured vcard_data_t. Empty fields are omitted. FN falls back to "given family" when empty.
| data | Input struct. |
| out_buf | Output buffer. |
| buf_len | Output buffer size (should be >= VCARD_MAX_LEN + 1). |
Generates vCard 4.0 text from a structured vcard_data_t. Empty fields are omitted. FN falls back to "given family" when empty.
Definition at line 981 of file vcard_store.cpp.
References append_field(), vcard_data_t::email, vcard_data_t::family_name, vcard_data_t::formatted_name, vcard_data_t::given_name, vcard_data_t::impp_matrix, vcard_data_t::impp_signal, vcard_data_t::impp_telegram, vcard_data_t::impp_threema, vcard_data_t::note, vcard_data_t::organization, vcard_data_t::social_profile, vcard_data_t::tel_cell, vcard_data_t::tel_home, vcard_data_t::tel_work, vcard_data_t::title, and vcard_data_t::url.
Referenced by cdc::mod_vcard::wizardFinish().
| bool vcard_parse_to_struct | ( | const char * | raw, |
| vcard_data_t * | out ) |
Parses vCard 4.0 raw text into a structured vcard_data_t.
| raw | Null-terminated vCard text (may contain CRLF or LF line endings). |
| out | Output struct (zeroed before parsing). |
Parses vCard 4.0 raw text into a structured vcard_data_t.
Definition at line 935 of file vcard_store.cpp.
References parse_line_into_struct().
Referenced by cdc::mod_vcard::VcardWizard::edit(), cdc::mod_vcard::VcardWizard::editReceived(), cdc::mod_vcard::showVcardDetails(), and cdc::mod_vcard::showVcardQr().
| bool vcard_store_add | ( | const char * | vcard, |
| size_t | len, | ||
| char * | err, | ||
| size_t | err_len ) |
Adds peer vCard to first free slot after validation and duplicate check.
| vcard | vCard text. |
| len | Input length. |
| err | Output error buffer. |
| err_len | Error buffer size. |
Definition at line 539 of file vcard_store.cpp.
References fnv1a_hash(), g_card_count, g_cards, set_err(), vcard_filter_empty_fields(), vcard_is_duplicate(), vcard_key_for_slot(), VCARD_MAX_CARDS, VCARD_MAX_LEN, VCARD_NAMESPACE, vcard_parse_names(), vcard_store_init(), and vcard_validate().
Referenced by cdc::mod_vcard::deliverVcard(), cdc::mod_vcard::importReceivedVcard(), and cdc::mod_vcard::wizardFinish().
| bool vcard_store_clear_own | ( | void | ) |
Deletes local own-vCard from storage.
Definition at line 429 of file vcard_store.cpp.
References g_own_loaded, g_own_present, g_own_vcard, VCARD_KEY_OWN, and VCARD_NAMESPACE.
Referenced by cdc::mod_vcard::cmdVcardDelete().
| bool vcard_store_contains | ( | const char * | vcard, |
| size_t | len ) |
Reports whether an exact-text vCard is already stored.
| vcard | Candidate vCard text. |
| len | Candidate length. |
vcard byte for byte. Definition at line 518 of file vcard_store.cpp.
References fnv1a_hash(), vcard_is_duplicate(), VCARD_NAMESPACE, and vcard_store_init().
Referenced by cdc::mod_vcard::importReceivedVcard().
| uint16_t vcard_store_count | ( | void | ) |
Returns number of stored peer vCards.
Definition at line 485 of file vcard_store.cpp.
References g_card_count, and vcard_store_init().
| bool vcard_store_delete | ( | uint16_t | slot | ) |
Deletes peer vCard at slot index.
| slot | Slot index. |
Definition at line 654 of file vcard_store.cpp.
References g_card_count, g_cards, vcard_key_for_slot(), VCARD_MAX_CARDS, VCARD_NAMESPACE, and vcard_store_init().
Referenced by cdc::mod_vcard::cmdVcardDelete(), and cdc::mod_vcard::onReceivedDeleteConfirm().
| size_t vcard_store_get | ( | uint16_t | slot, |
| char * | out, | ||
| size_t | max_len ) |
Retrieves raw vCard text from slot.
| slot | Slot index. |
| out | Output buffer. |
| max_len | Output buffer size. |
Definition at line 683 of file vcard_store.cpp.
References g_cards, vcard_key_for_slot(), VCARD_MAX_CARDS, VCARD_NAMESPACE, and vcard_store_init().
Referenced by cdc::mod_vcard::cmdVcardGet(), cdc::mod_vcard::ctxReceivedForward(), cdc::mod_vcard::ctxReceivedQr(), cdc::mod_vcard::VcardWizard::editReceived(), cdc::mod_vcard::VcardModule::exportBackup(), and cdc::mod_vcard::onReceivedSelect().
| bool vcard_store_get_display | ( | uint16_t | slot, |
| char * | out, | ||
| size_t | max_len ) |
Retrieves cached display label for slot.
| slot | Slot index. |
| out | Output label buffer. |
| max_len | Output buffer size. |
Definition at line 717 of file vcard_store.cpp.
References g_cards, VCARD_MAX_CARDS, and vcard_store_init().
Referenced by cdc::mod_vcard::cmdVcardList(), cdc::mod_vcard::cmdVcardSet(), and cdc::mod_vcard::rebuildReceivedList().
| bool vcard_store_get_display_own | ( | char * | out, |
| size_t | max_len ) |
Retrieves display name derived from local own-vCard.
| out | Output buffer. |
| max_len | Output buffer size. |
Definition at line 413 of file vcard_store.cpp.
References g_own_present, g_own_vcard, vcard_load_own(), and vcard_parse_names().
| size_t vcard_store_get_own | ( | char * | out, |
| size_t | max_len ) |
Retrieves local own-vCard text.
| out | Output buffer. |
| max_len | Output buffer size. |
Definition at line 387 of file vcard_store.cpp.
References g_own_present, g_own_vcard, and vcard_load_own().
Referenced by cdc::mod_vcard::cmdVcardGet(), cdc::mod_vcard::VcardWizard::edit(), cdc::mod_vcard::VcardModule::exportBackup(), cdc::mod_vcard::onMainMenuSelect(), and cdc::mod_vcard::onMyVcardLockscreenSelect().
| uint16_t vcard_store_get_sorted | ( | uint16_t * | out_slots, |
| uint16_t | max_slots ) |
Returns slot indices of stored cards sorted by last name.
| out_slots | Output slot-index array. |
| max_slots | Maximum writable entries. |
Definition at line 1048 of file vcard_store.cpp.
References g_cards, VCARD_MAX_CARDS, and vcard_store_init().
Referenced by cdc::mod_vcard::cmdVcardList(), cdc::mod_vcard::VcardModule::exportBackup(), and cdc::mod_vcard::rebuildReceivedList().
| bool vcard_store_has_own | ( | void | ) |
Returns whether local own-vCard exists.
Definition at line 402 of file vcard_store.cpp.
References g_own_present, and vcard_load_own().
Referenced by cdc::mod_vcard::onMainMenuSelect().
| void vcard_store_init | ( | void | ) |
Initializes metadata cache for stored peer vCards.
Definition at line 448 of file vcard_store.cpp.
References fnv1a_hash(), g_card_count, g_cards, g_cards_loaded, vcard_key_for_slot(), VCARD_MAX_CARDS, VCARD_MAX_LEN, VCARD_NAMESPACE, and vcard_parse_names().
Referenced by vcard_store_add(), vcard_store_contains(), vcard_store_count(), vcard_store_delete(), vcard_store_get(), vcard_store_get_display(), vcard_store_get_sorted(), and vcard_store_update().
| bool vcard_store_set_own | ( | const char * | vcard, |
| size_t | len, | ||
| char * | err, | ||
| size_t | err_len ) |
Stores local own-vCard after validation and field filtering.
| vcard | vCard text. |
| len | Input length. |
| err | Output error buffer. |
| err_len | Error buffer size. |
Definition at line 343 of file vcard_store.cpp.
References g_own_loaded, g_own_present, g_own_vcard, LOG_I, set_err(), TAG, vcard_filter_empty_fields(), VCARD_KEY_OWN, VCARD_MAX_LEN, VCARD_NAMESPACE, and vcard_validate().
Referenced by cdc::mod_vcard::VcardModule::importBackup(), cdc::mod_vcard::vcardLineInterceptor(), and cdc::mod_vcard::wizardFinish().
| bool vcard_store_update | ( | uint16_t | slot, |
| const char * | vcard, | ||
| size_t | len, | ||
| char * | err, | ||
| size_t | err_len ) |
Overwrites the vCard stored at slot in place after validation.
| slot | Slot index of an existing stored card. |
| vcard | New vCard text. |
| len | New vCard length. |
| err | Output error buffer. |
| err_len | Error buffer size. |
Overwrites the vCard stored at slot in place after validation.
| slot | Slot index of an existing stored card. |
| vcard | New vCard text. |
| len | New vCard length. |
| err | Output error buffer. |
| err_len | Error buffer size. |
Definition at line 610 of file vcard_store.cpp.
References fnv1a_hash(), g_cards, set_err(), vcard_filter_empty_fields(), vcard_key_for_slot(), VCARD_MAX_CARDS, VCARD_MAX_LEN, VCARD_NAMESPACE, vcard_parse_names(), vcard_store_init(), and vcard_validate().
Referenced by cdc::mod_vcard::vcardLineInterceptor(), and cdc::mod_vcard::wizardFinish().