Line data Source code
1 : /* QUIC encoders footprint */ 2 : 3 : /* used to define functions for determining footprint upper bound 4 : without encoding the data */ 5 : 6 : /* "returns" the number of bytes encoded */ 7 : #define FD_TEMPL_ENCODE_FP(TYPE) ( sizeof(fd_quic_##TYPE) ) 8 : 9 : /* returns bytes to be encoded */ 10 : #define FD_TEMPL_DEF_STRUCT_BEGIN(NAME) \ 11 6 : ulong fd_quic_encode_footprint_##NAME( fd_quic_##NAME##_t * frame ) { \ 12 6 : (void)frame; \ 13 6 : ulong buf = 0; \ 14 6 : ulong tmp_len = 0; (void)tmp_len; \ 15 : 16 : /* 1 byte for TYPE */ 17 : #define FD_TEMPL_MBR_FRAME_TYPE(NAME,ID_LO,ID_HI) \ 18 6 : buf++; 19 : 20 : 21 : /* determines footprint of element */ 22 : #define FD_TEMPL_MBR_ELEM(NAME,TYPE) \ 23 : buf += FD_TEMPL_ENCODE_FP(TYPE); \ 24 : 25 : 26 : /* worst case pktnum encoded size */ 27 : #define FD_TEMPL_MBR_ELEM_PKTNUM(NAME,TYPE) \ 28 : buf += 4; 29 : 30 : 31 : /* worst case varint encoded size */ 32 : #define FD_TEMPL_MBR_ELEM_VARINT(NAME,TYPE) \ 33 12 : buf += 8; \ 34 : 35 : 36 : #define FD_TEMPL_MBR_ELEM_VAR(NAME,MIN,MAX,LEN_NAME) \ 37 : tmp_len = frame->LEN_NAME; \ 38 : buf += tmp_len; 39 : 40 : 41 : #define FD_TEMPL_MBR_ELEM_VAR_RAW(NAME,MIN,MAX,LEN_NAME) \ 42 : tmp_len = frame->LEN_NAME; \ 43 : buf += tmp_len; 44 : 45 : #define FD_TEMPL_MBR_ELEM_RAW(NAME,BYTES) \ 46 : buf += (BYTES); 47 : 48 : /* at end, return the number of bytes consumed */ 49 : #define FD_TEMPL_DEF_STRUCT_END(NAME) \ 50 6 : return buf; \ 51 6 : } 52 : 53 : #include "fd_quic_dft.h" 54 :