-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmpis-table.h
43 lines (31 loc) · 968 Bytes
/
mpis-table.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef MPIS_TABLE_H
#define MPIS_TABLE_H
#include <stdint.h>
#include <unistd.h>
#define TTYPE_ENCAP 0x01
#define TTYPE_DECAP 0x02
#define TTYPE_SWAP 0x03
#define TFLAG_BYPASS_LINUX 0b00000001
#define TFLAG_OVERRIDE_FRAG 0b00000010
typedef struct _mpis_table {
uint32_t iif;
uint32_t selector;
uint32_t target;
// mask & cidr: valid if action is not swap
uint32_t mask;
uint8_t cidr;
// valid if type is not decap. data is cutoff-ttl value.
uint8_t target_data;
// TTYPE_*
uint8_t target_type;
// TFLAG_*
uint8_t target_flags;
} mpis_table;
void new_table();
void end_table();
mpis_table *get_table();
void add_entry(uint8_t target_type, const char *ifname, uint32_t selector, uint32_t target, uint8_t cidr, uint32_t target_data, uint8_t flags);
void store_retval(int retval);
int get_retval();
ssize_t parse_routes(const char *filename, mpis_table **table);
#endif // MPIS_TABLE_H