OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_QUIC_QUIC_CONFIG_H_ | 5 #ifndef NET_QUIC_QUIC_CONFIG_H_ |
6 #define NET_QUIC_QUIC_CONFIG_H_ | 6 #define NET_QUIC_QUIC_CONFIG_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "net/quic/crypto/crypto_handshake.h" | 10 #include "net/quic/crypto/crypto_handshake.h" |
11 #include "net/quic/crypto/crypto_utils.h" | 11 #include "net/quic/crypto/crypto_utils.h" |
12 #include "net/quic/quic_time.h" | 12 #include "net/quic/quic_time.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 // QuicNegotiatedParameters contains non-crypto parameters that are agreed upon | 16 // QuicNegotiatedParameters contains non-crypto parameters that are agreed upon |
17 // during the crypto handshake. | 17 // during the crypto handshake. |
18 class NET_EXPORT_PRIVATE QuicNegotiatedParameters { | 18 class NET_EXPORT_PRIVATE QuicNegotiatedParameters { |
19 public: | 19 public: |
20 QuicNegotiatedParameters(); | 20 QuicNegotiatedParameters(); |
21 | 21 |
22 CryptoTag congestion_control; | 22 QuicTag congestion_control; |
23 QuicTime::Delta idle_connection_state_lifetime; | 23 QuicTime::Delta idle_connection_state_lifetime; |
24 QuicTime::Delta keepalive_timeout; | 24 QuicTime::Delta keepalive_timeout; |
25 }; | 25 }; |
26 | 26 |
27 // QuicConfig contains non-crypto configuration options that are negotiated in | 27 // QuicConfig contains non-crypto configuration options that are negotiated in |
28 // the crypto handshake. | 28 // the crypto handshake. |
29 class NET_EXPORT_PRIVATE QuicConfig { | 29 class NET_EXPORT_PRIVATE QuicConfig { |
30 public: | 30 public: |
31 QuicConfig(); | 31 QuicConfig(); |
32 ~QuicConfig(); | 32 ~QuicConfig(); |
33 | 33 |
| 34 void set_idle_connection_state_lifetime( |
| 35 QuicTime::Delta idle_connection_state_lifetime) { |
| 36 idle_connection_state_lifetime_ = idle_connection_state_lifetime; |
| 37 } |
| 38 |
34 // SetDefaults sets the members to sensible, default values. | 39 // SetDefaults sets the members to sensible, default values. |
35 void SetDefaults(); | 40 void SetDefaults(); |
36 | 41 |
37 // SetFromMessage extracts the non-crypto configuration from |msg| and sets | 42 // SetFromMessage extracts the non-crypto configuration from |msg| and sets |
38 // the members of this object to match. This is expected to be called in the | 43 // the members of this object to match. This is expected to be called in the |
39 // case of a server which is loading a server config. The server config | 44 // case of a server which is loading a server config. The server config |
40 // contains the non-crypto parameters and so the server will need to keep its | 45 // contains the non-crypto parameters and so the server will need to keep its |
41 // QuicConfig in sync with the server config that it'll be sending to | 46 // QuicConfig in sync with the server config that it'll be sending to |
42 // clients. | 47 // clients. |
43 bool SetFromHandshakeMessage(const CryptoHandshakeMessage& scfg); | 48 bool SetFromHandshakeMessage(const CryptoHandshakeMessage& scfg); |
44 | 49 |
45 // ToHandshakeMessage serializes the settings in this object as a series of | 50 // ToHandshakeMessage serializes the settings in this object as a series of |
46 // tags /value pairs and adds them to |out|. | 51 // tags /value pairs and adds them to |out|. |
47 void ToHandshakeMessage(CryptoHandshakeMessage* out) const; | 52 void ToHandshakeMessage(CryptoHandshakeMessage* out) const; |
48 | 53 |
49 QuicErrorCode ProcessFinalPeerHandshake( | 54 QuicErrorCode ProcessFinalPeerHandshake( |
50 const CryptoHandshakeMessage& peer_handshake, | 55 const CryptoHandshakeMessage& peer_handshake, |
51 CryptoUtils::Priority priority, | 56 CryptoUtils::Priority priority, |
52 QuicNegotiatedParameters* out_params, | 57 QuicNegotiatedParameters* out_params, |
53 std::string* error_details) const; | 58 std::string* error_details) const; |
54 | 59 |
55 private: | 60 private: |
56 // Congestion control feedback type. | 61 // Congestion control feedback type. |
57 CryptoTagVector congestion_control_; | 62 QuicTagVector congestion_control_; |
58 // Idle connection state lifetime | 63 // Idle connection state lifetime |
59 QuicTime::Delta idle_connection_state_lifetime_; | 64 QuicTime::Delta idle_connection_state_lifetime_; |
60 // Keepalive timeout, or 0 to turn off keepalive probes | 65 // Keepalive timeout, or 0 to turn off keepalive probes |
61 QuicTime::Delta keepalive_timeout_; | 66 QuicTime::Delta keepalive_timeout_; |
62 }; | 67 }; |
63 | 68 |
64 } // namespace net | 69 } // namespace net |
65 | 70 |
66 #endif // NET_QUIC_QUIC_CONFIG_H_ | 71 #endif // NET_QUIC_QUIC_CONFIG_H_ |
OLD | NEW |