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 <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
8 #include <string> | 11 #include <string> |
9 | 12 |
10 #include "base/basictypes.h" | |
11 #include "net/quic/quic_protocol.h" | 13 #include "net/quic/quic_protocol.h" |
12 #include "net/quic/quic_time.h" | 14 #include "net/quic/quic_time.h" |
13 | 15 |
14 namespace net { | 16 namespace net { |
15 | 17 |
16 namespace test { | 18 namespace test { |
17 class QuicConfigPeer; | 19 class QuicConfigPeer; |
18 } // namespace test | 20 } // namespace test |
19 | 21 |
20 class CryptoHandshakeMessage; | 22 class CryptoHandshakeMessage; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 class NET_EXPORT_PRIVATE QuicNegotiableUint32 : public QuicNegotiableValue { | 77 class NET_EXPORT_PRIVATE QuicNegotiableUint32 : public QuicNegotiableValue { |
76 public: | 78 public: |
77 // Default and max values default to 0. | 79 // Default and max values default to 0. |
78 QuicNegotiableUint32(QuicTag name, QuicConfigPresence presence); | 80 QuicNegotiableUint32(QuicTag name, QuicConfigPresence presence); |
79 ~QuicNegotiableUint32() override; | 81 ~QuicNegotiableUint32() override; |
80 | 82 |
81 // Sets the maximum possible value that can be achieved after negotiation and | 83 // Sets the maximum possible value that can be achieved after negotiation and |
82 // also the default values to be assumed if PRESENCE_OPTIONAL and the *HLO msg | 84 // also the default values to be assumed if PRESENCE_OPTIONAL and the *HLO msg |
83 // doesn't contain a value corresponding to |name_|. |max| is serialised via | 85 // doesn't contain a value corresponding to |name_|. |max| is serialised via |
84 // ToHandshakeMessage call if |negotiated_| is false. | 86 // ToHandshakeMessage call if |negotiated_| is false. |
85 void set(uint32 max, uint32 default_value); | 87 void set(uint32_t max, uint32_t default_value); |
86 | 88 |
87 // Returns the value negotiated if |negotiated_| is true, otherwise returns | 89 // Returns the value negotiated if |negotiated_| is true, otherwise returns |
88 // default_value_ (used to set default values before negotiation finishes). | 90 // default_value_ (used to set default values before negotiation finishes). |
89 uint32 GetUint32() const; | 91 uint32_t GetUint32() const; |
90 | 92 |
91 // Serialises |name_| and value to |out|. If |negotiated_| is true then | 93 // Serialises |name_| and value to |out|. If |negotiated_| is true then |
92 // |negotiated_value_| is serialised, otherwise |max_value_| is serialised. | 94 // |negotiated_value_| is serialised, otherwise |max_value_| is serialised. |
93 void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; | 95 void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; |
94 | 96 |
95 // Sets |negotiated_value_| to the minimum of |max_value_| and the | 97 // Sets |negotiated_value_| to the minimum of |max_value_| and the |
96 // corresponding value from |peer_hello|. If the corresponding value is | 98 // corresponding value from |peer_hello|. If the corresponding value is |
97 // missing and PRESENCE_OPTIONAL then |negotiated_value_| is set to | 99 // missing and PRESENCE_OPTIONAL then |negotiated_value_| is set to |
98 // |default_value_|. | 100 // |default_value_|. |
99 QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello, | 101 QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello, |
100 HelloType hello_type, | 102 HelloType hello_type, |
101 std::string* error_details) override; | 103 std::string* error_details) override; |
102 | 104 |
103 private: | 105 private: |
104 uint32 max_value_; | 106 uint32_t max_value_; |
105 uint32 default_value_; | 107 uint32_t default_value_; |
106 uint32 negotiated_value_; | 108 uint32_t negotiated_value_; |
107 }; | 109 }; |
108 | 110 |
109 class NET_EXPORT_PRIVATE QuicNegotiableTag : public QuicNegotiableValue { | 111 class NET_EXPORT_PRIVATE QuicNegotiableTag : public QuicNegotiableValue { |
110 public: | 112 public: |
111 QuicNegotiableTag(QuicTag name, QuicConfigPresence presence); | 113 QuicNegotiableTag(QuicTag name, QuicConfigPresence presence); |
112 ~QuicNegotiableTag() override; | 114 ~QuicNegotiableTag() override; |
113 | 115 |
114 // Sets the possible values that |negotiated_tag_| can take after negotiation | 116 // Sets the possible values that |negotiated_tag_| can take after negotiation |
115 // and the default value that |negotiated_tag_| takes if OPTIONAL and *HLO | 117 // and the default value that |negotiated_tag_| takes if OPTIONAL and *HLO |
116 // msg doesn't contain tag |name_|. | 118 // msg doesn't contain tag |name_|. |
(...skipping 18 matching lines...) Expand all Loading... |
135 QuicErrorCode ReadVector(const CryptoHandshakeMessage& msg, | 137 QuicErrorCode ReadVector(const CryptoHandshakeMessage& msg, |
136 const QuicTag** out, | 138 const QuicTag** out, |
137 size_t* out_length, | 139 size_t* out_length, |
138 std::string* error_details) const; | 140 std::string* error_details) const; |
139 | 141 |
140 QuicTag negotiated_tag_; | 142 QuicTag negotiated_tag_; |
141 QuicTagVector possible_values_; | 143 QuicTagVector possible_values_; |
142 QuicTag default_value_; | 144 QuicTag default_value_; |
143 }; | 145 }; |
144 | 146 |
145 // Stores uint32 from CHLO or SHLO messages that are not negotiated. | 147 // Stores uint32_t from CHLO or SHLO messages that are not negotiated. |
146 class NET_EXPORT_PRIVATE QuicFixedUint32 : public QuicConfigValue { | 148 class NET_EXPORT_PRIVATE QuicFixedUint32 : public QuicConfigValue { |
147 public: | 149 public: |
148 QuicFixedUint32(QuicTag name, QuicConfigPresence presence); | 150 QuicFixedUint32(QuicTag name, QuicConfigPresence presence); |
149 ~QuicFixedUint32() override; | 151 ~QuicFixedUint32() override; |
150 | 152 |
151 bool HasSendValue() const; | 153 bool HasSendValue() const; |
152 | 154 |
153 uint32 GetSendValue() const; | 155 uint32_t GetSendValue() const; |
154 | 156 |
155 void SetSendValue(uint32 value); | 157 void SetSendValue(uint32_t value); |
156 | 158 |
157 bool HasReceivedValue() const; | 159 bool HasReceivedValue() const; |
158 | 160 |
159 uint32 GetReceivedValue() const; | 161 uint32_t GetReceivedValue() const; |
160 | 162 |
161 void SetReceivedValue(uint32 value); | 163 void SetReceivedValue(uint32_t value); |
162 | 164 |
163 // If has_send_value is true, serialises |tag_| and |send_value_| to |out|. | 165 // If has_send_value is true, serialises |tag_| and |send_value_| to |out|. |
164 void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; | 166 void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; |
165 | 167 |
166 // Sets |value_| to the corresponding value from |peer_hello_| if it exists. | 168 // Sets |value_| to the corresponding value from |peer_hello_| if it exists. |
167 QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello, | 169 QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello, |
168 HelloType hello_type, | 170 HelloType hello_type, |
169 std::string* error_details) override; | 171 std::string* error_details) override; |
170 | 172 |
171 private: | 173 private: |
172 uint32 send_value_; | 174 uint32_t send_value_; |
173 bool has_send_value_; | 175 bool has_send_value_; |
174 uint32 receive_value_; | 176 uint32_t receive_value_; |
175 bool has_receive_value_; | 177 bool has_receive_value_; |
176 }; | 178 }; |
177 | 179 |
178 // Stores tag from CHLO or SHLO messages that are not negotiated. | 180 // Stores tag from CHLO or SHLO messages that are not negotiated. |
179 class NET_EXPORT_PRIVATE QuicFixedTagVector : public QuicConfigValue { | 181 class NET_EXPORT_PRIVATE QuicFixedTagVector : public QuicConfigValue { |
180 public: | 182 public: |
181 QuicFixedTagVector(QuicTag name, QuicConfigPresence presence); | 183 QuicFixedTagVector(QuicTag name, QuicConfigPresence presence); |
182 ~QuicFixedTagVector() override; | 184 ~QuicFixedTagVector() override; |
183 | 185 |
184 bool HasSendValues() const; | 186 bool HasSendValues() const; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 QuicTime::Delta default_idle_conection_state_lifetime); | 246 QuicTime::Delta default_idle_conection_state_lifetime); |
245 | 247 |
246 QuicTime::Delta IdleConnectionStateLifetime() const; | 248 QuicTime::Delta IdleConnectionStateLifetime() const; |
247 | 249 |
248 void SetSilentClose(bool silent_close); | 250 void SetSilentClose(bool silent_close); |
249 | 251 |
250 bool SilentClose() const; | 252 bool SilentClose() const; |
251 | 253 |
252 void SetMaxStreamsPerConnection(size_t max_streams, size_t default_streams); | 254 void SetMaxStreamsPerConnection(size_t max_streams, size_t default_streams); |
253 | 255 |
254 uint32 MaxStreamsPerConnection() const; | 256 uint32_t MaxStreamsPerConnection() const; |
255 | 257 |
256 void set_max_time_before_crypto_handshake( | 258 void set_max_time_before_crypto_handshake( |
257 QuicTime::Delta max_time_before_crypto_handshake) { | 259 QuicTime::Delta max_time_before_crypto_handshake) { |
258 max_time_before_crypto_handshake_ = max_time_before_crypto_handshake; | 260 max_time_before_crypto_handshake_ = max_time_before_crypto_handshake; |
259 } | 261 } |
260 | 262 |
261 QuicTime::Delta max_time_before_crypto_handshake() const { | 263 QuicTime::Delta max_time_before_crypto_handshake() const { |
262 return max_time_before_crypto_handshake_; | 264 return max_time_before_crypto_handshake_; |
263 } | 265 } |
264 | 266 |
(...skipping 11 matching lines...) Expand all Loading... |
276 max_undecryptable_packets_ = max_undecryptable_packets; | 278 max_undecryptable_packets_ = max_undecryptable_packets; |
277 } | 279 } |
278 | 280 |
279 size_t max_undecryptable_packets() const { | 281 size_t max_undecryptable_packets() const { |
280 return max_undecryptable_packets_; | 282 return max_undecryptable_packets_; |
281 } | 283 } |
282 | 284 |
283 bool HasSetBytesForConnectionIdToSend() const; | 285 bool HasSetBytesForConnectionIdToSend() const; |
284 | 286 |
285 // Sets the peer's connection id length, in bytes. | 287 // Sets the peer's connection id length, in bytes. |
286 void SetBytesForConnectionIdToSend(uint32 bytes); | 288 void SetBytesForConnectionIdToSend(uint32_t bytes); |
287 | 289 |
288 bool HasReceivedBytesForConnectionId() const; | 290 bool HasReceivedBytesForConnectionId() const; |
289 | 291 |
290 uint32 ReceivedBytesForConnectionId() const; | 292 uint32_t ReceivedBytesForConnectionId() const; |
291 | 293 |
292 // Sets an estimated initial round trip time in us. | 294 // Sets an estimated initial round trip time in us. |
293 void SetInitialRoundTripTimeUsToSend(uint32 rtt_us); | 295 void SetInitialRoundTripTimeUsToSend(uint32_t rtt_us); |
294 | 296 |
295 bool HasReceivedInitialRoundTripTimeUs() const; | 297 bool HasReceivedInitialRoundTripTimeUs() const; |
296 | 298 |
297 uint32 ReceivedInitialRoundTripTimeUs() const; | 299 uint32_t ReceivedInitialRoundTripTimeUs() const; |
298 | 300 |
299 bool HasInitialRoundTripTimeUsToSend() const; | 301 bool HasInitialRoundTripTimeUsToSend() const; |
300 | 302 |
301 uint32 GetInitialRoundTripTimeUsToSend() const; | 303 uint32_t GetInitialRoundTripTimeUsToSend() const; |
302 | 304 |
303 // Sets an initial stream flow control window size to transmit to the peer. | 305 // Sets an initial stream flow control window size to transmit to the peer. |
304 void SetInitialStreamFlowControlWindowToSend(uint32 window_bytes); | 306 void SetInitialStreamFlowControlWindowToSend(uint32_t window_bytes); |
305 | 307 |
306 uint32 GetInitialStreamFlowControlWindowToSend() const; | 308 uint32_t GetInitialStreamFlowControlWindowToSend() const; |
307 | 309 |
308 bool HasReceivedInitialStreamFlowControlWindowBytes() const; | 310 bool HasReceivedInitialStreamFlowControlWindowBytes() const; |
309 | 311 |
310 uint32 ReceivedInitialStreamFlowControlWindowBytes() const; | 312 uint32_t ReceivedInitialStreamFlowControlWindowBytes() const; |
311 | 313 |
312 // Sets an initial session flow control window size to transmit to the peer. | 314 // Sets an initial session flow control window size to transmit to the peer. |
313 void SetInitialSessionFlowControlWindowToSend(uint32 window_bytes); | 315 void SetInitialSessionFlowControlWindowToSend(uint32_t window_bytes); |
314 | 316 |
315 uint32 GetInitialSessionFlowControlWindowToSend() const; | 317 uint32_t GetInitialSessionFlowControlWindowToSend() const; |
316 | 318 |
317 bool HasReceivedInitialSessionFlowControlWindowBytes() const; | 319 bool HasReceivedInitialSessionFlowControlWindowBytes() const; |
318 | 320 |
319 uint32 ReceivedInitialSessionFlowControlWindowBytes() const; | 321 uint32_t ReceivedInitialSessionFlowControlWindowBytes() const; |
320 | 322 |
321 // Sets socket receive buffer to transmit to the peer. | 323 // Sets socket receive buffer to transmit to the peer. |
322 void SetSocketReceiveBufferToSend(uint32 window_bytes); | 324 void SetSocketReceiveBufferToSend(uint32_t window_bytes); |
323 | 325 |
324 bool HasReceivedSocketReceiveBuffer() const; | 326 bool HasReceivedSocketReceiveBuffer() const; |
325 | 327 |
326 uint32 ReceivedSocketReceiveBuffer() const; | 328 uint32_t ReceivedSocketReceiveBuffer() const; |
327 | 329 |
328 bool negotiated() const; | 330 bool negotiated() const; |
329 | 331 |
330 // ToHandshakeMessage serialises the settings in this object as a series of | 332 // ToHandshakeMessage serialises the settings in this object as a series of |
331 // tags /value pairs and adds them to |out|. | 333 // tags /value pairs and adds them to |out|. |
332 void ToHandshakeMessage(CryptoHandshakeMessage* out) const; | 334 void ToHandshakeMessage(CryptoHandshakeMessage* out) const; |
333 | 335 |
334 // Calls ProcessPeerHello on each negotiable parameter. On failure returns | 336 // Calls ProcessPeerHello on each negotiable parameter. On failure returns |
335 // the corresponding QuicErrorCode and sets detailed error in |error_details|. | 337 // the corresponding QuicErrorCode and sets detailed error in |error_details|. |
336 QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello, | 338 QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 // Initial session flow control receive window in bytes. | 371 // Initial session flow control receive window in bytes. |
370 QuicFixedUint32 initial_session_flow_control_window_bytes_; | 372 QuicFixedUint32 initial_session_flow_control_window_bytes_; |
371 | 373 |
372 // Socket receive buffer in bytes. | 374 // Socket receive buffer in bytes. |
373 QuicFixedUint32 socket_receive_buffer_; | 375 QuicFixedUint32 socket_receive_buffer_; |
374 }; | 376 }; |
375 | 377 |
376 } // namespace net | 378 } // namespace net |
377 | 379 |
378 #endif // NET_QUIC_QUIC_CONFIG_H_ | 380 #endif // NET_QUIC_QUIC_CONFIG_H_ |
OLD | NEW |