1c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved.
2c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)// found in the LICENSE file.
4c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
5c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#ifndef NET_QUIC_QUIC_CONFIG_H_
6c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#define NET_QUIC_QUIC_CONFIG_H_
7c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
8c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include <string>
9c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
1090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "base/basictypes.h"
1190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "net/quic/quic_protocol.h"
12c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "net/quic/quic_time.h"
13c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
14c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)namespace net {
15c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
160529e5d033099cbfc42635f6f6183833b09dff6eBen Murdochnamespace test {
170529e5d033099cbfc42635f6f6183833b09dff6eBen Murdochclass QuicConfigPeer;
180529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch}  // namespace test
190529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class CryptoHandshakeMessage;
215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
22a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Describes whether or not a given QuicTag is required or optional in the
23a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// handshake message.
24a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)enum QuicConfigPresence {
25e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch  // This negotiable value can be absent from the handshake message. Default
26e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch  // value is selected as the negotiated value in such a case.
27a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PRESENCE_OPTIONAL,
28e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch  // This negotiable value is required in the handshake message otherwise the
29e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch  // Process*Hello function returns an error.
30a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PRESENCE_REQUIRED,
31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)};
32a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
330529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch// Whether the CryptoHandshakeMessage is from the client or server.
340529e5d033099cbfc42635f6f6183833b09dff6eBen Murdochenum HelloType {
350529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  CLIENT,
360529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  SERVER,
370529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch};
380529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
39a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// An abstract base class that stores a value that can be sent in CHLO/SHLO
40a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// message. These values can be OPTIONAL or REQUIRED, depending on |presence_|.
41a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class NET_EXPORT_PRIVATE QuicConfigValue {
42c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) public:
43a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  QuicConfigValue(QuicTag tag, QuicConfigPresence presence);
44a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual ~QuicConfigValue();
45a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
46a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Serialises tag name and value(s) to |out|.
47a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const = 0;
48a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
490529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  // Selects a mutually acceptable value from those offered in |peer_hello|
50a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // and those defined in the subclass.
510529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  virtual QuicErrorCode ProcessPeerHello(
520529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      const CryptoHandshakeMessage& peer_hello,
530529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      HelloType hello_type,
54a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      std::string* error_details) = 0;
55c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
56a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) protected:
57a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  const QuicTag tag_;
58a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  const QuicConfigPresence presence_;
59a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)};
60a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
61a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class NET_EXPORT_PRIVATE QuicNegotiableValue : public QuicConfigValue {
62a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) public:
63a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  QuicNegotiableValue(QuicTag tag, QuicConfigPresence presence);
64a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual ~QuicNegotiableValue();
6590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
6690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  bool negotiated() const {
6790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    return negotiated_;
6890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  }
6990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
7090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) protected:
7190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  bool negotiated_;
7290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)};
7390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
7490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class NET_EXPORT_PRIVATE QuicNegotiableUint32 : public QuicNegotiableValue {
7590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) public:
760f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  // Default and max values default to 0.
77a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  QuicNegotiableUint32(QuicTag name, QuicConfigPresence presence);
78a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual ~QuicNegotiableUint32();
7990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
8090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Sets the maximum possible value that can be achieved after negotiation and
8190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // also the default values to be assumed if PRESENCE_OPTIONAL and the *HLO msg
8290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // doesn't contain a value corresponding to |name_|. |max| is serialised via
8390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // ToHandshakeMessage call if |negotiated_| is false.
8490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  void set(uint32 max, uint32 default_value);
8590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
8690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Returns the value negotiated if |negotiated_| is true, otherwise returns
8790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // default_value_ (used to set default values before negotiation finishes).
8890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  uint32 GetUint32() const;
8990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
9090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Serialises |name_| and value to |out|. If |negotiated_| is true then
9190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // |negotiated_value_| is serialised, otherwise |max_value_| is serialised.
92a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const OVERRIDE;
9390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
9490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Sets |negotiated_value_| to the minimum of |max_value_| and the
950529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  // corresponding value from |peer_hello|. If the corresponding value is
9690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // missing and PRESENCE_OPTIONAL then |negotiated_value_| is set to
9790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // |default_value_|.
980529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  virtual QuicErrorCode ProcessPeerHello(
990529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      const CryptoHandshakeMessage& peer_hello,
1000529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      HelloType hello_type,
101a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      std::string* error_details) OVERRIDE;
10290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
10390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) private:
10490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  uint32 max_value_;
10590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  uint32 default_value_;
10690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  uint32 negotiated_value_;
10790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)};
10890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
10990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class NET_EXPORT_PRIVATE QuicNegotiableTag : public QuicNegotiableValue {
11090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) public:
111a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  QuicNegotiableTag(QuicTag name, QuicConfigPresence presence);
112a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual ~QuicNegotiableTag();
11390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
11490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Sets the possible values that |negotiated_tag_| can take after negotiation
11590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // and the default value that |negotiated_tag_| takes if OPTIONAL and *HLO
11690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // msg doesn't contain tag |name_|.
11790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  void set(const QuicTagVector& possible_values, QuicTag default_value);
11890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
11990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Returns the negotiated tag if |negotiated_| is true, otherwise returns
12090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // |default_value_| (used to set default values before negotiation finishes).
12190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicTag GetTag() const;
12290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
12390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Serialises |name_| and vector (either possible or negotiated) to |out|. If
12490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // |negotiated_| is true then |negotiated_tag_| is serialised, otherwise
12590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // |possible_values_| is serialised.
126a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const OVERRIDE;
12790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
12890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Selects the tag common to both tags in |client_hello| for |name_| and
12990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // |possible_values_| with preference to tag in |possible_values_|. The
13090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // selected tag is set as |negotiated_tag_|.
1310529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  virtual QuicErrorCode ProcessPeerHello(
1320529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      const CryptoHandshakeMessage& peer_hello,
1330529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      HelloType hello_type,
134a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      std::string* error_details) OVERRIDE;
13590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
13690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) private:
13790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Reads the vector corresponding to |name_| from |msg| into |out|. If the
13890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // |name_| is absent in |msg| and |presence_| is set to OPTIONAL |out| is set
13990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // to |possible_values_|.
14090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicErrorCode ReadVector(const CryptoHandshakeMessage& msg,
14190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                           const QuicTag** out,
14290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                           size_t* out_length,
14390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                           std::string* error_details) const;
14490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
14590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicTag negotiated_tag_;
14690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicTagVector possible_values_;
14790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicTag default_value_;
148c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)};
149c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
150a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Stores uint32 from CHLO or SHLO messages that are not negotiated.
151a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class NET_EXPORT_PRIVATE QuicFixedUint32 : public QuicConfigValue {
152a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) public:
1530529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  QuicFixedUint32(QuicTag name, QuicConfigPresence presence);
154a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual ~QuicFixedUint32();
155a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
1560529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  bool HasSendValue() const;
1570529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
1580529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  uint32 GetSendValue() const;
1590529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
1600529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  void SetSendValue(uint32 value);
1610529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
1620529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  bool HasReceivedValue() const;
1630529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
1640529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  uint32 GetReceivedValue() const;
165a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
1660529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  void SetReceivedValue(uint32 value);
167a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
1680529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  // If has_send_value is true, serialises |tag_| and |send_value_| to |out|.
169a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const OVERRIDE;
170a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
1710529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  // Sets |value_| to the corresponding value from |peer_hello_| if it exists.
1720529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  virtual QuicErrorCode ProcessPeerHello(
1730529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      const CryptoHandshakeMessage& peer_hello,
1740529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      HelloType hello_type,
175a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      std::string* error_details) OVERRIDE;
176a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
1770529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch private:
1780529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  uint32 send_value_;
1790529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  bool has_send_value_;
1800529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  uint32 receive_value_;
1810529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  bool has_receive_value_;
1820529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch};
1830529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
1840529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch// Stores tag from CHLO or SHLO messages that are not negotiated.
1850529e5d033099cbfc42635f6f6183833b09dff6eBen Murdochclass NET_EXPORT_PRIVATE QuicFixedTag : public QuicConfigValue {
1860529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch public:
1870529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  QuicFixedTag(QuicTag name, QuicConfigPresence presence);
1880529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  virtual ~QuicFixedTag();
1890529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
1900529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  bool HasSendValue() const;
1910529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
1920529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  QuicTag GetSendValue() const;
1930529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
1940529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  void SetSendValue(QuicTag value);
1950529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
1960529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  bool HasReceivedValue() const;
1970529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
1980529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  QuicTag GetReceivedValue() const;
1990529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
2000529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  void SetReceivedValue(QuicTag value);
2010529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
2020529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  // If has_send_value is true, serialises |tag_| and |send_value_| to |out|.
2030529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const OVERRIDE;
2040529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
2050529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  // Sets |value_| to the corresponding value from |client_hello_| if it exists.
2060529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  virtual QuicErrorCode ProcessPeerHello(
2070529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      const CryptoHandshakeMessage& peer_hello,
2080529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch      HelloType hello_type,
209a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      std::string* error_details) OVERRIDE;
210a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
211a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) private:
2120529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  QuicTag send_value_;
2130529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  bool has_send_value_;
2140529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  QuicTag receive_value_;
2150529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  bool has_receive_value_;
216a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)};
217a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
21846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// Stores tag from CHLO or SHLO messages that are not negotiated.
21946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)class NET_EXPORT_PRIVATE QuicFixedTagVector : public QuicConfigValue {
22046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) public:
22146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  QuicFixedTagVector(QuicTag name, QuicConfigPresence presence);
22246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  virtual ~QuicFixedTagVector();
22346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
22446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  bool HasSendValues() const;
22546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
22646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  QuicTagVector GetSendValues() const;
22746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
22846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  void SetSendValues(const QuicTagVector& values);
22946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
23046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  bool HasReceivedValues() const;
23146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
23246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  QuicTagVector GetReceivedValues() const;
23346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
23446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  void SetReceivedValues(const QuicTagVector& values);
23546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
23646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // If has_send_value is true, serialises |tag_vector_| and |send_value_| to
23746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // |out|.
23846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const OVERRIDE;
23946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
24046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // Sets |receive_values_| to the corresponding value from |client_hello_| if
24146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // it exists.
24246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  virtual QuicErrorCode ProcessPeerHello(
24346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      const CryptoHandshakeMessage& peer_hello,
24446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      HelloType hello_type,
24546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      std::string* error_details) OVERRIDE;
24646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
24746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) private:
24846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  QuicTagVector send_values_;
24946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  bool has_send_values_;
25046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  QuicTagVector receive_values_;
25146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  bool has_receive_values_;
25246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)};
25346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
254c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)// QuicConfig contains non-crypto configuration options that are negotiated in
255c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)// the crypto handshake.
256c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)class NET_EXPORT_PRIVATE QuicConfig {
257c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) public:
258c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  QuicConfig();
259c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  ~QuicConfig();
260c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
26146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  void set_congestion_feedback(const QuicTagVector& congestion_feedback,
26246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                               QuicTag default_congestion_feedback);
26346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
26446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  QuicTag congestion_feedback() const;
26546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
266116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  void SetConnectionOptionsToSend(const QuicTagVector& connection_options);
26746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
268116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  bool HasReceivedConnectionOptions() const;
26990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
270116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  QuicTagVector ReceivedConnectionOptions() const;
271116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
272116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  bool HasSendConnectionOptions() const;
273116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
274116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  QuicTagVector SendConnectionOptions() const;
27590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
2760529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  void SetLossDetectionToSend(QuicTag loss_detection);
2770529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
2780529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  bool HasReceivedLossDetection() const;
279e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch
2800529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  QuicTag ReceivedLossDetection() const;
281e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch
282b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  void set_idle_connection_state_lifetime(
28390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)      QuicTime::Delta max_idle_connection_state_lifetime,
28490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)      QuicTime::Delta default_idle_conection_state_lifetime);
28590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
28690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicTime::Delta idle_connection_state_lifetime() const;
28790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
28890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicTime::Delta keepalive_timeout() const;
28990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
29090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  void set_max_streams_per_connection(size_t max_streams,
29190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                                      size_t default_streams);
29290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
29390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  uint32 max_streams_per_connection() const;
29490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
295868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  void set_max_time_before_crypto_handshake(
296868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      QuicTime::Delta max_time_before_crypto_handshake);
297868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
298868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  QuicTime::Delta max_time_before_crypto_handshake() const;
299868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
3000529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  // Sets the peer's default initial congestion window in packets.
3010529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  void SetInitialCongestionWindowToSend(size_t initial_window);
3020f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
3030529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  bool HasReceivedInitialCongestionWindow() const;
3040529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
3050529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  uint32 ReceivedInitialCongestionWindow() const;
3060f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
3070f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  // Sets an estimated initial round trip time in us.
3080529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  void SetInitialRoundTripTimeUsToSend(size_t rtt_us);
3090529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
3100529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  bool HasReceivedInitialRoundTripTimeUs() const;
3110f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
3120529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  uint32 ReceivedInitialRoundTripTimeUs() const;
3130f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
3141320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  bool HasInitialRoundTripTimeUsToSend() const;
3151320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
3161320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  uint32 GetInitialRoundTripTimeUsToSend() const;
3171320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
3186d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  // TODO(rjshade): Remove all InitialFlowControlWindow methods when removing
3196d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  // QUIC_VERSION_19.
3206d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  // Sets an initial stream flow control window size to transmit to the peer.
3210529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  void SetInitialFlowControlWindowToSend(uint32 window_bytes);
322a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
323f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  uint32 GetInitialFlowControlWindowToSend() const;
324f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)
3250529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  bool HasReceivedInitialFlowControlWindowBytes() const;
3260529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
3270529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  uint32 ReceivedInitialFlowControlWindowBytes() const;
328a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
3296d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  // Sets an initial stream flow control window size to transmit to the peer.
3306d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  void SetInitialStreamFlowControlWindowToSend(uint32 window_bytes);
3316d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)
3326d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  uint32 GetInitialStreamFlowControlWindowToSend() const;
3336d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)
3346d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  bool HasReceivedInitialStreamFlowControlWindowBytes() const;
3356d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)
3366d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  uint32 ReceivedInitialStreamFlowControlWindowBytes() const;
3376d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)
3386d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  // Sets an initial session flow control window size to transmit to the peer.
3396d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  void SetInitialSessionFlowControlWindowToSend(uint32 window_bytes);
3406d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)
3416d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  uint32 GetInitialSessionFlowControlWindowToSend() const;
3426d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)
3436d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  bool HasReceivedInitialSessionFlowControlWindowBytes() const;
3446d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)
3456d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  uint32 ReceivedInitialSessionFlowControlWindowBytes() const;
3466d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)
3476e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)  // Sets socket receive buffer to transmit to the peer.
3486e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)  void SetSocketReceiveBufferToSend(uint32 window_bytes);
3496e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
3506e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)  uint32 GetSocketReceiveBufferToSend() const;
3516e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
3526e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)  bool HasReceivedSocketReceiveBuffer() const;
3536e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
3546e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)  uint32 ReceivedSocketReceiveBuffer() const;
3556e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
35690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  bool negotiated();
357b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
358c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // SetDefaults sets the members to sensible, default values.
359c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  void SetDefaults();
360c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
3610529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  // ToHandshakeMessage serialises the settings in this object as a series of
362c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // tags /value pairs and adds them to |out|.
363c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  void ToHandshakeMessage(CryptoHandshakeMessage* out) const;
364c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
3650529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  // Calls ProcessPeerHello on each negotiable parameter. On failure returns
36690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // the corresponding QuicErrorCode and sets detailed error in |error_details|.
3670529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello,
3680529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch                                 HelloType hello_type,
3690529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch                                 std::string* error_details);
370c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
371c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) private:
3720529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  friend class test::QuicConfigPeer;
3730529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
374c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Congestion control feedback type.
37546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  QuicNegotiableTag congestion_feedback_;
376116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // Connection options.
377116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  QuicFixedTagVector connection_options_;
378e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch  // Loss detection feedback type.
3790529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  QuicFixedTag loss_detection_;
380c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Idle connection state lifetime
38190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicNegotiableUint32 idle_connection_state_lifetime_seconds_;
382c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Keepalive timeout, or 0 to turn off keepalive probes
38390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicNegotiableUint32 keepalive_timeout_seconds_;
38490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Maximum number of streams that the connection can support.
38590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicNegotiableUint32 max_streams_per_connection_;
386868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Maximum time till the session can be alive before crypto handshake is
387868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // finished. (Not negotiated).
388868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  QuicTime::Delta max_time_before_crypto_handshake_;
3890f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  // Initial congestion window in packets.
3900529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  QuicFixedUint32 initial_congestion_window_;
3910f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  // Initial round trip time estimate in microseconds.
3920529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  QuicFixedUint32 initial_round_trip_time_us_;
3936d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)
3946d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  // TODO(rjshade): Remove when removing QUIC_VERSION_19.
3950529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  // Initial flow control receive window in bytes.
3960529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  QuicFixedUint32 initial_flow_control_window_bytes_;
3976d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)
3986d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  // Initial stream flow control receive window in bytes.
3996d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  QuicFixedUint32 initial_stream_flow_control_window_bytes_;
4006d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  // Initial session flow control receive window in bytes.
4016d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  QuicFixedUint32 initial_session_flow_control_window_bytes_;
4026e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
4036e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)  // Socket receive buffer in bytes.
4046e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)  QuicFixedUint32 socket_receive_buffer_;
405c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)};
406c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
407c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)}  // namespace net
408c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
409c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#endif  // NET_QUIC_QUIC_CONFIG_H_
410