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 0 : #define FD_QUIC_STREAM_TYPE_UNI_CLIENT 2 7 0 : #define FD_QUIC_STREAM_TYPE_UNI_SERVER 3 8 : 9 0 : #define FD_QUIC_DEFAULT_INITIAL_RX_MAX_STREAM_DATA 1280 /* IPv6 minimum MTU */ 10 : 11 : /* FD_QUIC_STREAM_TX_OVERHEAD bounds the bytes a packet built by 12 : fd_quic_conn_tx_stream holds besides its STREAM frames: short header 13 : (1+20+4), ACK frames (128), AEAD tag (16). FD_QUIC_STREAM_TX_MAX is 14 : the largest stream that fits such a packet (STREAM frame header is 15 : 1+8+2 bytes). */ 16 : 17 0 : #define FD_QUIC_STREAM_TX_OVERHEAD (169UL) 18 0 : #define FD_QUIC_STREAM_TX_MAX (1200UL-FD_QUIC_STREAM_TX_OVERHEAD-11UL) 19 : 20 : /* FD_QUIC_{SUCCESS,FAILED} are used for error return codes. */ 21 0 : #define FD_QUIC_SUCCESS (0) 22 0 : #define FD_QUIC_FAILED (1) 23 : 24 : /* FD_QUIC_ALIGN specifies the alignment needed for an fd_quic_t. 25 : This is provided to facilitate compile-time QUIC declarations. 26 : Also see fd_quic_align() */ 27 0 : #define FD_QUIC_ALIGN (4096UL) /* 4KiB */ 28 : 29 : /* FD_QUIC_MTU is the assumed network link MTU in bytes, including L2 30 : and L3 headers. */ 31 0 : #define FD_QUIC_MTU (1500) 32 : 33 : /* FD_QUIC_SHORTEST_PKT is the smallest possible byte size of a QUIC v1 34 : packet. */ 35 0 : #define FD_QUIC_SHORTEST_PKT (16) 36 : 37 : /* FD_QUIC_INITIAL_PAYLOAD_SZ_MIN is the min byte size of the UDP payload 38 : of Initial-type packets. Mandated for both clients and servers as a 39 : form of MTU discovery and to mitigate amplification attacks. See 40 : RFC 9000 Section 14.1: 41 : https://datatracker.ietf.org/doc/html/rfc9000#name-initial-datagram-size */ 42 0 : #define FD_QUIC_INITIAL_PAYLOAD_SZ_MIN (1200) 43 0 : #define FD_QUIC_INITIAL_PAYLOAD_SZ_MAX (FD_QUIC_INITIAL_PAYLOAD_SZ_MIN) 44 : 45 : /* FD_QUIC_MAX_PAYLOAD_SZ is the max byte size of the UDP payload of any 46 : QUIC packets. Derived from FD_QUIC_MTU by subtracting the typical 47 : IPv4 header (no options) and UDP header sizes. */ 48 : #define FD_QUIC_MAX_PAYLOAD_SZ (FD_QUIC_MTU - 20 - 8) 49 : 50 : /* FD_QUIC_ROLE_{CLIENT,SERVER} identify the fd_quic_t's role as a 51 : client or server. */ 52 0 : #define FD_QUIC_ROLE_CLIENT 1 53 0 : #define FD_QUIC_ROLE_SERVER 2 54 : 55 : /* FD_QUIC_MIN_CONN_ID_CNT: min permitted conn ID count per conn */ 56 0 : #define FD_QUIC_MIN_CONN_ID_CNT (4UL) 57 : 58 : /* FD_QUIC_DEFAULT_SPARSITY: default fd_quic_limits_t->conn_id_sparsity */ 59 0 : #define FD_QUIC_DEFAULT_SPARSITY (2.5) 60 : 61 : /* FD_QUIC_PKT_TYPE_{...}: QUIC v1 packet types. 62 : INITIAL, ZERO_RTT, HANDSHAKE, and RETRY match the long_packet_type 63 : field. */ 64 0 : #define FD_QUIC_PKT_TYPE_INITIAL (0) 65 0 : #define FD_QUIC_PKT_TYPE_ZERO_RTT (1) 66 0 : #define FD_QUIC_PKT_TYPE_HANDSHAKE (2) 67 0 : #define FD_QUIC_PKT_TYPE_RETRY (3) 68 0 : #define FD_QUIC_PKT_TYPE_ONE_RTT (4) 69 : 70 : /* FD_QUIC_PKT_COALESCE_LIMIT controls how many QUIC long packets are 71 : handled in the same datagram. */ 72 0 : #define FD_QUIC_PKT_COALESCE_LIMIT (4) 73 : 74 : /* AES-128-GCM secret params */ 75 : #define FD_QUIC_INITIAL_SECRET_SZ 32 76 0 : #define FD_QUIC_SECRET_SZ 32 77 0 : #define FD_QUIC_HP_SAMPLE_SZ 16 78 : #define FD_QUIC_NONCE_SZ 12 79 : 80 : /* FD_QUIC_RETRY_MAX_TOKEN_SZ is the max permitted Retry Token size that 81 : fd_quic clients will accept. This is unfortunately not specified by 82 : RFC 9000. */ 83 : #define FD_QUIC_RETRY_MAX_TOKEN_SZ (256UL) 84 : /* RETRY secret size in bytes */ 85 0 : #define FD_QUIC_RETRY_SECRET_SZ 16 86 : /* RETRY iv size in bytes */ 87 0 : #define FD_QUIC_RETRY_IV_SZ 12 88 : 89 : #define FD_QUIC_PKT_NUM_UNUSED (~0ul) 90 : #define FD_QUIC_PKT_NUM_PENDING (~1ul) 91 : 92 : /* scheduling granularity */ 93 : /* does not need to be remotely accurate */ 94 : /* used for calculating an upper bound on the expected response of an ack */ 95 : #define FD_QUIC_SCHED_GRANULARITY_US 10.0f 96 : 97 : /* RTT probe period */ 98 : /* used to bound the time between RTT measurements */ 99 0 : #define FD_QUIC_RTT_PERIOD_US 60e6f 100 : 101 : /* initial RTT, used before it's measured */ 102 0 : #define FD_QUIC_INITIAL_RTT_US 200e3f 103 : 104 : #endif /* HEADER_fd_src_waltz_quic_fd_quic_enum_h */