summaryrefslogtreecommitdiff
path: root/chromium/net/third_party/quiche/src/quic/core/quic_types.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/net/third_party/quiche/src/quic/core/quic_types.h')
-rw-r--r--chromium/net/third_party/quiche/src/quic/core/quic_types.h66
1 files changed, 51 insertions, 15 deletions
diff --git a/chromium/net/third_party/quiche/src/quic/core/quic_types.h b/chromium/net/third_party/quiche/src/quic/core/quic_types.h
index afd42be3f46..23cbe7a4eb4 100644
--- a/chromium/net/third_party/quiche/src/quic/core/quic_types.h
+++ b/chromium/net/third_party/quiche/src/quic/core/quic_types.h
@@ -15,6 +15,7 @@
#include "net/third_party/quiche/src/quic/core/quic_error_codes.h"
#include "net/third_party/quiche/src/quic/core/quic_packet_number.h"
#include "net/third_party/quiche/src/quic/core/quic_time.h"
+#include "net/third_party/quiche/src/quic/platform/api/quic_containers.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
namespace quic {
@@ -23,6 +24,7 @@ typedef uint16_t QuicPacketLength;
typedef uint32_t QuicControlFrameId;
typedef uint32_t QuicHeaderId;
typedef uint32_t QuicMessageId;
+typedef uint64_t QuicDatagramFlowId;
// TODO(fkastenholz): Should update this to 64 bits for V99.
typedef uint32_t QuicStreamId;
@@ -55,7 +57,8 @@ typedef uint64_t QuicConnectionIdSequenceNumber;
// A struct for functions which consume data payloads and fins.
struct QUIC_EXPORT_PRIVATE QuicConsumedData {
- QuicConsumedData(size_t bytes_consumed, bool fin_consumed);
+ constexpr QuicConsumedData(size_t bytes_consumed, bool fin_consumed)
+ : bytes_consumed(bytes_consumed), fin_consumed(fin_consumed) {}
// By default, gtest prints the raw bytes of an object. The bool data
// member causes this object to have padding bytes, which causes the
@@ -94,6 +97,7 @@ enum WriteStatus {
// - Errors MUST be added after WRITE_STATUS_ERROR.
WRITE_STATUS_ERROR,
WRITE_STATUS_MSG_TOO_BIG,
+ WRITE_STATUS_FAILED_TO_COALESCE_PACKET,
WRITE_STATUS_NUM_VALUES,
};
@@ -115,8 +119,10 @@ inline bool IsWriteError(WriteStatus status) {
// A struct used to return the result of write calls including either the number
// of bytes written or the error code, depending upon the status.
struct QUIC_EXPORT_PRIVATE WriteResult {
- WriteResult(WriteStatus status, int bytes_written_or_error_code);
- WriteResult();
+ constexpr WriteResult(WriteStatus status, int bytes_written_or_error_code)
+ : status(status), bytes_written(bytes_written_or_error_code) {}
+
+ constexpr WriteResult() : WriteResult(WRITE_STATUS_ERROR, 0) {}
bool operator==(const WriteResult& other) const {
if (status != other.status) {
@@ -153,6 +159,7 @@ enum TransmissionType : int8_t {
LOSS_RETRANSMISSION, // Retransmits due to loss detection.
RTO_RETRANSMISSION, // Retransmits due to retransmit time out.
TLP_RETRANSMISSION, // Tail loss probes.
+ PTO_RETRANSMISSION, // Retransmission due to probe timeout.
PROBING_RETRANSMISSION, // Retransmission in order to probe bandwidth.
LAST_TRANSMISSION_TYPE = PROBING_RETRANSMISSION,
};
@@ -265,10 +272,13 @@ enum QuicIetfFrameType : uint8_t {
IETF_CONNECTION_CLOSE = 0x1c,
IETF_APPLICATION_CLOSE = 0x1d,
- // MESSAGE frame type is not yet determined, use 0x2x temporarily to give
- // stream frame some wiggle room.
+ // The MESSAGE frame type has not yet been fully standardized.
+ // QUIC versions starting with 46 and before 99 use 0x20-0x21.
+ // IETF QUIC (v99) uses 0x30-0x31, see draft-pauly-quic-datagram.
IETF_EXTENSION_MESSAGE_NO_LENGTH = 0x20,
IETF_EXTENSION_MESSAGE = 0x21,
+ IETF_EXTENSION_MESSAGE_NO_LENGTH_V99 = 0x30,
+ IETF_EXTENSION_MESSAGE_V99 = 0x31,
};
QUIC_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
const QuicIetfFrameType& c);
@@ -308,7 +318,8 @@ enum QuicPacketNumberLength : uint8_t {
PACKET_3BYTE_PACKET_NUMBER = 3, // Used in versions 45+.
PACKET_4BYTE_PACKET_NUMBER = 4,
IETF_MAX_PACKET_NUMBER_LENGTH = 4,
- // TODO(rch): Remove this when we remove QUIC_VERSION_39.
+ // TODO(rch): Remove these when we remove QUIC_VERSION_43 since these values
+ // are not representable with v46 and above.
PACKET_6BYTE_PACKET_NUMBER = 6,
PACKET_8BYTE_PACKET_NUMBER = 8
};
@@ -440,7 +451,7 @@ enum StreamSendingState {
};
enum SentPacketState : uint8_t {
- // The packet has been sent and waiting to be acked.
+ // The packet is in flight and waiting to be acked.
OUTSTANDING,
FIRST_PACKET_STATE = OUTSTANDING,
// The packet was never sent.
@@ -449,6 +460,8 @@ enum SentPacketState : uint8_t {
ACKED,
// This packet is not expected to be acked.
UNACKABLE,
+ // This packet has been delivered or unneeded.
+ NEUTERED,
// States below are corresponding to retransmission types in TransmissionType.
@@ -461,6 +474,8 @@ enum SentPacketState : uint8_t {
TLP_RETRANSMITTED,
// This packet has been retransmitted when RTO fires.
RTO_RETRANSMITTED,
+ // This packet has been retransmitted when PTO fires.
+ PTO_RETRANSMITTED,
// This packet has been retransmitted for probing purpose.
PROBE_RETRANSMITTED,
LAST_PACKET_STATE = PROBE_RETRANSMITTED,
@@ -476,10 +491,10 @@ QUIC_EXPORT_PRIVATE std::string PacketHeaderFormatToString(
PacketHeaderFormat format);
// Information about a newly acknowledged packet.
-struct AckedPacket {
- AckedPacket(QuicPacketNumber packet_number,
- QuicPacketLength bytes_acked,
- QuicTime receive_timestamp)
+struct QUIC_EXPORT_PRIVATE AckedPacket {
+ constexpr AckedPacket(QuicPacketNumber packet_number,
+ QuicPacketLength bytes_acked,
+ QuicTime receive_timestamp)
: packet_number(packet_number),
bytes_acked(bytes_acked),
receive_timestamp(receive_timestamp) {}
@@ -498,10 +513,10 @@ struct AckedPacket {
};
// A vector of acked packets.
-typedef std::vector<AckedPacket> AckedPacketVector;
+typedef QuicInlinedVector<AckedPacket, 2> AckedPacketVector;
// Information about a newly lost packet.
-struct LostPacket {
+struct QUIC_EXPORT_PRIVATE LostPacket {
LostPacket(QuicPacketNumber packet_number, QuicPacketLength bytes_lost)
: packet_number(packet_number), bytes_lost(bytes_lost) {}
@@ -515,7 +530,7 @@ struct LostPacket {
};
// A vector of lost packets.
-typedef std::vector<LostPacket> LostPacketVector;
+typedef QuicInlinedVector<LostPacket, 2> LostPacketVector;
enum QuicIetfTransportErrorCodes : uint64_t {
NO_IETF_QUIC_ERROR = 0x0,
@@ -542,7 +557,7 @@ QUIC_EXPORT_PRIVATE std::ostream& operator<<(
// first element of the pair is false, it means that an IETF Application Close
// should be done instead.
-struct QuicErrorCodeToIetfMapping {
+struct QUIC_EXPORT_PRIVATE QuicErrorCodeToIetfMapping {
bool is_transport_close_;
union {
uint64_t application_error_code_;
@@ -599,6 +614,9 @@ enum MessageStatus {
// reaches an invalid state.
};
+QUIC_EXPORT_PRIVATE std::string MessageStatusToString(
+ MessageStatus message_status);
+
// Used to return the result of SendMessage calls
struct QUIC_EXPORT_PRIVATE MessageResult {
MessageResult(MessageStatus status, QuicMessageId message_id);
@@ -607,11 +625,17 @@ struct QUIC_EXPORT_PRIVATE MessageResult {
return status == other.status && message_id == other.message_id;
}
+ QUIC_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os,
+ const MessageResult& mr);
+
MessageStatus status;
// Only valid when status is MESSAGE_STATUS_SUCCESS.
QuicMessageId message_id;
};
+QUIC_EXPORT_PRIVATE std::string MessageResultToString(
+ MessageResult message_result);
+
enum WriteStreamDataResult {
WRITE_SUCCESS,
STREAM_MISSING, // Trying to write data of a nonexistent stream (e.g.
@@ -660,6 +684,18 @@ enum AckResult {
PACKETS_ACKED_IN_WRONG_PACKET_NUMBER_SPACE,
};
+// Indicates the fate of a serialized packet in WritePacket().
+enum SerializedPacketFate : uint8_t {
+ COALESCE, // Try to coalesce packet.
+ BUFFER, // Buffer packet in buffered_packets_.
+ SEND_TO_WRITER, // Send packet to writer.
+ FAILED_TO_WRITE_COALESCED_PACKET, // Packet cannot be coalesced, error occurs
+ // when sending existing coalesced packet.
+};
+
+QUIC_EXPORT_PRIVATE std::string SerializedPacketFateToString(
+ SerializedPacketFate fate);
+
// There are three different forms of CONNECTION_CLOSE.
typedef enum QuicConnectionCloseType {
GOOGLE_QUIC_CONNECTION_CLOSE = 0,