LCOV - code coverage report
Current view: top level - app/shared_dev/commands/quic_trace - fd_quic_trace.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 16 0.0 %
Date: 2025-09-16 04:29:32 Functions: 0 4 0.0 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_app_fddev_quic_trace_fd_quic_trace_h
       2             : #define HEADER_fd_src_app_fddev_quic_trace_fd_quic_trace_h
       3             : 
       4             : #include "../../../shared/fd_config.h"
       5             : #include "../../../shared/fd_action.h"
       6             : #include "../../../../disco/net/fd_net_tile.h"
       7             : #include "../../../../disco/quic/fd_quic_tile.h"
       8             : #include "../../../../waltz/quic/fd_quic_private.h"
       9             : 
      10             : /* map cpeer_conn_id->conn_idx */
      11             : struct peer_conn_id_map {
      12             :   ulong             conn_id;  /* the peer conn_id isn't restricted to len 8 */
      13             :                               /* however, we don't know the size, so we assume */
      14             :                               /* the size is at least 8, and truncate the rest */
      15             :   uint              hash;     /* for memoizing the hash value */
      16             :   uint              conn_idx; /* the connection index */
      17             : };
      18             : 
      19             : typedef struct peer_conn_id_map peer_conn_id_map_t;
      20             : 
      21             : #define MAP_NAME              peer_conn_id_map
      22           0 : #define MAP_KEY               conn_id
      23           0 : #define MAP_T                 peer_conn_id_map_t
      24           0 : #define PEER_MAP_LG_SLOT_CNT  20
      25           0 : #define MAP_LG_SLOT_CNT       PEER_MAP_LG_SLOT_CNT
      26             : #include "../../../../util/tmpl/fd_map.c"
      27             : 
      28             : /* fd_quic_trace_ctx_remote is the original fd_quic_ctx_t, but the
      29             :    pointer itself is in the local address space. */
      30             : extern void const         *  fd_quic_trace_tile_ctx_remote; /* local ptr to remote ctx */
      31             : extern ulong                 fd_quic_trace_tile_ctx_raddr;  /* remote addr of remote ctx */
      32             : extern ulong volatile     *  fd_quic_trace_link_metrics;
      33             : extern void const         *  fd_quic_trace_log_base;
      34             : extern peer_conn_id_map_t    _fd_quic_trace_peer_map[1UL<<PEER_MAP_LG_SLOT_CNT];
      35             : extern peer_conn_id_map_t *  fd_quic_trace_peer_map;
      36             : 
      37             : /* fd_quic_trace_target_fseq are the fseq counters published by the
      38             :    target quic tile */
      39             : 
      40             : extern ulong ** fd_quic_trace_target_fseq;
      41             : 
      42             : struct fd_quic_trace_ctx {
      43             :   int   dump;         /* whether the user requested --dump */
      44             :   int   dump_config;  /* whether the user requested --dump-config */
      45             :   int   dump_conns;   /* whether the user requested --dump-conns */
      46             :   int   trace_send;   /* whether the user requested tracing send tile (1) or quic tile (0) */
      47             :   ulong net_out_base; /* base address of net-out chunks in local addr space */
      48             : 
      49             :   fd_quic_t * quic;  /* local join to remote quic */
      50             :   fd_net_rx_bounds_t net_in_bounds[1]; /* bounds of net-in chunks in local addr space */
      51             :   uchar buffer[ FD_NET_MTU ];
      52             : };
      53             : 
      54             : typedef struct fd_quic_trace_ctx fd_quic_trace_ctx_t;
      55             : 
      56             : struct fd_quic_trace_frame_ctx {
      57             :   ulong  conn_id;
      58             :   uint   src_ip;
      59             :   ushort src_port;
      60             :   uchar  pkt_type;
      61             :   ulong  pkt_num;
      62             : };
      63             : 
      64             : typedef struct fd_quic_trace_frame_ctx fd_quic_trace_frame_ctx_t;
      65             : 
      66           0 : #define translate_ptr( ptr ) __extension__({                   \
      67           0 :   ulong rel   = (ulong)(ptr) - fd_quic_trace_tile_ctx_raddr; \
      68           0 :   ulong laddr = (ulong)fd_quic_trace_tile_ctx_remote + rel;  \
      69           0 :   (__typeof__(ptr))(laddr);                                  \
      70           0 : })
      71             : 
      72           0 : #define tile_member( ctx_ptr, field, is_send ) \
      73           0 : *fd_ptr_if( is_send, &(((fd_send_tile_ctx_t*)(ctx_ptr))->field), &(((fd_quic_ctx_t*)(ctx_ptr))->field))
      74             : 
      75             : 
      76             : FD_PROTOTYPES_BEGIN
      77             : 
      78             : void
      79             : fd_quic_trace_frames( fd_quic_trace_frame_ctx_t * context,
      80             :                       uchar               const * data,
      81             :                       ulong                       data_sz );
      82             : 
      83             : void
      84             : fd_quic_trace_rx_tile( fd_quic_trace_ctx_t  * trace_ctx,
      85             :                        fd_frag_meta_t const * rx_mcache,
      86             :                        fd_frag_meta_t const * tx_mcache );
      87             : 
      88             : void
      89             : fd_quic_trace_log_tile( fd_quic_trace_ctx_t  * ctx,
      90             :                         fd_frag_meta_t const * in_mcache );
      91             : 
      92             : static inline fd_quic_conn_t const *
      93           0 : fd_quic_trace_conn_at_idx( fd_quic_t const * quic, ulong idx ) {
      94           0 :   fd_quic_state_t const * state = fd_quic_get_state_const( quic );
      95           0 :   ulong const local_conn_base   = translate_ptr( state->conn_base );
      96           0 :   return (fd_quic_conn_t *)( local_conn_base + idx * state->conn_sz );
      97           0 : }
      98             : 
      99             : FD_PROTOTYPES_END
     100             : 
     101             : 
     102             : extern action_t fd_action_quic_trace;
     103             : 
     104             : #endif /* HEADER_fd_src_app_fddev_quic_trace_fd_quic_trace_h */

Generated by: LCOV version 1.14