libcontrac
A library for contact tracing
|
Provides containers for managing lists of items. More...
Data Structures | |
struct | DtkListItem |
A DTK list element. More... | |
struct | DtkList |
The head of a DTK list. More... | |
struct | RpiListItem |
An RPI list element. More... | |
struct | RpiList |
The head of an RPI list. More... | |
Functions | |
DtkList * | dtk_list_new () |
void | dtk_list_delete (DtkList *data) |
void | dtk_list_append (DtkList *data, Dtk *dtk) |
DtkListItem const * | dtk_list_first (DtkList const *data) |
DtkListItem const * | dtk_list_next (DtkListItem const *data) |
Dtk const * | dtk_list_get_dtk (DtkListItem const *data) |
void | dtk_list_add_diagnosis (DtkList *data, unsigned char const *dtk_bytes, uint32_t day_number) |
RpiList * | rpi_list_new () |
void | rpi_list_delete (RpiList *data) |
void | rpi_list_append (RpiList *data, Rpi *rpi) |
RpiListItem const * | rpi_list_first (RpiList const *data) |
RpiListItem const * | rpi_list_next (RpiListItem const *data) |
Rpi const * | rpi_list_get_rpi (RpiListItem const *data) |
void | rpi_list_add_beacon (RpiList *data, unsigned char const *rpi_bytes, uint8_t time_interval_number) |
Provides containers for managing lists of items.
This allows the simplified management of lists of Dtk and Rpi objects. This is useful when checking DTKs received from a Diagnosis Server with RPIs captured over Bluetooth. The two can be easily stored and passed into the match_list_find_matches() function.
void dtk_list_add_diagnosis | ( | DtkList * | data, |
unsigned char const * | dtk_bytes, | ||
uint32_t | day_number | ||
) |
Adds Dtk data to the list.
The dtk_bytes buffer passed in must contain exactly DTK_SIZE (16) bytes of data. It doen't have to be null terminated.
data | The current list to operate on. |
dtk_bytes | The DTK value to add, in binary format. |
day_number | The day number to associate with the DTK. |
void dtk_list_append | ( | DtkList * | data, |
Dtk * | dtk | ||
) |
Adds an item to the list.
This adds a Dtk item to the list. It's primarily for internal use and when adding DTKs to the list it's usually more appropriate to use the dtk_list_add_diagnosis() function.
data | The list to append to. |
dtk | The DTK to append. |
void dtk_list_delete | ( | DtkList * | data | ) |
Deletes an instance of the class, freeing up the memory allocated to it.
This will also delete all items contained in the list.
data | The instance to free. |
DtkListItem const * dtk_list_first | ( | DtkList const * | data | ) |
Returns the first item in the list.
Useful for iterating through the items in the list.
data | The list to operate on. |
Dtk const * dtk_list_get_dtk | ( | DtkListItem const * | data | ) |
Returns the Dtk item contained in this list item.
data | The current item in the list. |
DtkList * dtk_list_new | ( | ) |
Creates a new instance of the class.
DtkListItem const * dtk_list_next | ( | DtkListItem const * | data | ) |
Returns the next item in the list.
Useful for iterating through the items in the list.
data | The current item in the list. |
void rpi_list_add_beacon | ( | RpiList * | data, |
unsigned char const * | rpi_bytes, | ||
uint8_t | time_interval_number | ||
) |
Adds Rpi data to the list.
The rpi_bytes buffer passed in must contain exactly RPI_SIZE (16) bytes of data. It doen't have to be null terminated.
data | The current list to operate on. |
rpi_bytes | The RPI value to add, in binary format. |
time_interval_number | The time interval number to associate with the RPI. |
void rpi_list_append | ( | RpiList * | data, |
Rpi * | rpi | ||
) |
Adds an item to the list.
This adds an Rpi item to the list. It's primarily for internal use and when adding RPIs to the list it's usually more appropriate to use the rpi_list_add_beacon() function.
data | The list to append to. |
rpi | The RPI to append. |
void rpi_list_delete | ( | RpiList * | data | ) |
Deletes an instance of the class, freeing up the memory allocated to it.
This will also delete all items contained in the list.
data | The instance to free. |
RpiListItem const * rpi_list_first | ( | RpiList const * | data | ) |
Returns the first item in the list.
Useful for iterating through the items in the list.
data | The list to operate on. |
Rpi const * rpi_list_get_rpi | ( | RpiListItem const * | data | ) |
Returns the Rpi item contained in this list item.
data | The current item in the list. |
RpiList * rpi_list_new | ( | ) |
Creates a new instance of the class.
RpiListItem const * rpi_list_next | ( | RpiListItem const * | data | ) |
Returns the next item in the list.
Useful for iterating through the items in the list.
data | The current item in the list. |