LCOV - code coverage report
Current view: top level - waltz/ip - fd_fib4_private.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 10 10 100.0 %
Date: 2025-03-20 12:08:36 Functions: 6 6 100.0 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_waltz_route_fd_fib4_private_h
       2             : #define HEADER_fd_src_waltz_route_fd_fib4_private_h
       3             : 
       4             : #include "fd_fib4.h"
       5             : 
       6             : struct __attribute__((aligned(FD_FIB4_ALIGN))) fd_fib4_key {
       7             :   /* FIXME optimize this to 8 bytes? */
       8             :   uint addr; /* prefix bits, little endian (low bits outside of mask are undefined) */
       9             :   uint mask; /* bit pattern */
      10             :   uint prio; /* lower is higher */
      11             : };
      12             : 
      13             : typedef struct fd_fib4_key fd_fib4_key_t;
      14             : 
      15             : struct __attribute__((aligned(FD_FIB4_ALIGN))) fd_fib4 {
      16             :   ulong generation;
      17             :   ulong cnt;
      18             :   ulong max;
      19             :   ulong hop_off;
      20             :   /* fd_fib4_key_t[] follows */
      21             :   /* fd_fib4_hop_t[] follows */
      22             : };
      23             : 
      24             : FD_FN_CONST ulong
      25         114 : fd_fib4_key_tbl_laddr( fd_fib4_t const * fib ) {
      26         114 :   return (ulong)fib + sizeof(fd_fib4_t);
      27         114 : }
      28             : 
      29             : FD_FN_PURE ulong
      30         114 : fd_fib4_hop_tbl_laddr( fd_fib4_t const * fib ) {
      31         114 :   return (ulong)fib + fib->hop_off;
      32         114 : }
      33             : 
      34          48 : FD_FN_CONST static inline fd_fib4_key_t const * fd_fib4_key_tbl_const( fd_fib4_t const * fib ) { return (fd_fib4_key_t const *)fd_fib4_key_tbl_laddr( fib ); }
      35          66 : FD_FN_CONST static inline fd_fib4_key_t *       fd_fib4_key_tbl      ( fd_fib4_t *       fib ) { return (fd_fib4_key_t *)      fd_fib4_key_tbl_laddr( fib ); }
      36          48 : FD_FN_CONST static inline fd_fib4_hop_t const * fd_fib4_hop_tbl_const( fd_fib4_t const * fib ) { return (fd_fib4_hop_t const *)fd_fib4_hop_tbl_laddr( fib ); }
      37          66 : FD_FN_CONST static inline fd_fib4_hop_t *       fd_fib4_hop_tbl      ( fd_fib4_t *       fib ) { return (fd_fib4_hop_t *)      fd_fib4_hop_tbl_laddr( fib ); }
      38             : 
      39             : #endif /* HEADER_fd_src_waltz_route_fd_fib4_private_h */

Generated by: LCOV version 1.14