CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
vcard_store.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <cstdint>
5
6#define VCARD_MAX_LEN 768
7#define VCARD_MAX_CARDS 100
8
15typedef struct {
16 char given_name[48];
17 char family_name[48];
19 char organization[64];
20 char title[64];
21 char email[96];
22 char tel_home[32];
23 char tel_cell[32];
24 char tel_work[32];
25 char url[128];
26 char impp_telegram[64];
27 char impp_signal[64];
28 char impp_matrix[96];
29 char impp_threema[32];
30 char social_profile[128];
31 char note[128];
33
34bool vcard_store_set_own(const char* vcard, size_t len, char* err, size_t err_len);
35size_t vcard_store_get_own(char* out, size_t max_len);
36size_t vcard_filter_empty_fields(char* vcard, size_t len);
37bool vcard_store_has_own(void);
38bool vcard_store_clear_own(void);
39bool vcard_store_get_display_own(char* out, size_t max_len);
40void vcard_store_init(void);
41uint16_t vcard_store_count(void);
42bool vcard_store_add(const char* vcard, size_t len, char* err, size_t err_len);
43
50bool vcard_store_contains(const char* vcard, size_t len);
51
52bool vcard_store_delete(uint16_t slot);
53
63bool vcard_store_update(uint16_t slot, const char* vcard, size_t len, char* err, size_t err_len);
64
65size_t vcard_store_get(uint16_t slot, char* out, size_t max_len);
66bool vcard_store_get_display(uint16_t slot, char* out, size_t max_len);
67uint16_t vcard_store_get_sorted(uint16_t* out_slots, uint16_t max_slots);
68
75bool vcard_parse_to_struct(const char* raw, vcard_data_t* out);
76
85size_t vcard_generate_from_struct(const vcard_data_t* data, char* out_buf, size_t buf_len);
Structured representation of an own vCard for editor/wizard use.
Definition vcard_store.h:15
char tel_cell[32]
Definition vcard_store.h:23
char family_name[48]
Definition vcard_store.h:17
char tel_work[32]
Definition vcard_store.h:24
char formatted_name[96]
Definition vcard_store.h:18
char title[64]
Definition vcard_store.h:20
char social_profile[128]
Definition vcard_store.h:30
char tel_home[32]
Definition vcard_store.h:22
char note[128]
Definition vcard_store.h:31
char email[96]
Definition vcard_store.h:21
char organization[64]
Definition vcard_store.h:19
char given_name[48]
Definition vcard_store.h:16
char url[128]
Definition vcard_store.h:25
char impp_signal[64]
Definition vcard_store.h:27
char impp_threema[32]
Definition vcard_store.h:29
char impp_telegram[64]
Definition vcard_store.h:26
char impp_matrix[96]
Definition vcard_store.h:28
size_t vcard_store_get_own(char *out, size_t max_len)
Retrieves local own-vCard text.
bool vcard_store_has_own(void)
Returns whether local own-vCard exists.
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.
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_clear_own(void)
Deletes local own-vCard from storage.
bool vcard_parse_to_struct(const char *raw, vcard_data_t *out)
Parses vCard 4.0 raw text into a structured vcard_data_t.
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.
uint16_t vcard_store_get_sorted(uint16_t *out_slots, uint16_t max_slots)
Returns slot indices of stored cards sorted by last name.
size_t vcard_filter_empty_fields(char *vcard, size_t len)
Removes empty optional fields from vCard text in-place.
uint16_t vcard_store_count(void)
Returns number of stored peer vCards.
bool vcard_store_contains(const char *vcard, size_t len)
Reports whether an exact-text vCard is already stored.
bool vcard_store_get_display_own(char *out, size_t max_len)
Retrieves display name derived from local own-vCard.
bool vcard_store_get_display(uint16_t slot, char *out, size_t max_len)
Retrieves cached display label for slot.
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....
void vcard_store_init(void)
Initializes metadata cache for stored peer vCards.
bool vcard_store_delete(uint16_t slot)
Deletes peer vCard at slot index.