LCOV - code coverage report
Current view: top level - waltz/quic/templ - fd_quic_pretty_print.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 34 0.0 %
Date: 2025-01-08 12:08:44 Functions: 0 0 -

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

Generated by: LCOV version 1.14