45 lines
854 B
C
45 lines
854 B
C
#pragma once
|
|
|
|
#include <saem/SAEM.h>
|
|
#include <stdint.h>
|
|
|
|
#define MAX_ANNOUNCEMENTS_LEN 32
|
|
|
|
typedef struct announcement {
|
|
uint32_t its_aid;
|
|
uint8_t protocol_id;
|
|
uint8_t traffic_class;
|
|
|
|
struct {
|
|
uint8_t ipv6_addr[16];
|
|
uint16_t port;
|
|
} endpoint;
|
|
|
|
uint64_t station_id;
|
|
uint64_t timestamp;
|
|
|
|
uint32_t n_trigger;
|
|
} announcement_t;
|
|
|
|
typedef struct bulletin {
|
|
announcement_t* to_consume[MAX_ANNOUNCEMENTS_LEN];
|
|
uint8_t to_consume_len;
|
|
|
|
announcement_t* to_provide[16];
|
|
uint8_t to_provide_len;
|
|
|
|
pthread_mutex_t lock;
|
|
} bulletin_t;
|
|
|
|
typedef enum SAEM_CODE {
|
|
SAEM_OK,
|
|
SAEM_INVALID_HEADER_MESSAGE_ID,
|
|
SAEM_INVALID_HEADER_VERSION
|
|
} SAEM_CODE_R;
|
|
|
|
void bulletin_init(bulletin_t* bulletin);
|
|
|
|
SAEM_CODE_R saem_check(void* fc, bulletin_t* bulletin, SAEM_t* saem);
|
|
|
|
void* sa_service(void* fc);
|