LCOV - code coverage report
Current view: top level - waltz/quic - fd_quic_enum.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 25 31 80.6 %
Date: 2024-11-13 11:58:15 Functions: 0 0 -

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

Generated by: LCOV version 1.14