12#define BLOCK_STORAGE_DIR "../data/"
13#define BLOCKCHAIN_DIR BLOCK_STORAGE_DIR "blockchain/"
14#define PENDING_BLOCK_FILE BLOCK_STORAGE_DIR "pending_block"
15#define PENDING_VOTES_FILE BLOCK_STORAGE_DIR "pending_votes.txt"
57void delete_dir_files(
const char* path);
58void create_dir_structure();
void prepend_protected(CellProtected **list, Protected *pr)
Prepend CellProtected to a list !!! takes ownership of pr.
Definition: dataio.c:319
CellProtected * rand_list_protected(size_t len)
generate random list of protected
Definition: dataio.c:592
void free_list_protected(CellProtected *c)
frees the list of pretected
Definition: dataio.c:562
CellProtected * create_cell_protected(Protected *pr)
Create a cell protected object.
Definition: dataio.c:308
struct cellProtected CellProtected
void print_list_keys(CellKey *LCK)
print the keys from a list
Definition: dataio.c:266
void free_list_keys(CellKey *cellkey)
free a list of keys
Definition: dataio.c:537
void remove_fraudulent_declarations(CellProtected **list)
removes fraudulent block from the chain. Fraudulent blocks are the ones that don't verify the signatu...
Definition: dataio.c:575
CellProtected * str_to_list_protected(const char *str)
converts string to a list of protected
Definition: dataio.c:432
CellKey * read_public_keys(char *file)
Read the public keys of a file, return them in a CellKey structure.
Definition: dataio.c:237
void free_cell_keys(CellKey *c)
free a CellKey object(correspond to delete_cell_key in the subject).
Definition: dataio.c:526
CellProtected * fuse_protected_lists(CellProtected *A, CellProtected *B)
fusionner les liste A et B. Modifies A!
Definition: dataio.c:642
CellProtected * copy_protected_list(const CellProtected *o)
copies the list of protected values. The copies order is inverted.
Definition: dataio.c:508
char * list_protected_to_str(const CellProtected *list)
converts list of protected to a string.
Definition: dataio.c:373
void free_cell_protected(CellProtected *c)
correspond au delete_cell_protected dans le sujet
Definition: dataio.c:551
CellProtected * read_protected(const char *filename)
read protected list from file. data format is lines in protected_to_str format each representing a pr...
Definition: dataio.c:334
CellProtected * rand_list_protected_range(size_t len, char low, char hi)
generate random list of protected with message characters in range [low, hi].
Definition: dataio.c:604
CellKey * insert_cell_key(CellKey *cellkey, Key *key)
Insert a new element to cellkey (head insertion).
Definition: dataio.c:220
void print_protected_list(CellProtected *list)
prints the chained list of protected
Definition: dataio.c:490
CellKey * create_cell_key(Key *key)
Allocate and initialize a CellKey object.
Definition: dataio.c:209
void generate_random_data(int nv, int nc, const char *dir)
generates nv public and private keys and prints them in ./{dir}/keys.txt. Chooses nc couple of keys a...
Definition: dataio.c:32