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