1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef QUICHE_QUIC_CORE_QUIC_CONFIG_H_ 6 #define QUICHE_QUIC_CORE_QUIC_CONFIG_H_ 7 8 #include <cstddef> 9 #include <cstdint> 10 #include <optional> 11 #include <string> 12 13 #include "quiche/quic/core/crypto/transport_parameters.h" 14 #include "quiche/quic/core/quic_connection_id.h" 15 #include "quiche/quic/core/quic_packets.h" 16 #include "quiche/quic/core/quic_time.h" 17 #include "quiche/quic/core/quic_types.h" 18 #include "quiche/quic/platform/api/quic_export.h" 19 20 namespace quic { 21 22 namespace test { 23 class QuicConfigPeer; 24 } // namespace test 25 26 class CryptoHandshakeMessage; 27 28 // Describes whether or not a given QuicTag is required or optional in the 29 // handshake message. 30 enum QuicConfigPresence : uint8_t { 31 // This negotiable value can be absent from the handshake message. Default 32 // value is selected as the negotiated value in such a case. 33 PRESENCE_OPTIONAL, 34 // This negotiable value is required in the handshake message otherwise the 35 // Process*Hello function returns an error. 36 PRESENCE_REQUIRED, 37 }; 38 39 // Whether the CryptoHandshakeMessage is from the client or server. 40 enum HelloType { 41 CLIENT, 42 SERVER, 43 }; 44 45 // An abstract base class that stores a value that can be sent in CHLO/SHLO 46 // message. These values can be OPTIONAL or REQUIRED, depending on |presence_|. 47 class QUICHE_EXPORT QuicConfigValue { 48 public: 49 QuicConfigValue(QuicTag tag, QuicConfigPresence presence); 50 virtual ~QuicConfigValue(); 51 52 // Serialises tag name and value(s) to |out|. 53 virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const = 0; 54 55 // Selects a mutually acceptable value from those offered in |peer_hello| 56 // and those defined in the subclass. 57 virtual QuicErrorCode ProcessPeerHello( 58 const CryptoHandshakeMessage& peer_hello, HelloType hello_type, 59 std::string* error_details) = 0; 60 61 protected: 62 const QuicTag tag_; 63 const QuicConfigPresence presence_; 64 }; 65 66 // Stores uint32_t from CHLO or SHLO messages that are not negotiated. 67 class QUICHE_EXPORT QuicFixedUint32 : public QuicConfigValue { 68 public: 69 QuicFixedUint32(QuicTag tag, QuicConfigPresence presence); 70 ~QuicFixedUint32() override; 71 72 bool HasSendValue() const; 73 74 uint32_t GetSendValue() const; 75 76 void SetSendValue(uint32_t value); 77 78 bool HasReceivedValue() const; 79 80 uint32_t GetReceivedValue() const; 81 82 void SetReceivedValue(uint32_t value); 83 84 // If has_send_value is true, serialises |tag_| and |send_value_| to |out|. 85 void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; 86 87 // Sets |value_| to the corresponding value from |peer_hello_| if it exists. 88 QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello, 89 HelloType hello_type, 90 std::string* error_details) override; 91 92 private: 93 bool has_send_value_; 94 bool has_receive_value_; 95 uint32_t send_value_; 96 uint32_t receive_value_; 97 }; 98 99 // Stores 62bit numbers from handshake messages that unilaterally shared by each 100 // endpoint. IMPORTANT: these are serialized as 32-bit unsigned integers when 101 // using QUIC_CRYPTO versions and CryptoHandshakeMessage. 102 class QUICHE_EXPORT QuicFixedUint62 : public QuicConfigValue { 103 public: 104 QuicFixedUint62(QuicTag name, QuicConfigPresence presence); 105 ~QuicFixedUint62() override; 106 107 bool HasSendValue() const; 108 109 uint64_t GetSendValue() const; 110 111 void SetSendValue(uint64_t value); 112 113 bool HasReceivedValue() const; 114 115 uint64_t GetReceivedValue() const; 116 117 void SetReceivedValue(uint64_t value); 118 119 // If has_send_value is true, serialises |tag_| and |send_value_| to |out|. 120 // IMPORTANT: this method serializes |send_value_| as an unsigned 32bit 121 // integer. 122 void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; 123 124 // Sets |value_| to the corresponding value from |peer_hello_| if it exists. 125 QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello, 126 HelloType hello_type, 127 std::string* error_details) override; 128 129 private: 130 bool has_send_value_; 131 bool has_receive_value_; 132 uint64_t send_value_; 133 uint64_t receive_value_; 134 }; 135 136 // Stores StatelessResetToken from CHLO or SHLO messages that are not 137 // negotiated. 138 class QUICHE_EXPORT QuicFixedStatelessResetToken : public QuicConfigValue { 139 public: 140 QuicFixedStatelessResetToken(QuicTag tag, QuicConfigPresence presence); 141 ~QuicFixedStatelessResetToken() override; 142 143 bool HasSendValue() const; 144 145 const StatelessResetToken& GetSendValue() const; 146 147 void SetSendValue(const StatelessResetToken& value); 148 149 bool HasReceivedValue() const; 150 151 const StatelessResetToken& GetReceivedValue() const; 152 153 void SetReceivedValue(const StatelessResetToken& value); 154 155 // If has_send_value is true, serialises |tag_| and |send_value_| to |out|. 156 void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; 157 158 // Sets |value_| to the corresponding value from |peer_hello_| if it exists. 159 QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello, 160 HelloType hello_type, 161 std::string* error_details) override; 162 163 private: 164 bool has_send_value_; 165 bool has_receive_value_; 166 StatelessResetToken send_value_; 167 StatelessResetToken receive_value_; 168 }; 169 170 // Stores tag from CHLO or SHLO messages that are not negotiated. 171 class QUICHE_EXPORT QuicFixedTagVector : public QuicConfigValue { 172 public: 173 QuicFixedTagVector(QuicTag name, QuicConfigPresence presence); 174 QuicFixedTagVector(const QuicFixedTagVector& other); 175 ~QuicFixedTagVector() override; 176 177 bool HasSendValues() const; 178 179 const QuicTagVector& GetSendValues() const; 180 181 void SetSendValues(const QuicTagVector& values); 182 183 bool HasReceivedValues() const; 184 185 const QuicTagVector& GetReceivedValues() const; 186 187 void SetReceivedValues(const QuicTagVector& values); 188 189 // If has_send_value is true, serialises |tag_vector_| and |send_value_| to 190 // |out|. 191 void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; 192 193 // Sets |receive_values_| to the corresponding value from |client_hello_| if 194 // it exists. 195 QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello, 196 HelloType hello_type, 197 std::string* error_details) override; 198 199 private: 200 bool has_send_values_; 201 bool has_receive_values_; 202 QuicTagVector send_values_; 203 QuicTagVector receive_values_; 204 }; 205 206 // Stores QuicSocketAddress from CHLO or SHLO messages that are not negotiated. 207 class QUICHE_EXPORT QuicFixedSocketAddress : public QuicConfigValue { 208 public: 209 QuicFixedSocketAddress(QuicTag tag, QuicConfigPresence presence); 210 ~QuicFixedSocketAddress() override; 211 212 bool HasSendValue() const; 213 214 const QuicSocketAddress& GetSendValue() const; 215 216 void SetSendValue(const QuicSocketAddress& value); 217 218 void ClearSendValue(); 219 220 bool HasReceivedValue() const; 221 222 const QuicSocketAddress& GetReceivedValue() const; 223 224 void SetReceivedValue(const QuicSocketAddress& value); 225 226 void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; 227 228 QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello, 229 HelloType hello_type, 230 std::string* error_details) override; 231 232 private: 233 bool has_send_value_; 234 bool has_receive_value_; 235 QuicSocketAddress send_value_; 236 QuicSocketAddress receive_value_; 237 }; 238 239 // QuicConfig contains non-crypto configuration options that are negotiated in 240 // the crypto handshake. 241 class QUICHE_EXPORT QuicConfig { 242 public: 243 QuicConfig(); 244 QuicConfig(const QuicConfig& other); 245 ~QuicConfig(); 246 247 void SetConnectionOptionsToSend(const QuicTagVector& connection_options); 248 249 bool HasReceivedConnectionOptions() const; 250 251 void SetGoogleHandshakeMessageToSend(std::string message); 252 253 const std::optional<std::string>& GetReceivedGoogleHandshakeMessage() const; 254 255 // Sets initial received connection options. All received connection options 256 // will be initialized with these fields. Initial received options may only be 257 // set once per config, prior to the setting of any other options. If options 258 // have already been set (either by previous calls or via handshake), this 259 // function does nothing and returns false. 260 bool SetInitialReceivedConnectionOptions(const QuicTagVector& tags); 261 262 const QuicTagVector& ReceivedConnectionOptions() const; 263 264 bool HasSendConnectionOptions() const; 265 266 const QuicTagVector& SendConnectionOptions() const; 267 268 // Returns true if the client is sending or the server has received a 269 // connection option. 270 // TODO(ianswett): Rename to HasClientRequestedSharedOption 271 bool HasClientSentConnectionOption(QuicTag tag, 272 Perspective perspective) const; 273 274 void SetClientConnectionOptions( 275 const QuicTagVector& client_connection_options); 276 277 // Returns true if the client has requested the specified connection option. 278 // Checks the client connection options if the |perspective| is client and 279 // connection options if the |perspective| is the server. 280 bool HasClientRequestedIndependentOption(QuicTag tag, 281 Perspective perspective) const; 282 283 const QuicTagVector& ClientRequestedIndependentOptions( 284 Perspective perspective) const; 285 286 void SetIdleNetworkTimeout(QuicTime::Delta idle_network_timeout); 287 288 QuicTime::Delta IdleNetworkTimeout() const; 289 290 // Sets the max bidirectional stream count that this endpoint supports. 291 void SetMaxBidirectionalStreamsToSend(uint32_t max_streams); 292 uint32_t GetMaxBidirectionalStreamsToSend() const; 293 294 bool HasReceivedMaxBidirectionalStreams() const; 295 // Gets the max bidirectional stream limit imposed by the peer. 296 uint32_t ReceivedMaxBidirectionalStreams() const; 297 298 // Sets the max unidirectional stream count that this endpoint supports. 299 void SetMaxUnidirectionalStreamsToSend(uint32_t max_streams); 300 uint32_t GetMaxUnidirectionalStreamsToSend() const; 301 302 bool HasReceivedMaxUnidirectionalStreams() const; 303 // Gets the max unidirectional stream limit imposed by the peer. 304 uint32_t ReceivedMaxUnidirectionalStreams() const; 305 set_max_time_before_crypto_handshake(QuicTime::Delta max_time_before_crypto_handshake)306 void set_max_time_before_crypto_handshake( 307 QuicTime::Delta max_time_before_crypto_handshake) { 308 max_time_before_crypto_handshake_ = max_time_before_crypto_handshake; 309 } 310 max_time_before_crypto_handshake()311 QuicTime::Delta max_time_before_crypto_handshake() const { 312 return max_time_before_crypto_handshake_; 313 } 314 set_max_idle_time_before_crypto_handshake(QuicTime::Delta max_idle_time_before_crypto_handshake)315 void set_max_idle_time_before_crypto_handshake( 316 QuicTime::Delta max_idle_time_before_crypto_handshake) { 317 max_idle_time_before_crypto_handshake_ = 318 max_idle_time_before_crypto_handshake; 319 } 320 max_idle_time_before_crypto_handshake()321 QuicTime::Delta max_idle_time_before_crypto_handshake() const { 322 return max_idle_time_before_crypto_handshake_; 323 } 324 set_max_undecryptable_packets(size_t max_undecryptable_packets)325 void set_max_undecryptable_packets(size_t max_undecryptable_packets) { 326 max_undecryptable_packets_ = max_undecryptable_packets; 327 } 328 max_undecryptable_packets()329 size_t max_undecryptable_packets() const { 330 return max_undecryptable_packets_; 331 } 332 333 // Peer's connection id length, in bytes. Only used in Q043 and Q046. 334 bool HasSetBytesForConnectionIdToSend() const; 335 void SetBytesForConnectionIdToSend(uint32_t bytes); 336 bool HasReceivedBytesForConnectionId() const; 337 uint32_t ReceivedBytesForConnectionId() const; 338 339 // Estimated initial round trip time in us. 340 void SetInitialRoundTripTimeUsToSend(uint64_t rtt_us); 341 bool HasReceivedInitialRoundTripTimeUs() const; 342 uint64_t ReceivedInitialRoundTripTimeUs() const; 343 bool HasInitialRoundTripTimeUsToSend() const; 344 uint64_t GetInitialRoundTripTimeUsToSend() const; 345 346 // Sets an initial stream flow control window size to transmit to the peer. 347 void SetInitialStreamFlowControlWindowToSend(uint64_t window_bytes); 348 uint64_t GetInitialStreamFlowControlWindowToSend() const; 349 bool HasReceivedInitialStreamFlowControlWindowBytes() const; 350 uint64_t ReceivedInitialStreamFlowControlWindowBytes() const; 351 352 // Specifies the initial flow control window (max stream data) for 353 // incoming bidirectional streams. Incoming means streams initiated by our 354 // peer. If not set, GetInitialMaxStreamDataBytesIncomingBidirectionalToSend 355 // returns the value passed to SetInitialStreamFlowControlWindowToSend. 356 void SetInitialMaxStreamDataBytesIncomingBidirectionalToSend( 357 uint64_t window_bytes); 358 uint64_t GetInitialMaxStreamDataBytesIncomingBidirectionalToSend() const; 359 bool HasReceivedInitialMaxStreamDataBytesIncomingBidirectional() const; 360 uint64_t ReceivedInitialMaxStreamDataBytesIncomingBidirectional() const; 361 362 // Specifies the initial flow control window (max stream data) for 363 // outgoing bidirectional streams. Outgoing means streams initiated by us. 364 // If not set, GetInitialMaxStreamDataBytesOutgoingBidirectionalToSend 365 // returns the value passed to SetInitialStreamFlowControlWindowToSend. 366 void SetInitialMaxStreamDataBytesOutgoingBidirectionalToSend( 367 uint64_t window_bytes); 368 uint64_t GetInitialMaxStreamDataBytesOutgoingBidirectionalToSend() const; 369 bool HasReceivedInitialMaxStreamDataBytesOutgoingBidirectional() const; 370 uint64_t ReceivedInitialMaxStreamDataBytesOutgoingBidirectional() const; 371 372 // Specifies the initial flow control window (max stream data) for 373 // unidirectional streams. If not set, 374 // GetInitialMaxStreamDataBytesUnidirectionalToSend returns the value passed 375 // to SetInitialStreamFlowControlWindowToSend. 376 void SetInitialMaxStreamDataBytesUnidirectionalToSend(uint64_t window_bytes); 377 uint64_t GetInitialMaxStreamDataBytesUnidirectionalToSend() const; 378 bool HasReceivedInitialMaxStreamDataBytesUnidirectional() const; 379 uint64_t ReceivedInitialMaxStreamDataBytesUnidirectional() const; 380 381 // Sets an initial session flow control window size to transmit to the peer. 382 void SetInitialSessionFlowControlWindowToSend(uint64_t window_bytes); 383 uint64_t GetInitialSessionFlowControlWindowToSend() const; 384 bool HasReceivedInitialSessionFlowControlWindowBytes() const; 385 uint64_t ReceivedInitialSessionFlowControlWindowBytes() const; 386 387 // Disable connection migration. 388 void SetDisableConnectionMigration(); 389 bool DisableConnectionMigration() const; 390 391 // IPv6 alternate server address. 392 void SetIPv6AlternateServerAddressToSend( 393 const QuicSocketAddress& alternate_server_address_ipv6); 394 bool HasReceivedIPv6AlternateServerAddress() const; 395 const QuicSocketAddress& ReceivedIPv6AlternateServerAddress() const; 396 397 // IPv4 alternate server address. 398 void SetIPv4AlternateServerAddressToSend( 399 const QuicSocketAddress& alternate_server_address_ipv4); 400 bool HasReceivedIPv4AlternateServerAddress() const; 401 const QuicSocketAddress& ReceivedIPv4AlternateServerAddress() const; 402 403 // Called to set |connection_id| and |stateless_reset_token| if server 404 // preferred address has been set via SetIPv(4|6)AlternateServerAddressToSend. 405 // Please note, this is different from SetStatelessResetTokenToSend(const 406 // StatelessResetToken&) which is used to send the token corresponding to the 407 // existing server_connection_id. 408 void SetPreferredAddressConnectionIdAndTokenToSend( 409 const QuicConnectionId& connection_id, 410 const StatelessResetToken& stateless_reset_token); 411 412 // Preferred Address Connection ID and Token. 413 bool HasReceivedPreferredAddressConnectionIdAndToken() const; 414 const std::pair<QuicConnectionId, StatelessResetToken>& 415 ReceivedPreferredAddressConnectionIdAndToken() const; 416 std::optional<QuicSocketAddress> GetPreferredAddressToSend( 417 quiche::IpAddressFamily address_family) const; 418 void ClearAlternateServerAddressToSend( 419 quiche::IpAddressFamily address_family); 420 421 // Original destination connection ID. 422 void SetOriginalConnectionIdToSend( 423 const QuicConnectionId& original_destination_connection_id); 424 bool HasReceivedOriginalConnectionId() const; 425 QuicConnectionId ReceivedOriginalConnectionId() const; 426 427 // Stateless reset token. 428 void SetStatelessResetTokenToSend( 429 const StatelessResetToken& stateless_reset_token); 430 bool HasStatelessResetTokenToSend() const; 431 bool HasReceivedStatelessResetToken() const; 432 const StatelessResetToken& ReceivedStatelessResetToken() const; 433 434 // Manage the IETF QUIC Max ACK Delay transport parameter. 435 // The sent value is the delay that this node uses 436 // (QuicSentPacketManager::local_max_ack_delay_). 437 // The received delay is the value received from 438 // the peer (QuicSentPacketManager::peer_max_ack_delay_). 439 void SetMaxAckDelayToSendMs(uint32_t max_ack_delay_ms); 440 uint32_t GetMaxAckDelayToSendMs() const; 441 bool HasReceivedMaxAckDelayMs() const; 442 uint32_t ReceivedMaxAckDelayMs() const; 443 444 // Manage the IETF QUIC extension Min Ack Delay transport parameter. 445 // An endpoint uses min_ack_delay to advsertise its support for 446 // AckFrequencyFrame sent by peer. 447 void SetMinAckDelayMs(uint32_t min_ack_delay_ms); 448 uint32_t GetMinAckDelayToSendMs() const; 449 bool HasReceivedMinAckDelayMs() const; 450 uint32_t ReceivedMinAckDelayMs() const; 451 452 void SetAckDelayExponentToSend(uint32_t exponent); 453 uint32_t GetAckDelayExponentToSend() const; 454 bool HasReceivedAckDelayExponent() const; 455 uint32_t ReceivedAckDelayExponent() const; 456 457 // IETF QUIC max_udp_payload_size transport parameter. 458 void SetMaxPacketSizeToSend(uint64_t max_udp_payload_size); 459 uint64_t GetMaxPacketSizeToSend() const; 460 bool HasReceivedMaxPacketSize() const; 461 uint64_t ReceivedMaxPacketSize() const; 462 463 // IETF QUIC max_datagram_frame_size transport parameter. 464 void SetMaxDatagramFrameSizeToSend(uint64_t max_datagram_frame_size); 465 uint64_t GetMaxDatagramFrameSizeToSend() const; 466 bool HasReceivedMaxDatagramFrameSize() const; 467 uint64_t ReceivedMaxDatagramFrameSize() const; 468 469 // IETF QUIC active_connection_id_limit transport parameter. 470 void SetActiveConnectionIdLimitToSend(uint64_t active_connection_id_limit); 471 uint64_t GetActiveConnectionIdLimitToSend() const; 472 bool HasReceivedActiveConnectionIdLimit() const; 473 uint64_t ReceivedActiveConnectionIdLimit() const; 474 475 // Initial source connection ID. 476 void SetInitialSourceConnectionIdToSend( 477 const QuicConnectionId& initial_source_connection_id); 478 bool HasReceivedInitialSourceConnectionId() const; 479 QuicConnectionId ReceivedInitialSourceConnectionId() const; 480 481 // Retry source connection ID. 482 void SetRetrySourceConnectionIdToSend( 483 const QuicConnectionId& retry_source_connection_id); 484 bool HasReceivedRetrySourceConnectionId() const; 485 QuicConnectionId ReceivedRetrySourceConnectionId() const; 486 487 bool negotiated() const; 488 489 void SetCreateSessionTagIndicators(QuicTagVector tags); 490 491 const QuicTagVector& create_session_tag_indicators() const; 492 493 // ToHandshakeMessage serialises the settings in this object as a series of 494 // tags /value pairs and adds them to |out|. 495 void ToHandshakeMessage(CryptoHandshakeMessage* out, 496 QuicTransportVersion transport_version) const; 497 498 // Calls ProcessPeerHello on each negotiable parameter. On failure returns 499 // the corresponding QuicErrorCode and sets detailed error in |error_details|. 500 QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello, 501 HelloType hello_type, 502 std::string* error_details); 503 504 // FillTransportParameters writes the values to send for ICSL, MIDS, CFCW, and 505 // SFCW to |*params|, returning true if the values could be written and false 506 // if something prevents them from being written (e.g. a value is too large). 507 bool FillTransportParameters(TransportParameters* params) const; 508 509 // ProcessTransportParameters reads from |params| which were received from a 510 // peer. If |is_resumption|, some configs will not be processed. 511 // On failure, it returns a QuicErrorCode and puts a detailed error in 512 // |*error_details|. 513 QuicErrorCode ProcessTransportParameters(const TransportParameters& params, 514 bool is_resumption, 515 std::string* error_details); 516 custom_transport_parameters_to_send()517 TransportParameters::ParameterMap& custom_transport_parameters_to_send() { 518 return custom_transport_parameters_to_send_; 519 } 520 const TransportParameters::ParameterMap& received_custom_transport_parameters()521 received_custom_transport_parameters() const { 522 return received_custom_transport_parameters_; 523 } 524 525 // Called to clear google_handshake_message to send or received. 526 void ClearGoogleHandshakeMessage(); 527 528 private: 529 friend class test::QuicConfigPeer; 530 531 // SetDefaults sets the members to sensible, default values. 532 void SetDefaults(); 533 534 // Whether we've received the peer's config. 535 bool negotiated_; 536 537 // Configurations options that are not negotiated. 538 // Maximum time the session can be alive before crypto handshake is finished. 539 QuicTime::Delta max_time_before_crypto_handshake_; 540 // Maximum idle time before the crypto handshake has completed. 541 QuicTime::Delta max_idle_time_before_crypto_handshake_; 542 // Maximum number of undecryptable packets stored before CHLO/SHLO. 543 size_t max_undecryptable_packets_; 544 545 // Connection options which affect the server side. May also affect the 546 // client side in cases when identical behavior is desirable. 547 QuicFixedTagVector connection_options_; 548 // Connection options which only affect the client side. 549 QuicFixedTagVector client_connection_options_; 550 // Maximum idle network timeout. 551 // Uses the max_idle_timeout transport parameter in IETF QUIC. 552 // Note that received_max_idle_timeout_ is only populated if we receive the 553 // peer's value, which isn't guaranteed in IETF QUIC as sending is optional. 554 QuicTime::Delta max_idle_timeout_to_send_; 555 std::optional<QuicTime::Delta> received_max_idle_timeout_; 556 // Maximum number of dynamic streams that a Google QUIC connection 557 // can support or the maximum number of bidirectional streams that 558 // an IETF QUIC connection can support. 559 // The SendValue is the limit on peer-created streams that this endpoint is 560 // advertising. 561 // The ReceivedValue is the limit on locally-created streams that 562 // the peer advertised. 563 // Uses the initial_max_streams_bidi transport parameter in IETF QUIC. 564 QuicFixedUint32 max_bidirectional_streams_; 565 // Maximum number of unidirectional streams that the connection can 566 // support. 567 // The SendValue is the limit on peer-created streams that this endpoint is 568 // advertising. 569 // The ReceivedValue is the limit on locally-created streams that the peer 570 // advertised. 571 // Uses the initial_max_streams_uni transport parameter in IETF QUIC. 572 QuicFixedUint32 max_unidirectional_streams_; 573 // The number of bytes required for the connection ID. This is only used in 574 // the legacy header format used only by Q043 at this point. 575 QuicFixedUint32 bytes_for_connection_id_; 576 // Initial round trip time estimate in microseconds. 577 QuicFixedUint62 initial_round_trip_time_us_; 578 579 // Initial IETF QUIC stream flow control receive windows in bytes. 580 // Incoming bidirectional streams. 581 // Uses the initial_max_stream_data_bidi_{local,remote} transport parameter 582 // in IETF QUIC, depending on whether we're sending or receiving. 583 QuicFixedUint62 initial_max_stream_data_bytes_incoming_bidirectional_; 584 // Outgoing bidirectional streams. 585 // Uses the initial_max_stream_data_bidi_{local,remote} transport parameter 586 // in IETF QUIC, depending on whether we're sending or receiving. 587 QuicFixedUint62 initial_max_stream_data_bytes_outgoing_bidirectional_; 588 // Unidirectional streams. 589 // Uses the initial_max_stream_data_uni transport parameter in IETF QUIC. 590 QuicFixedUint62 initial_max_stream_data_bytes_unidirectional_; 591 592 // Initial Google QUIC stream flow control receive window in bytes. 593 QuicFixedUint62 initial_stream_flow_control_window_bytes_; 594 595 // Initial session flow control receive window in bytes. 596 // Uses the initial_max_data transport parameter in IETF QUIC. 597 QuicFixedUint62 initial_session_flow_control_window_bytes_; 598 599 // Whether active connection migration is allowed. 600 // Uses the disable_active_migration transport parameter in IETF QUIC. 601 QuicFixedUint32 connection_migration_disabled_; 602 603 // Alternate server addresses the client could connect to. 604 // Uses the preferred_address transport parameter in IETF QUIC. 605 // Note that when QUIC_CRYPTO is in use, only one of the addresses is sent. 606 QuicFixedSocketAddress alternate_server_address_ipv6_; 607 QuicFixedSocketAddress alternate_server_address_ipv4_; 608 // Connection Id data to send from the server or receive at the client as part 609 // of the preferred address transport parameter. 610 std::optional<std::pair<QuicConnectionId, StatelessResetToken>> 611 preferred_address_connection_id_and_token_; 612 613 // Stateless reset token used in IETF public reset packet. 614 // Uses the stateless_reset_token transport parameter in IETF QUIC. 615 QuicFixedStatelessResetToken stateless_reset_token_; 616 617 // List of QuicTags whose presence immediately causes the session to 618 // be created. This allows for CHLOs that are larger than a single 619 // packet to be processed. 620 QuicTagVector create_session_tag_indicators_; 621 622 // Maximum ack delay. The sent value is the value used on this node. 623 // The received value is the value received from the peer and used by 624 // the peer. 625 // Uses the max_ack_delay transport parameter in IETF QUIC. 626 QuicFixedUint32 max_ack_delay_ms_; 627 628 // Minimum ack delay. Used to enable sender control of max_ack_delay. 629 // Uses the min_ack_delay transport parameter in IETF QUIC extension. 630 QuicFixedUint32 min_ack_delay_ms_; 631 632 // The sent exponent is the exponent that this node uses when serializing an 633 // ACK frame (and the peer should use when deserializing the frame); 634 // the received exponent is the value the peer uses to serialize frames and 635 // this node uses to deserialize them. 636 // Uses the ack_delay_exponent transport parameter in IETF QUIC. 637 QuicFixedUint32 ack_delay_exponent_; 638 639 // Maximum packet size in bytes. 640 // Uses the max_udp_payload_size transport parameter in IETF QUIC. 641 QuicFixedUint62 max_udp_payload_size_; 642 643 // Maximum DATAGRAM/MESSAGE frame size in bytes. 644 // Uses the max_datagram_frame_size transport parameter in IETF QUIC. 645 QuicFixedUint62 max_datagram_frame_size_; 646 647 // Maximum number of connection IDs from the peer. 648 // Uses the active_connection_id_limit transport parameter in IETF QUIC. 649 QuicFixedUint62 active_connection_id_limit_; 650 651 // The value of the Destination Connection ID field from the first 652 // Initial packet sent by the client. 653 // Uses the original_destination_connection_id transport parameter in 654 // IETF QUIC. 655 std::optional<QuicConnectionId> original_destination_connection_id_to_send_; 656 std::optional<QuicConnectionId> received_original_destination_connection_id_; 657 658 // The value that the endpoint included in the Source Connection ID field of 659 // the first Initial packet it sent. 660 // Uses the initial_source_connection_id transport parameter in IETF QUIC. 661 std::optional<QuicConnectionId> initial_source_connection_id_to_send_; 662 std::optional<QuicConnectionId> received_initial_source_connection_id_; 663 664 // The value that the server included in the Source Connection ID field of a 665 // Retry packet it sent. 666 // Uses the retry_source_connection_id transport parameter in IETF QUIC. 667 std::optional<QuicConnectionId> retry_source_connection_id_to_send_; 668 std::optional<QuicConnectionId> received_retry_source_connection_id_; 669 670 // Custom transport parameters that can be sent and received in the TLS 671 // handshake. 672 TransportParameters::ParameterMap custom_transport_parameters_to_send_; 673 TransportParameters::ParameterMap received_custom_transport_parameters_; 674 675 // Google internal handshake message. 676 std::optional<std::string> google_handshake_message_to_send_; 677 std::optional<std::string> received_google_handshake_message_; 678 }; 679 680 } // namespace quic 681 682 #endif // QUICHE_QUIC_CORE_QUIC_CONFIG_H_ 683