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

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

Issue 2706893002: Make QuicFramer unaware of path. Also, send/receive PathClose has no effect. (Closed)
Patch Set: Created 3 years, 10 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/core/quic_connection_test.cc ('k') | net/quic/core/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_CORE_QUIC_FRAMER_H_ 5 #ifndef NET_QUIC_CORE_QUIC_FRAMER_H_
6 #define NET_QUIC_CORE_QUIC_FRAMER_H_ 6 #define NET_QUIC_CORE_QUIC_FRAMER_H_
7 7
8 #include <cstddef> 8 #include <cstddef>
9 #include <cstdint> 9 #include <cstdint>
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 #include <unordered_map>
13 #include <unordered_set>
14 12
15 #include "base/macros.h" 13 #include "base/macros.h"
16 #include "base/strings/string_piece.h" 14 #include "base/strings/string_piece.h"
17 #include "net/quic/core/quic_packets.h" 15 #include "net/quic/core/quic_packets.h"
18 #include "net/quic/platform/api/quic_export.h" 16 #include "net/quic/platform/api/quic_export.h"
19 17
20 namespace net { 18 namespace net {
21 19
22 namespace test { 20 namespace test {
23 class QuicFramerPeer; 21 class QuicFramerPeer;
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 323
326 void SetSupportedVersions(const QuicVersionVector& versions) { 324 void SetSupportedVersions(const QuicVersionVector& versions) {
327 supported_versions_ = versions; 325 supported_versions_ = versions;
328 quic_version_ = versions[0]; 326 quic_version_ = versions[0];
329 } 327 }
330 328
331 void set_validate_flags(bool value) { validate_flags_ = value; } 329 void set_validate_flags(bool value) { validate_flags_ = value; }
332 330
333 Perspective perspective() const { return perspective_; } 331 Perspective perspective() const { return perspective_; }
334 332
335 // Called when a PATH_CLOSED frame has been sent/received on |path_id|.
336 void OnPathClosed(QuicPathId path_id);
337
338 QuicTag last_version_tag() { return last_version_tag_; } 333 QuicTag last_version_tag() { return last_version_tag_; }
339 334
340 private: 335 private:
341 friend class test::QuicFramerPeer; 336 friend class test::QuicFramerPeer;
342 337
343 typedef std::map<QuicPacketNumber, uint8_t> NackRangeMap; 338 typedef std::map<QuicPacketNumber, uint8_t> NackRangeMap;
344 339
345 struct AckFrameInfo { 340 struct AckFrameInfo {
346 AckFrameInfo(); 341 AckFrameInfo();
347 AckFrameInfo(const AckFrameInfo& other); 342 AckFrameInfo(const AckFrameInfo& other);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 bool ProcessBlockedFrame(QuicDataReader* reader, QuicBlockedFrame* frame); 395 bool ProcessBlockedFrame(QuicDataReader* reader, QuicBlockedFrame* frame);
401 bool ProcessPathCloseFrame(QuicDataReader* reader, QuicPathCloseFrame* frame); 396 bool ProcessPathCloseFrame(QuicDataReader* reader, QuicPathCloseFrame* frame);
402 397
403 bool DecryptPayload(QuicDataReader* encrypted_reader, 398 bool DecryptPayload(QuicDataReader* encrypted_reader,
404 const QuicPacketHeader& header, 399 const QuicPacketHeader& header,
405 const QuicEncryptedPacket& packet, 400 const QuicEncryptedPacket& packet,
406 char* decrypted_buffer, 401 char* decrypted_buffer,
407 size_t buffer_length, 402 size_t buffer_length,
408 size_t* decrypted_length); 403 size_t* decrypted_length);
409 404
410 // Checks if |path_id| is a viable path to receive packets on. Returns true
411 // and sets |base_packet_number| to the packet number to calculate the
412 // incoming packet number from if the path is not closed. Returns false
413 // otherwise.
414 bool IsValidPath(QuicPathId path_id, QuicPacketNumber* base_packet_number);
415
416 // Sets last_packet_number_. This can only be called after the packet is 405 // Sets last_packet_number_. This can only be called after the packet is
417 // successfully decrypted. 406 // successfully decrypted.
418 void SetLastPacketNumber(const QuicPacketHeader& header); 407 void SetLastPacketNumber(const QuicPacketHeader& header);
419 408
420 // Returns the full packet number from the truncated 409 // Returns the full packet number from the truncated
421 // wire format version and the last seen packet number. 410 // wire format version and the last seen packet number.
422 QuicPacketNumber CalculatePacketNumberFromWire( 411 QuicPacketNumber CalculatePacketNumberFromWire(
423 QuicPacketNumberLength packet_number_length, 412 QuicPacketNumberLength packet_number_length,
424 QuicPacketNumber base_packet_number, 413 QuicPacketNumber base_packet_number,
425 QuicPacketNumber packet_number) const; 414 QuicPacketNumber packet_number) const;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 473
485 bool RaiseError(QuicErrorCode error); 474 bool RaiseError(QuicErrorCode error);
486 475
487 void set_error(QuicErrorCode error) { error_ = error; } 476 void set_error(QuicErrorCode error) { error_ = error; }
488 477
489 void set_detailed_error(const char* error) { detailed_error_ = error; } 478 void set_detailed_error(const char* error) { detailed_error_ = error; }
490 479
491 std::string detailed_error_; 480 std::string detailed_error_;
492 QuicFramerVisitorInterface* visitor_; 481 QuicFramerVisitorInterface* visitor_;
493 QuicErrorCode error_; 482 QuicErrorCode error_;
494 // Set of closed paths. A path is considered as closed if a PATH_CLOSED frame
495 // has been sent/received.
496 // TODO(fayang): this set is never cleaned up. A possible improvement is to
497 // use intervals.
498 std::unordered_set<QuicPathId> closed_paths_;
499 // Updated by ProcessPacketHeader when it succeeds. 483 // Updated by ProcessPacketHeader when it succeeds.
500 QuicPacketNumber last_packet_number_; 484 QuicPacketNumber last_packet_number_;
501 // Map mapping path id to packet number of largest successfully decrypted
502 // received packet.
503 std::unordered_map<QuicPathId, QuicPacketNumber> largest_packet_numbers_;
504 // Updated by ProcessPacketHeader when it succeeds decrypting a larger packet. 485 // Updated by ProcessPacketHeader when it succeeds decrypting a larger packet.
505 QuicPacketNumber largest_packet_number_; 486 QuicPacketNumber largest_packet_number_;
506 // The path on which last successfully decrypted packet was received.
507 QuicPathId last_path_id_;
508 // Updated by WritePacketHeader. 487 // Updated by WritePacketHeader.
509 QuicConnectionId last_serialized_connection_id_; 488 QuicConnectionId last_serialized_connection_id_;
510 // The last QUIC version tag received. 489 // The last QUIC version tag received.
511 QuicTag last_version_tag_; 490 QuicTag last_version_tag_;
512 // Version of the protocol being used. 491 // Version of the protocol being used.
513 QuicVersion quic_version_; 492 QuicVersion quic_version_;
514 // This vector contains QUIC versions which we currently support. 493 // This vector contains QUIC versions which we currently support.
515 // This should be ordered such that the highest supported version is the first 494 // This should be ordered such that the highest supported version is the first
516 // element, with subsequent elements in descending order (versions can be 495 // element, with subsequent elements in descending order (versions can be
517 // skipped as necessary). 496 // skipped as necessary).
(...skipping 25 matching lines...) Expand all
543 QuicTime::Delta last_timestamp_; 522 QuicTime::Delta last_timestamp_;
544 // The diversification nonce from the last received packet. 523 // The diversification nonce from the last received packet.
545 DiversificationNonce last_nonce_; 524 DiversificationNonce last_nonce_;
546 525
547 DISALLOW_COPY_AND_ASSIGN(QuicFramer); 526 DISALLOW_COPY_AND_ASSIGN(QuicFramer);
548 }; 527 };
549 528
550 } // namespace net 529 } // namespace net
551 530
552 #endif // NET_QUIC_CORE_QUIC_FRAMER_H_ 531 #endif // NET_QUIC_CORE_QUIC_FRAMER_H_
OLDNEW
« no previous file with comments | « net/quic/core/quic_connection_test.cc ('k') | net/quic/core/quic_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698