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

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

Issue 15937012: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Small bug fixes Created 7 years, 6 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 | Annotate | Revision Log
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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 static size_t GetMinAckFrameSize(); 226 static size_t GetMinAckFrameSize();
227 // Size in bytes of all reset stream frame without the error details. 227 // Size in bytes of all reset stream frame without the error details.
228 static size_t GetMinRstStreamFrameSize(); 228 static size_t GetMinRstStreamFrameSize();
229 // Size in bytes of all connection close frame fields without the error 229 // Size in bytes of all connection close frame fields without the error
230 // details and the missing packets from the enclosed ack frame. 230 // details and the missing packets from the enclosed ack frame.
231 static size_t GetMinConnectionCloseFrameSize(); 231 static size_t GetMinConnectionCloseFrameSize();
232 // Size in bytes of all GoAway frame fields without the reason phrase. 232 // Size in bytes of all GoAway frame fields without the reason phrase.
233 static size_t GetMinGoAwayFrameSize(); 233 static size_t GetMinGoAwayFrameSize();
234 // The maximum number of nacks which can be transmitted in a single ack packet 234 // The maximum number of nacks which can be transmitted in a single ack packet
235 // without exceeding kMaxPacketSize. 235 // without exceeding kMaxPacketSize.
236 static size_t GetMaxUnackedPackets(bool include_version); 236 static size_t GetMaxUnackedPackets(QuicPacketHeader header);
237 // Size in bytes required for a serialized version negotiation packet 237 // Size in bytes required for a serialized version negotiation packet
238 size_t GetVersionNegotiationPacketSize(size_t number_versions); 238 size_t GetVersionNegotiationPacketSize(size_t number_versions);
239 239
240 // Returns the number of bytes added to the packet for the specified frame, 240 // Returns the number of bytes added to the packet for the specified frame,
241 // and 0 if the frame doesn't fit. Includes the header size for the first 241 // and 0 if the frame doesn't fit. Includes the header size for the first
242 // frame. 242 // frame.
243 size_t GetSerializedFrameLength( 243 size_t GetSerializedFrameLength(
244 const QuicFrame& frame, size_t free_bytes, bool first_frame); 244 const QuicFrame& frame, size_t free_bytes, bool first_frame);
245 245
246 // Returns the associated data from the encrypted packet |encrypted| as a 246 // Returns the associated data from the encrypted packet |encrypted| as a
247 // stringpiece. 247 // stringpiece.
248 static base::StringPiece GetAssociatedDataFromEncryptedPacket( 248 static base::StringPiece GetAssociatedDataFromEncryptedPacket(
249 const QuicEncryptedPacket& encrypted, bool includes_version); 249 const QuicEncryptedPacket& encrypted,
250 QuicGuidLength guid_length,
251 bool includes_version);
250 252
251 // Returns a SerializedPacket whose |packet| member is owned by the caller, 253 // Returns a SerializedPacket whose |packet| member is owned by the caller,
252 // and is populated with the fields in |header| and |frames|, or is NULL if 254 // and is populated with the fields in |header| and |frames|, or is NULL if
253 // the packet could not be created. 255 // the packet could not be created.
254 // TODO(ianswett): Used for testing only. 256 // TODO(ianswett): Used for testing only.
255 SerializedPacket ConstructFrameDataPacket(const QuicPacketHeader& header, 257 SerializedPacket ConstructFrameDataPacket(const QuicPacketHeader& header,
256 const QuicFrames& frames); 258 const QuicFrames& frames);
257 259
258 // Returns a SerializedPacket whose |packet| member is owned by the caller, 260 // Returns a SerializedPacket whose |packet| member is owned by the caller,
259 // is created from the first |num_frames| frames, or is NULL if the packet 261 // is created from the first |num_frames| frames, or is NULL if the packet
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 bool ProcessAckFrame(QuicAckFrame* frame); 348 bool ProcessAckFrame(QuicAckFrame* frame);
347 bool ProcessReceivedInfo(ReceivedPacketInfo* received_info); 349 bool ProcessReceivedInfo(ReceivedPacketInfo* received_info);
348 bool ProcessSentInfo(SentPacketInfo* sent_info); 350 bool ProcessSentInfo(SentPacketInfo* sent_info);
349 bool ProcessQuicCongestionFeedbackFrame( 351 bool ProcessQuicCongestionFeedbackFrame(
350 QuicCongestionFeedbackFrame* congestion_feedback); 352 QuicCongestionFeedbackFrame* congestion_feedback);
351 bool ProcessRstStreamFrame(QuicRstStreamFrame* frame); 353 bool ProcessRstStreamFrame(QuicRstStreamFrame* frame);
352 bool ProcessConnectionCloseFrame(QuicConnectionCloseFrame* frame); 354 bool ProcessConnectionCloseFrame(QuicConnectionCloseFrame* frame);
353 bool ProcessGoAwayFrame(QuicGoAwayFrame* frame); 355 bool ProcessGoAwayFrame(QuicGoAwayFrame* frame);
354 356
355 bool DecryptPayload(QuicPacketSequenceNumber packet_sequence_number, 357 bool DecryptPayload(QuicPacketSequenceNumber packet_sequence_number,
358 QuicGuidLength guid_length,
356 bool version_flag, 359 bool version_flag,
357 const QuicEncryptedPacket& packet); 360 const QuicEncryptedPacket& packet);
358 361
359 // Returns the full packet sequence number from the truncated 362 // Returns the full packet sequence number from the truncated
360 // wire format version and the last seen packet sequence number. 363 // wire format version and the last seen packet sequence number.
361 QuicPacketSequenceNumber CalculatePacketSequenceNumberFromWire( 364 QuicPacketSequenceNumber CalculatePacketSequenceNumberFromWire(
362 QuicPacketSequenceNumber packet_sequence_number) const; 365 QuicPacketSequenceNumber packet_sequence_number) const;
363 366
364 // Computes the wire size in bytes of the payload of |frame|. 367 // Computes the wire size in bytes of the payload of |frame|.
365 size_t ComputeFrameLength(const QuicFrame& frame); 368 size_t ComputeFrameLength(const QuicFrame& frame);
(...skipping 27 matching lines...) Expand all
393 } 396 }
394 397
395 std::string detailed_error_; 398 std::string detailed_error_;
396 scoped_ptr<QuicDataReader> reader_; 399 scoped_ptr<QuicDataReader> reader_;
397 QuicFramerVisitorInterface* visitor_; 400 QuicFramerVisitorInterface* visitor_;
398 QuicFecBuilderInterface* fec_builder_; 401 QuicFecBuilderInterface* fec_builder_;
399 QuicReceivedEntropyHashCalculatorInterface* entropy_calculator_; 402 QuicReceivedEntropyHashCalculatorInterface* entropy_calculator_;
400 QuicErrorCode error_; 403 QuicErrorCode error_;
401 // Updated by ProcessPacketHeader when it succeeds. 404 // Updated by ProcessPacketHeader when it succeeds.
402 QuicPacketSequenceNumber last_sequence_number_; 405 QuicPacketSequenceNumber last_sequence_number_;
406 // Updated by WritePacketHeader.
407 QuicGuid last_serialized_guid_;
403 // Buffer containing decrypted payload data during parsing. 408 // Buffer containing decrypted payload data during parsing.
404 scoped_ptr<QuicData> decrypted_; 409 scoped_ptr<QuicData> decrypted_;
405 // Version of the protocol being used. 410 // Version of the protocol being used.
406 QuicTag quic_version_; 411 QuicTag quic_version_;
407 // Primary decrypter used to decrypt packets during parsing. 412 // Primary decrypter used to decrypt packets during parsing.
408 scoped_ptr<QuicDecrypter> decrypter_; 413 scoped_ptr<QuicDecrypter> decrypter_;
409 // Alternative decrypter that can also be used to decrypt packets. 414 // Alternative decrypter that can also be used to decrypt packets.
410 scoped_ptr<QuicDecrypter> alternative_decrypter_; 415 scoped_ptr<QuicDecrypter> alternative_decrypter_;
411 // alternative_decrypter_latch_is true if, when |alternative_decrypter_| 416 // alternative_decrypter_latch_is true if, when |alternative_decrypter_|
412 // successfully decrypts a packet, we should install it as the only 417 // successfully decrypts a packet, we should install it as the only
413 // decrypter. 418 // decrypter.
414 bool alternative_decrypter_latch_; 419 bool alternative_decrypter_latch_;
415 // Encrypters used to encrypt packets via EncryptPacket(). 420 // Encrypters used to encrypt packets via EncryptPacket().
416 scoped_ptr<QuicEncrypter> encrypter_[NUM_ENCRYPTION_LEVELS]; 421 scoped_ptr<QuicEncrypter> encrypter_[NUM_ENCRYPTION_LEVELS];
417 // Tracks if the framer is being used by the entity that received the 422 // Tracks if the framer is being used by the entity that received the
418 // connection or the entity that initiated it. 423 // connection or the entity that initiated it.
419 bool is_server_; 424 bool is_server_;
420 // The time this frames was created. Time written to the wire will be 425 // The time this frames was created. Time written to the wire will be
421 // written as a delta from this value. 426 // written as a delta from this value.
422 QuicTime creation_time_; 427 QuicTime creation_time_;
423 428
424 DISALLOW_COPY_AND_ASSIGN(QuicFramer); 429 DISALLOW_COPY_AND_ASSIGN(QuicFramer);
425 }; 430 };
426 431
427 } // namespace net 432 } // namespace net
428 433
429 #endif // NET_QUIC_QUIC_FRAMER_H_ 434 #endif // NET_QUIC_QUIC_FRAMER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698