#include "quiche/quic/core/quic_framer.h"
#include <sys/types.h>
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <memory>
#include <optional>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include "absl/base/attributes.h"
#include "absl/base/macros.h"
#include "absl/base/optimization.h"
#include "absl/status/status.h"
#include "absl/strings/escaping.h"
#include "absl/strings/numbers.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_split.h"
#include "absl/strings/string_view.h"
#include "quiche/quic/core/crypto/crypto_framer.h"
#include "quiche/quic/core/crypto/crypto_handshake.h"
#include "quiche/quic/core/crypto/crypto_handshake_message.h"
#include "quiche/quic/core/crypto/crypto_protocol.h"
#include "quiche/quic/core/crypto/crypto_utils.h"
#include "quiche/quic/core/crypto/null_decrypter.h"
#include "quiche/quic/core/crypto/null_encrypter.h"
#include "quiche/quic/core/crypto/quic_decrypter.h"
#include "quiche/quic/core/crypto/quic_encrypter.h"
#include "quiche/quic/core/crypto/quic_random.h"
#include "quiche/quic/core/frames/quic_ack_frequency_frame.h"
#include "quiche/quic/core/frames/quic_reset_stream_at_frame.h"
#include "quiche/quic/core/quic_connection_id.h"
#include "quiche/quic/core/quic_constants.h"
#include "quiche/quic/core/quic_data_reader.h"
#include "quiche/quic/core/quic_data_writer.h"
#include "quiche/quic/core/quic_error_codes.h"
#include "quiche/quic/core/quic_packets.h"
#include "quiche/quic/core/quic_socket_address_coder.h"
#include "quiche/quic/core/quic_stream_frame_data_producer.h"
#include "quiche/quic/core/quic_time.h"
#include "quiche/quic/core/quic_types.h"
#include "quiche/quic/core/quic_utils.h"
#include "quiche/quic/core/quic_versions.h"
#include "quiche/quic/platform/api/quic_bug_tracker.h"
#include "quiche/quic/platform/api/quic_client_stats.h"
#include "quiche/quic/platform/api/quic_flag_utils.h"
#include "quiche/quic/platform/api/quic_flags.h"
#include "quiche/quic/platform/api/quic_ip_address_family.h"
#include "quiche/quic/platform/api/quic_logging.h"
#include "quiche/quic/platform/api/quic_stack_trace.h"
#include "quiche/common/quiche_text_utils.h"
#include "quiche/common/wire_serialization.h"
namespace quic {
namespace {
#define ENDPOINT …
const uint8_t kQuicFrameTypeSpecialMask = …;
const uint8_t kQuicFrameTypeStreamMask = …;
const uint8_t kQuicFrameTypeAckMask = …;
static_assert …;
const uint8_t kQuicStreamIdShift = …;
const uint8_t kQuicStreamIDLengthMask = …;
const uint8_t kQuicStreamShift = …;
const uint8_t kQuicStreamOffsetMask = …;
const uint8_t kQuicStreamDataLengthShift = …;
const uint8_t kQuicStreamDataLengthMask = …;
const uint8_t kQuicStreamFinShift = …;
const uint8_t kQuicStreamFinMask = …;
const uint8_t kQuicSequenceNumberLengthNumBits = …;
const uint8_t kActBlockLengthOffset = …;
const uint8_t kLargestAckedOffset = …;
const uint8_t kQuicHasMultipleAckBlocksOffset = …;
const uint8_t kQuicNumTimestampsLength = …;
const uint8_t kQuicFirstTimestampLength = …;
const uint8_t kQuicTimestampLength = …;
const uint8_t kQuicTimestampPacketNumberGapLength = …;
const int kMaxErrorStringLength = …;
const uint8_t kConnectionIdLengthAdjustment = …;
const uint8_t kDestinationConnectionIdLengthMask = …;
const uint8_t kSourceConnectionIdLengthMask = …;
uint64_t Delta(uint64_t a, uint64_t b) { … }
uint64_t ClosestTo(uint64_t target, uint64_t a, uint64_t b) { … }
QuicPacketNumberLength ReadAckPacketNumberLength(uint8_t flags) { … }
uint8_t PacketNumberLengthToOnWireValue(
QuicPacketNumberLength packet_number_length) { … }
QuicPacketNumberLength GetShortHeaderPacketNumberLength(uint8_t type) { … }
uint8_t LongHeaderTypeToOnWireValue(QuicLongHeaderType type,
const ParsedQuicVersion& version) { … }
QuicLongHeaderType GetLongHeaderType(uint8_t type,
const ParsedQuicVersion& version) { … }
QuicPacketNumberLength GetLongHeaderPacketNumberLength(uint8_t type) { … }
PacketNumberSpace GetPacketNumberSpace(const QuicPacketHeader& header) { … }
EncryptionLevel GetEncryptionLevel(const QuicPacketHeader& header) { … }
absl::string_view TruncateErrorString(absl::string_view error) { … }
size_t TruncatedErrorStringSize(const absl::string_view& error) { … }
uint8_t GetConnectionIdLengthValue(uint8_t length) { … }
bool IsValidPacketNumberLength(QuicPacketNumberLength packet_number_length) { … }
bool IsValidFullPacketNumber(uint64_t full_packet_number,
ParsedQuicVersion version) { … }
bool AppendIetfConnectionIds(bool version_flag, bool use_length_prefix,
QuicConnectionId destination_connection_id,
QuicConnectionId source_connection_id,
QuicDataWriter* writer) { … }
enum class DroppedPacketReason { … };
void RecordDroppedPacketReason(DroppedPacketReason reason) { … }
PacketHeaderFormat GetIetfPacketHeaderFormat(uint8_t type_byte) { … }
std::string GenerateErrorString(std::string initial_error_string,
QuicErrorCode quic_error_code) { … }
size_t AckEcnCountSize(const QuicAckFrame& ack_frame) { … }
}
QuicFramer::QuicFramer(const ParsedQuicVersionVector& supported_versions,
QuicTime creation_time, Perspective perspective,
uint8_t expected_server_connection_id_length)
: … { … }
QuicFramer::~QuicFramer() { … }
size_t QuicFramer::GetMinStreamFrameSize(QuicTransportVersion version,
QuicStreamId stream_id,
QuicStreamOffset offset,
bool last_frame_in_packet,
size_t data_length) { … }
size_t QuicFramer::GetMinCryptoFrameSize(QuicStreamOffset offset,
QuicPacketLength data_length) { … }
size_t QuicFramer::GetMessageFrameSize(bool last_frame_in_packet,
QuicByteCount length) { … }
size_t QuicFramer::GetMinAckFrameSize(
QuicTransportVersion version, const QuicAckFrame& ack_frame,
uint32_t local_ack_delay_exponent,
bool use_ietf_ack_with_receive_timestamp) { … }
size_t QuicFramer::GetStopWaitingFrameSize(
QuicPacketNumberLength packet_number_length) { … }
size_t QuicFramer::GetRstStreamFrameSize(QuicTransportVersion version,
const QuicRstStreamFrame& frame) { … }
size_t QuicFramer::GetConnectionCloseFrameSize(
QuicTransportVersion version, const QuicConnectionCloseFrame& frame) { … }
size_t QuicFramer::GetMinGoAwayFrameSize() { … }
size_t QuicFramer::GetWindowUpdateFrameSize(
QuicTransportVersion version, const QuicWindowUpdateFrame& frame) { … }
size_t QuicFramer::GetMaxStreamsFrameSize(QuicTransportVersion version,
const QuicMaxStreamsFrame& frame) { … }
size_t QuicFramer::GetStreamsBlockedFrameSize(
QuicTransportVersion version, const QuicStreamsBlockedFrame& frame) { … }
size_t QuicFramer::GetBlockedFrameSize(QuicTransportVersion version,
const QuicBlockedFrame& frame) { … }
size_t QuicFramer::GetStopSendingFrameSize(const QuicStopSendingFrame& frame) { … }
size_t QuicFramer::GetAckFrequencyFrameSize(
const QuicAckFrequencyFrame& frame) { … }
size_t QuicFramer::GetResetStreamAtFrameSize(
const QuicResetStreamAtFrame& frame) { … }
size_t QuicFramer::GetPathChallengeFrameSize(
const QuicPathChallengeFrame& frame) { … }
size_t QuicFramer::GetPathResponseFrameSize(
const QuicPathResponseFrame& frame) { … }
size_t QuicFramer::GetRetransmittableControlFrameSize(
QuicTransportVersion version, const QuicFrame& frame) { … }
size_t QuicFramer::GetStreamIdSize(QuicStreamId stream_id) { … }
size_t QuicFramer::GetStreamOffsetSize(QuicStreamOffset offset) { … }
size_t QuicFramer::GetNewConnectionIdFrameSize(
const QuicNewConnectionIdFrame& frame) { … }
size_t QuicFramer::GetRetireConnectionIdFrameSize(
const QuicRetireConnectionIdFrame& frame) { … }
size_t QuicFramer::GetNewTokenFrameSize(const QuicNewTokenFrame& frame) { … }
bool QuicFramer::IsSupportedVersion(const ParsedQuicVersion version) const { … }
size_t QuicFramer::GetSerializedFrameLength(
const QuicFrame& frame, size_t free_bytes, bool first_frame,
bool last_frame, QuicPacketNumberLength packet_number_length) { … }
QuicFramer::AckFrameInfo::AckFrameInfo()
: … { … }
QuicFramer::AckFrameInfo::AckFrameInfo(const AckFrameInfo& other) = default;
QuicFramer::AckFrameInfo::~AckFrameInfo() { … }
bool QuicFramer::WriteIetfLongHeaderLength(const QuicPacketHeader& header,
QuicDataWriter* writer,
size_t length_field_offset,
EncryptionLevel level) { … }
size_t QuicFramer::BuildDataPacket(const QuicPacketHeader& header,
const QuicFrames& frames, char* buffer,
size_t packet_length,
EncryptionLevel level) { … }
size_t QuicFramer::AppendIetfFrames(const QuicFrames& frames,
QuicDataWriter* writer) { … }
std::unique_ptr<QuicEncryptedPacket> QuicFramer::BuildPublicResetPacket(
const QuicPublicResetPacket& packet) { … }
size_t QuicFramer::GetMinStatelessResetPacketLength() { … }
std::unique_ptr<QuicEncryptedPacket> QuicFramer::BuildIetfStatelessResetPacket(
QuicConnectionId connection_id, size_t received_packet_length,
StatelessResetToken stateless_reset_token) { … }
std::unique_ptr<QuicEncryptedPacket> QuicFramer::BuildIetfStatelessResetPacket(
QuicConnectionId , size_t received_packet_length,
StatelessResetToken stateless_reset_token, QuicRandom* random) { … }
std::unique_ptr<QuicEncryptedPacket> QuicFramer::BuildVersionNegotiationPacket(
QuicConnectionId server_connection_id,
QuicConnectionId client_connection_id, bool ietf_quic,
bool use_length_prefix, const ParsedQuicVersionVector& versions) { … }
std::unique_ptr<QuicEncryptedPacket>
QuicFramer::BuildIetfVersionNegotiationPacket(
bool use_length_prefix, QuicConnectionId server_connection_id,
QuicConnectionId client_connection_id,
const ParsedQuicVersionVector& versions) { … }
bool QuicFramer::ProcessPacket(const QuicEncryptedPacket& packet) { … }
bool QuicFramer::ProcessPacketInternal(const QuicEncryptedPacket& packet) { … }
bool QuicFramer::ProcessVersionNegotiationPacket(
QuicDataReader* reader, const QuicPacketHeader& header) { … }
bool QuicFramer::ProcessRetryPacket(QuicDataReader* reader,
const QuicPacketHeader& header) { … }
void QuicFramer::MaybeProcessCoalescedPacket(
const QuicDataReader& encrypted_reader, uint64_t remaining_bytes_length,
const QuicPacketHeader& header) { … }
bool QuicFramer::MaybeProcessIetfLength(QuicDataReader* encrypted_reader,
QuicPacketHeader* header) { … }
bool QuicFramer::ProcessIetfDataPacket(QuicDataReader* encrypted_reader,
QuicPacketHeader* header,
const QuicEncryptedPacket& packet,
char* decrypted_buffer,
size_t buffer_length) { … }
bool QuicFramer::IsIetfStatelessResetPacket(
const QuicPacketHeader& header) const { … }
bool QuicFramer::HasEncrypterOfEncryptionLevel(EncryptionLevel level) const { … }
bool QuicFramer::HasDecrypterOfEncryptionLevel(EncryptionLevel level) const { … }
bool QuicFramer::HasAnEncrypterForSpace(PacketNumberSpace space) const { … }
EncryptionLevel QuicFramer::GetEncryptionLevelToSendApplicationData() const { … }
bool QuicFramer::AppendIetfHeaderTypeByte(const QuicPacketHeader& header,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendIetfPacketHeader(const QuicPacketHeader& header,
QuicDataWriter* writer,
size_t* length_field_offset) { … }
const QuicTime::Delta QuicFramer::CalculateTimestampFromWire(
uint32_t time_delta_us) { … }
uint64_t QuicFramer::CalculatePacketNumberFromWire(
QuicPacketNumberLength packet_number_length,
QuicPacketNumber base_packet_number, uint64_t packet_number) { … }
QuicPacketNumberLength QuicFramer::GetMinPacketNumberLength(
QuicPacketNumber packet_number) { … }
uint8_t QuicFramer::GetPacketNumberFlags(
QuicPacketNumberLength packet_number_length) { … }
QuicFramer::AckFrameInfo QuicFramer::GetAckFrameInfo(
const QuicAckFrame& frame) { … }
bool QuicFramer::ProcessIetfHeaderTypeByte(QuicDataReader* reader,
QuicPacketHeader* header) { … }
bool QuicFramer::ProcessVersionLabel(QuicDataReader* reader,
QuicVersionLabel* version_label) { … }
bool QuicFramer::ProcessAndValidateIetfConnectionIdLength(
QuicDataReader* reader, ParsedQuicVersion version, Perspective perspective,
bool should_update_expected_server_connection_id_length,
uint8_t* expected_server_connection_id_length,
uint8_t* destination_connection_id_length,
uint8_t* source_connection_id_length, std::string* detailed_error) { … }
bool QuicFramer::ValidateReceivedConnectionIds(const QuicPacketHeader& header) { … }
bool QuicFramer::ProcessIetfPacketHeader(QuicDataReader* reader,
QuicPacketHeader* header) { … }
bool QuicFramer::ProcessAndCalculatePacketNumber(
QuicDataReader* reader, QuicPacketNumberLength packet_number_length,
QuicPacketNumber base_packet_number, uint64_t* packet_number) { … }
bool QuicFramer::ProcessFrameData(QuicDataReader* reader,
const QuicPacketHeader& header) { … }
bool QuicFramer::IsIetfFrameTypeExpectedForEncryptionLevel(
uint64_t frame_type, EncryptionLevel level) { … }
bool QuicFramer::ProcessIetfFrameData(QuicDataReader* reader,
const QuicPacketHeader& header,
EncryptionLevel decrypted_level) { … }
namespace {
inline uint8_t GetMaskFromNumBits(uint8_t num_bits) { … }
uint8_t ExtractBits(uint8_t flags, uint8_t num_bits, uint8_t offset) { … }
bool ExtractBit(uint8_t flags, uint8_t offset) { … }
void SetBits(uint8_t* flags, uint8_t val, uint8_t num_bits, uint8_t offset) { … }
void SetBit(uint8_t* flags, bool val, uint8_t offset) { … }
}
bool QuicFramer::ProcessStreamFrame(QuicDataReader* reader, uint8_t frame_type,
QuicStreamFrame* frame) { … }
bool QuicFramer::ProcessIetfStreamFrame(QuicDataReader* reader,
uint8_t frame_type,
QuicStreamFrame* frame) { … }
bool QuicFramer::ProcessCryptoFrame(QuicDataReader* reader,
EncryptionLevel encryption_level,
QuicCryptoFrame* frame) { … }
bool QuicFramer::ProcessAckFrequencyFrame(QuicDataReader* reader,
QuicAckFrequencyFrame* frame) { … }
bool QuicFramer::ProcessResetStreamAtFrame(QuicDataReader& reader,
QuicResetStreamAtFrame& frame) { … }
bool QuicFramer::ProcessAckFrame(QuicDataReader* reader, uint8_t frame_type) { … }
bool QuicFramer::ProcessTimestampsInAckFrame(uint8_t num_received_packets,
QuicPacketNumber largest_acked,
QuicDataReader* reader) { … }
bool QuicFramer::ProcessIetfAckFrame(QuicDataReader* reader,
uint64_t frame_type,
QuicAckFrame* ack_frame) { … }
bool QuicFramer::ProcessIetfTimestampsInAckFrame(QuicPacketNumber largest_acked,
QuicDataReader* reader) { … }
bool QuicFramer::ProcessStopWaitingFrame(QuicDataReader* reader,
const QuicPacketHeader& header,
QuicStopWaitingFrame* stop_waiting) { … }
bool QuicFramer::ProcessRstStreamFrame(QuicDataReader* reader,
QuicRstStreamFrame* frame) { … }
bool QuicFramer::ProcessConnectionCloseFrame(QuicDataReader* reader,
QuicConnectionCloseFrame* frame) { … }
bool QuicFramer::ProcessGoAwayFrame(QuicDataReader* reader,
QuicGoAwayFrame* frame) { … }
bool QuicFramer::ProcessWindowUpdateFrame(QuicDataReader* reader,
QuicWindowUpdateFrame* frame) { … }
bool QuicFramer::ProcessBlockedFrame(QuicDataReader* reader,
QuicBlockedFrame* frame) { … }
void QuicFramer::ProcessPaddingFrame(QuicDataReader* reader,
QuicPaddingFrame* frame) { … }
bool QuicFramer::ProcessMessageFrame(QuicDataReader* reader,
bool no_message_length,
QuicMessageFrame* frame) { … }
absl::string_view QuicFramer::GetAssociatedDataFromEncryptedPacket(
QuicTransportVersion version, const QuicEncryptedPacket& encrypted,
uint8_t destination_connection_id_length,
uint8_t source_connection_id_length, bool includes_version,
bool includes_diversification_nonce,
QuicPacketNumberLength packet_number_length,
quiche::QuicheVariableLengthIntegerLength retry_token_length_length,
uint64_t retry_token_length,
quiche::QuicheVariableLengthIntegerLength length_length) { … }
void QuicFramer::SetDecrypter(EncryptionLevel level,
std::unique_ptr<QuicDecrypter> decrypter) { … }
void QuicFramer::SetAlternativeDecrypter(
EncryptionLevel level, std::unique_ptr<QuicDecrypter> decrypter,
bool latch_once_used) { … }
void QuicFramer::InstallDecrypter(EncryptionLevel level,
std::unique_ptr<QuicDecrypter> decrypter) { … }
void QuicFramer::RemoveDecrypter(EncryptionLevel level) { … }
void QuicFramer::SetKeyUpdateSupportForConnection(bool enabled) { … }
void QuicFramer::DiscardPreviousOneRttKeys() { … }
bool QuicFramer::DoKeyUpdate(KeyUpdateReason reason) { … }
QuicPacketCount QuicFramer::PotentialPeerKeyUpdateAttemptCount() const { … }
const QuicDecrypter* QuicFramer::GetDecrypter(EncryptionLevel level) const { … }
const QuicDecrypter* QuicFramer::decrypter() const { … }
const QuicDecrypter* QuicFramer::alternative_decrypter() const { … }
void QuicFramer::SetEncrypter(EncryptionLevel level,
std::unique_ptr<QuicEncrypter> encrypter) { … }
void QuicFramer::RemoveEncrypter(EncryptionLevel level) { … }
void QuicFramer::SetInitialObfuscators(QuicConnectionId connection_id) { … }
size_t QuicFramer::EncryptInPlace(EncryptionLevel level,
QuicPacketNumber packet_number, size_t ad_len,
size_t total_len, size_t buffer_len,
char* buffer) { … }
namespace {
const size_t kHPSampleLen = …;
constexpr bool IsLongHeader(uint8_t type_byte) { … }
}
bool QuicFramer::ApplyHeaderProtection(EncryptionLevel level, char* buffer,
size_t buffer_len, size_t ad_len) { … }
bool QuicFramer::RemoveHeaderProtection(
QuicDataReader* reader, const QuicEncryptedPacket& packet,
QuicDecrypter& decrypter, Perspective perspective,
const ParsedQuicVersion& version, QuicPacketNumber base_packet_number,
QuicPacketHeader* header, uint64_t* full_packet_number,
AssociatedDataStorage& associated_data) { … }
size_t QuicFramer::EncryptPayload(EncryptionLevel level,
QuicPacketNumber packet_number,
const QuicPacket& packet, char* buffer,
size_t buffer_len) { … }
size_t QuicFramer::GetCiphertextSize(EncryptionLevel level,
size_t plaintext_size) const { … }
size_t QuicFramer::GetMaxPlaintextSize(size_t ciphertext_size) { … }
QuicPacketCount QuicFramer::GetOneRttEncrypterConfidentialityLimit() const { … }
bool QuicFramer::DecryptPayload(size_t udp_packet_length,
absl::string_view encrypted,
absl::string_view associated_data,
const QuicPacketHeader& header,
char* decrypted_buffer, size_t buffer_length,
size_t* decrypted_length,
EncryptionLevel* decrypted_level) { … }
size_t QuicFramer::GetIetfAckFrameSize(const QuicAckFrame& frame) { … }
size_t QuicFramer::GetIetfAckFrameTimestampSize(const QuicAckFrame& ack) { … }
size_t QuicFramer::GetAckFrameSize(
const QuicAckFrame& ack, QuicPacketNumberLength ) { … }
size_t QuicFramer::GetAckFrameTimeStampSize(const QuicAckFrame& ack) { … }
size_t QuicFramer::ComputeFrameLength(
const QuicFrame& frame, bool last_frame_in_packet,
QuicPacketNumberLength packet_number_length) { … }
bool QuicFramer::AppendTypeByte(const QuicFrame& frame,
bool last_frame_in_packet,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendIetfFrameType(const QuicFrame& frame,
bool last_frame_in_packet,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendPacketNumber(QuicPacketNumberLength packet_number_length,
QuicPacketNumber packet_number,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendStreamId(size_t stream_id_length, QuicStreamId stream_id,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendStreamOffset(size_t offset_length,
QuicStreamOffset offset,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendAckBlock(uint8_t gap,
QuicPacketNumberLength length_length,
uint64_t length, QuicDataWriter* writer) { … }
bool QuicFramer::AppendStreamFrame(const QuicStreamFrame& frame,
bool no_stream_frame_length,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendNewTokenFrame(const QuicNewTokenFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::ProcessNewTokenFrame(QuicDataReader* reader,
QuicNewTokenFrame* frame) { … }
bool QuicFramer::AppendIetfStreamFrame(const QuicStreamFrame& frame,
bool last_frame_in_packet,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendCryptoFrame(const QuicCryptoFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendAckFrequencyFrame(const QuicAckFrequencyFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendResetFrameAtFrame(const QuicResetStreamAtFrame& frame,
QuicDataWriter& writer) { … }
void QuicFramer::set_version(const ParsedQuicVersion version) { … }
bool QuicFramer::AppendAckFrameAndTypeByte(const QuicAckFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendTimestampsToAckFrame(const QuicAckFrame& frame,
QuicDataWriter* writer) { … }
absl::InlinedVector<QuicFramer::AckTimestampRange, 2>
QuicFramer::GetAckTimestampRanges(const QuicAckFrame& frame,
std::string& detailed_error) const { … }
int64_t QuicFramer::FrameAckTimestampRanges(
const QuicAckFrame& frame,
const absl::InlinedVector<AckTimestampRange, 2>& timestamp_ranges,
QuicDataWriter* writer) const { … }
bool QuicFramer::AppendIetfTimestampsToAckFrame(const QuicAckFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendIetfAckFrameAndTypeByte(const QuicAckFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendRstStreamFrame(const QuicRstStreamFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendConnectionCloseFrame(
const QuicConnectionCloseFrame& frame, QuicDataWriter* writer) { … }
bool QuicFramer::AppendGoAwayFrame(const QuicGoAwayFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendWindowUpdateFrame(const QuicWindowUpdateFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendBlockedFrame(const QuicBlockedFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendPaddingFrame(const QuicPaddingFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendMessageFrameAndTypeByte(const QuicMessageFrame& frame,
bool last_frame_in_packet,
QuicDataWriter* writer) { … }
bool QuicFramer::RaiseError(QuicErrorCode error) { … }
bool QuicFramer::IsVersionNegotiation(const QuicPacketHeader& header) const { … }
bool QuicFramer::AppendIetfConnectionCloseFrame(
const QuicConnectionCloseFrame& frame, QuicDataWriter* writer) { … }
bool QuicFramer::ProcessIetfConnectionCloseFrame(
QuicDataReader* reader, QuicConnectionCloseType type,
QuicConnectionCloseFrame* frame) { … }
bool QuicFramer::ProcessPathChallengeFrame(QuicDataReader* reader,
QuicPathChallengeFrame* frame) { … }
bool QuicFramer::ProcessPathResponseFrame(QuicDataReader* reader,
QuicPathResponseFrame* frame) { … }
bool QuicFramer::AppendPathChallengeFrame(const QuicPathChallengeFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendPathResponseFrame(const QuicPathResponseFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::AppendIetfResetStreamFrame(const QuicRstStreamFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::ProcessIetfResetStreamFrame(QuicDataReader* reader,
QuicRstStreamFrame* frame) { … }
bool QuicFramer::ProcessStopSendingFrame(
QuicDataReader* reader, QuicStopSendingFrame* stop_sending_frame) { … }
bool QuicFramer::AppendStopSendingFrame(
const QuicStopSendingFrame& stop_sending_frame, QuicDataWriter* writer) { … }
bool QuicFramer::AppendMaxDataFrame(const QuicWindowUpdateFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::ProcessMaxDataFrame(QuicDataReader* reader,
QuicWindowUpdateFrame* frame) { … }
bool QuicFramer::AppendMaxStreamDataFrame(const QuicWindowUpdateFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::ProcessMaxStreamDataFrame(QuicDataReader* reader,
QuicWindowUpdateFrame* frame) { … }
bool QuicFramer::AppendMaxStreamsFrame(const QuicMaxStreamsFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::ProcessMaxStreamsFrame(QuicDataReader* reader,
QuicMaxStreamsFrame* frame,
uint64_t frame_type) { … }
bool QuicFramer::AppendDataBlockedFrame(const QuicBlockedFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::ProcessDataBlockedFrame(QuicDataReader* reader,
QuicBlockedFrame* frame) { … }
bool QuicFramer::AppendStreamDataBlockedFrame(const QuicBlockedFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::ProcessStreamDataBlockedFrame(QuicDataReader* reader,
QuicBlockedFrame* frame) { … }
bool QuicFramer::AppendStreamsBlockedFrame(const QuicStreamsBlockedFrame& frame,
QuicDataWriter* writer) { … }
bool QuicFramer::ProcessStreamsBlockedFrame(QuicDataReader* reader,
QuicStreamsBlockedFrame* frame,
uint64_t frame_type) { … }
bool QuicFramer::AppendNewConnectionIdFrame(
const QuicNewConnectionIdFrame& frame, QuicDataWriter* writer) { … }
bool QuicFramer::ProcessNewConnectionIdFrame(QuicDataReader* reader,
QuicNewConnectionIdFrame* frame) { … }
bool QuicFramer::AppendRetireConnectionIdFrame(
const QuicRetireConnectionIdFrame& frame, QuicDataWriter* writer) { … }
bool QuicFramer::ProcessRetireConnectionIdFrame(
QuicDataReader* reader, QuicRetireConnectionIdFrame* frame) { … }
bool QuicFramer::ReadUint32FromVarint62(QuicDataReader* reader,
QuicIetfFrameType type,
QuicStreamId* id) { … }
uint8_t QuicFramer::GetStreamFrameTypeByte(const QuicStreamFrame& frame,
bool last_frame_in_packet) const { … }
uint8_t QuicFramer::GetIetfStreamFrameTypeByte(
const QuicStreamFrame& frame, bool last_frame_in_packet) const { … }
void QuicFramer::EnableMultiplePacketNumberSpacesSupport() { … }
QuicErrorCode QuicFramer::ParsePublicHeaderDispatcher(
const QuicEncryptedPacket& packet,
uint8_t expected_destination_connection_id_length,
PacketHeaderFormat* format, QuicLongHeaderType* long_packet_type,
bool* version_present, bool* has_length_prefix,
QuicVersionLabel* version_label, ParsedQuicVersion* parsed_version,
QuicConnectionId* destination_connection_id,
QuicConnectionId* source_connection_id,
std::optional<absl::string_view>* retry_token,
std::string* detailed_error) { … }
QuicErrorCode QuicFramer::ParsePublicHeaderDispatcherShortHeaderLengthUnknown(
const QuicEncryptedPacket& packet, PacketHeaderFormat* format,
QuicLongHeaderType* long_packet_type, bool* version_present,
bool* has_length_prefix, QuicVersionLabel* version_label,
ParsedQuicVersion* parsed_version,
QuicConnectionId* destination_connection_id,
QuicConnectionId* source_connection_id,
std::optional<absl::string_view>* retry_token, std::string* detailed_error,
ConnectionIdGeneratorInterface& generator) { … }
QuicErrorCode QuicFramer::TryDecryptInitialPacketDispatcher(
const QuicEncryptedPacket& packet, const ParsedQuicVersion& version,
PacketHeaderFormat format, QuicLongHeaderType long_packet_type,
const QuicConnectionId& destination_connection_id,
const QuicConnectionId& source_connection_id,
const std::optional<absl::string_view>& retry_token,
QuicPacketNumber largest_decrypted_inital_packet_number,
QuicDecrypter& decrypter, std::optional<uint64_t>* packet_number) { … }
QuicErrorCode QuicFramer::ParsePublicHeaderGoogleQuic(
QuicDataReader* reader, uint8_t* first_byte, PacketHeaderFormat* format,
bool* version_present, QuicVersionLabel* version_label,
ParsedQuicVersion* parsed_version,
QuicConnectionId* destination_connection_id, std::string* detailed_error) { … }
namespace {
const QuicVersionLabel kProxVersionLabel = …;
inline bool PacketHasLengthPrefixedConnectionIds(
const QuicDataReader& reader, ParsedQuicVersion parsed_version,
QuicVersionLabel version_label, uint8_t first_byte) { … }
inline bool ParseLongHeaderConnectionIds(
QuicDataReader& reader, bool has_length_prefix,
QuicVersionLabel version_label, QuicConnectionId& destination_connection_id,
QuicConnectionId& source_connection_id, std::string& detailed_error) { … }
}
QuicErrorCode QuicFramer::ParsePublicHeader(
QuicDataReader* reader, uint8_t expected_destination_connection_id_length,
bool ietf_format, uint8_t* first_byte, PacketHeaderFormat* format,
bool* version_present, bool* has_length_prefix,
QuicVersionLabel* version_label, ParsedQuicVersion* parsed_version,
QuicConnectionId* destination_connection_id,
QuicConnectionId* source_connection_id,
QuicLongHeaderType* long_packet_type,
quiche::QuicheVariableLengthIntegerLength* retry_token_length_length,
absl::string_view* retry_token, std::string* detailed_error) { … }
bool QuicFramer::WriteClientVersionNegotiationProbePacket(
char* packet_bytes, QuicByteCount packet_length,
const char* destination_connection_id_bytes,
uint8_t destination_connection_id_length) { … }
bool QuicFramer::ParseServerVersionNegotiationProbeResponse(
const char* packet_bytes, QuicByteCount packet_length,
char* source_connection_id_bytes, uint8_t* source_connection_id_length_out,
std::string* detailed_error) { … }
void MaybeExtractQuicErrorCode(QuicConnectionCloseFrame* frame) { … }
#undef ENDPOINT
}