Lots of random cleanups, mostly for native_theme_win.cc:
[chromium-blink-merge.git] / net / quic / quic_config.cc
blobb38323082605b20c87c0ccf7a06182ccf8d89cf8
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.
5 #include "net/quic/quic_config.h"
7 #include <algorithm>
9 #include "base/logging.h"
10 #include "net/quic/crypto/crypto_handshake_message.h"
11 #include "net/quic/crypto/crypto_protocol.h"
12 #include "net/quic/quic_flags.h"
13 #include "net/quic/quic_sent_packet_manager.h"
14 #include "net/quic/quic_utils.h"
16 using std::min;
17 using std::string;
19 namespace net {
21 // Reads the value corresponding to |name_| from |msg| into |out|. If the
22 // |name_| is absent in |msg| and |presence| is set to OPTIONAL |out| is set
23 // to |default_value|.
24 QuicErrorCode ReadUint32(const CryptoHandshakeMessage& msg,
25 QuicTag tag,
26 QuicConfigPresence presence,
27 uint32 default_value,
28 uint32* out,
29 string* error_details) {
30 DCHECK(error_details != NULL);
31 QuicErrorCode error = msg.GetUint32(tag, out);
32 switch (error) {
33 case QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND:
34 if (presence == PRESENCE_REQUIRED) {
35 *error_details = "Missing " + QuicUtils::TagToString(tag);
36 break;
38 error = QUIC_NO_ERROR;
39 *out = default_value;
40 break;
41 case QUIC_NO_ERROR:
42 break;
43 default:
44 *error_details = "Bad " + QuicUtils::TagToString(tag);
45 break;
47 return error;
51 QuicConfigValue::QuicConfigValue(QuicTag tag,
52 QuicConfigPresence presence)
53 : tag_(tag),
54 presence_(presence) {
56 QuicConfigValue::~QuicConfigValue() {}
58 QuicNegotiableValue::QuicNegotiableValue(QuicTag tag,
59 QuicConfigPresence presence)
60 : QuicConfigValue(tag, presence),
61 negotiated_(false) {
63 QuicNegotiableValue::~QuicNegotiableValue() {}
65 QuicNegotiableUint32::QuicNegotiableUint32(QuicTag tag,
66 QuicConfigPresence presence)
67 : QuicNegotiableValue(tag, presence),
68 max_value_(0),
69 default_value_(0) {
71 QuicNegotiableUint32::~QuicNegotiableUint32() {}
73 void QuicNegotiableUint32::set(uint32 max, uint32 default_value) {
74 DCHECK_LE(default_value, max);
75 max_value_ = max;
76 default_value_ = default_value;
79 uint32 QuicNegotiableUint32::GetUint32() const {
80 if (negotiated_) {
81 return negotiated_value_;
83 return default_value_;
86 void QuicNegotiableUint32::ToHandshakeMessage(
87 CryptoHandshakeMessage* out) const {
88 if (negotiated_) {
89 out->SetValue(tag_, negotiated_value_);
90 } else {
91 out->SetValue(tag_, max_value_);
95 QuicErrorCode QuicNegotiableUint32::ProcessPeerHello(
96 const CryptoHandshakeMessage& peer_hello,
97 HelloType hello_type,
98 string* error_details) {
99 DCHECK(!negotiated_);
100 DCHECK(error_details != NULL);
101 uint32 value;
102 QuicErrorCode error = ReadUint32(peer_hello,
103 tag_,
104 presence_,
105 default_value_,
106 &value,
107 error_details);
108 if (error != QUIC_NO_ERROR) {
109 return error;
111 if (hello_type == SERVER && value > max_value_) {
112 *error_details =
113 "Invalid value received for " + QuicUtils::TagToString(tag_);
114 return QUIC_INVALID_NEGOTIATED_VALUE;
117 negotiated_ = true;
118 negotiated_value_ = min(value, max_value_);
119 return QUIC_NO_ERROR;
122 QuicNegotiableTag::QuicNegotiableTag(QuicTag tag, QuicConfigPresence presence)
123 : QuicNegotiableValue(tag, presence),
124 negotiated_tag_(0),
125 default_value_(0) {
128 QuicNegotiableTag::~QuicNegotiableTag() {}
130 void QuicNegotiableTag::set(const QuicTagVector& possible,
131 QuicTag default_value) {
132 DCHECK(ContainsQuicTag(possible, default_value));
133 possible_values_ = possible;
134 default_value_ = default_value;
137 QuicTag QuicNegotiableTag::GetTag() const {
138 if (negotiated_) {
139 return negotiated_tag_;
141 return default_value_;
144 void QuicNegotiableTag::ToHandshakeMessage(CryptoHandshakeMessage* out) const {
145 if (negotiated_) {
146 // Because of the way we serialize and parse handshake messages we can
147 // serialize this as value and still parse it as a vector.
148 out->SetValue(tag_, negotiated_tag_);
149 } else {
150 out->SetVector(tag_, possible_values_);
154 QuicErrorCode QuicNegotiableTag::ReadVector(
155 const CryptoHandshakeMessage& msg,
156 const QuicTag** out,
157 size_t* out_length,
158 string* error_details) const {
159 DCHECK(error_details != NULL);
160 QuicErrorCode error = msg.GetTaglist(tag_, out, out_length);
161 switch (error) {
162 case QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND:
163 if (presence_ == PRESENCE_REQUIRED) {
164 *error_details = "Missing " + QuicUtils::TagToString(tag_);
165 break;
167 error = QUIC_NO_ERROR;
168 *out_length = 1;
169 *out = &default_value_;
171 case QUIC_NO_ERROR:
172 break;
173 default:
174 *error_details = "Bad " + QuicUtils::TagToString(tag_);
175 break;
177 return error;
180 QuicErrorCode QuicNegotiableTag::ProcessPeerHello(
181 const CryptoHandshakeMessage& peer_hello,
182 HelloType hello_type,
183 string* error_details) {
184 DCHECK(!negotiated_);
185 DCHECK(error_details != NULL);
186 const QuicTag* received_tags;
187 size_t received_tags_length;
188 QuicErrorCode error = ReadVector(peer_hello, &received_tags,
189 &received_tags_length, error_details);
190 if (error != QUIC_NO_ERROR) {
191 return error;
194 if (hello_type == SERVER) {
195 if (received_tags_length != 1 ||
196 !ContainsQuicTag(possible_values_, *received_tags)) {
197 *error_details = "Invalid " + QuicUtils::TagToString(tag_);
198 return QUIC_INVALID_NEGOTIATED_VALUE;
200 negotiated_tag_ = *received_tags;
201 } else {
202 QuicTag negotiated_tag;
203 if (!QuicUtils::FindMutualTag(possible_values_,
204 received_tags,
205 received_tags_length,
206 QuicUtils::LOCAL_PRIORITY,
207 &negotiated_tag,
208 NULL)) {
209 *error_details = "Unsupported " + QuicUtils::TagToString(tag_);
210 return QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP;
212 negotiated_tag_ = negotiated_tag;
215 negotiated_ = true;
216 return QUIC_NO_ERROR;
219 QuicFixedUint32::QuicFixedUint32(QuicTag tag, QuicConfigPresence presence)
220 : QuicConfigValue(tag, presence),
221 has_send_value_(false),
222 has_receive_value_(false) {
224 QuicFixedUint32::~QuicFixedUint32() {}
226 bool QuicFixedUint32::HasSendValue() const {
227 return has_send_value_;
230 uint32 QuicFixedUint32::GetSendValue() const {
231 LOG_IF(DFATAL, !has_send_value_)
232 << "No send value to get for tag:" << QuicUtils::TagToString(tag_);
233 return send_value_;
236 void QuicFixedUint32::SetSendValue(uint32 value) {
237 has_send_value_ = true;
238 send_value_ = value;
241 bool QuicFixedUint32::HasReceivedValue() const {
242 return has_receive_value_;
245 uint32 QuicFixedUint32::GetReceivedValue() const {
246 LOG_IF(DFATAL, !has_receive_value_)
247 << "No receive value to get for tag:" << QuicUtils::TagToString(tag_);
248 return receive_value_;
251 void QuicFixedUint32::SetReceivedValue(uint32 value) {
252 has_receive_value_ = true;
253 receive_value_ = value;
256 void QuicFixedUint32::ToHandshakeMessage(CryptoHandshakeMessage* out) const {
257 if (has_send_value_) {
258 out->SetValue(tag_, send_value_);
262 QuicErrorCode QuicFixedUint32::ProcessPeerHello(
263 const CryptoHandshakeMessage& peer_hello,
264 HelloType hello_type,
265 string* error_details) {
266 DCHECK(error_details != NULL);
267 QuicErrorCode error = peer_hello.GetUint32(tag_, &receive_value_);
268 switch (error) {
269 case QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND:
270 if (presence_ == PRESENCE_OPTIONAL) {
271 return QUIC_NO_ERROR;
273 *error_details = "Missing " + QuicUtils::TagToString(tag_);
274 break;
275 case QUIC_NO_ERROR:
276 has_receive_value_ = true;
277 break;
278 default:
279 *error_details = "Bad " + QuicUtils::TagToString(tag_);
280 break;
282 return error;
285 QuicFixedTag::QuicFixedTag(QuicTag name,
286 QuicConfigPresence presence)
287 : QuicConfigValue(name, presence),
288 has_send_value_(false),
289 has_receive_value_(false) {
292 QuicFixedTag::~QuicFixedTag() {}
294 bool QuicFixedTag::HasSendValue() const {
295 return has_send_value_;
298 uint32 QuicFixedTag::GetSendValue() const {
299 LOG_IF(DFATAL, !has_send_value_)
300 << "No send value to get for tag:" << QuicUtils::TagToString(tag_);
301 return send_value_;
304 void QuicFixedTag::SetSendValue(uint32 value) {
305 has_send_value_ = true;
306 send_value_ = value;
309 bool QuicFixedTag::HasReceivedValue() const {
310 return has_receive_value_;
313 uint32 QuicFixedTag::GetReceivedValue() const {
314 LOG_IF(DFATAL, !has_receive_value_)
315 << "No receive value to get for tag:" << QuicUtils::TagToString(tag_);
316 return receive_value_;
319 void QuicFixedTag::SetReceivedValue(uint32 value) {
320 has_receive_value_ = true;
321 receive_value_ = value;
324 void QuicFixedTag::ToHandshakeMessage(CryptoHandshakeMessage* out) const {
325 if (has_send_value_) {
326 out->SetValue(tag_, send_value_);
330 QuicErrorCode QuicFixedTag::ProcessPeerHello(
331 const CryptoHandshakeMessage& peer_hello,
332 HelloType hello_type,
333 string* error_details) {
334 DCHECK(error_details != NULL);
335 QuicErrorCode error = peer_hello.GetUint32(tag_, &receive_value_);
336 switch (error) {
337 case QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND:
338 if (presence_ == PRESENCE_OPTIONAL) {
339 return QUIC_NO_ERROR;
341 *error_details = "Missing " + QuicUtils::TagToString(tag_);
342 break;
343 case QUIC_NO_ERROR:
344 has_receive_value_ = true;
345 break;
346 default:
347 *error_details = "Bad " + QuicUtils::TagToString(tag_);
348 break;
350 return error;
353 QuicFixedTagVector::QuicFixedTagVector(QuicTag name,
354 QuicConfigPresence presence)
355 : QuicConfigValue(name, presence),
356 has_send_values_(false),
357 has_receive_values_(false) {
360 QuicFixedTagVector::~QuicFixedTagVector() {}
362 bool QuicFixedTagVector::HasSendValues() const {
363 return has_send_values_;
366 QuicTagVector QuicFixedTagVector::GetSendValues() const {
367 LOG_IF(DFATAL, !has_send_values_)
368 << "No send values to get for tag:" << QuicUtils::TagToString(tag_);
369 return send_values_;
372 void QuicFixedTagVector::SetSendValues(const QuicTagVector& values) {
373 has_send_values_ = true;
374 send_values_ = values;
377 bool QuicFixedTagVector::HasReceivedValues() const {
378 return has_receive_values_;
381 QuicTagVector QuicFixedTagVector::GetReceivedValues() const {
382 LOG_IF(DFATAL, !has_receive_values_)
383 << "No receive value to get for tag:" << QuicUtils::TagToString(tag_);
384 return receive_values_;
387 void QuicFixedTagVector::SetReceivedValues(const QuicTagVector& values) {
388 has_receive_values_ = true;
389 receive_values_ = values;
392 void QuicFixedTagVector::ToHandshakeMessage(CryptoHandshakeMessage* out) const {
393 if (has_send_values_) {
394 out->SetVector(tag_, send_values_);
398 QuicErrorCode QuicFixedTagVector::ProcessPeerHello(
399 const CryptoHandshakeMessage& peer_hello,
400 HelloType hello_type,
401 string* error_details) {
402 DCHECK(error_details != NULL);
403 const QuicTag* received_tags;
404 size_t received_tags_length;
405 QuicErrorCode error =
406 peer_hello.GetTaglist(tag_, &received_tags, &received_tags_length);
407 switch (error) {
408 case QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND:
409 if (presence_ == PRESENCE_OPTIONAL) {
410 return QUIC_NO_ERROR;
412 *error_details = "Missing " + QuicUtils::TagToString(tag_);
413 break;
414 case QUIC_NO_ERROR:
415 DVLOG(1) << "Received Connection Option tags from receiver.";
416 has_receive_values_ = true;
417 for (size_t i = 0; i < received_tags_length; ++i) {
418 receive_values_.push_back(received_tags[i]);
420 break;
421 default:
422 *error_details = "Bad " + QuicUtils::TagToString(tag_);
423 break;
425 return error;
428 QuicConfig::QuicConfig()
429 : congestion_feedback_(kCGST, PRESENCE_REQUIRED),
430 connection_options_(kCOPT, PRESENCE_OPTIONAL),
431 loss_detection_(kLOSS, PRESENCE_OPTIONAL),
432 idle_connection_state_lifetime_seconds_(kICSL, PRESENCE_REQUIRED),
433 keepalive_timeout_seconds_(kKATO, PRESENCE_OPTIONAL),
434 max_streams_per_connection_(kMSPC, PRESENCE_REQUIRED),
435 max_time_before_crypto_handshake_(QuicTime::Delta::Zero()),
436 initial_congestion_window_(kSWND, PRESENCE_OPTIONAL),
437 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL),
438 // TODO(rjshade): Make this PRESENCE_REQUIRED when QUIC_VERSION_16 and
439 // QUIC_VERSION_15 are retired.
440 initial_flow_control_window_bytes_(kIFCW, PRESENCE_OPTIONAL),
441 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring
442 // QUIC_VERSION_19.
443 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL),
444 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring
445 // QUIC_VERSION_19.
446 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL) {
449 QuicConfig::~QuicConfig() {}
451 void QuicConfig::set_congestion_feedback(
452 const QuicTagVector& congestion_feedback,
453 QuicTag default_congestion_feedback) {
454 congestion_feedback_.set(congestion_feedback, default_congestion_feedback);
457 QuicTag QuicConfig::congestion_feedback() const {
458 return congestion_feedback_.GetTag();
461 void QuicConfig::SetConnectionOptionsToSend(
462 const QuicTagVector& connection_options) {
463 connection_options_.SetSendValues(connection_options);
466 bool QuicConfig::HasReceivedConnectionOptions() const {
467 return connection_options_.HasReceivedValues();
470 QuicTagVector QuicConfig::ReceivedConnectionOptions() const {
471 return connection_options_.GetReceivedValues();
474 bool QuicConfig::HasSendConnectionOptions() const {
475 return connection_options_.HasSendValues();
478 QuicTagVector QuicConfig::SendConnectionOptions() const {
479 return connection_options_.GetSendValues();
482 void QuicConfig::SetLossDetectionToSend(QuicTag loss_detection) {
483 loss_detection_.SetSendValue(loss_detection);
486 bool QuicConfig::HasReceivedLossDetection() const {
487 return loss_detection_.HasReceivedValue();
490 QuicTag QuicConfig::ReceivedLossDetection() const {
491 return loss_detection_.GetReceivedValue();
494 void QuicConfig::set_idle_connection_state_lifetime(
495 QuicTime::Delta max_idle_connection_state_lifetime,
496 QuicTime::Delta default_idle_conection_state_lifetime) {
497 idle_connection_state_lifetime_seconds_.set(
498 max_idle_connection_state_lifetime.ToSeconds(),
499 default_idle_conection_state_lifetime.ToSeconds());
502 QuicTime::Delta QuicConfig::idle_connection_state_lifetime() const {
503 return QuicTime::Delta::FromSeconds(
504 idle_connection_state_lifetime_seconds_.GetUint32());
507 QuicTime::Delta QuicConfig::keepalive_timeout() const {
508 return QuicTime::Delta::FromSeconds(
509 keepalive_timeout_seconds_.GetUint32());
512 void QuicConfig::set_max_streams_per_connection(size_t max_streams,
513 size_t default_streams) {
514 max_streams_per_connection_.set(max_streams, default_streams);
517 uint32 QuicConfig::max_streams_per_connection() const {
518 return max_streams_per_connection_.GetUint32();
521 void QuicConfig::set_max_time_before_crypto_handshake(
522 QuicTime::Delta max_time_before_crypto_handshake) {
523 max_time_before_crypto_handshake_ = max_time_before_crypto_handshake;
526 QuicTime::Delta QuicConfig::max_time_before_crypto_handshake() const {
527 return max_time_before_crypto_handshake_;
530 void QuicConfig::SetInitialCongestionWindowToSend(size_t initial_window) {
531 initial_congestion_window_.SetSendValue(initial_window);
534 bool QuicConfig::HasReceivedInitialCongestionWindow() const {
535 return initial_congestion_window_.HasReceivedValue();
538 uint32 QuicConfig::ReceivedInitialCongestionWindow() const {
539 return initial_congestion_window_.GetReceivedValue();
542 void QuicConfig::SetInitialRoundTripTimeUsToSend(size_t rtt) {
543 initial_round_trip_time_us_.SetSendValue(rtt);
546 bool QuicConfig::HasReceivedInitialRoundTripTimeUs() const {
547 return initial_round_trip_time_us_.HasReceivedValue();
550 uint32 QuicConfig::ReceivedInitialRoundTripTimeUs() const {
551 return initial_round_trip_time_us_.GetReceivedValue();
554 void QuicConfig::SetInitialFlowControlWindowToSend(uint32 window_bytes) {
555 if (window_bytes < kDefaultFlowControlSendWindow) {
556 LOG(DFATAL) << "Initial flow control receive window (" << window_bytes
557 << ") cannot be set lower than default ("
558 << kDefaultFlowControlSendWindow << ").";
559 window_bytes = kDefaultFlowControlSendWindow;
561 initial_flow_control_window_bytes_.SetSendValue(window_bytes);
564 uint32 QuicConfig::GetInitialFlowControlWindowToSend() const {
565 return initial_flow_control_window_bytes_.GetSendValue();
568 bool QuicConfig::HasReceivedInitialFlowControlWindowBytes() const {
569 return initial_flow_control_window_bytes_.HasReceivedValue();
572 uint32 QuicConfig::ReceivedInitialFlowControlWindowBytes() const {
573 return initial_flow_control_window_bytes_.GetReceivedValue();
576 void QuicConfig::SetInitialStreamFlowControlWindowToSend(uint32 window_bytes) {
577 if (window_bytes < kDefaultFlowControlSendWindow) {
578 LOG(DFATAL) << "Initial stream flow control receive window ("
579 << window_bytes << ") cannot be set lower than default ("
580 << kDefaultFlowControlSendWindow << ").";
581 window_bytes = kDefaultFlowControlSendWindow;
583 initial_stream_flow_control_window_bytes_.SetSendValue(window_bytes);
586 uint32 QuicConfig::GetInitialStreamFlowControlWindowToSend() const {
587 return initial_stream_flow_control_window_bytes_.GetSendValue();
590 bool QuicConfig::HasReceivedInitialStreamFlowControlWindowBytes() const {
591 return initial_stream_flow_control_window_bytes_.HasReceivedValue();
594 uint32 QuicConfig::ReceivedInitialStreamFlowControlWindowBytes() const {
595 return initial_stream_flow_control_window_bytes_.GetReceivedValue();
598 void QuicConfig::SetInitialSessionFlowControlWindowToSend(uint32 window_bytes) {
599 if (window_bytes < kDefaultFlowControlSendWindow) {
600 LOG(DFATAL) << "Initial session flow control receive window ("
601 << window_bytes << ") cannot be set lower than default ("
602 << kDefaultFlowControlSendWindow << ").";
603 window_bytes = kDefaultFlowControlSendWindow;
605 initial_session_flow_control_window_bytes_.SetSendValue(window_bytes);
608 uint32 QuicConfig::GetInitialSessionFlowControlWindowToSend() const {
609 return initial_session_flow_control_window_bytes_.GetSendValue();
612 bool QuicConfig::HasReceivedInitialSessionFlowControlWindowBytes() const {
613 return initial_session_flow_control_window_bytes_.HasReceivedValue();
616 uint32 QuicConfig::ReceivedInitialSessionFlowControlWindowBytes() const {
617 return initial_session_flow_control_window_bytes_.GetReceivedValue();
620 bool QuicConfig::negotiated() {
621 // TODO(ianswett): Add the negotiated parameters once and iterate over all
622 // of them in negotiated, ToHandshakeMessage, ProcessClientHello, and
623 // ProcessServerHello.
624 return congestion_feedback_.negotiated() &&
625 idle_connection_state_lifetime_seconds_.negotiated() &&
626 keepalive_timeout_seconds_.negotiated() &&
627 max_streams_per_connection_.negotiated();
630 void QuicConfig::SetDefaults() {
631 QuicTagVector congestion_feedback;
632 if (FLAGS_enable_quic_pacing) {
633 congestion_feedback.push_back(kPACE);
635 congestion_feedback.push_back(kQBIC);
636 congestion_feedback_.set(congestion_feedback, kQBIC);
637 idle_connection_state_lifetime_seconds_.set(kDefaultTimeoutSecs,
638 kDefaultInitialTimeoutSecs);
639 // kKATO is optional. Return 0 if not negotiated.
640 keepalive_timeout_seconds_.set(0, 0);
641 max_streams_per_connection_.set(kDefaultMaxStreamsPerConnection,
642 kDefaultMaxStreamsPerConnection);
643 max_time_before_crypto_handshake_ = QuicTime::Delta::FromSeconds(
644 kDefaultMaxTimeForCryptoHandshakeSecs);
646 SetInitialFlowControlWindowToSend(kDefaultFlowControlSendWindow);
647 SetInitialStreamFlowControlWindowToSend(kDefaultFlowControlSendWindow);
648 SetInitialSessionFlowControlWindowToSend(kDefaultFlowControlSendWindow);
651 void QuicConfig::EnablePacing(bool enable_pacing) {
652 QuicTagVector congestion_feedback;
653 if (enable_pacing) {
654 congestion_feedback.push_back(kPACE);
656 congestion_feedback.push_back(kQBIC);
657 congestion_feedback_.set(congestion_feedback, kQBIC);
660 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const {
661 congestion_feedback_.ToHandshakeMessage(out);
662 idle_connection_state_lifetime_seconds_.ToHandshakeMessage(out);
663 keepalive_timeout_seconds_.ToHandshakeMessage(out);
664 max_streams_per_connection_.ToHandshakeMessage(out);
665 initial_congestion_window_.ToHandshakeMessage(out);
666 initial_round_trip_time_us_.ToHandshakeMessage(out);
667 loss_detection_.ToHandshakeMessage(out);
668 initial_flow_control_window_bytes_.ToHandshakeMessage(out);
669 initial_stream_flow_control_window_bytes_.ToHandshakeMessage(out);
670 initial_session_flow_control_window_bytes_.ToHandshakeMessage(out);
671 connection_options_.ToHandshakeMessage(out);
674 QuicErrorCode QuicConfig::ProcessPeerHello(
675 const CryptoHandshakeMessage& peer_hello,
676 HelloType hello_type,
677 string* error_details) {
678 DCHECK(error_details != NULL);
680 QuicErrorCode error = QUIC_NO_ERROR;
681 if (error == QUIC_NO_ERROR) {
682 error = congestion_feedback_.ProcessPeerHello(
683 peer_hello, hello_type, error_details);
685 if (error == QUIC_NO_ERROR) {
686 error = idle_connection_state_lifetime_seconds_.ProcessPeerHello(
687 peer_hello, hello_type, error_details);
689 if (error == QUIC_NO_ERROR) {
690 error = keepalive_timeout_seconds_.ProcessPeerHello(
691 peer_hello, hello_type, error_details);
693 if (error == QUIC_NO_ERROR) {
694 error = max_streams_per_connection_.ProcessPeerHello(
695 peer_hello, hello_type, error_details);
697 if (error == QUIC_NO_ERROR) {
698 error = initial_congestion_window_.ProcessPeerHello(
699 peer_hello, hello_type, error_details);
701 if (error == QUIC_NO_ERROR) {
702 error = initial_round_trip_time_us_.ProcessPeerHello(
703 peer_hello, hello_type, error_details);
705 if (error == QUIC_NO_ERROR) {
706 error = initial_flow_control_window_bytes_.ProcessPeerHello(
707 peer_hello, hello_type, error_details);
709 if (error == QUIC_NO_ERROR) {
710 error = initial_stream_flow_control_window_bytes_.ProcessPeerHello(
711 peer_hello, hello_type, error_details);
713 if (error == QUIC_NO_ERROR) {
714 error = initial_session_flow_control_window_bytes_.ProcessPeerHello(
715 peer_hello, hello_type, error_details);
717 if (error == QUIC_NO_ERROR) {
718 error = loss_detection_.ProcessPeerHello(
719 peer_hello, hello_type, error_details);
721 if (error == QUIC_NO_ERROR) {
722 error = connection_options_.ProcessPeerHello(
723 peer_hello, hello_type, error_details);
725 return error;
728 } // namespace net