Line data Source code
1 : #define FD_TEMPL_DEF_STRUCT_BEGIN(NAME) \ 2 : static inline \ 3 : void \ 4 6 : fd_quic_dump_struct_##NAME( fd_quic_##NAME##_t const * data ) { \ 5 6 : (void)data; 6 : 7 : #define FD_QUIC_FMT_uchar "u" 8 : #define FD_QUIC_FMT_ushort "u" 9 : #define FD_QUIC_FMT_uint "u" 10 : #define FD_QUIC_FMT_ulong "lu" 11 : 12 : #define FD_QUIC_HEX_FMT_uchar "x" 13 : #define FD_QUIC_HEX_FMT_ushort "x" 14 : #define FD_QUIC_HEX_FMT_uint "x" 15 : #define FD_QUIC_HEX_FMT_ulong "lx" 16 : 17 : #define FD_TEMPL_MBR_FRAME_TYPE(TYPE,ID_LO,ID_HI) \ 18 3 : if( ID_LO == ID_HI ) { \ 19 3 : printf( " " "frame_type : %x\n", (unsigned)(ID_LO) ); \ 20 3 : } else { \ 21 0 : printf( " " "frame_type : %x - %x\n", (unsigned)(ID_LO), (unsigned)(ID_HI) ); \ 22 0 : } 23 : 24 : #define FD_TEMPL_MBR_ELEM(NAME,TYPE) \ 25 : printf( " " #NAME ": %" FD_QUIC_FMT_##TYPE " 0x%" FD_QUIC_HEX_FMT_##TYPE "\n", data->NAME, data->NAME ); 26 : 27 : #define FD_TEMPL_MBR_ELEM_VARINT(NAME,TYPE) \ 28 9 : printf( " " #NAME ": %" FD_QUIC_FMT_##TYPE " 0x%" FD_QUIC_HEX_FMT_##TYPE "\n", data->NAME, data->NAME ); 29 : 30 : #define FD_TEMPL_MBR_ELEM_PKTNUM(NAME,TYPE) \ 31 : printf( " " #NAME " offset: %u\n", data->NAME##_pnoff ); 32 : 33 : 34 : #define FD_TEMPL_MBR_ELEM_VAR(NAME,BITS_MIN,BITS_MAX,LEN_NAME) \ 35 : do { \ 36 : printf( " " #NAME ": " ); \ 37 : ulong tmp_len = data->LEN_NAME; \ 38 : if( tmp_len * 8 > BITS_MAX ) tmp_len = ( BITS_MAX + 7 ) / 8; \ 39 : for( ulong j = 0; j < tmp_len; ++j ) { \ 40 : printf( " %2.2x", data->NAME[j] ); \ 41 : } \ 42 : printf( "\n" ); \ 43 : } while(0); 44 : 45 : #define FD_TEMPL_MBR_ELEM_VAR_RAW(NAME,BITS_MIN,BITS_MAX,LEN_NAME) \ 46 : do { \ 47 : printf( " " #NAME ": " ); \ 48 : ulong tmp_len = data->LEN_NAME; \ 49 : if( tmp_len * 8 > BITS_MAX ) tmp_len = ( BITS_MAX + 7 ) / 8; \ 50 : for( ulong j = 0; j < tmp_len; ++j ) { \ 51 : printf( " %2.2x", data->NAME[j] ); \ 52 : } \ 53 : printf( "\n" ); \ 54 : } while(0); 55 : 56 : #define FD_TEMPL_MBR_ELEM_ARRAY(NAME,TYPE,BYTES_MIN,BYTES_MAX) \ 57 : printf( " " #NAME " count: %u\n", data->NAME##_len ); \ 58 : do { \ 59 : printf( " " #NAME ": " ); \ 60 : ulong tmp_len = data->NAME##_len; \ 61 : if( tmp_len > BYTES_MAX ) tmp_len = BYTES_MAX; \ 62 : for( ulong j = 0; j < tmp_len; ++j ) { \ 63 : printf( " %" FD_QUIC_HEX_FMT_##TYPE, data->NAME[j] ); \ 64 : } \ 65 : printf( "\n" ); \ 66 : } while(0); 67 : 68 : #define FD_TEMPL_MBR_ELEM_FIXED(NAME,TYPE,BYTES) \ 69 : printf( " " #NAME " count: %u\n", (uint)(BYTES) ); \ 70 : do { \ 71 : printf( " " #NAME ": " ); \ 72 : for( ulong j = 0; j < BYTES; ++j ) { \ 73 : printf( " %" FD_QUIC_HEX_FMT_##TYPE, data->NAME[j] ); \ 74 : } \ 75 : printf( "\n" ); \ 76 : } while(0); 77 : 78 : #define FD_TEMPL_MBR_OPT(STRUCT,NAME,COND,TEMPL) \ 79 : TEMPL 80 : 81 : #define FD_TEMPL_DEF_STRUCT_END(NAME) \ 82 6 : } 83 : 84 : #include "fd_quic_dft.h" 85 :