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