Line data Source code
1 : #include <stdio.h> 2 : 3 : #define FD_TEMPL_DEF_STRUCT_BEGIN(NAME) \ 4 : static inline \ 5 : void \ 6 6 : fd_quic_dump_struct_##NAME( fd_quic_##NAME##_t const * data ) { \ 7 6 : (void)data; 8 : 9 : #define FD_QUIC_FMT_uchar "u" 10 : #define FD_QUIC_FMT_ushort "u" 11 : #define FD_QUIC_FMT_uint "u" 12 : #define FD_QUIC_FMT_ulong "lu" 13 : 14 : #define FD_QUIC_HEX_FMT_uchar "x" 15 : #define FD_QUIC_HEX_FMT_ushort "x" 16 : #define FD_QUIC_HEX_FMT_uint "x" 17 : #define FD_QUIC_HEX_FMT_ulong "lx" 18 : 19 : #define FD_TEMPL_MBR_FRAME_TYPE(TYPE,ID_LO,ID_HI) \ 20 3 : if( ID_LO == ID_HI ) { \ 21 3 : printf( " " "frame_type : %x\n", (unsigned)(ID_LO) ); \ 22 3 : } else { \ 23 0 : printf( " " "frame_type : %x - %x\n", (unsigned)(ID_LO), (unsigned)(ID_HI) ); \ 24 0 : } 25 : 26 : #define FD_TEMPL_MBR_ELEM(NAME,TYPE) \ 27 : printf( " " #NAME ": %" FD_QUIC_FMT_##TYPE " 0x%" FD_QUIC_HEX_FMT_##TYPE "\n", data->NAME, data->NAME ); 28 : 29 : #define FD_TEMPL_MBR_ELEM_VARINT(NAME,TYPE) \ 30 9 : printf( " " #NAME ": %" FD_QUIC_FMT_##TYPE " 0x%" FD_QUIC_HEX_FMT_##TYPE "\n", data->NAME, data->NAME ); 31 : 32 : #define FD_TEMPL_MBR_ELEM_PKTNUM(NAME,TYPE) \ 33 : printf( " " #NAME " offset: %u\n", data->NAME##_pnoff ); 34 : 35 : 36 : #define FD_TEMPL_MBR_ELEM_VAR(NAME,MIN,MAX,LEN_NAME) \ 37 : do { \ 38 : printf( " " #NAME ": " ); \ 39 : ulong tmp_len = data->LEN_NAME; \ 40 : if( tmp_len>(MAX) ) tmp_len = MAX; \ 41 : for( ulong j = 0; j < tmp_len; ++j ) { \ 42 : printf( " %2.2x", data->NAME[j] ); \ 43 : } \ 44 : printf( "\n" ); \ 45 : } while(0); 46 : 47 : #define FD_TEMPL_MBR_ELEM_VAR_RAW(NAME,MIN,MAX,LEN_NAME) \ 48 : FD_TEMPL_MBR_ELEM_VAR(NAME,MIN,MAX,LEN_NAME) 49 : 50 : #define FD_TEMPL_MBR_ELEM_RAW(NAME,BYTES) \ 51 : printf( " " #NAME " count: %u\n", (uint)(BYTES) ); \ 52 : do { \ 53 : printf( " " #NAME ": " ); \ 54 : for( ulong j = 0; j < BYTES; ++j ) { \ 55 : printf( " %02x", data->NAME[j] ); \ 56 : } \ 57 : printf( "\n" ); \ 58 : } while(0); 59 : 60 : #define FD_TEMPL_DEF_STRUCT_END(NAME) \ 61 6 : } 62 : 63 : #include "fd_quic_dft.h" 64 :