-
Notifications
You must be signed in to change notification settings - Fork 0
/
fec_srv6.h
80 lines (68 loc) · 1.78 KB
/
fec_srv6.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef FEC_SRH_H_
#define FEC_SRH_H_
#define TLV_CODING_SOURCE 28
#define TLV_CODING_REPAIR 29
#define MAX_PACKET_SIZE 65536
#define my_memset(ptr, size) ({\
__u64 *____ptr_64 = (__u64 *)ptr;\
for (__u16 ____i = 0; ____i < size / 8; ++____i) {\
____ptr_64[____i] = 0;\
}\
})
#define my_memcpy(ptr1, ptr2, size) ({\
__u64 *____ptr1_64 = (__u64 *)ptr1;\
__u64 *____ptr2_64 = (__u64 *)ptr2;\
for (__u16 ____i = 0; ____i < size / 8; ++____i) {\
____ptr1_64[____i] = ____ptr2_64[____i];\
}\
})
#define BPF_PACKET_HEADER __attribute__((packed))
// Block FEC Framework
#define MAX_BLOCK_SIZE 10
struct tlvSource__block_t {
__u8 tlv_type;
__u8 len;
__u16 padding;
__u16 sourceBlockNb;
__u16 sourceSymbolNb;
} BPF_PACKET_HEADER;
struct tlvRepair__block_t {
__u8 tlv_type;
__u8 len;
__u16 unused;
__u16 sourceBlockNb;
__u16 repairSymbolNb; // Will not be used for now
__u32 repairFecInfo; // Repair FEC Information (32 bits)
__u16 payload_len; // Payload length in bytes
__u8 nss; // Number of Source Symbols
__u8 nrs; // Number of Repair Symbols
} BPF_PACKET_HEADER;
// Convolutional FEC FRamework
#define MAX_RLC_WINDOW_SIZE 16
#define MAX_RLC_WINDOW_SLIDE 5
#define MAX_RLC_REPAIR_GEN 8
struct tlvSource__convo_t {
__u8 tlv_type;
__u8 len;
__u16 controller_update;
__u32 encodingSymbolID;
} BPF_PACKET_HEADER;
struct tlvRepair__convo_t {
__u8 tlv_type;
__u8 len;
__u16 controller_update;
__u32 encodingSymbolID;
__u32 repairFecInfo;
__u16 coded_payload_len;
__u8 nss;
__u8 nrs;
} BPF_PACKET_HEADER;
// Controller
typedef struct {
__u8 tlv_type;
__u8 len;
__u16 padding;
__u16 received_counter;
__u16 theoretical_counter;
} tlv_controller_t;
#endif