libcontrac
A library for contact tracing
contrac.h
Go to the documentation of this file.
1 
29 #ifndef __CONTRAC_H
30 #define __CONTRAC_H
31 
32 // Includes
33 
34 #include <stdint.h>
35 #include <stdbool.h>
36 
37 // Defines
38 
39 // Data sizes in bytes
40 
44 #define TK_SIZE (32)
45 
49 #define TK_SIZE_BASE64 (44)
50 
51 // Structures
52 
58 typedef struct _Contrac Contrac;
59 
60 // Function prototypes
61 
62 Contrac * contrac_new();
63 void contrac_delete(Contrac * data);
64 
65 bool contrac_generate_tracing_key(Contrac * data);
66 bool contrac_set_day_number(Contrac * data, uint32_t day_number);
67 bool contrac_set_time_interval_number(Contrac * data, uint8_t time_interval_number);
68 bool contrac_update_current_time(Contrac * data);
69 bool contrac_get_initialised(Contrac const * data);
70 uint32_t contrac_get_day_number(Contrac * data);
71 uint8_t contrac_get_time_interval_number(Contrac * data);
72 
73 unsigned char const * contrac_get_tracing_key(Contrac const * data);
74 void contrac_get_tracing_key_base64(Contrac const * data, char * base64);
75 
76 void contrac_set_tracing_key(Contrac * data, unsigned char const * tracing_key);
77 bool contrac_set_tracing_key_base64(Contrac * data, char const * tracing_key);
78 
79 unsigned char const * contrac_get_daily_key(Contrac const * data);
80 void contrac_get_daily_key_base64(Contrac const * data, char * base64);
81 
82 unsigned char const * contrac_get_proximity_id(Contrac const * data);
83 void contrac_get_proximity_id_base64(Contrac const * data, char * base64);
84 
85 // Function definitions
86 
87 #endif // __CONTRAC_H
88 
bool contrac_set_tracing_key_base64(Contrac *data, char const *tracing_key)
Definition: contrac.c:378
Contrac * contrac_new()
Definition: contrac.c:112
The core structure for storing Contact Tracing state.
Definition: contrac.c:92
unsigned char const * contrac_get_daily_key(Contrac const *data)
Definition: contrac.c:422
bool contrac_update_current_time(Contrac *data)
Definition: contrac.c:513
uint32_t contrac_get_day_number(Contrac *data)
Definition: contrac.c:275
void contrac_get_tracing_key_base64(Contrac const *data, char *base64)
Definition: contrac.c:353
void contrac_get_daily_key_base64(Contrac const *data, char *base64)
Definition: contrac.c:441
bool contrac_set_day_number(Contrac *data, uint32_t day_number)
Definition: contrac.c:183
void contrac_get_proximity_id_base64(Contrac const *data, char *base64)
Definition: contrac.c:485
void contrac_set_tracing_key(Contrac *data, unsigned char const *tracing_key)
Definition: contrac.c:314
uint8_t contrac_get_time_interval_number(Contrac *data)
Definition: contrac.c:295
bool contrac_generate_tracing_key(Contrac *data)
Definition: contrac.c:148
void contrac_delete(Contrac *data)
Definition: contrac.c:127
bool contrac_get_initialised(Contrac const *data)
Definition: contrac.c:257
unsigned char const * contrac_get_tracing_key(Contrac const *data)
Definition: contrac.c:335
unsigned char const * contrac_get_proximity_id(Contrac const *data)
Definition: contrac.c:467
bool contrac_set_time_interval_number(Contrac *data, uint8_t time_interval_number)
Definition: contrac.c:221