libcontrac
A library for contact tracing
Files | Data Structures | Functions
Matching

Provides a way to match collected RPIs with downloaded DTKs. More...

Files

file  match.c
 Provides a way to match collected RPIs with downloaded DTKs.
 
file  match.h
 Provides a way to match collected RPIs with downloaded DTKs.
 

Data Structures

struct  MatchListItem
 A match list element. More...
 
struct  MatchList
 The head of a match list. More...
 

Functions

MatchListItem * match_list_item_new ()
 
void match_list_item_delete (MatchListItem *data)
 
void match_list_append (MatchList *data, MatchListItem *item)
 
MatchList * match_list_new ()
 
void match_list_delete (MatchList *data)
 
void match_list_clear (MatchList *data)
 
size_t match_list_count (MatchList *data)
 
MatchListItem const * match_list_first (MatchList const *data)
 
MatchListItem const * match_list_next (MatchListItem const *data)
 
uint32_t match_list_get_day_number (MatchListItem const *data)
 
uint8_t match_list_get_time_interval_number (MatchListItem const *data)
 
void match_list_find_matches (MatchList *data, RpiList *beacons, DtkList *diagnosis_keys)
 

Detailed Description

Provides a way to match collected RPIs with downloaded DTKs.

This class provides functionality allowing RPIs that have been collected over Bluetooth to be matched against DTKs downloaded from a Diagnosis Server.

Function Documentation

◆ match_list_append()

void match_list_append ( MatchList *  data,
MatchListItem *  item 
)

Adds an item to the list.

This adds a match to the list. It's primarily for internal use.

Parameters
dataThe list to append to.
itemThe match to append.

◆ match_list_clear()

void match_list_clear ( MatchList *  data)

Clears all items from the list.

Removes all items from the list to create an empty list. The memory associated with the items in the list is freed.

Parameters
dataThe list to operate on.

◆ match_list_count()

size_t match_list_count ( MatchList *  data)

Returns the number of items in the list.

Immediately after creation, or after the match_list_clear() function has been called, this will return zero.

Parameters
dataThe list to operate on.

◆ match_list_delete()

void match_list_delete ( MatchList *  data)

Deletes an instance of the class, freeing up the memory allocated to it.

This will also delete all items contained in the list.

Parameters
dataThe instance to free.

◆ match_list_find_matches()

void match_list_find_matches ( MatchList *  data,
RpiList *  beacons,
DtkList *  diagnosis_keys 
)

Returns a list of matches found between the beacons and diagnoses.

This searches through the list of DTKs and the list of RPIs provided, and returns a list of matches.

If the returned list has any elements in, this would suggest that the user has been in contact with someone who tested positive and uploaded their DTK to a Diagnosis Server.

The match list isn't cleared by this call and so any new values will be appended to it.

Parameters
dataThe list that any matches will be appended to.
beaconsA list of RPIs extracted from overheard BLE beacons.
diagnosis_keysA list of DTKs downloaed from a Diagnosis Server.

◆ match_list_first()

MatchListItem const * match_list_first ( MatchList const *  data)

Returns the first item in the list.

Useful for iterating through the items in the list.

Parameters
dataThe list to operate on.
Returns
The first item of the list.

◆ match_list_get_day_number()

uint32_t match_list_get_day_number ( MatchListItem const *  data)

Returns the day number of the item in the list.

This will represent the day number of when an interaction occurred with someone who has subsequently uploaded their DTK to a diagnosis server due to testing positive.

Parameters
dataThe list to operate on.
Returns
The day number for this item.

◆ match_list_get_time_interval_number()

uint8_t match_list_get_time_interval_number ( MatchListItem const *  data)

Returns the time interval number of the item in the list.

This will represent the time interval number of when an interaction occurred with someone who has subsequently uploaded their DTK to a diagnosis server due to testing positive.

Parameters
dataThe list to operate on.
Returns
The time interval number for this item.

◆ match_list_item_delete()

void match_list_item_delete ( MatchListItem *  data)

Deletes an instance of the class, freeing up the memory allocated to it.

Parameters
dataThe instance to free.

◆ match_list_item_new()

MatchListItem * match_list_item_new ( )

Creates a new instance of the class.

Returns
The newly created object.

◆ match_list_new()

MatchList * match_list_new ( )

Creates a new instance of the class.

Returns
The newly created object.

◆ match_list_next()

MatchListItem const * match_list_next ( MatchListItem const *  data)

Returns the next item in the list.

Useful for iterating through the items in the list.

Parameters
dataThe current item in the list.
Returns
The next item in the list following the current item.