LCOV - code coverage report
Current view: top level - waltz/quic - fd_quic_enum.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 25 32 78.1 %
Date: 2025-10-27 04:40:00 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_waltz_quic_fd_quic_enum_h
       2             : #define HEADER_fd_src_waltz_quic_fd_quic_enum_h
       3             : 
       4             : /* FD_QUIC_STREAM_TYPE_* indicate stream type (two least significant
       5             :    bits of a stream ID) */
       6             : #define FD_QUIC_STREAM_TYPE_BIDI_CLIENT 0
       7             : #define FD_QUIC_STREAM_TYPE_BIDI_SERVER 1
       8     1579542 : #define FD_QUIC_STREAM_TYPE_UNI_CLIENT  2
       9     1263603 : #define FD_QUIC_STREAM_TYPE_UNI_SERVER  3
      10             : 
      11             : /* FD_QUIC_{SUCCESS,FAILED} are used for error return codes. */
      12   357412942 : #define FD_QUIC_SUCCESS (0)
      13     4068177 : #define FD_QUIC_FAILED  (1)
      14             : 
      15             : /* FD_QUIC_TYPE_{UNI,BI}DIR indicate stream type. */
      16             : #define FD_QUIC_TYPE_BIDIR  (0)
      17             : #define FD_QUIC_TYPE_UNIDIR (1)
      18             : 
      19             : /* FD_QUIC_ALIGN specifies the alignment needed for an fd_quic_t.
      20             :    This is provided to facilitate compile-time QUIC declarations.
      21             :    Also see fd_quic_align() */
      22        4395 : #define FD_QUIC_ALIGN (4096UL)  /* 4KiB */
      23             : 
      24             : /* FD_QUIC_MTU is the assumed network link MTU in bytes, including L2
      25             :    and L3 headers. */
      26        2088 : #define FD_QUIC_MTU (1500)
      27             : 
      28             : /* FD_QUIC_SHORTEST_PKT is the smallest possible byte size of a QUIC v1
      29             :    packet. */
      30           0 : #define FD_QUIC_SHORTEST_PKT (16)
      31             : 
      32             : /* FD_QUIC_INITIAL_PAYLOAD_SZ_MIN is the min byte size of the UDP payload
      33             :    of Initial-type packets.  Mandated for both clients and servers as a
      34             :    form of MTU discovery and to mitigate amplification attacks.  See
      35             :    RFC 9000 Section 14.1:
      36             :    https://datatracker.ietf.org/doc/html/rfc9000#name-initial-datagram-size */
      37      364017 : #define FD_QUIC_INITIAL_PAYLOAD_SZ_MIN (1200)
      38      350763 : #define FD_QUIC_INITIAL_PAYLOAD_SZ_MAX (FD_QUIC_INITIAL_PAYLOAD_SZ_MIN)
      39             : 
      40             : /* FD_QUIC_MAX_PAYLOAD_SZ is the max byte size of the UDP payload of any
      41             :    QUIC packets.  Derived from FD_QUIC_MTU by subtracting the typical
      42             :    IPv4 header (no options) and UDP header sizes. */
      43             : #define FD_QUIC_MAX_PAYLOAD_SZ (FD_QUIC_MTU - 20 - 8)
      44             : 
      45             : /* FD_QUIC_ROLE_{CLIENT,SERVER} identify the fd_quic_t's role as a
      46             :    client or server. */
      47       49182 : #define FD_QUIC_ROLE_CLIENT 1
      48      306432 : #define FD_QUIC_ROLE_SERVER 2
      49             : 
      50             : /* FD_QUIC_SEND_ERR_* are negative int error codes indicating a stream
      51             :    send failure.
      52             :    ...INVAL_STREAM: Not allowed to send for stream ID (e.g. not open)
      53             :    ...INVAL_CONN:   Connection not in valid state for sending
      54             :    ...FIN:          Not allowed to send, stream finished
      55             :    ...STREAM_STATE: Stream is not (yet) in valid state to send
      56             :    ...FLOW:         Out of buffer space, retry later */
      57           0 : #define FD_QUIC_SEND_ERR_INVAL_STREAM (-1)
      58           0 : #define FD_QUIC_SEND_ERR_INVAL_CONN   (-2)
      59           0 : #define FD_QUIC_SEND_ERR_FIN          (-3)
      60           0 : #define FD_QUIC_SEND_ERR_STREAM_STATE (-4)
      61           0 : #define FD_QUIC_SEND_ERR_FLOW         (-5)
      62             : 
      63             : /* FD_QUIC_MIN_CONN_ID_CNT: min permitted conn ID count per conn */
      64           0 : #define FD_QUIC_MIN_CONN_ID_CNT (4UL)
      65             : 
      66             : /* FD_QUIC_DEFAULT_SPARSITY: default fd_quic_limits_t->conn_id_sparsity */
      67       16131 : #define FD_QUIC_DEFAULT_SPARSITY (2.5)
      68             : 
      69             : /* FD_QUIC_STREAM_NOTIFY_* indicate stream notification types.
      70             :    All events indicate that stream lifetime has ended and no more
      71             :    callbacks will be generated for it.  The stream object will be freed
      72             :    after event delivery.
      73             : 
      74             :    ...END:        All stream data was transmitted successfully
      75             :    ...PEER_RESET: Peer has ceased sending non-gracefully
      76             :    ...PEER_STOP:  Peer has requested us to stop sending
      77             :    ...DROP:       Local side dropped the stream
      78             :    ...CONN:       Stream aborted due to conn close */
      79    17526491 : #define FD_QUIC_STREAM_NOTIFY_END        (0)
      80             : #define FD_QUIC_STREAM_NOTIFY_PEER_RESET (1)
      81             : #define FD_QUIC_STREAM_NOTIFY_PEER_STOP  (2)
      82             : #define FD_QUIC_STREAM_NOTIFY_DROP       (3)
      83       12082 : #define FD_QUIC_STREAM_NOTIFY_CONN       (4)
      84             : 
      85             : /* FD_QUIC_PKT_TYPE_{...}: QUIC v1 packet types.
      86             :    INITIAL, ZERO_RTT, HANDSHAKE, and RETRY match the long_packet_type
      87             :    field. */
      88       52056 : #define FD_QUIC_PKT_TYPE_INITIAL   (0)
      89          78 : #define FD_QUIC_PKT_TYPE_ZERO_RTT  (1)
      90       48582 : #define FD_QUIC_PKT_TYPE_HANDSHAKE (2)
      91         150 : #define FD_QUIC_PKT_TYPE_RETRY     (3)
      92   121398487 : #define FD_QUIC_PKT_TYPE_ONE_RTT   (4)
      93             : 
      94             : /* FD_QUIC_PKT_COALESCE_LIMIT controls how many QUIC long packets are
      95             :    handled in the same datagram. */
      96       53340 : #define FD_QUIC_PKT_COALESCE_LIMIT (4)
      97             : 
      98             : /* AES-128-GCM secret params */
      99             : #define FD_QUIC_INITIAL_SECRET_SZ 32
     100       97944 : #define FD_QUIC_SECRET_SZ         32
     101             : #define FD_QUIC_HP_SAMPLE_SZ      16
     102             : #define FD_QUIC_NONCE_SZ          12
     103             : 
     104             : /* FD_QUIC_RETRY_MAX_TOKEN_SZ is the max permitted Retry Token size that
     105             :    fd_quic clients will accept.  This is unfortunately not specified by
     106             :    RFC 9000. */
     107             : #define FD_QUIC_RETRY_MAX_TOKEN_SZ (256UL)
     108             : /* RETRY secret size in bytes */
     109        3390 : #define FD_QUIC_RETRY_SECRET_SZ 16
     110             : /* RETRY iv size in bytes */
     111        3390 : #define FD_QUIC_RETRY_IV_SZ 12
     112             : 
     113    64502892 : #define FD_QUIC_STREAM_ID_UNUSED (ULONG_MAX)
     114             : 
     115             : #define FD_QUIC_PKT_NUM_UNUSED  (~0ul)
     116             : #define FD_QUIC_PKT_NUM_PENDING (~1ul)
     117             : 
     118             : /* scheduling granularity */
     119             : /* does not need to be remotely accurate */
     120             : /* used for calculating an upper bound on the expected response of an ack */
     121             : #define FD_QUIC_SCHED_GRANULARITY_US 10.0f
     122             : 
     123             : /* RTT probe period */
     124             : /* used to bound the time between RTT measurements */
     125      314385 : #define FD_QUIC_RTT_PERIOD_US 60e6f
     126             : 
     127             : /* initial RTT, used before it's measured */
     128     1257540 : #define FD_QUIC_INITIAL_RTT_US 200e3f
     129             : 
     130             : #endif /* HEADER_fd_src_waltz_quic_fd_quic_enum_h */

Generated by: LCOV version 1.14