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 <limits> | 8 #include <limits> |
| 9 #include <ostream> |
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 QuicAckFrame() {} | 242 QuicAckFrame() {} |
242 QuicAckFrame(QuicPacketSequenceNumber largest_received, | 243 QuicAckFrame(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 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, |
| 253 const QuicAckFrame& s); |
| 254 |
251 SentPacketInfo sent_info; | 255 SentPacketInfo sent_info; |
252 ReceivedPacketInfo received_info; | 256 ReceivedPacketInfo received_info; |
253 CongestionInfo congestion_info; | 257 CongestionInfo congestion_info; |
254 | |
255 friend std::ostream& operator<<(std::ostream& os, const QuicAckFrame& 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 }; | 258 }; |
276 | 259 |
277 struct NET_EXPORT_PRIVATE QuicRstStreamFrame { | 260 struct NET_EXPORT_PRIVATE QuicRstStreamFrame { |
278 QuicRstStreamFrame() {} | 261 QuicRstStreamFrame() {} |
279 QuicRstStreamFrame(QuicStreamId stream_id, uint64 offset, | 262 QuicRstStreamFrame(QuicStreamId stream_id, uint64 offset, |
280 QuicErrorCode error_code) | 263 QuicErrorCode error_code) |
281 : stream_id(stream_id), offset(offset), error_code(error_code) { | 264 : stream_id(stream_id), offset(offset), error_code(error_code) { |
282 DCHECK_LE(error_code, std::numeric_limits<uint8>::max()); | 265 DCHECK_LE(error_code, std::numeric_limits<uint8>::max()); |
283 } | 266 } |
284 | 267 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 | 305 |
323 typedef std::vector<QuicFrame> QuicFrames; | 306 typedef std::vector<QuicFrame> QuicFrames; |
324 | 307 |
325 struct NET_EXPORT_PRIVATE QuicFecData { | 308 struct NET_EXPORT_PRIVATE QuicFecData { |
326 QuicFecData(); | 309 QuicFecData(); |
327 QuicFecGroupNumber fec_group; | 310 QuicFecGroupNumber fec_group; |
328 QuicPacketSequenceNumber first_protected_packet_sequence_number; | 311 QuicPacketSequenceNumber first_protected_packet_sequence_number; |
329 // The last protected packet's sequence number will be one | 312 // The last protected packet's sequence number will be one |
330 // less than the sequence number of the FEC packet. | 313 // less than the sequence number of the FEC packet. |
331 base::StringPiece redundancy; | 314 base::StringPiece redundancy; |
332 bool operator==(const QuicFecData& other) const { | 315 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 }; | 316 }; |
346 | 317 |
347 struct NET_EXPORT_PRIVATE QuicPacketData { | 318 struct NET_EXPORT_PRIVATE QuicPacketData { |
348 std::string data; | 319 std::string data; |
349 }; | 320 }; |
350 | 321 |
351 class NET_EXPORT_PRIVATE QuicData { | 322 class NET_EXPORT_PRIVATE QuicData { |
352 public: | 323 public: |
353 QuicData(const char* buffer, size_t length) | 324 QuicData(const char* buffer, size_t length) |
354 : buffer_(buffer), | 325 : buffer_(buffer), |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 return base::StringPiece(data() + kStartOfHashData, kStartOfEncryptedData); | 387 return base::StringPiece(data() + kStartOfHashData, kStartOfEncryptedData); |
417 } | 388 } |
418 | 389 |
419 private: | 390 private: |
420 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket); | 391 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket); |
421 }; | 392 }; |
422 | 393 |
423 } // namespace net | 394 } // namespace net |
424 | 395 |
425 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 396 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
OLD | NEW |