it2s-itss-facilities/src/facilities.h

133 lines
2.4 KiB
C

#ifndef FACILITIES_H
#define FACILITIES_H
#include <pthread.h>
#include <stdbool.h>
#include <zmq.h>
#include "cam.h"
#include "denm.h"
#include "infrastructure.h"
#include "cpm.h"
#include "saem.h"
#include "tpm.h"
#include "vcm.h"
#include "evm.h"
#include "edm.h"
#include "mcm.h"
#include <it2s-tender/epv.h>
#include <it2s-tender/database.h>
#include <it2s-tender/log.h>
#include <it2s-tender/constants.h>
#include <it2s-tender/queue.h>
/*
* IT2S-GN defines a maximum packet size equal to 2360 bytes.
* For indications to the networking layer, a maximum of 2360 bytes for data + 512 bytes for other fields is set.
*/
#define INDICATION_BUFFER_SIZE 2560
enum ID_CHANGE_STAGE {
ID_CHANGE_INACTIVE,
ID_CHANGE_BLOCKED,
ID_CHANGE_PREPARE,
ID_CHANGE_COMMIT
};
typedef struct facilities {
pthread_t ca_service;
pthread_t den_service;
pthread_t infrastructure_service;
pthread_t transmitting;
pthread_t cp_service;
pthread_t sa_service;
pthread_t vc_service;
pthread_t evcsn_service;
pthread_t mcm_service;
// ZMQ
struct {
zmq_pollitem_t* responders;
uint16_t n_responders;
char* networking_address;
char* applications_address;
char* security_address;
char* management_address;
} zmq;
// Transmitter
itss_queue_t* tx_queue;
void* apps_socket; /* alternative to tx queue, only used in rx/main thread */
struct {
uint8_t defaultv;
bool handle_all;
} pver;
// CA
lightship_t lightship;
// DEN
den_t den;
// Infrastructure
infrastructure_t infrastructure;
// CPM
cp_t cp;
// SA
bulletin_t bulletin;
// TP
tolling_t tolling;
// VC
coordination_t coordination;
// EVCSN
evm_args_t evm_args;
// EDM
edm_t edm;
// MCM
mcm_coord_t mcm_coord;
// Logging
struct {
bool recorder;
itss_db_t* dbms;
} logging;
int station_type;
bool use_security;
bool replay;
bool upf;
struct {
uint16_t width;
uint16_t length;
uint8_t role;
} vehicle;
struct {
pthread_mutex_t lock;
uint32_t station_id;
uint8_t ipv6_addr[16];
struct {
pthread_mutex_t lock;
bool random;
int stage;
} change;
} id;
bool exit;
} facilities_t;
extern facilities_t facilities;
#endif