#ifndef FACILITIES_DENM_H #define FACILITIES_DENM_H #include #include #include #include enum EVENT_STATE { EVENT_ACTIVE, EVENT_CANCELLED, EVENT_NEGATED }; typedef struct event { uint64_t id; DENM_t *denm; uint32_t station_id; uint32_t sn; uint64_t detection_time; uint64_t reference_time; uint64_t expiration_time; int32_t latitude; int32_t longitude; bool enabled; enum EVENT_STATE state; } event_t; typedef struct den { event_t ** events; uint32_t sn; uint16_t n_stored_events; uint16_t n_active_events; uint16_t n_cancelled_events; uint16_t n_negated_events; uint16_t n_max_events; uint32_t default_event_duration; pthread_mutex_t lock; } den_t; enum EVENT_CHECK_RESULT { EVENT_NEW, EVENT_INVALID, EVENT_PASSED, EVENT_CANCELLATION, EVENT_NEGATION, EVENT_UPDATE, EVENT_REPEATED, EVENT_NUMBER_EXCEEDED }; typedef struct cc_ssp_bm { const char* cause_type; const int cause_code; const uint32_t bitmap_val; } cc_ssp_bm_t; /** * Evaluate a DENM event. * Does all the checks to a DENM and adds it to the database. *Don't* free the DENM struct after calling this function * @param den the DEN service struct * @param denm the DENM to evaluate * @param id message intra ITS-S identitifier * @param ssp permissions * @return 0 if event OK, 1 if event NOK */ int event_manage(den_t* den, DENM_t* denm, int64_t* id, uint8_t* ssp, uint32_t ssp_len); void* den_service(void* fc); #endif