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

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

Issue 47283002: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compilation error Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_end_to_end_unittest.cc ('k') | net/quic/quic_framer.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_FRAMER_H_ 5 #ifndef NET_QUIC_QUIC_FRAMER_H_
6 #define NET_QUIC_QUIC_FRAMER_H_ 6 #define NET_QUIC_QUIC_FRAMER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 QuicPacketSequenceNumber sequence_number) const = 0; 143 QuicPacketSequenceNumber sequence_number) const = 0;
144 }; 144 };
145 145
146 // Class for parsing and constructing QUIC packets. It has a 146 // Class for parsing and constructing QUIC packets. It has a
147 // QuicFramerVisitorInterface that is called when packets are parsed. 147 // QuicFramerVisitorInterface that is called when packets are parsed.
148 // It also has a QuicFecBuilder that is called when packets are constructed 148 // It also has a QuicFecBuilder that is called when packets are constructed
149 // in order to generate FEC data for subsequently building FEC packets. 149 // in order to generate FEC data for subsequently building FEC packets.
150 class NET_EXPORT_PRIVATE QuicFramer { 150 class NET_EXPORT_PRIVATE QuicFramer {
151 public: 151 public:
152 // Constructs a new framer that installs a kNULL QuicEncrypter and 152 // Constructs a new framer that installs a kNULL QuicEncrypter and
153 // QuicDecrypter for level ENCRYPTION_NONE. 153 // QuicDecrypter for level ENCRYPTION_NONE. |supported_versions| specifies the
154 QuicFramer(QuicVersion quic_version, 154 // list of supported QUIC versions. |quic_version_| is set to the maximum
155 // version in |supported_versions|.
156 QuicFramer(const QuicVersionVector& supported_versions,
155 QuicTime creation_time, 157 QuicTime creation_time,
156 bool is_server); 158 bool is_server);
157 159
158 virtual ~QuicFramer(); 160 virtual ~QuicFramer();
159 161
160 // Returns true if |version| is a supported protocol version. 162 // Returns true if |version| is a supported protocol version.
161 bool IsSupportedVersion(const QuicVersion version) const; 163 bool IsSupportedVersion(const QuicVersion version) const;
162 164
163 // Calculates the largest observed packet to advertise in the case an Ack 165 // Calculates the largest observed packet to advertise in the case an Ack
164 // Frame was truncated. last_written in this case is the iterator for the 166 // Frame was truncated. last_written in this case is the iterator for the
(...skipping 10 matching lines...) Expand all
175 visitor_ = visitor; 177 visitor_ = visitor;
176 } 178 }
177 179
178 // Set a builder to be called from the framer when building FEC protected 180 // Set a builder to be called from the framer when building FEC protected
179 // packets. If this is called multiple times, only the last builder 181 // packets. If this is called multiple times, only the last builder
180 // will be used. The builder need not be set. 182 // will be used. The builder need not be set.
181 void set_fec_builder(QuicFecBuilderInterface* builder) { 183 void set_fec_builder(QuicFecBuilderInterface* builder) {
182 fec_builder_ = builder; 184 fec_builder_ = builder;
183 } 185 }
184 186
187 const QuicVersionVector& supported_versions() const {
188 return supported_versions_;
189 }
190
185 QuicVersion version() const { 191 QuicVersion version() const {
186 return quic_version_; 192 return quic_version_;
187 } 193 }
188 194
189 void set_version(const QuicVersion version); 195 void set_version(const QuicVersion version);
190 196
191 // Does not DCHECK for supported version. Used by tests to set unsupported 197 // Does not DCHECK for supported version. Used by tests to set unsupported
192 // version to trigger version negotiation. 198 // version to trigger version negotiation.
193 void set_version_for_tests(const QuicVersion version) { 199 void set_version_for_tests(const QuicVersion version) {
194 quic_version_ = version; 200 quic_version_ = version;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 QuicReceivedEntropyHashCalculatorInterface* entropy_calculator_; 428 QuicReceivedEntropyHashCalculatorInterface* entropy_calculator_;
423 QuicErrorCode error_; 429 QuicErrorCode error_;
424 // Updated by ProcessPacketHeader when it succeeds. 430 // Updated by ProcessPacketHeader when it succeeds.
425 QuicPacketSequenceNumber last_sequence_number_; 431 QuicPacketSequenceNumber last_sequence_number_;
426 // Updated by WritePacketHeader. 432 // Updated by WritePacketHeader.
427 QuicGuid last_serialized_guid_; 433 QuicGuid last_serialized_guid_;
428 // Buffer containing decrypted payload data during parsing. 434 // Buffer containing decrypted payload data during parsing.
429 scoped_ptr<QuicData> decrypted_; 435 scoped_ptr<QuicData> decrypted_;
430 // Version of the protocol being used. 436 // Version of the protocol being used.
431 QuicVersion quic_version_; 437 QuicVersion quic_version_;
438 // This vector contains QUIC versions which we currently support.
439 // This should be ordered such that the highest supported version is the first
440 // element, with subsequent elements in descending order (versions can be
441 // skipped as necessary).
442 QuicVersionVector supported_versions_;
432 // Primary decrypter used to decrypt packets during parsing. 443 // Primary decrypter used to decrypt packets during parsing.
433 scoped_ptr<QuicDecrypter> decrypter_; 444 scoped_ptr<QuicDecrypter> decrypter_;
434 // Alternative decrypter that can also be used to decrypt packets. 445 // Alternative decrypter that can also be used to decrypt packets.
435 scoped_ptr<QuicDecrypter> alternative_decrypter_; 446 scoped_ptr<QuicDecrypter> alternative_decrypter_;
436 // alternative_decrypter_latch_is true if, when |alternative_decrypter_| 447 // alternative_decrypter_latch_is true if, when |alternative_decrypter_|
437 // successfully decrypts a packet, we should install it as the only 448 // successfully decrypts a packet, we should install it as the only
438 // decrypter. 449 // decrypter.
439 bool alternative_decrypter_latch_; 450 bool alternative_decrypter_latch_;
440 // Encrypters used to encrypt packets via EncryptPacket(). 451 // Encrypters used to encrypt packets via EncryptPacket().
441 scoped_ptr<QuicEncrypter> encrypter_[NUM_ENCRYPTION_LEVELS]; 452 scoped_ptr<QuicEncrypter> encrypter_[NUM_ENCRYPTION_LEVELS];
442 // Tracks if the framer is being used by the entity that received the 453 // Tracks if the framer is being used by the entity that received the
443 // connection or the entity that initiated it. 454 // connection or the entity that initiated it.
444 bool is_server_; 455 bool is_server_;
445 // The time this frames was created. Time written to the wire will be 456 // The time this frames was created. Time written to the wire will be
446 // written as a delta from this value. 457 // written as a delta from this value.
447 QuicTime creation_time_; 458 QuicTime creation_time_;
448 459
449 DISALLOW_COPY_AND_ASSIGN(QuicFramer); 460 DISALLOW_COPY_AND_ASSIGN(QuicFramer);
450 }; 461 };
451 462
452 } // namespace net 463 } // namespace net
453 464
454 #endif // NET_QUIC_QUIC_FRAMER_H_ 465 #endif // NET_QUIC_QUIC_FRAMER_H_
OLDNEW
« no previous file with comments | « net/quic/quic_end_to_end_unittest.cc ('k') | net/quic/quic_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698