Line data Source code
1 : /* QUIC encoders footprint */ 2 : 3 : /* used to find max encoding sizes for compile time allocations 4 : constructs structs with char arrays to determine the sizes 5 : this avoids the need for packed 6 : then a simple sizeof does the job */ 7 : 8 : /* returns the max footprint for a given frame */ 9 : #define FD_QUIC_MAX_FOOTPRINT(NAME) \ 10 12727137 : (sizeof(struct fd_quic_max_fp_struct_##NAME)) 11 : 12 : /* "returns" the number of bytes encoded */ 13 : #define FD_TEMPL_ENCODE_FP(TYPE) ( sizeof(fd_quic_##TYPE) ) 14 : 15 : /* returns bytes to be encoded */ 16 : #define FD_TEMPL_DEF_STRUCT_BEGIN(NAME) \ 17 : struct fd_quic_max_fp_struct_##NAME { 18 : 19 : /* 1 byte for TYPE */ 20 : #define FD_TEMPL_MBR_FRAME_TYPE(NAME,ID_LO,ID_HI) \ 21 : char type[1]; 22 : 23 : 24 : /* determines footprint of element */ 25 : #define FD_TEMPL_MBR_ELEM(NAME,TYPE) \ 26 : char NAME[FD_TEMPL_ENCODE_FP(TYPE)]; 27 : 28 : 29 : /* determines the encoding footprint of the PKTNUM */ 30 : #define FD_TEMPL_MBR_ELEM_PKTNUM(NAME,TYPE) \ 31 : char NAME[8]; 32 : 33 : 34 : /* determines the encoding footprint of the VARINT */ 35 : #define FD_TEMPL_MBR_ELEM_VARINT(NAME,TYPE) \ 36 : char NAME[8]; 37 : 38 : 39 : #define FD_TEMPL_MBR_ELEM_VAR(NAME,MIN,MAX,LEN_NAME) \ 40 : char NAME[MAX]; 41 : 42 : 43 : #define FD_TEMPL_MBR_ELEM_VAR_RAW(NAME,MIN,MAX,LEN_NAME) \ 44 : char NAME[MAX]; 45 : 46 : 47 : #define FD_TEMPL_MBR_ELEM_RAW(NAME,BYTES) \ 48 : char NAME[BYTES]; 49 : 50 : 51 : /* at end, return the number of bytes consumed */ 52 : #define FD_TEMPL_DEF_STRUCT_END(NAME) \ 53 : }; 54 : 55 : #include "fd_quic_dft.h" 56 :