Line data Source code
1 : #ifdef HEADER_fd_src_waltz_quic_templ_fd_quic_frame_types_templ_h 2 : #error "fd_quic_frame_types_templ.c included twice" 3 : #endif 4 : #define HEADER_fd_src_waltz_quic_templ_fd_quic_frame_types_templ_h 5 : 6 : #include "fd_quic_frame.h" 7 : 8 : /* Lookup table for allowed frame types *******************************/ 9 : 10 : uchar const __attribute__((aligned(0x20))) 11 : fd_quic_frame_type_flags[ FD_QUIC_FRAME_TYPE_CNT ] = { 12 : 13 : #define F(T,MID,NAME,F0,F1,F2,F3,F4) \ 14 : [T] = FD_QUIC_FRAME_FLAG_##F0 + \ 15 : FD_QUIC_FRAME_FLAG_##F1 + \ 16 : FD_QUIC_FRAME_FLAG_##F2 + \ 17 : FD_QUIC_FRAME_FLAG_##F3 + \ 18 : FD_QUIC_FRAME_FLAG_##F4, 19 : FD_QUIC_FRAME_TYPES(F) 20 : #undef F 21 : 22 : }; 23 : 24 : 25 : /* Lookup table for frame metric IDs **********************************/ 26 : 27 : static uchar const __attribute__((aligned(0x20))) 28 : fd_quic_frame_metric_id[ FD_QUIC_FRAME_TYPE_CNT ] = { 29 : # define F(T,MID,...) [T] = (MID), 30 : FD_QUIC_FRAME_TYPES(F) 31 : # undef F 32 : }; 33 : 34 : 35 : /* Frame handlers *****************************************************/ 36 : 37 : /* Generate frame interpreter (decode + handle) */ 38 : 39 : #define FD_TEMPL_DEF_STRUCT_BEGIN(NAME) \ 40 : static ulong fd_quic_interpret_##NAME( \ 41 : fd_quic_frame_ctx_t * const ctx, \ 42 : uchar const * const buf, \ 43 : ulong const buf_sz \ 44 95299626 : ) { \ 45 95299626 : fd_quic_##NAME##_t frame[1]; \ 46 95299626 : uchar const * p0 = buf; \ 47 95299626 : uchar const * const p1 = buf+buf_sz; \ 48 95299626 : ulong rc; \ 49 95299626 : \ 50 95299626 : rc = fd_quic_decode_##NAME( frame, p0, (ulong)(p1-p0) ); \ 51 95299626 : if( FD_UNLIKELY( rc==FD_QUIC_PARSE_FAIL ) ) return FD_QUIC_PARSE_FAIL;\ 52 95299626 : p0 += rc; \ 53 95299626 : \ 54 95299626 : rc = fd_quic_handle_##NAME( ctx, frame, p0, (ulong)(p1-p0) ); \ 55 95299626 : if( FD_UNLIKELY( rc==FD_QUIC_PARSE_FAIL ) ) return FD_QUIC_PARSE_FAIL;\ 56 95299626 : p0 += rc; \ 57 95299596 : \ 58 95299596 : return (ulong)(p0-buf); \ 59 95299626 : } 60 : #include "fd_quic_dft.h" 61 : #include "fd_quic_frames_templ.h" 62 : #include "fd_quic_undefs.h"