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

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

Issue 2011653004: Remove obsolete fields in quic_protocol and their current usage in QUIC. Reorders QuicAckFrame fie… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@122721477
Patch Set: Created 4 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
« no previous file with comments | « net/quic/quic_packet_creator.cc ('k') | net/quic/quic_protocol.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 #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 <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 24 matching lines...) Expand all
35 35
36 class QuicPacket; 36 class QuicPacket;
37 struct QuicPacketHeader; 37 struct QuicPacketHeader;
38 class QuicAckListenerInterface; 38 class QuicAckListenerInterface;
39 39
40 typedef uint64_t QuicConnectionId; 40 typedef uint64_t QuicConnectionId;
41 typedef uint32_t QuicStreamId; 41 typedef uint32_t QuicStreamId;
42 typedef uint64_t QuicStreamOffset; 42 typedef uint64_t QuicStreamOffset;
43 typedef uint64_t QuicPacketNumber; 43 typedef uint64_t QuicPacketNumber;
44 typedef uint8_t QuicPathId; 44 typedef uint8_t QuicPathId;
45 typedef QuicPacketNumber QuicFecGroupNumber;
46 typedef uint64_t QuicPublicResetNonceProof; 45 typedef uint64_t QuicPublicResetNonceProof;
47 typedef uint8_t QuicPacketEntropyHash; 46 typedef uint8_t QuicPacketEntropyHash;
48 typedef uint32_t QuicHeaderId; 47 typedef uint32_t QuicHeaderId;
49 // QuicTag is the type of a tag in the wire protocol. 48 // QuicTag is the type of a tag in the wire protocol.
50 typedef uint32_t QuicTag; 49 typedef uint32_t QuicTag;
51 typedef std::vector<QuicTag> QuicTagVector; 50 typedef std::vector<QuicTag> QuicTagVector;
52 typedef std::map<QuicTag, std::string> QuicTagValueMap; 51 typedef std::map<QuicTag, std::string> QuicTagValueMap;
53 typedef uint16_t QuicPacketLength; 52 typedef uint16_t QuicPacketLength;
54 53
55 // Default initial maximum size in bytes of a QUIC packet. 54 // Default initial maximum size in bytes of a QUIC packet.
(...skipping 24 matching lines...) Expand all
80 79
81 // Maximum number of tracked packets. 80 // Maximum number of tracked packets.
82 const QuicPacketCount kMaxTrackedPackets = 10000; 81 const QuicPacketCount kMaxTrackedPackets = 10000;
83 82
84 // Default size of the socket receive buffer in bytes. 83 // Default size of the socket receive buffer in bytes.
85 const QuicByteCount kDefaultSocketReceiveBuffer = 256 * 1024; 84 const QuicByteCount kDefaultSocketReceiveBuffer = 256 * 1024;
86 // Minimum size of the socket receive buffer in bytes. 85 // Minimum size of the socket receive buffer in bytes.
87 // Smaller values are ignored. 86 // Smaller values are ignored.
88 const QuicByteCount kMinSocketReceiveBuffer = 16 * 1024; 87 const QuicByteCount kMinSocketReceiveBuffer = 16 * 1024;
89 88
90 // Fraction of the receive buffer that can be used for encrypted bytes.
91 // Allows a 5% overhead for IP and UDP framing, as well as ack only packets.
92 static const float kUsableRecieveBufferFraction = 0.95f;
93 // Fraction of the receive buffer that can be used, based on conservative 89 // Fraction of the receive buffer that can be used, based on conservative
94 // estimates and testing on Linux. 90 // estimates and testing on Linux.
95 // An alternative to kUsableRecieveBufferFraction. 91 // An alternative to kUsableRecieveBufferFraction.
96 static const float kConservativeReceiveBufferFraction = 0.6f; 92 static const float kConservativeReceiveBufferFraction = 0.6f;
97 93
98 // Don't allow a client to suggest an RTT shorter than 10ms. 94 // Don't allow a client to suggest an RTT shorter than 10ms.
99 const uint32_t kMinInitialRoundTripTimeUs = 10 * kNumMicrosPerMilli; 95 const uint32_t kMinInitialRoundTripTimeUs = 10 * kNumMicrosPerMilli;
100 96
101 // Don't allow a client to suggest an RTT longer than 15 seconds. 97 // Don't allow a client to suggest an RTT longer than 15 seconds.
102 const uint32_t kMaxInitialRoundTripTimeUs = 15 * kNumMicrosPerSecond; 98 const uint32_t kMaxInitialRoundTripTimeUs = 15 * kNumMicrosPerSecond;
103 99
104 // Maximum number of open streams per connection. 100 // Maximum number of open streams per connection.
105 const size_t kDefaultMaxStreamsPerConnection = 100; 101 const size_t kDefaultMaxStreamsPerConnection = 100;
106 102
107 // Number of bytes reserved for public flags in the packet header. 103 // Number of bytes reserved for public flags in the packet header.
108 const size_t kPublicFlagsSize = 1; 104 const size_t kPublicFlagsSize = 1;
109 // Number of bytes reserved for version number in the packet header. 105 // Number of bytes reserved for version number in the packet header.
110 const size_t kQuicVersionSize = 4; 106 const size_t kQuicVersionSize = 4;
111 // Number of bytes reserved for path id in the packet header. 107 // Number of bytes reserved for path id in the packet header.
112 const size_t kQuicPathIdSize = 1; 108 const size_t kQuicPathIdSize = 1;
113 // Number of bytes reserved for private flags in the packet header. 109 // Number of bytes reserved for private flags in the packet header.
114 const size_t kPrivateFlagsSize = 1; 110 const size_t kPrivateFlagsSize = 1;
115 // Number of bytes reserved for FEC group in the packet header.
116 const size_t kFecGroupSize = 1;
117 111
118 // Signifies that the QuicPacket will contain version of the protocol. 112 // Signifies that the QuicPacket will contain version of the protocol.
119 const bool kIncludeVersion = true; 113 const bool kIncludeVersion = true;
120 // Signifies that the QuicPacket will contain path id. 114 // Signifies that the QuicPacket will contain path id.
121 const bool kIncludePathId = true; 115 const bool kIncludePathId = true;
122 // Signifies that the QuicPacket will include a diversification nonce. 116 // Signifies that the QuicPacket will include a diversification nonce.
123 const bool kIncludeDiversificationNonce = true; 117 const bool kIncludeDiversificationNonce = true;
124 118
125 // Stream ID is reserved to denote an invalid ID. 119 // Stream ID is reserved to denote an invalid ID.
126 const QuicStreamId kInvalidStreamId = 0; 120 const QuicStreamId kInvalidStreamId = 0;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 // The path MTU discovery frame is encoded as a PING frame on the wire. 264 // The path MTU discovery frame is encoded as a PING frame on the wire.
271 MTU_DISCOVERY_FRAME, 265 MTU_DISCOVERY_FRAME,
272 NUM_FRAME_TYPES 266 NUM_FRAME_TYPES
273 }; 267 };
274 268
275 enum QuicConnectionIdLength { 269 enum QuicConnectionIdLength {
276 PACKET_0BYTE_CONNECTION_ID = 0, 270 PACKET_0BYTE_CONNECTION_ID = 0,
277 PACKET_8BYTE_CONNECTION_ID = 8 271 PACKET_8BYTE_CONNECTION_ID = 8
278 }; 272 };
279 273
280 enum InFecGroup {
281 NOT_IN_FEC_GROUP,
282 IN_FEC_GROUP,
283 };
284
285 enum QuicPacketNumberLength : int8_t { 274 enum QuicPacketNumberLength : int8_t {
286 PACKET_1BYTE_PACKET_NUMBER = 1, 275 PACKET_1BYTE_PACKET_NUMBER = 1,
287 PACKET_2BYTE_PACKET_NUMBER = 2, 276 PACKET_2BYTE_PACKET_NUMBER = 2,
288 PACKET_4BYTE_PACKET_NUMBER = 4, 277 PACKET_4BYTE_PACKET_NUMBER = 4,
289 PACKET_6BYTE_PACKET_NUMBER = 6 278 PACKET_6BYTE_PACKET_NUMBER = 6
290 }; 279 };
291 280
292 // Used to indicate a QuicSequenceNumberLength using two flag bits. 281 // Used to indicate a QuicSequenceNumberLength using two flag bits.
293 enum QuicPacketNumberLengthFlags { 282 enum QuicPacketNumberLengthFlags {
294 PACKET_FLAGS_1BYTE_PACKET = 0, // 00 283 PACKET_FLAGS_1BYTE_PACKET = 0, // 00
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 // Connection migration was attempted, but there was no new network to 689 // Connection migration was attempted, but there was no new network to
701 // migrate to. 690 // migrate to.
702 QUIC_CONNECTION_MIGRATION_NO_NEW_NETWORK = 83, 691 QUIC_CONNECTION_MIGRATION_NO_NEW_NETWORK = 83,
703 // Network changed, but connection had one or more non-migratable streams. 692 // Network changed, but connection had one or more non-migratable streams.
704 QUIC_CONNECTION_MIGRATION_NON_MIGRATABLE_STREAM = 84, 693 QUIC_CONNECTION_MIGRATION_NON_MIGRATABLE_STREAM = 84,
705 694
706 // No error. Used as bound while iterating. 695 // No error. Used as bound while iterating.
707 QUIC_LAST_ERROR = 91, 696 QUIC_LAST_ERROR = 91,
708 }; 697 };
709 698
710 // Must be updated any time a QuicErrorCode is deprecated.
711 const int kDeprecatedQuicErrorCount = 4;
712 const int kActiveQuicErrorCount = QUIC_LAST_ERROR - kDeprecatedQuicErrorCount;
713
714 typedef char DiversificationNonce[32]; 699 typedef char DiversificationNonce[32];
715 700
716 struct NET_EXPORT_PRIVATE QuicPacketPublicHeader { 701 struct NET_EXPORT_PRIVATE QuicPacketPublicHeader {
717 QuicPacketPublicHeader(); 702 QuicPacketPublicHeader();
718 explicit QuicPacketPublicHeader(const QuicPacketPublicHeader& other); 703 explicit QuicPacketPublicHeader(const QuicPacketPublicHeader& other);
719 ~QuicPacketPublicHeader(); 704 ~QuicPacketPublicHeader();
720 705
721 // Universal header. All QuicPacket headers will have a connection_id and 706 // Universal header. All QuicPacket headers will have a connection_id and
722 // public flags. 707 // public flags.
723 QuicConnectionId connection_id; 708 QuicConnectionId connection_id;
(...skipping 19 matching lines...) Expand all
743 728
744 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, 729 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os,
745 const QuicPacketHeader& s); 730 const QuicPacketHeader& s);
746 731
747 QuicPacketPublicHeader public_header; 732 QuicPacketPublicHeader public_header;
748 QuicPacketNumber packet_number; 733 QuicPacketNumber packet_number;
749 QuicPathId path_id; 734 QuicPathId path_id;
750 bool entropy_flag; 735 bool entropy_flag;
751 QuicPacketEntropyHash entropy_hash; 736 QuicPacketEntropyHash entropy_hash;
752 bool fec_flag; 737 bool fec_flag;
753 InFecGroup is_in_fec_group;
754 QuicFecGroupNumber fec_group;
755 }; 738 };
756 739
757 struct NET_EXPORT_PRIVATE QuicPublicResetPacket { 740 struct NET_EXPORT_PRIVATE QuicPublicResetPacket {
758 QuicPublicResetPacket(); 741 QuicPublicResetPacket();
759 explicit QuicPublicResetPacket(const QuicPacketPublicHeader& header); 742 explicit QuicPublicResetPacket(const QuicPacketPublicHeader& header);
760 743
761 QuicPacketPublicHeader public_header; 744 QuicPacketPublicHeader public_header;
762 QuicPublicResetNonceProof nonce_proof; 745 QuicPublicResetNonceProof nonce_proof;
763 QuicPacketNumber rejected_packet_number; 746 QuicPacketNumber rejected_packet_number;
764 IPEndPoint client_address; 747 IPEndPoint client_address;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 }; 993 };
1011 994
1012 struct NET_EXPORT_PRIVATE QuicAckFrame { 995 struct NET_EXPORT_PRIVATE QuicAckFrame {
1013 QuicAckFrame(); 996 QuicAckFrame();
1014 QuicAckFrame(const QuicAckFrame& other); 997 QuicAckFrame(const QuicAckFrame& other);
1015 ~QuicAckFrame(); 998 ~QuicAckFrame();
1016 999
1017 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, 1000 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os,
1018 const QuicAckFrame& s); 1001 const QuicAckFrame& s);
1019 1002
1020 // Path which this ack belongs to.
1021 QuicPathId path_id;
1022
1023 // Entropy hash of all packets up to largest observed not including missing
1024 // packets.
1025 QuicPacketEntropyHash entropy_hash;
1026
1027 // Whether the ack had to be truncated when sent.
1028 bool is_truncated;
1029
1030 // The highest packet number we've observed from the peer. 1003 // The highest packet number we've observed from the peer.
1031 // 1004 //
1032 // In general, this should be the largest packet number we've received. In 1005 // In general, this should be the largest packet number we've received. In
1033 // the case of truncated acks, we may have to advertise a lower "upper bound" 1006 // the case of truncated acks, we may have to advertise a lower "upper bound"
1034 // than largest received, to avoid implicitly acking missing packets that 1007 // than largest received, to avoid implicitly acking missing packets that
1035 // don't fit in the missing packet list due to size limitations. In this 1008 // don't fit in the missing packet list due to size limitations. In this
1036 // case, largest_observed may be a packet which is also in the missing packets 1009 // case, largest_observed may be a packet which is also in the missing packets
1037 // list. 1010 // list.
1038 QuicPacketNumber largest_observed; 1011 QuicPacketNumber largest_observed;
1039 1012
1040 // Time elapsed since largest_observed was received until this Ack frame was 1013 // Time elapsed since largest_observed was received until this Ack frame was
1041 // sent. 1014 // sent.
1042 QuicTime::Delta ack_delay_time; 1015 QuicTime::Delta ack_delay_time;
1043 1016
1044 // Vector of <packet_number, time> for when packets arrived. 1017 // Vector of <packet_number, time> for when packets arrived.
1045 PacketTimeVector received_packet_times; 1018 PacketTimeVector received_packet_times;
1046 1019
1047 // Set of packets. 1020 // Set of packets.
1048 PacketNumberQueue packets; 1021 PacketNumberQueue packets;
1049 1022
1023 // Path which this ack belongs to.
1024 QuicPathId path_id;
1025
1026 // Entropy hash of all packets up to largest observed not including missing
1027 // packets.
1028 QuicPacketEntropyHash entropy_hash;
1029
1030 // Whether the ack had to be truncated when sent.
1031 bool is_truncated;
1032
1050 // If true, |packets| express missing packets. Otherwise, |packets| express 1033 // If true, |packets| express missing packets. Otherwise, |packets| express
1051 // received packets. 1034 // received packets.
1052 bool missing; 1035 bool missing;
1053 }; 1036 };
1054 1037
1055 // True if the packet number is greater than largest_observed or is listed 1038 // True if the packet number is greater than largest_observed or is listed
1056 // as missing. 1039 // as missing.
1057 // Always returns false for packet numbers less than least_unacked. 1040 // Always returns false for packet numbers less than least_unacked.
1058 bool NET_EXPORT_PRIVATE 1041 bool NET_EXPORT_PRIVATE
1059 IsAwaitingPacket(const QuicAckFrame& ack_frame, 1042 IsAwaitingPacket(const QuicAckFrame& ack_frame,
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 ~SerializedPacket(); 1380 ~SerializedPacket();
1398 1381
1399 // Not owned. 1382 // Not owned.
1400 const char* encrypted_buffer; 1383 const char* encrypted_buffer;
1401 QuicPacketLength encrypted_length; 1384 QuicPacketLength encrypted_length;
1402 QuicFrames retransmittable_frames; 1385 QuicFrames retransmittable_frames;
1403 IsHandshake has_crypto_handshake; 1386 IsHandshake has_crypto_handshake;
1404 // -1: full padding to the end of a max-sized packet 1387 // -1: full padding to the end of a max-sized packet
1405 // 0: no padding 1388 // 0: no padding
1406 // otherwise: only pad up to num_padding_bytes bytes 1389 // otherwise: only pad up to num_padding_bytes bytes
1407 int num_padding_bytes; 1390 int16_t num_padding_bytes;
1408 QuicPathId path_id; 1391 QuicPathId path_id;
1409 QuicPacketNumber packet_number; 1392 QuicPacketNumber packet_number;
1410 QuicPacketNumberLength packet_number_length; 1393 QuicPacketNumberLength packet_number_length;
1411 EncryptionLevel encryption_level; 1394 EncryptionLevel encryption_level;
1412 QuicPacketEntropyHash entropy_hash; 1395 QuicPacketEntropyHash entropy_hash;
1413 bool has_ack; 1396 bool has_ack;
1414 bool has_stop_waiting; 1397 bool has_stop_waiting;
1398 TransmissionType transmission_type;
1415 QuicPathId original_path_id; 1399 QuicPathId original_path_id;
1416 QuicPacketNumber original_packet_number; 1400 QuicPacketNumber original_packet_number;
1417 TransmissionType transmission_type;
1418 1401
1419 // Optional notifiers which will be informed when this packet has been ACKed. 1402 // Optional notifiers which will be informed when this packet has been ACKed.
1420 std::list<AckListenerWrapper> listeners; 1403 std::list<AckListenerWrapper> listeners;
1421 }; 1404 };
1422 1405
1423 struct NET_EXPORT_PRIVATE TransmissionInfo { 1406 struct NET_EXPORT_PRIVATE TransmissionInfo {
1424 // Used by STL when assigning into a map. 1407 // Used by STL when assigning into a map.
1425 TransmissionInfo(); 1408 TransmissionInfo();
1426 1409
1427 // Constructs a Transmission with a new all_transmissions set 1410 // Constructs a Transmission with a new all_transmissions set
(...skipping 19 matching lines...) Expand all
1447 TransmissionType transmission_type; 1430 TransmissionType transmission_type;
1448 // In flight packets have not been abandoned or lost. 1431 // In flight packets have not been abandoned or lost.
1449 bool in_flight; 1432 bool in_flight;
1450 // True if the packet can never be acked, so it can be removed. Occurs when 1433 // True if the packet can never be acked, so it can be removed. Occurs when
1451 // a packet is never sent, after it is acknowledged once, or if it's a crypto 1434 // a packet is never sent, after it is acknowledged once, or if it's a crypto
1452 // packet we never expect to receive an ack for. 1435 // packet we never expect to receive an ack for.
1453 bool is_unackable; 1436 bool is_unackable;
1454 // True if the packet contains stream data from the crypto stream. 1437 // True if the packet contains stream data from the crypto stream.
1455 bool has_crypto_handshake; 1438 bool has_crypto_handshake;
1456 // Non-zero if the packet needs padding if it's retransmitted. 1439 // Non-zero if the packet needs padding if it's retransmitted.
1457 int num_padding_bytes; 1440 int16_t num_padding_bytes;
1458 // Stores the packet number of the next retransmission of this packet. 1441 // Stores the packet number of the next retransmission of this packet.
1459 // Zero if the packet has not been retransmitted. 1442 // Zero if the packet has not been retransmitted.
1460 QuicPacketNumber retransmission; 1443 QuicPacketNumber retransmission;
1461 // Non-empty if there is a listener for this packet. 1444 // Non-empty if there is a listener for this packet.
1462 std::list<AckListenerWrapper> ack_listeners; 1445 std::list<AckListenerWrapper> ack_listeners;
1463 }; 1446 };
1464 1447
1465 // Struct to store the pending retransmission information. 1448 // Struct to store the pending retransmission information.
1466 struct PendingRetransmission { 1449 struct PendingRetransmission {
1467 PendingRetransmission(QuicPathId path_id, 1450 PendingRetransmission(QuicPathId path_id,
(...skipping 30 matching lines...) Expand all
1498 : iov(iov), iov_count(iov_count), total_length(total_length) {} 1481 : iov(iov), iov_count(iov_count), total_length(total_length) {}
1499 1482
1500 const struct iovec* iov; 1483 const struct iovec* iov;
1501 const int iov_count; 1484 const int iov_count;
1502 const size_t total_length; 1485 const size_t total_length;
1503 }; 1486 };
1504 1487
1505 } // namespace net 1488 } // namespace net
1506 1489
1507 #endif // NET_QUIC_QUIC_PROTOCOL_H_ 1490 #endif // NET_QUIC_QUIC_PROTOCOL_H_
OLDNEW
« no previous file with comments | « net/quic/quic_packet_creator.cc ('k') | net/quic/quic_protocol.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698