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

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

Issue 11377096: Change from re-transmitting an packet with a retransmit number to sending a new packet with a new s… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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_packet_creator.cc ('k') | net/quic/test_tools/quic_test_utils.h » ('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_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 <ostream>
10 #include <utility> 10 #include <utility>
(...skipping 17 matching lines...) Expand all
28 typedef uint64 QuicTransmissionTime; 28 typedef uint64 QuicTransmissionTime;
29 typedef uint8 QuicFecGroupNumber; 29 typedef uint8 QuicFecGroupNumber;
30 30
31 // TODO(rch): Consider Quic specific names for these constants. 31 // TODO(rch): Consider Quic specific names for these constants.
32 const size_t kMaxPacketSize = 1200; // Maximum size in bytes of a QUIC packet. 32 const size_t kMaxPacketSize = 1200; // Maximum size in bytes of a QUIC packet.
33 33
34 // Maximum number of open streams per connection. 34 // Maximum number of open streams per connection.
35 const size_t kDefaultMaxStreamsPerConnection = 100; 35 const size_t kDefaultMaxStreamsPerConnection = 100;
36 36
37 // Size in bytes of the packet header common across all packets. 37 // Size in bytes of the packet header common across all packets.
38 const size_t kPacketHeaderSize = 25; 38 const size_t kPacketHeaderSize = 24;
39 // Index of the first byte in a QUIC packet of FEC protected data. 39 // Index of the first byte in a QUIC packet of FEC protected data.
40 const size_t kStartOfFecProtectedData = kPacketHeaderSize; 40 const size_t kStartOfFecProtectedData = kPacketHeaderSize;
41 // Index of the first byte in a QUIC packet of encrypted data. 41 // Index of the first byte in a QUIC packet of encrypted data.
42 const size_t kStartOfEncryptedData = kPacketHeaderSize - 1; 42 const size_t kStartOfEncryptedData = kPacketHeaderSize - 1;
43 // Index of the first byte in a QUIC packet which is hashed. 43 // Index of the first byte in a QUIC packet which is hashed.
44 const size_t kStartOfHashData = 0; 44 const size_t kStartOfHashData = 0;
45 // Index into the retransmission offset in the header. 45 // Index into the sequence number offset in the header.
46 // (After GUID and sequence number.) 46 const int kSequenceNumberOffset = 8;
47 const int kRetransmissionOffset = 14;
48 // Index into the transmission time offset in the header. 47 // Index into the transmission time offset in the header.
49 const int kTransmissionTimeOffset = 15; 48 const int kTransmissionTimeOffset = 14;
49 // Index into the flags offset in the header.
50 const int kFlagsOffset = 22;
51 // Index into the fec group offset in the header.
52 const int kFecGroupOffset = 23;
50 53
51 // Size in bytes of all stream frame fields. 54 // Size in bytes of all stream frame fields.
52 const size_t kMinStreamFrameLength = 15; 55 const size_t kMinStreamFrameLength = 15;
53 56
54 // Limit on the delta between stream IDs. 57 // Limit on the delta between stream IDs.
55 const QuicStreamId kMaxStreamIdDelta = 100; 58 const QuicStreamId kMaxStreamIdDelta = 100;
56 59
57 // Reserved ID for the crypto stream. 60 // Reserved ID for the crypto stream.
58 // TODO(rch): ensure that this is not usable by any other streams. 61 // TODO(rch): ensure that this is not usable by any other streams.
59 const QuicStreamId kCryptoStreamId = 1; 62 const QuicStreamId kCryptoStreamId = 1;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // A crypto message was receieved with an illegal message tag. 141 // A crypto message was receieved with an illegal message tag.
139 QUIC_INVALID_CRYPTO_MESSAGE_TYPE, 142 QUIC_INVALID_CRYPTO_MESSAGE_TYPE,
140 143
141 }; 144 };
142 145
143 struct NET_EXPORT_PRIVATE QuicPacketHeader { 146 struct NET_EXPORT_PRIVATE QuicPacketHeader {
144 // Includes the ConnectionHeader and CongestionMonitoredHeader 147 // Includes the ConnectionHeader and CongestionMonitoredHeader
145 // from the design docs, as well as some elements of DecryptedData. 148 // from the design docs, as well as some elements of DecryptedData.
146 QuicGuid guid; 149 QuicGuid guid;
147 QuicPacketSequenceNumber packet_sequence_number; 150 QuicPacketSequenceNumber packet_sequence_number;
148 uint8 retransmission_count;
149 QuicTransmissionTime transmission_time; 151 QuicTransmissionTime transmission_time;
150 QuicPacketFlags flags; 152 QuicPacketFlags flags;
151 QuicFecGroupNumber fec_group; 153 QuicFecGroupNumber fec_group;
152 }; 154 };
153 155
154 struct NET_EXPORT_PRIVATE QuicStreamFrame { 156 struct NET_EXPORT_PRIVATE QuicStreamFrame {
155 QuicStreamFrame(); 157 QuicStreamFrame();
156 QuicStreamFrame(QuicStreamId stream_id, 158 QuicStreamFrame(QuicStreamId stream_id,
157 bool fin, 159 bool fin,
158 uint64 offset, 160 uint64 offset,
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 private: 347 private:
346 const char* buffer_; 348 const char* buffer_;
347 size_t length_; 349 size_t length_;
348 bool owns_buffer_; 350 bool owns_buffer_;
349 351
350 DISALLOW_COPY_AND_ASSIGN(QuicData); 352 DISALLOW_COPY_AND_ASSIGN(QuicData);
351 }; 353 };
352 354
353 class NET_EXPORT_PRIVATE QuicPacket : public QuicData { 355 class NET_EXPORT_PRIVATE QuicPacket : public QuicData {
354 public: 356 public:
355 QuicPacket(char* buffer, size_t length, bool owns_buffer) 357 QuicPacket(
358 char* buffer, size_t length, bool owns_buffer, QuicPacketFlags flags)
356 : QuicData(buffer, length, owns_buffer), 359 : QuicData(buffer, length, owns_buffer),
357 buffer_(buffer) { } 360 buffer_(buffer),
361 flags_(flags) { }
358 362
359 base::StringPiece FecProtectedData() const { 363 base::StringPiece FecProtectedData() const {
360 return base::StringPiece(data() + kStartOfFecProtectedData, 364 return base::StringPiece(data() + kStartOfFecProtectedData,
361 length() - kStartOfFecProtectedData); 365 length() - kStartOfFecProtectedData);
362 } 366 }
363 367
364 base::StringPiece AssociatedData() const { 368 base::StringPiece AssociatedData() const {
365 return base::StringPiece(data() + kStartOfHashData, kStartOfEncryptedData); 369 return base::StringPiece(data() + kStartOfHashData, kStartOfEncryptedData);
366 } 370 }
367 371
368 base::StringPiece Plaintext() const { 372 base::StringPiece Plaintext() const {
369 return base::StringPiece(data() + kStartOfEncryptedData, 373 return base::StringPiece(data() + kStartOfEncryptedData,
370 length() - kStartOfEncryptedData); 374 length() - kStartOfEncryptedData);
371 } 375 }
376
377 bool IsFecPacket() const {
378 return flags_ == PACKET_FLAGS_FEC;
379 }
380
372 char* mutable_data() { return buffer_; } 381 char* mutable_data() { return buffer_; }
373 382
374 private: 383 private:
375 char* buffer_; 384 char* buffer_;
385 const QuicPacketFlags flags_;
376 386
377 DISALLOW_COPY_AND_ASSIGN(QuicPacket); 387 DISALLOW_COPY_AND_ASSIGN(QuicPacket);
378 }; 388 };
379 389
380 class NET_EXPORT_PRIVATE QuicEncryptedPacket : public QuicData { 390 class NET_EXPORT_PRIVATE QuicEncryptedPacket : public QuicData {
381 public: 391 public:
382 QuicEncryptedPacket(const char* buffer, size_t length) 392 QuicEncryptedPacket(const char* buffer, size_t length)
383 : QuicData(buffer, length) { } 393 : QuicData(buffer, length) { }
384 394
385 QuicEncryptedPacket(char* buffer, size_t length, bool owns_buffer) 395 QuicEncryptedPacket(char* buffer, size_t length, bool owns_buffer)
386 : QuicData(buffer, length, owns_buffer) { } 396 : QuicData(buffer, length, owns_buffer) { }
387 397
388 base::StringPiece AssociatedData() const { 398 base::StringPiece AssociatedData() const {
389 return base::StringPiece(data() + kStartOfHashData, kStartOfEncryptedData); 399 return base::StringPiece(data() + kStartOfHashData, kStartOfEncryptedData);
390 } 400 }
391 401
392 private: 402 private:
393 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket); 403 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket);
394 }; 404 };
395 405
396 } // namespace net 406 } // namespace net
397 407
398 #endif // NET_QUIC_QUIC_PROTOCOL_H_ 408 #endif // NET_QUIC_QUIC_PROTOCOL_H_
OLDNEW
« no previous file with comments | « net/quic/quic_packet_creator.cc ('k') | net/quic/test_tools/quic_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698