2020-07-14 20:54:14 +02:00
|
|
|
// Copyright 2020 Lukas Haubaum
|
|
|
|
//
|
|
|
|
// Licensed under the GNU Affero General Public License, Version 3;
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
|
|
|
|
// https://www.gnu.org/licenses/agpl-3.0.html
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
2020-07-13 20:32:53 +02:00
|
|
|
|
|
|
|
#ifndef _ena_DATASTRUCTURES_H_
|
|
|
|
#define _ena_DATASTRUCTURES_H_
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "ena-crypto.h"
|
|
|
|
|
2020-07-14 20:54:14 +02:00
|
|
|
/**
|
|
|
|
* @brief different risk levels
|
|
|
|
*
|
|
|
|
* not used for now
|
|
|
|
*/
|
|
|
|
typedef enum
|
2020-07-13 20:32:53 +02:00
|
|
|
{
|
|
|
|
RISK_LEVEL_INVALID = 0,
|
|
|
|
RISK_LEVEL_LOWEST,
|
|
|
|
RISK_LEVEL_LOW,
|
|
|
|
RISK_LEVEL_LOW_MEDIUM,
|
|
|
|
RISK_LEVEL_MEDIUM,
|
|
|
|
RISK_LEVEL_MEDIUM_HIGH,
|
|
|
|
RISK_LEVEL_HIGH,
|
|
|
|
RISK_LEVEL_VERY_HIGH,
|
|
|
|
RISK_LEVEL_HIGHEST,
|
|
|
|
} ena_risklevel_t;
|
|
|
|
|
2020-07-14 20:54:14 +02:00
|
|
|
/**
|
|
|
|
* @brief configuration for risk score calculation
|
|
|
|
*
|
|
|
|
* not used for now
|
|
|
|
*/
|
|
|
|
typedef struct
|
2020-07-13 20:32:53 +02:00
|
|
|
{
|
|
|
|
int minimum_risk_score;
|
|
|
|
int attenuation_score[8];
|
|
|
|
int attenuation_weight;
|
|
|
|
int days_sinse_last_exposure_score[8];
|
|
|
|
int days_sinse_last_exposure_weight;
|
|
|
|
int duration_scores[8];
|
|
|
|
float duration_weight;
|
|
|
|
int transmission_risk_scores[8];
|
|
|
|
float transmission_risk_weight;
|
|
|
|
uint8_t duration_at_attenuation_thresholds[2];
|
|
|
|
} __packed ena_config_t;
|
|
|
|
|
2020-07-14 20:54:14 +02:00
|
|
|
/**
|
|
|
|
* @brief structure for TEK
|
|
|
|
*/
|
|
|
|
typedef struct
|
2020-07-13 20:32:53 +02:00
|
|
|
{
|
2020-07-14 20:54:14 +02:00
|
|
|
uint8_t key_data[ENA_KEY_LENGTH]; // key data for encryption
|
|
|
|
uint32_t enin; // ENIN marking start of validity
|
|
|
|
uint8_t rolling_period; // period after validity start to mark key as expired
|
2020-07-13 20:32:53 +02:00
|
|
|
} __packed ena_tek_t;
|
|
|
|
|
2020-07-14 20:54:14 +02:00
|
|
|
/**
|
|
|
|
* @brief sturcture for a temporary detection
|
|
|
|
*/
|
|
|
|
typedef struct
|
2020-07-13 20:32:53 +02:00
|
|
|
{
|
2020-07-14 20:54:14 +02:00
|
|
|
uint8_t rpi[ENA_KEY_LENGTH]; // received RPI of detection
|
|
|
|
uint8_t aem[ENA_AEM_METADATA_LENGTH]; // received AEM of detection
|
|
|
|
uint32_t timestamp_first; // timestamp of first recognition
|
|
|
|
uint32_t timestamp_last; // timestamp of last recognition
|
|
|
|
int rssi; // last measured RSSI
|
2020-07-13 20:32:53 +02:00
|
|
|
} __packed ena_temp_detection_t;
|
|
|
|
|
2020-07-14 20:54:14 +02:00
|
|
|
/**
|
|
|
|
* @brief sturcture for a detection
|
|
|
|
*/
|
|
|
|
typedef struct
|
2020-07-13 20:32:53 +02:00
|
|
|
{
|
2020-07-14 20:54:14 +02:00
|
|
|
uint8_t rpi[ENA_KEY_LENGTH]; // received RPI of detection
|
|
|
|
uint8_t aem[ENA_AEM_METADATA_LENGTH]; // received AEM of detection
|
|
|
|
uint32_t timestamp; // timestamp of last recognition
|
|
|
|
int rssi; // last measured RSSI
|
2020-07-13 20:32:53 +02:00
|
|
|
} __packed ena_detection_t;
|
|
|
|
|
|
|
|
#endif
|