quic_config.h revision 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7
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)
165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class CryptoHandshakeMessage;
175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
1890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class NET_EXPORT_PRIVATE QuicNegotiableValue {
19c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) public:
2090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  enum Presence {
2190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    // This negotiable value can be absent from the handshake message. Default
2290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    // value is selected as the negotiated value in such a case.
2390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    PRESENCE_OPTIONAL,
2490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    // This negotiable value is required in the handshake message otherwise the
2590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    // Process*Hello function returns an error.
2690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    PRESENCE_REQUIRED,
2790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  };
28c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
2990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicNegotiableValue(QuicTag tag, Presence presence);
3090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
3190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  bool negotiated() const {
3290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    return negotiated_;
3390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  }
3490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
3590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) protected:
3690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  const QuicTag tag_;
3790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  const Presence presence_;
3890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  bool negotiated_;
3990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)};
4090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
4190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class NET_EXPORT_PRIVATE QuicNegotiableUint32 : public QuicNegotiableValue {
4290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) public:
430f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  // Default and max values default to 0.
4490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicNegotiableUint32(QuicTag name, Presence presence);
4590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
4690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Sets the maximum possible value that can be achieved after negotiation and
4790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // also the default values to be assumed if PRESENCE_OPTIONAL and the *HLO msg
4890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // doesn't contain a value corresponding to |name_|. |max| is serialised via
4990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // ToHandshakeMessage call if |negotiated_| is false.
5090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  void set(uint32 max, uint32 default_value);
5190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
5290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Returns the value negotiated if |negotiated_| is true, otherwise returns
5390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // default_value_ (used to set default values before negotiation finishes).
5490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  uint32 GetUint32() const;
5590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
5690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Serialises |name_| and value to |out|. If |negotiated_| is true then
5790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // |negotiated_value_| is serialised, otherwise |max_value_| is serialised.
5890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  void ToHandshakeMessage(CryptoHandshakeMessage* out) const;
5990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
6090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Sets |negotiated_value_| to the minimum of |max_value_| and the
6190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // corresponding value from |client_hello|. If the corresponding value is
6290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // missing and PRESENCE_OPTIONAL then |negotiated_value_| is set to
6390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // |default_value_|.
6490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicErrorCode ProcessClientHello(const CryptoHandshakeMessage& client_hello,
6590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                                   std::string* error_details);
6690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
6790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Sets the |negotiated_value_| to the corresponding value from
6890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // |server_hello|. Returns error if the value received in |server_hello| is
6990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // greater than |max_value_|. If the corresponding value is missing and
7090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // PRESENCE_OPTIONAL then |negotiated_value_| is set to |0|,
7190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicErrorCode ProcessServerHello(const CryptoHandshakeMessage& server_hello,
7290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                                   std::string* error_details);
7390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
7490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) private:
7590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Reads the value corresponding to |name_| from |msg| into |out|. If the
7690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // |name_| is absent in |msg| and |presence_| is set to OPTIONAL |out| is set
7790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // to |max_value_|.
7890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicErrorCode ReadUint32(const CryptoHandshakeMessage& msg,
7990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                           uint32* out,
8090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                           std::string* error_details) const;
8190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
8290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  uint32 max_value_;
8390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  uint32 default_value_;
8490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  uint32 negotiated_value_;
8590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)};
8690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
8790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class NET_EXPORT_PRIVATE QuicNegotiableTag : public QuicNegotiableValue {
8890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) public:
8990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicNegotiableTag(QuicTag name, Presence presence);
9090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  ~QuicNegotiableTag();
9190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
9290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Sets the possible values that |negotiated_tag_| can take after negotiation
9390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // and the default value that |negotiated_tag_| takes if OPTIONAL and *HLO
9490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // msg doesn't contain tag |name_|.
9590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  void set(const QuicTagVector& possible_values, QuicTag default_value);
9690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
9790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Returns the negotiated tag if |negotiated_| is true, otherwise returns
9890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // |default_value_| (used to set default values before negotiation finishes).
9990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicTag GetTag() const;
10090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
10190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Serialises |name_| and vector (either possible or negotiated) to |out|. If
10290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // |negotiated_| is true then |negotiated_tag_| is serialised, otherwise
10390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // |possible_values_| is serialised.
10490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  void ToHandshakeMessage(CryptoHandshakeMessage* out) const;
10590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
10690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Selects the tag common to both tags in |client_hello| for |name_| and
10790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // |possible_values_| with preference to tag in |possible_values_|. The
10890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // selected tag is set as |negotiated_tag_|.
10990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicErrorCode ProcessClientHello(const CryptoHandshakeMessage& client_hello,
11090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                                   std::string* error_details);
11190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
11290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Sets the value for |name_| tag in |server_hello| as |negotiated_value_|.
11390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Returns error if the value received in |server_hello| isn't present in
11490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // |possible_values_|.
11590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicErrorCode ProcessServerHello(const CryptoHandshakeMessage& server_hello,
11690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                                   std::string* error_details);
11790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
11890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) private:
11990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Reads the vector corresponding to |name_| from |msg| into |out|. If the
12090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // |name_| is absent in |msg| and |presence_| is set to OPTIONAL |out| is set
12190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // to |possible_values_|.
12290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicErrorCode ReadVector(const CryptoHandshakeMessage& msg,
12390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                           const QuicTag** out,
12490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                           size_t* out_length,
12590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                           std::string* error_details) const;
12690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
12790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicTag negotiated_tag_;
12890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicTagVector possible_values_;
12990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicTag default_value_;
130c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)};
131c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
132c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)// QuicConfig contains non-crypto configuration options that are negotiated in
133c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)// the crypto handshake.
134c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)class NET_EXPORT_PRIVATE QuicConfig {
135c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) public:
136c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  QuicConfig();
137c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  ~QuicConfig();
138c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
13990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  void set_congestion_control(const QuicTagVector& congestion_control,
14090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                              QuicTag default_congestion_control);
14190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
14290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicTag congestion_control() const;
14390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
144b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  void set_idle_connection_state_lifetime(
14590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)      QuicTime::Delta max_idle_connection_state_lifetime,
14690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)      QuicTime::Delta default_idle_conection_state_lifetime);
14790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
14890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicTime::Delta idle_connection_state_lifetime() const;
14990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
15090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicTime::Delta keepalive_timeout() const;
15190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
15290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  void set_max_streams_per_connection(size_t max_streams,
15390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                                      size_t default_streams);
15490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
15590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  uint32 max_streams_per_connection() const;
15690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
157868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  void set_max_time_before_crypto_handshake(
158868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      QuicTime::Delta max_time_before_crypto_handshake);
159868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
160868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  QuicTime::Delta max_time_before_crypto_handshake() const;
161868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
1620f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  // Sets the server's TCP sender's max and default initial congestion window
1630f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  // in packets.
1640f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  void set_server_initial_congestion_window(size_t max_initial_window,
1650f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)                                            size_t default_initial_window);
1660f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
1670f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  uint32 server_initial_congestion_window() const;
1680f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
1690f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  // Sets an estimated initial round trip time in us.
1700f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  void set_initial_round_trip_time_us(size_t max_rtt, size_t default_rtt);
1710f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
1720f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  uint32 initial_round_trip_time_us() const;
1730f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
17490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  bool negotiated();
175b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)
176c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // SetDefaults sets the members to sensible, default values.
177c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  void SetDefaults();
178c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
179c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // ToHandshakeMessage serializes the settings in this object as a series of
180c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // tags /value pairs and adds them to |out|.
181c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  void ToHandshakeMessage(CryptoHandshakeMessage* out) const;
182c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
18390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Calls ProcessClientHello on each negotiable parameter. On failure returns
18490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // the corresponding QuicErrorCode and sets detailed error in |error_details|.
18590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicErrorCode ProcessClientHello(const CryptoHandshakeMessage& client_hello,
18690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                                   std::string* error_details);
18790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
18890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Calls ProcessServerHello on each negotiable parameter. On failure returns
18990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // the corresponding QuicErrorCode and sets detailed error in |error_details|.
19090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicErrorCode ProcessServerHello(const CryptoHandshakeMessage& server_hello,
19190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                                   std::string* error_details);
192c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
193c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) private:
194c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Congestion control feedback type.
19590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicNegotiableTag congestion_control_;
196c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Idle connection state lifetime
19790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicNegotiableUint32 idle_connection_state_lifetime_seconds_;
198c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Keepalive timeout, or 0 to turn off keepalive probes
19990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicNegotiableUint32 keepalive_timeout_seconds_;
20090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Maximum number of streams that the connection can support.
20190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  QuicNegotiableUint32 max_streams_per_connection_;
202868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Maximum time till the session can be alive before crypto handshake is
203868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // finished. (Not negotiated).
204868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  QuicTime::Delta max_time_before_crypto_handshake_;
2050f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  // Initial congestion window in packets.
2060f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  QuicNegotiableUint32 server_initial_congestion_window_;
2070f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  // Initial round trip time estimate in microseconds.
2080f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  QuicNegotiableUint32 initial_round_trip_time_us_;
209c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)};
210c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
211c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)}  // namespace net
212c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
213c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#endif  // NET_QUIC_QUIC_CONFIG_H_
214