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 <ostream> | |
| 8 #include <limits> | 9 #include <limits> |
|
jar (doing other things)
2012/10/19 00:26:53
nit: alphabetize
Ryan Hamilton
2012/10/21 22:09:07
Done.
| |
| 9 #include <utility> | 10 #include <utility> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 13 #include "base/hash_tables.h" | 14 #include "base/hash_tables.h" |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "base/string_piece.h" | 16 #include "base/string_piece.h" |
| 16 #include "net/base/net_export.h" | 17 #include "net/base/net_export.h" |
| 17 #include "net/quic/uint128.h" | 18 #include "net/quic/uint128.h" |
| 18 | 19 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 QuicAckFragment() {} | 242 QuicAckFragment() {} |
| 242 QuicAckFragment(QuicPacketSequenceNumber largest_received, | 243 QuicAckFragment(QuicPacketSequenceNumber largest_received, |
| 243 QuicTransmissionTime time_received, | 244 QuicTransmissionTime time_received, |
| 244 QuicPacketSequenceNumber least_unacked) { | 245 QuicPacketSequenceNumber least_unacked) { |
| 245 received_info.largest_received = largest_received; | 246 received_info.largest_received = largest_received; |
| 246 received_info.time_received = time_received; | 247 received_info.time_received = time_received; |
| 247 sent_info.least_unacked = least_unacked; | 248 sent_info.least_unacked = least_unacked; |
| 248 congestion_info.type = kNone; | 249 congestion_info.type = kNone; |
| 249 } | 250 } |
| 250 | 251 |
| 252 friend std::ostream& operator<<(std::ostream& os, const QuicAckFragment& s); | |
| 253 | |
| 251 SentPacketInfo sent_info; | 254 SentPacketInfo sent_info; |
| 252 ReceivedPacketInfo received_info; | 255 ReceivedPacketInfo received_info; |
| 253 CongestionInfo congestion_info; | 256 CongestionInfo congestion_info; |
| 254 | |
| 255 friend std::ostream& operator<<(std::ostream& os, const QuicAckFragment& s) { | |
| 256 os << "largest_received: " << s.received_info.largest_received | |
| 257 << " time: " << s.received_info.time_received | |
| 258 << " missing: "; | |
| 259 for (base::hash_set<QuicPacketSequenceNumber>::const_iterator it = | |
| 260 s.received_info.missing_packets.begin(); | |
| 261 it != s.received_info.missing_packets.end(); ++it) { | |
| 262 os << *it << " "; | |
| 263 } | |
| 264 | |
| 265 os << " least_waiting: " << s.sent_info.least_unacked | |
| 266 << " no_retransmit: "; | |
| 267 for (base::hash_set<QuicPacketSequenceNumber>::const_iterator it = | |
| 268 s.sent_info.non_retransmiting.begin(); | |
| 269 it != s.sent_info.non_retransmiting.end(); ++it) { | |
| 270 os << *it << " "; | |
| 271 } | |
| 272 os << "\n"; | |
| 273 return os; | |
| 274 } | |
| 275 }; | 257 }; |
| 276 | 258 |
| 277 struct NET_EXPORT_PRIVATE QuicRstStreamFragment { | 259 struct NET_EXPORT_PRIVATE QuicRstStreamFragment { |
| 278 QuicRstStreamFragment() {} | 260 QuicRstStreamFragment() {} |
| 279 QuicRstStreamFragment(QuicStreamId stream_id, uint64 offset, | 261 QuicRstStreamFragment(QuicStreamId stream_id, uint64 offset, |
| 280 QuicErrorCode error_code) | 262 QuicErrorCode error_code) |
| 281 : stream_id(stream_id), offset(offset), error_code(error_code) { | 263 : stream_id(stream_id), offset(offset), error_code(error_code) { |
| 282 DCHECK_LE(error_code, std::numeric_limits<uint8>::max()); | 264 DCHECK_LE(error_code, std::numeric_limits<uint8>::max()); |
| 283 } | 265 } |
| 284 | 266 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 | 304 |
| 323 typedef std::vector<QuicFragment> QuicFragments; | 305 typedef std::vector<QuicFragment> QuicFragments; |
| 324 | 306 |
| 325 struct NET_EXPORT_PRIVATE QuicFecData { | 307 struct NET_EXPORT_PRIVATE QuicFecData { |
| 326 QuicFecData(); | 308 QuicFecData(); |
| 327 QuicFecGroupNumber fec_group; | 309 QuicFecGroupNumber fec_group; |
| 328 QuicPacketSequenceNumber first_protected_packet_sequence_number; | 310 QuicPacketSequenceNumber first_protected_packet_sequence_number; |
| 329 // The last protected packet's sequence number will be one | 311 // The last protected packet's sequence number will be one |
| 330 // less than the sequence number of the FEC packet. | 312 // less than the sequence number of the FEC packet. |
| 331 base::StringPiece redundancy; | 313 base::StringPiece redundancy; |
| 332 bool operator==(const QuicFecData& other) const { | 314 bool operator==(const QuicFecData& other) const; |
| 333 if (fec_group != other.fec_group) { | |
| 334 return false; | |
| 335 } | |
| 336 if (first_protected_packet_sequence_number != | |
| 337 other.first_protected_packet_sequence_number) { | |
| 338 return false; | |
| 339 } | |
| 340 if (redundancy != other.redundancy) { | |
| 341 return false; | |
| 342 } | |
| 343 return true; | |
| 344 } | |
| 345 }; | 315 }; |
| 346 | 316 |
| 347 struct NET_EXPORT_PRIVATE QuicPacketData { | 317 struct NET_EXPORT_PRIVATE QuicPacketData { |
| 348 std::string data; | 318 std::string data; |
| 349 }; | 319 }; |
| 350 | 320 |
| 351 class NET_EXPORT_PRIVATE QuicData { | 321 class NET_EXPORT_PRIVATE QuicData { |
| 352 public: | 322 public: |
| 353 QuicData(const char* buffer, size_t length) | 323 QuicData(const char* buffer, size_t length) |
| 354 : buffer_(buffer), | 324 : buffer_(buffer), |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 416 return base::StringPiece(data() + kStartOfHashData, kStartOfEncryptedData); | 386 return base::StringPiece(data() + kStartOfHashData, kStartOfEncryptedData); |
| 417 } | 387 } |
| 418 | 388 |
| 419 private: | 389 private: |
| 420 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket); | 390 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket); |
| 421 }; | 391 }; |
| 422 | 392 |
| 423 } // namespace net | 393 } // namespace net |
| 424 | 394 |
| 425 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 395 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
| OLD | NEW |