| 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 "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // doesn't contain a value corresponding to |name_|. |max| is serialised via | 82 // doesn't contain a value corresponding to |name_|. |max| is serialised via |
| 83 // ToHandshakeMessage call if |negotiated_| is false. | 83 // ToHandshakeMessage call if |negotiated_| is false. |
| 84 void set(uint32 max, uint32 default_value); | 84 void set(uint32 max, uint32 default_value); |
| 85 | 85 |
| 86 // Returns the value negotiated if |negotiated_| is true, otherwise returns | 86 // Returns the value negotiated if |negotiated_| is true, otherwise returns |
| 87 // default_value_ (used to set default values before negotiation finishes). | 87 // default_value_ (used to set default values before negotiation finishes). |
| 88 uint32 GetUint32() const; | 88 uint32 GetUint32() const; |
| 89 | 89 |
| 90 // Serialises |name_| and value to |out|. If |negotiated_| is true then | 90 // Serialises |name_| and value to |out|. If |negotiated_| is true then |
| 91 // |negotiated_value_| is serialised, otherwise |max_value_| is serialised. | 91 // |negotiated_value_| is serialised, otherwise |max_value_| is serialised. |
| 92 virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const OVERRIDE; | 92 virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; |
| 93 | 93 |
| 94 // Sets |negotiated_value_| to the minimum of |max_value_| and the | 94 // Sets |negotiated_value_| to the minimum of |max_value_| and the |
| 95 // corresponding value from |peer_hello|. If the corresponding value is | 95 // corresponding value from |peer_hello|. If the corresponding value is |
| 96 // missing and PRESENCE_OPTIONAL then |negotiated_value_| is set to | 96 // missing and PRESENCE_OPTIONAL then |negotiated_value_| is set to |
| 97 // |default_value_|. | 97 // |default_value_|. |
| 98 virtual QuicErrorCode ProcessPeerHello( | 98 virtual QuicErrorCode ProcessPeerHello( |
| 99 const CryptoHandshakeMessage& peer_hello, | 99 const CryptoHandshakeMessage& peer_hello, |
| 100 HelloType hello_type, | 100 HelloType hello_type, |
| 101 std::string* error_details) OVERRIDE; | 101 std::string* error_details) override; |
| 102 | 102 |
| 103 private: | 103 private: |
| 104 uint32 max_value_; | 104 uint32 max_value_; |
| 105 uint32 default_value_; | 105 uint32 default_value_; |
| 106 uint32 negotiated_value_; | 106 uint32 negotiated_value_; |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 class NET_EXPORT_PRIVATE QuicNegotiableTag : public QuicNegotiableValue { | 109 class NET_EXPORT_PRIVATE QuicNegotiableTag : public QuicNegotiableValue { |
| 110 public: | 110 public: |
| 111 QuicNegotiableTag(QuicTag name, QuicConfigPresence presence); | 111 QuicNegotiableTag(QuicTag name, QuicConfigPresence presence); |
| 112 virtual ~QuicNegotiableTag(); | 112 virtual ~QuicNegotiableTag(); |
| 113 | 113 |
| 114 // Sets the possible values that |negotiated_tag_| can take after negotiation | 114 // Sets the possible values that |negotiated_tag_| can take after negotiation |
| 115 // and the default value that |negotiated_tag_| takes if OPTIONAL and *HLO | 115 // and the default value that |negotiated_tag_| takes if OPTIONAL and *HLO |
| 116 // msg doesn't contain tag |name_|. | 116 // msg doesn't contain tag |name_|. |
| 117 void set(const QuicTagVector& possible_values, QuicTag default_value); | 117 void set(const QuicTagVector& possible_values, QuicTag default_value); |
| 118 | 118 |
| 119 // Returns the negotiated tag if |negotiated_| is true, otherwise returns | 119 // Returns the negotiated tag if |negotiated_| is true, otherwise returns |
| 120 // |default_value_| (used to set default values before negotiation finishes). | 120 // |default_value_| (used to set default values before negotiation finishes). |
| 121 QuicTag GetTag() const; | 121 QuicTag GetTag() const; |
| 122 | 122 |
| 123 // Serialises |name_| and vector (either possible or negotiated) to |out|. If | 123 // Serialises |name_| and vector (either possible or negotiated) to |out|. If |
| 124 // |negotiated_| is true then |negotiated_tag_| is serialised, otherwise | 124 // |negotiated_| is true then |negotiated_tag_| is serialised, otherwise |
| 125 // |possible_values_| is serialised. | 125 // |possible_values_| is serialised. |
| 126 virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const OVERRIDE; | 126 virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; |
| 127 | 127 |
| 128 // Selects the tag common to both tags in |client_hello| for |name_| and | 128 // Selects the tag common to both tags in |client_hello| for |name_| and |
| 129 // |possible_values_| with preference to tag in |possible_values_|. The | 129 // |possible_values_| with preference to tag in |possible_values_|. The |
| 130 // selected tag is set as |negotiated_tag_|. | 130 // selected tag is set as |negotiated_tag_|. |
| 131 virtual QuicErrorCode ProcessPeerHello( | 131 virtual QuicErrorCode ProcessPeerHello( |
| 132 const CryptoHandshakeMessage& peer_hello, | 132 const CryptoHandshakeMessage& peer_hello, |
| 133 HelloType hello_type, | 133 HelloType hello_type, |
| 134 std::string* error_details) OVERRIDE; | 134 std::string* error_details) override; |
| 135 | 135 |
| 136 private: | 136 private: |
| 137 // Reads the vector corresponding to |name_| from |msg| into |out|. If the | 137 // Reads the vector corresponding to |name_| from |msg| into |out|. If the |
| 138 // |name_| is absent in |msg| and |presence_| is set to OPTIONAL |out| is set | 138 // |name_| is absent in |msg| and |presence_| is set to OPTIONAL |out| is set |
| 139 // to |possible_values_|. | 139 // to |possible_values_|. |
| 140 QuicErrorCode ReadVector(const CryptoHandshakeMessage& msg, | 140 QuicErrorCode ReadVector(const CryptoHandshakeMessage& msg, |
| 141 const QuicTag** out, | 141 const QuicTag** out, |
| 142 size_t* out_length, | 142 size_t* out_length, |
| 143 std::string* error_details) const; | 143 std::string* error_details) const; |
| 144 | 144 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 159 | 159 |
| 160 void SetSendValue(uint32 value); | 160 void SetSendValue(uint32 value); |
| 161 | 161 |
| 162 bool HasReceivedValue() const; | 162 bool HasReceivedValue() const; |
| 163 | 163 |
| 164 uint32 GetReceivedValue() const; | 164 uint32 GetReceivedValue() const; |
| 165 | 165 |
| 166 void SetReceivedValue(uint32 value); | 166 void SetReceivedValue(uint32 value); |
| 167 | 167 |
| 168 // If has_send_value is true, serialises |tag_| and |send_value_| to |out|. | 168 // If has_send_value is true, serialises |tag_| and |send_value_| to |out|. |
| 169 virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const OVERRIDE; | 169 virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; |
| 170 | 170 |
| 171 // Sets |value_| to the corresponding value from |peer_hello_| if it exists. | 171 // Sets |value_| to the corresponding value from |peer_hello_| if it exists. |
| 172 virtual QuicErrorCode ProcessPeerHello( | 172 virtual QuicErrorCode ProcessPeerHello( |
| 173 const CryptoHandshakeMessage& peer_hello, | 173 const CryptoHandshakeMessage& peer_hello, |
| 174 HelloType hello_type, | 174 HelloType hello_type, |
| 175 std::string* error_details) OVERRIDE; | 175 std::string* error_details) override; |
| 176 | 176 |
| 177 private: | 177 private: |
| 178 uint32 send_value_; | 178 uint32 send_value_; |
| 179 bool has_send_value_; | 179 bool has_send_value_; |
| 180 uint32 receive_value_; | 180 uint32 receive_value_; |
| 181 bool has_receive_value_; | 181 bool has_receive_value_; |
| 182 }; | 182 }; |
| 183 | 183 |
| 184 // Stores tag from CHLO or SHLO messages that are not negotiated. | 184 // Stores tag from CHLO or SHLO messages that are not negotiated. |
| 185 class NET_EXPORT_PRIVATE QuicFixedTag : public QuicConfigValue { | 185 class NET_EXPORT_PRIVATE QuicFixedTag : public QuicConfigValue { |
| 186 public: | 186 public: |
| 187 QuicFixedTag(QuicTag name, QuicConfigPresence presence); | 187 QuicFixedTag(QuicTag name, QuicConfigPresence presence); |
| 188 virtual ~QuicFixedTag(); | 188 virtual ~QuicFixedTag(); |
| 189 | 189 |
| 190 bool HasSendValue() const; | 190 bool HasSendValue() const; |
| 191 | 191 |
| 192 QuicTag GetSendValue() const; | 192 QuicTag GetSendValue() const; |
| 193 | 193 |
| 194 void SetSendValue(QuicTag value); | 194 void SetSendValue(QuicTag value); |
| 195 | 195 |
| 196 bool HasReceivedValue() const; | 196 bool HasReceivedValue() const; |
| 197 | 197 |
| 198 QuicTag GetReceivedValue() const; | 198 QuicTag GetReceivedValue() const; |
| 199 | 199 |
| 200 void SetReceivedValue(QuicTag value); | 200 void SetReceivedValue(QuicTag value); |
| 201 | 201 |
| 202 // If has_send_value is true, serialises |tag_| and |send_value_| to |out|. | 202 // If has_send_value is true, serialises |tag_| and |send_value_| to |out|. |
| 203 virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const OVERRIDE; | 203 virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; |
| 204 | 204 |
| 205 // Sets |value_| to the corresponding value from |client_hello_| if it exists. | 205 // Sets |value_| to the corresponding value from |client_hello_| if it exists. |
| 206 virtual QuicErrorCode ProcessPeerHello( | 206 virtual QuicErrorCode ProcessPeerHello( |
| 207 const CryptoHandshakeMessage& peer_hello, | 207 const CryptoHandshakeMessage& peer_hello, |
| 208 HelloType hello_type, | 208 HelloType hello_type, |
| 209 std::string* error_details) OVERRIDE; | 209 std::string* error_details) override; |
| 210 | 210 |
| 211 private: | 211 private: |
| 212 QuicTag send_value_; | 212 QuicTag send_value_; |
| 213 bool has_send_value_; | 213 bool has_send_value_; |
| 214 QuicTag receive_value_; | 214 QuicTag receive_value_; |
| 215 bool has_receive_value_; | 215 bool has_receive_value_; |
| 216 }; | 216 }; |
| 217 | 217 |
| 218 // Stores tag from CHLO or SHLO messages that are not negotiated. | 218 // Stores tag from CHLO or SHLO messages that are not negotiated. |
| 219 class NET_EXPORT_PRIVATE QuicFixedTagVector : public QuicConfigValue { | 219 class NET_EXPORT_PRIVATE QuicFixedTagVector : public QuicConfigValue { |
| 220 public: | 220 public: |
| 221 QuicFixedTagVector(QuicTag name, QuicConfigPresence presence); | 221 QuicFixedTagVector(QuicTag name, QuicConfigPresence presence); |
| 222 virtual ~QuicFixedTagVector(); | 222 virtual ~QuicFixedTagVector(); |
| 223 | 223 |
| 224 bool HasSendValues() const; | 224 bool HasSendValues() const; |
| 225 | 225 |
| 226 QuicTagVector GetSendValues() const; | 226 QuicTagVector GetSendValues() const; |
| 227 | 227 |
| 228 void SetSendValues(const QuicTagVector& values); | 228 void SetSendValues(const QuicTagVector& values); |
| 229 | 229 |
| 230 bool HasReceivedValues() const; | 230 bool HasReceivedValues() const; |
| 231 | 231 |
| 232 QuicTagVector GetReceivedValues() const; | 232 QuicTagVector GetReceivedValues() const; |
| 233 | 233 |
| 234 void SetReceivedValues(const QuicTagVector& values); | 234 void SetReceivedValues(const QuicTagVector& values); |
| 235 | 235 |
| 236 // If has_send_value is true, serialises |tag_vector_| and |send_value_| to | 236 // If has_send_value is true, serialises |tag_vector_| and |send_value_| to |
| 237 // |out|. | 237 // |out|. |
| 238 virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const OVERRIDE; | 238 virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; |
| 239 | 239 |
| 240 // Sets |receive_values_| to the corresponding value from |client_hello_| if | 240 // Sets |receive_values_| to the corresponding value from |client_hello_| if |
| 241 // it exists. | 241 // it exists. |
| 242 virtual QuicErrorCode ProcessPeerHello( | 242 virtual QuicErrorCode ProcessPeerHello( |
| 243 const CryptoHandshakeMessage& peer_hello, | 243 const CryptoHandshakeMessage& peer_hello, |
| 244 HelloType hello_type, | 244 HelloType hello_type, |
| 245 std::string* error_details) OVERRIDE; | 245 std::string* error_details) override; |
| 246 | 246 |
| 247 private: | 247 private: |
| 248 QuicTagVector send_values_; | 248 QuicTagVector send_values_; |
| 249 bool has_send_values_; | 249 bool has_send_values_; |
| 250 QuicTagVector receive_values_; | 250 QuicTagVector receive_values_; |
| 251 bool has_receive_values_; | 251 bool has_receive_values_; |
| 252 }; | 252 }; |
| 253 | 253 |
| 254 // QuicConfig contains non-crypto configuration options that are negotiated in | 254 // QuicConfig contains non-crypto configuration options that are negotiated in |
| 255 // the crypto handshake. | 255 // the crypto handshake. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 // Initial session flow control receive window in bytes. | 408 // Initial session flow control receive window in bytes. |
| 409 QuicFixedUint32 initial_session_flow_control_window_bytes_; | 409 QuicFixedUint32 initial_session_flow_control_window_bytes_; |
| 410 | 410 |
| 411 // Socket receive buffer in bytes. | 411 // Socket receive buffer in bytes. |
| 412 QuicFixedUint32 socket_receive_buffer_; | 412 QuicFixedUint32 socket_receive_buffer_; |
| 413 }; | 413 }; |
| 414 | 414 |
| 415 } // namespace net | 415 } // namespace net |
| 416 | 416 |
| 417 #endif // NET_QUIC_QUIC_CONFIG_H_ | 417 #endif // NET_QUIC_QUIC_CONFIG_H_ |
| OLD | NEW |