it2s-itss-facilities/src/evm.h

110 lines
2.7 KiB
C

#ifndef FACILITIES_EVM_H
#define FACILITIES_EVM_H
#include <it2s-asn/etsi-its-v1/evcsnm/EI1_EvcsnPdu.h>
#include <it2s-asn/etsi-its-v1/evrsrm/EI1_EV-RSR.h>
#include <it2s-tender/epv.h>
#include <pthread.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <it2s-asn/etsi-its-sdu/itss-networking/EIS_NetworkingIndication.h>
enum EVM_CHECK_R {
EVM_OK,
EVM_INVALID,
EVM_BAD_PERMISSIONS
};
/*
* @brief Analyzes a received EVCSNM
*
* @return A EVM check code
*/
enum EVM_CHECK_R check_evcsnm(EIS_BTPPacketIndication_t *bpi, EI1_EvcsnPdu_t *evcsnm, uint8_t *ssp, uint32_t ssp_len);
/*
* @brief Analyzes a received EVRSRM
*
* @return A EVM check code
*/
enum EVM_CHECK_R check_evrsrm(EIS_BTPPacketIndication_t *bpi, EI1_EV_RSR_t *evrsrm, uint8_t *ssp, uint32_t ssp_len);
/*
* @brief Main CA service
*
* @return NULL
*/
void *evcsn_service();
/**
* @brief Creates a EVCSNM response and sends it
* @param evcsnm_request The EVCSNM request
*
* @return 0 on success, 1 otherwise
*/
int evrsrm_recv(EI1_EV_RSR_t *evrsr_request);
/**
* @brief Creates a pre reservation response.
* @param evrsrm_oer The encoded pre reservation response
* @param evrsrm_len The length of the encoded pre reservation response
*
* @return The reservation response
*/
static int evrsrm_pre_reservation_response(uint8_t *evrsrm_oer, uint32_t *evrsrm_len);
/**
* @brief Creates a reservation response.
* @param evrsrm_oer The encoded reservation response
* @param evrsrm_len The length of the encoded reservation response
*
* @return The reservation response
*/
static int evrsrm_reservation_response(EI1_EV_RSR_t *evrsrm_request, uint8_t *evrsrm_oer, uint32_t *evrsrm_len);
/**
* @brief Creates a reservation cancellation response.
* @param evrsrm_oer The encoded reservation response
* @param evrsrm_len The length of the encoded reservation response
*
* @return The reservation response
*/
static int evrsrm_cancellation_response(EI1_EV_RSR_t *evrsrm_request, uint8_t *evrsrm_oer, uint32_t *evrsrm_len);
/**
* @brief Creates a reservation update response.
* @param evrsrm_oer The encoded reservation response
* @param evrsrm_len The length of the encoded reservation response
*
* @return The reservation response
*/
static int evrsrm_update_response(EI1_EV_RSR_t *evrsrm_request, uint8_t *evrsrm_oer, uint32_t *evrsrm_len);
/**
* Analyses a evcsnm
* @param evcsnm The evcsnm to be analyzed
* @return 0 on success, other value otherwise
*/
int evcsnm_check(EI1_EvcsnPdu_t *evcsnm);
/**
* Analyses a evrsrm
* @param evrsrm The evrsrm to be analyzed
* @return 0 on success, other value otherwise
*/
int evrsrm_check(EI1_EV_RSR_t *evrsrm);
typedef struct evm_args {
bool activate;
} evm_args_t;
#endif