109 lines
2.6 KiB
C
109 lines
2.6 KiB
C
#ifndef FACILITIES_EVM_H
|
|
#define FACILITIES_EVM_H
|
|
|
|
#include <it2s-asn/evcsnm/EvcsnPdu.h>
|
|
#include <it2s-asn/evrsrm/EV-RSR.h>
|
|
#include <it2s-asn/itss-transport/BTPPacketIndication.h>
|
|
#include <it2s-tender/epv.h>
|
|
#include <pthread.h>
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include <stdlib.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(BTPPacketIndication_t *bpi, 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(BTPPacketIndication_t *bpi, 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(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(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(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(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(EvcsnPdu_t *evcsnm);
|
|
|
|
/**
|
|
* Analyses a evrsrm
|
|
* @param evrsrm The evrsrm to be analyzed
|
|
* @return 0 on success, other value otherwise
|
|
*/
|
|
int evrsrm_check(EV_RSR_t *evrsrm);
|
|
|
|
typedef struct evm_args {
|
|
bool activate;
|
|
} evm_args_t;
|
|
|
|
#endif
|