Line data Source code
1 : #ifndef HEADER_fd_src_disco_shred_fd_fec_set_h 2 : #define HEADER_fd_src_disco_shred_fd_fec_set_h 3 : 4 : #include "../../ballet/shred/fd_shred.h" 5 : #include "../../tango/fd_tango_base.h" 6 : 7 0 : #define FD_FEC_SHRED_CNT 32 8 : 9 : /* Maximum number of FECs in a slot is max number of shreds in a slot / 32 shreds per FEC */ 10 0 : #define FD_FEC_BLK_MAX (FD_SHRED_BLK_MAX / FD_FEC_SHRED_CNT) 11 : 12 : /* When using Merkle shreds, an FEC set is essentially the transmission 13 : granularity. Each FEC set has likely dozens of packets, but you have 14 : to construct the entire FEC set before you can send the first byte. 15 : Similarly, on the receive side, in order to validate an FEC set, you 16 : have to receive or reconstruct the whole thing. */ 17 : 18 : struct __attribute__((aligned(FD_CHUNK_ALIGN))) fd_fec_set { 19 : /* Compact bitset of whether we've received the shred or not. */ 20 : uint data_shred_rcvd; 21 : uint parity_shred_rcvd; 22 : 23 : union { 24 : fd_shred_t s[ 1 ]; 25 : uchar b[ FD_SHRED_MAX_SZ ]; /* could be min_sz */ 26 : } data_shreds[ FD_FEC_SHRED_CNT ]; 27 : union { 28 : fd_shred_t s[ 1 ]; 29 : uchar b[ FD_SHRED_MAX_SZ ]; 30 : } parity_shreds[ FD_FEC_SHRED_CNT ]; 31 : }; 32 : typedef struct fd_fec_set fd_fec_set_t; 33 : 34 : #endif /* HEADER_fd_src_disco_shred_fd_fec_set_h */