Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_PROTOCOL_H_ | 5 #ifndef NET_QUIC_QUIC_PROTOCOL_H_ |
| 6 #define NET_QUIC_QUIC_PROTOCOL_H_ | 6 #define NET_QUIC_QUIC_PROTOCOL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 typedef uint8 QuicFecGroupNumber; | 35 typedef uint8 QuicFecGroupNumber; |
| 36 | 36 |
| 37 // A struct for functions which consume data payloads and fins. | 37 // A struct for functions which consume data payloads and fins. |
| 38 // The first member of the pair indicates bytes consumed. | 38 // The first member of the pair indicates bytes consumed. |
| 39 // The second member of the pair indicates if an incoming fin was consumed. | 39 // The second member of the pair indicates if an incoming fin was consumed. |
| 40 struct QuicConsumedData { | 40 struct QuicConsumedData { |
| 41 QuicConsumedData(size_t bytes_consumed, bool fin_consumed) | 41 QuicConsumedData(size_t bytes_consumed, bool fin_consumed) |
| 42 : bytes_consumed(bytes_consumed), | 42 : bytes_consumed(bytes_consumed), |
| 43 fin_consumed(fin_consumed) { | 43 fin_consumed(fin_consumed) { |
| 44 } | 44 } |
| 45 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | |
| 46 std::ostream& os, const QuicConsumedData& s); | |
| 47 | |
| 45 size_t bytes_consumed; | 48 size_t bytes_consumed; |
| 46 bool fin_consumed; | 49 bool fin_consumed; |
| 47 }; | 50 }; |
| 48 | 51 |
| 49 | 52 |
| 50 // TODO(rch): Consider Quic specific names for these constants. | 53 // TODO(rch): Consider Quic specific names for these constants. |
| 51 const size_t kMaxPacketSize = 1200; // Maximum size in bytes of a QUIC packet. | 54 const size_t kMaxPacketSize = 1200; // Maximum size in bytes of a QUIC packet. |
| 52 | 55 |
| 53 // Maximum number of open streams per connection. | 56 // Maximum number of open streams per connection. |
| 54 const size_t kDefaultMaxStreamsPerConnection = 100; | 57 const size_t kDefaultMaxStreamsPerConnection = 100; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 // TODO(ianswett): Re-evaluate the trade-offs of hash_set vs set when framing | 189 // TODO(ianswett): Re-evaluate the trade-offs of hash_set vs set when framing |
| 187 // is finalized. | 190 // is finalized. |
| 188 typedef std::set<QuicPacketSequenceNumber> SequenceSet; | 191 typedef std::set<QuicPacketSequenceNumber> SequenceSet; |
| 189 // TODO(pwestin): Add a way to enforce the max size of this map. | 192 // TODO(pwestin): Add a way to enforce the max size of this map. |
| 190 typedef std::map<QuicPacketSequenceNumber, QuicTime> TimeMap; | 193 typedef std::map<QuicPacketSequenceNumber, QuicTime> TimeMap; |
| 191 | 194 |
| 192 struct NET_EXPORT_PRIVATE ReceivedPacketInfo { | 195 struct NET_EXPORT_PRIVATE ReceivedPacketInfo { |
| 193 ReceivedPacketInfo(); | 196 ReceivedPacketInfo(); |
| 194 ~ReceivedPacketInfo(); | 197 ~ReceivedPacketInfo(); |
| 195 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | 198 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
| 196 std::ostream& os, const ReceivedPacketInfo& s); | 199 std::ostream& os, const ReceivedPacketInfo& s); |
|
wtc
2013/01/17 18:59:36
I copied the operator<< solution from several othe
| |
| 197 | 200 |
| 198 // Records a packet receipt. | 201 // Records a packet receipt. |
| 199 void RecordReceived(QuicPacketSequenceNumber sequence_number); | 202 void RecordReceived(QuicPacketSequenceNumber sequence_number); |
| 200 | 203 |
| 201 // True if the sequence number is greater than largest_observed or is listed | 204 // True if the sequence number is greater than largest_observed or is listed |
| 202 // as missing. | 205 // as missing. |
| 203 // Always returns false for sequence numbers less than least_unacked. | 206 // Always returns false for sequence numbers less than least_unacked. |
| 204 bool IsAwaitingPacket(QuicPacketSequenceNumber sequence_number) const; | 207 bool IsAwaitingPacket(QuicPacketSequenceNumber sequence_number) const; |
| 205 | 208 |
| 206 // Clears all missing packets less than |least_unacked|. | 209 // Clears all missing packets less than |least_unacked|. |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 422 }; | 425 }; |
| 423 | 426 |
| 424 class NET_EXPORT_PRIVATE QuicEncryptedPacket : public QuicData { | 427 class NET_EXPORT_PRIVATE QuicEncryptedPacket : public QuicData { |
| 425 public: | 428 public: |
| 426 QuicEncryptedPacket(const char* buffer, size_t length) | 429 QuicEncryptedPacket(const char* buffer, size_t length) |
| 427 : QuicData(buffer, length) { } | 430 : QuicData(buffer, length) { } |
| 428 | 431 |
| 429 QuicEncryptedPacket(char* buffer, size_t length, bool owns_buffer) | 432 QuicEncryptedPacket(char* buffer, size_t length, bool owns_buffer) |
| 430 : QuicData(buffer, length, owns_buffer) { } | 433 : QuicData(buffer, length, owns_buffer) { } |
| 431 | 434 |
| 435 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | |
| 436 std::ostream& os, const QuicEncryptedPacket& s); | |
| 437 | |
| 432 base::StringPiece AssociatedData() const { | 438 base::StringPiece AssociatedData() const { |
| 433 return base::StringPiece(data() + kStartOfHashData, kStartOfEncryptedData); | 439 return base::StringPiece(data() + kStartOfHashData, kStartOfEncryptedData); |
| 434 } | 440 } |
| 435 | 441 |
| 436 private: | 442 private: |
| 437 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket); | 443 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket); |
| 438 }; | 444 }; |
| 439 | 445 |
| 440 } // namespace net | 446 } // namespace net |
| 441 | 447 |
| 442 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 448 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
| OLD | NEW |