Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: net/quic/quic_config.h

Issue 667923003: Standardize usage of virtual/override/final in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_client_session_base.h ('k') | net/quic/quic_connection.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 std::string* error_details) = 0; 54 std::string* error_details) = 0;
55 55
56 protected: 56 protected:
57 const QuicTag tag_; 57 const QuicTag tag_;
58 const QuicConfigPresence presence_; 58 const QuicConfigPresence presence_;
59 }; 59 };
60 60
61 class NET_EXPORT_PRIVATE QuicNegotiableValue : public QuicConfigValue { 61 class NET_EXPORT_PRIVATE QuicNegotiableValue : public QuicConfigValue {
62 public: 62 public:
63 QuicNegotiableValue(QuicTag tag, QuicConfigPresence presence); 63 QuicNegotiableValue(QuicTag tag, QuicConfigPresence presence);
64 virtual ~QuicNegotiableValue(); 64 ~QuicNegotiableValue() override;
65 65
66 bool negotiated() const { 66 bool negotiated() const {
67 return negotiated_; 67 return negotiated_;
68 } 68 }
69 69
70 protected: 70 protected:
71 bool negotiated_; 71 bool negotiated_;
72 }; 72 };
73 73
74 class NET_EXPORT_PRIVATE QuicNegotiableUint32 : public QuicNegotiableValue { 74 class NET_EXPORT_PRIVATE QuicNegotiableUint32 : public QuicNegotiableValue {
75 public: 75 public:
76 // Default and max values default to 0. 76 // Default and max values default to 0.
77 QuicNegotiableUint32(QuicTag name, QuicConfigPresence presence); 77 QuicNegotiableUint32(QuicTag name, QuicConfigPresence presence);
78 virtual ~QuicNegotiableUint32(); 78 ~QuicNegotiableUint32() override;
79 79
80 // Sets the maximum possible value that can be achieved after negotiation and 80 // Sets the maximum possible value that can be achieved after negotiation and
81 // also the default values to be assumed if PRESENCE_OPTIONAL and the *HLO msg 81 // also the default values to be assumed if PRESENCE_OPTIONAL and the *HLO msg
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 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 QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello,
99 const CryptoHandshakeMessage& peer_hello, 99 HelloType hello_type,
100 HelloType hello_type, 100 std::string* error_details) override;
101 std::string* error_details) override;
102 101
103 private: 102 private:
104 uint32 max_value_; 103 uint32 max_value_;
105 uint32 default_value_; 104 uint32 default_value_;
106 uint32 negotiated_value_; 105 uint32 negotiated_value_;
107 }; 106 };
108 107
109 class NET_EXPORT_PRIVATE QuicNegotiableTag : public QuicNegotiableValue { 108 class NET_EXPORT_PRIVATE QuicNegotiableTag : public QuicNegotiableValue {
110 public: 109 public:
111 QuicNegotiableTag(QuicTag name, QuicConfigPresence presence); 110 QuicNegotiableTag(QuicTag name, QuicConfigPresence presence);
112 virtual ~QuicNegotiableTag(); 111 ~QuicNegotiableTag() override;
113 112
114 // Sets the possible values that |negotiated_tag_| can take after negotiation 113 // Sets the possible values that |negotiated_tag_| can take after negotiation
115 // and the default value that |negotiated_tag_| takes if OPTIONAL and *HLO 114 // and the default value that |negotiated_tag_| takes if OPTIONAL and *HLO
116 // msg doesn't contain tag |name_|. 115 // msg doesn't contain tag |name_|.
117 void set(const QuicTagVector& possible_values, QuicTag default_value); 116 void set(const QuicTagVector& possible_values, QuicTag default_value);
118 117
119 // Returns the negotiated tag if |negotiated_| is true, otherwise returns 118 // Returns the negotiated tag if |negotiated_| is true, otherwise returns
120 // |default_value_| (used to set default values before negotiation finishes). 119 // |default_value_| (used to set default values before negotiation finishes).
121 QuicTag GetTag() const; 120 QuicTag GetTag() const;
122 121
123 // Serialises |name_| and vector (either possible or negotiated) to |out|. If 122 // Serialises |name_| and vector (either possible or negotiated) to |out|. If
124 // |negotiated_| is true then |negotiated_tag_| is serialised, otherwise 123 // |negotiated_| is true then |negotiated_tag_| is serialised, otherwise
125 // |possible_values_| is serialised. 124 // |possible_values_| is serialised.
126 virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; 125 void ToHandshakeMessage(CryptoHandshakeMessage* out) const override;
127 126
128 // Selects the tag common to both tags in |client_hello| for |name_| and 127 // Selects the tag common to both tags in |client_hello| for |name_| and
129 // |possible_values_| with preference to tag in |possible_values_|. The 128 // |possible_values_| with preference to tag in |possible_values_|. The
130 // selected tag is set as |negotiated_tag_|. 129 // selected tag is set as |negotiated_tag_|.
131 virtual QuicErrorCode ProcessPeerHello( 130 QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello,
132 const CryptoHandshakeMessage& peer_hello, 131 HelloType hello_type,
133 HelloType hello_type, 132 std::string* error_details) override;
134 std::string* error_details) override;
135 133
136 private: 134 private:
137 // Reads the vector corresponding to |name_| from |msg| into |out|. If the 135 // 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 136 // |name_| is absent in |msg| and |presence_| is set to OPTIONAL |out| is set
139 // to |possible_values_|. 137 // to |possible_values_|.
140 QuicErrorCode ReadVector(const CryptoHandshakeMessage& msg, 138 QuicErrorCode ReadVector(const CryptoHandshakeMessage& msg,
141 const QuicTag** out, 139 const QuicTag** out,
142 size_t* out_length, 140 size_t* out_length,
143 std::string* error_details) const; 141 std::string* error_details) const;
144 142
145 QuicTag negotiated_tag_; 143 QuicTag negotiated_tag_;
146 QuicTagVector possible_values_; 144 QuicTagVector possible_values_;
147 QuicTag default_value_; 145 QuicTag default_value_;
148 }; 146 };
149 147
150 // Stores uint32 from CHLO or SHLO messages that are not negotiated. 148 // Stores uint32 from CHLO or SHLO messages that are not negotiated.
151 class NET_EXPORT_PRIVATE QuicFixedUint32 : public QuicConfigValue { 149 class NET_EXPORT_PRIVATE QuicFixedUint32 : public QuicConfigValue {
152 public: 150 public:
153 QuicFixedUint32(QuicTag name, QuicConfigPresence presence); 151 QuicFixedUint32(QuicTag name, QuicConfigPresence presence);
154 virtual ~QuicFixedUint32(); 152 ~QuicFixedUint32() override;
155 153
156 bool HasSendValue() const; 154 bool HasSendValue() const;
157 155
158 uint32 GetSendValue() const; 156 uint32 GetSendValue() const;
159 157
160 void SetSendValue(uint32 value); 158 void SetSendValue(uint32 value);
161 159
162 bool HasReceivedValue() const; 160 bool HasReceivedValue() const;
163 161
164 uint32 GetReceivedValue() const; 162 uint32 GetReceivedValue() const;
165 163
166 void SetReceivedValue(uint32 value); 164 void SetReceivedValue(uint32 value);
167 165
168 // If has_send_value is true, serialises |tag_| and |send_value_| to |out|. 166 // If has_send_value is true, serialises |tag_| and |send_value_| to |out|.
169 virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; 167 void ToHandshakeMessage(CryptoHandshakeMessage* out) const override;
170 168
171 // Sets |value_| to the corresponding value from |peer_hello_| if it exists. 169 // Sets |value_| to the corresponding value from |peer_hello_| if it exists.
172 virtual QuicErrorCode ProcessPeerHello( 170 QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello,
173 const CryptoHandshakeMessage& peer_hello, 171 HelloType hello_type,
174 HelloType hello_type, 172 std::string* error_details) override;
175 std::string* error_details) override;
176 173
177 private: 174 private:
178 uint32 send_value_; 175 uint32 send_value_;
179 bool has_send_value_; 176 bool has_send_value_;
180 uint32 receive_value_; 177 uint32 receive_value_;
181 bool has_receive_value_; 178 bool has_receive_value_;
182 }; 179 };
183 180
184 // Stores tag from CHLO or SHLO messages that are not negotiated. 181 // Stores tag from CHLO or SHLO messages that are not negotiated.
185 class NET_EXPORT_PRIVATE QuicFixedTag : public QuicConfigValue { 182 class NET_EXPORT_PRIVATE QuicFixedTag : public QuicConfigValue {
186 public: 183 public:
187 QuicFixedTag(QuicTag name, QuicConfigPresence presence); 184 QuicFixedTag(QuicTag name, QuicConfigPresence presence);
188 virtual ~QuicFixedTag(); 185 ~QuicFixedTag() override;
189 186
190 bool HasSendValue() const; 187 bool HasSendValue() const;
191 188
192 QuicTag GetSendValue() const; 189 QuicTag GetSendValue() const;
193 190
194 void SetSendValue(QuicTag value); 191 void SetSendValue(QuicTag value);
195 192
196 bool HasReceivedValue() const; 193 bool HasReceivedValue() const;
197 194
198 QuicTag GetReceivedValue() const; 195 QuicTag GetReceivedValue() const;
199 196
200 void SetReceivedValue(QuicTag value); 197 void SetReceivedValue(QuicTag value);
201 198
202 // If has_send_value is true, serialises |tag_| and |send_value_| to |out|. 199 // If has_send_value is true, serialises |tag_| and |send_value_| to |out|.
203 virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; 200 void ToHandshakeMessage(CryptoHandshakeMessage* out) const override;
204 201
205 // Sets |value_| to the corresponding value from |client_hello_| if it exists. 202 // Sets |value_| to the corresponding value from |client_hello_| if it exists.
206 virtual QuicErrorCode ProcessPeerHello( 203 QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello,
207 const CryptoHandshakeMessage& peer_hello, 204 HelloType hello_type,
208 HelloType hello_type, 205 std::string* error_details) override;
209 std::string* error_details) override;
210 206
211 private: 207 private:
212 QuicTag send_value_; 208 QuicTag send_value_;
213 bool has_send_value_; 209 bool has_send_value_;
214 QuicTag receive_value_; 210 QuicTag receive_value_;
215 bool has_receive_value_; 211 bool has_receive_value_;
216 }; 212 };
217 213
218 // Stores tag from CHLO or SHLO messages that are not negotiated. 214 // Stores tag from CHLO or SHLO messages that are not negotiated.
219 class NET_EXPORT_PRIVATE QuicFixedTagVector : public QuicConfigValue { 215 class NET_EXPORT_PRIVATE QuicFixedTagVector : public QuicConfigValue {
220 public: 216 public:
221 QuicFixedTagVector(QuicTag name, QuicConfigPresence presence); 217 QuicFixedTagVector(QuicTag name, QuicConfigPresence presence);
222 virtual ~QuicFixedTagVector(); 218 ~QuicFixedTagVector() override;
223 219
224 bool HasSendValues() const; 220 bool HasSendValues() const;
225 221
226 QuicTagVector GetSendValues() const; 222 QuicTagVector GetSendValues() const;
227 223
228 void SetSendValues(const QuicTagVector& values); 224 void SetSendValues(const QuicTagVector& values);
229 225
230 bool HasReceivedValues() const; 226 bool HasReceivedValues() const;
231 227
232 QuicTagVector GetReceivedValues() const; 228 QuicTagVector GetReceivedValues() const;
233 229
234 void SetReceivedValues(const QuicTagVector& values); 230 void SetReceivedValues(const QuicTagVector& values);
235 231
236 // If has_send_value is true, serialises |tag_vector_| and |send_value_| to 232 // If has_send_value is true, serialises |tag_vector_| and |send_value_| to
237 // |out|. 233 // |out|.
238 virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; 234 void ToHandshakeMessage(CryptoHandshakeMessage* out) const override;
239 235
240 // Sets |receive_values_| to the corresponding value from |client_hello_| if 236 // Sets |receive_values_| to the corresponding value from |client_hello_| if
241 // it exists. 237 // it exists.
242 virtual QuicErrorCode ProcessPeerHello( 238 QuicErrorCode ProcessPeerHello(const CryptoHandshakeMessage& peer_hello,
243 const CryptoHandshakeMessage& peer_hello, 239 HelloType hello_type,
244 HelloType hello_type, 240 std::string* error_details) override;
245 std::string* error_details) override;
246 241
247 private: 242 private:
248 QuicTagVector send_values_; 243 QuicTagVector send_values_;
249 bool has_send_values_; 244 bool has_send_values_;
250 QuicTagVector receive_values_; 245 QuicTagVector receive_values_;
251 bool has_receive_values_; 246 bool has_receive_values_;
252 }; 247 };
253 248
254 // QuicConfig contains non-crypto configuration options that are negotiated in 249 // QuicConfig contains non-crypto configuration options that are negotiated in
255 // the crypto handshake. 250 // the crypto handshake.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 // Initial session flow control receive window in bytes. 413 // Initial session flow control receive window in bytes.
419 QuicFixedUint32 initial_session_flow_control_window_bytes_; 414 QuicFixedUint32 initial_session_flow_control_window_bytes_;
420 415
421 // Socket receive buffer in bytes. 416 // Socket receive buffer in bytes.
422 QuicFixedUint32 socket_receive_buffer_; 417 QuicFixedUint32 socket_receive_buffer_;
423 }; 418 };
424 419
425 } // namespace net 420 } // namespace net
426 421
427 #endif // NET_QUIC_QUIC_CONFIG_H_ 422 #endif // NET_QUIC_QUIC_CONFIG_H_
OLDNEW
« no previous file with comments | « net/quic/quic_client_session_base.h ('k') | net/quic/quic_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698