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

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

Issue 268343002: Allow 0-RTT handshakes for QUIC HTTPS requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 7 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
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_fec_group.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 // Tracks information about an FEC group, including the packets 5 // Tracks information about an FEC group, including the packets
6 // that have been seen, and the running parity. Provided the ability 6 // that have been seen, and the running parity. Provided the ability
7 // to revive a dropped packet. 7 // to revive a dropped packet.
8 8
9 #ifndef NET_QUIC_QUIC_FEC_GROUP_H_ 9 #ifndef NET_QUIC_QUIC_FEC_GROUP_H_
10 #define NET_QUIC_QUIC_FEC_GROUP_H_ 10 #define NET_QUIC_QUIC_FEC_GROUP_H_
11 11
12 #include <set>
13
14 #include "base/strings/string_piece.h" 12 #include "base/strings/string_piece.h"
15 #include "net/quic/quic_protocol.h" 13 #include "net/quic/quic_protocol.h"
16 14
17 namespace net { 15 namespace net {
18 16
19 class NET_EXPORT_PRIVATE QuicFecGroup { 17 class NET_EXPORT_PRIVATE QuicFecGroup {
20 public: 18 public:
21 QuicFecGroup(); 19 QuicFecGroup();
22 ~QuicFecGroup(); 20 ~QuicFecGroup();
23 21
24 // Updates the FEC group based on the delivery of a data packet. 22 // Updates the FEC group based on the delivery of a data packet decrypted at
25 // Returns false if this packet has already been seen, true otherwise. 23 // |encryption_level|. Returns false if this packet has already been seen,
26 bool Update(const QuicPacketHeader& header, 24 // true otherwise.
25 bool Update(EncryptionLevel encryption_level,
26 const QuicPacketHeader& header,
27 base::StringPiece decrypted_payload); 27 base::StringPiece decrypted_payload);
28 28
29 // Updates the FEC group based on the delivery of an FEC packet. 29 // Updates the FEC group based on the delivery of an FEC packet decrypted at
30 // Returns false if this packet has already been seen or if it does 30 // |encryption_level|. Returns false if this packet has already been seen or
31 // not claim to protect all the packets previously seen in this group. 31 // if it does not claim to protect all the packets previously seen in this
32 // |fec_packet_entropy|: XOR of entropy of all packets in the fec group. 32 // group.
33 bool UpdateFec(QuicPacketSequenceNumber fec_packet_sequence_number, 33 bool UpdateFec(EncryptionLevel encryption_level,
34 QuicPacketSequenceNumber fec_packet_sequence_number,
34 const QuicFecData& fec); 35 const QuicFecData& fec);
35 36
36 // Returns true if a packet can be revived from this FEC group. 37 // Returns true if a packet can be revived from this FEC group.
37 bool CanRevive() const; 38 bool CanRevive() const;
38 39
39 // Returns true if all packets (FEC and data) from this FEC group have been 40 // Returns true if all packets (FEC and data) from this FEC group have been
40 // seen or revived 41 // seen or revived
41 bool IsFinished() const; 42 bool IsFinished() const;
42 43
43 // Revives the missing packet from this FEC group. This may return a packet 44 // Revives the missing packet from this FEC group. This may return a packet
(...skipping 13 matching lines...) Expand all
57 } 58 }
58 59
59 QuicPacketSequenceNumber min_protected_packet() const { 60 QuicPacketSequenceNumber min_protected_packet() const {
60 return min_protected_packet_; 61 return min_protected_packet_;
61 } 62 }
62 63
63 size_t NumReceivedPackets() const { 64 size_t NumReceivedPackets() const {
64 return received_packets_.size(); 65 return received_packets_.size();
65 } 66 }
66 67
68 // Returns the effective encryption level of the FEC group.
69 EncryptionLevel effective_encryption_level() const {
70 return effective_encryption_level_;
71 }
72
67 private: 73 private:
68 bool UpdateParity(base::StringPiece payload); 74 bool UpdateParity(base::StringPiece payload);
69 // Returns the number of missing packets, or size_t max if the number 75 // Returns the number of missing packets, or size_t max if the number
70 // of missing packets is not known. 76 // of missing packets is not known.
71 size_t NumMissingPackets() const; 77 size_t NumMissingPackets() const;
72 78
73 // Set of packets that we have recevied. 79 // Set of packets that we have recevied.
74 SequenceNumberSet received_packets_; 80 SequenceNumberSet received_packets_;
75 // Sequence number of the first protected packet in this group (the one 81 // Sequence number of the first protected packet in this group (the one
76 // with the lowest packet sequence number). Will only be set once the FEC 82 // with the lowest packet sequence number). Will only be set once the FEC
77 // packet has been seen. 83 // packet has been seen.
78 QuicPacketSequenceNumber min_protected_packet_; 84 QuicPacketSequenceNumber min_protected_packet_;
79 // Sequence number of the last protected packet in this group (the one 85 // Sequence number of the last protected packet in this group (the one
80 // with the highest packet sequence number). Will only be set once the FEC 86 // with the highest packet sequence number). Will only be set once the FEC
81 // packet has been seen. 87 // packet has been seen.
82 QuicPacketSequenceNumber max_protected_packet_; 88 QuicPacketSequenceNumber max_protected_packet_;
83 // The cumulative parity calculation of all received packets. 89 // The cumulative parity calculation of all received packets.
84 char payload_parity_[kMaxPacketSize]; 90 char payload_parity_[kMaxPacketSize];
85 size_t payload_parity_len_; 91 size_t payload_parity_len_;
92 // The effective encryption level, which is the lowest encryption level of
93 // the data and FEC in the group.
94 EncryptionLevel effective_encryption_level_;
86 95
87 DISALLOW_COPY_AND_ASSIGN(QuicFecGroup); 96 DISALLOW_COPY_AND_ASSIGN(QuicFecGroup);
88 }; 97 };
89 98
90 } // namespace net 99 } // namespace net
91 100
92 #endif // NET_QUIC_QUIC_FEC_GROUP_H_ 101 #endif // NET_QUIC_QUIC_FEC_GROUP_H_
OLDNEW
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_fec_group.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698