#include "quiche/quic/core/quic_config.h"
#include <algorithm>
#include <cstring>
#include <limits>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include "absl/base/attributes.h"
#include "absl/strings/string_view.h"
#include "quiche/quic/core/crypto/crypto_handshake_message.h"
#include "quiche/quic/core/crypto/crypto_protocol.h"
#include "quiche/quic/core/quic_connection_id.h"
#include "quiche/quic/core/quic_constants.h"
#include "quiche/quic/core/quic_socket_address_coder.h"
#include "quiche/quic/core/quic_types.h"
#include "quiche/quic/core/quic_utils.h"
#include "quiche/quic/platform/api/quic_bug_tracker.h"
#include "quiche/quic/platform/api/quic_flag_utils.h"
#include "quiche/quic/platform/api/quic_flags.h"
#include "quiche/quic/platform/api/quic_logging.h"
#include "quiche/quic/platform/api/quic_socket_address.h"
namespace quic {
QuicErrorCode ReadUint32(const CryptoHandshakeMessage& msg, QuicTag tag,
QuicConfigPresence presence, uint32_t default_value,
uint32_t* out, std::string* error_details) { … }
QuicConfigValue::QuicConfigValue(QuicTag tag, QuicConfigPresence presence)
: … { … }
QuicConfigValue::~QuicConfigValue() { … }
QuicFixedUint32::QuicFixedUint32(QuicTag tag, QuicConfigPresence presence)
: … { … }
QuicFixedUint32::~QuicFixedUint32() { … }
bool QuicFixedUint32::HasSendValue() const { … }
uint32_t QuicFixedUint32::GetSendValue() const { … }
void QuicFixedUint32::SetSendValue(uint32_t value) { … }
bool QuicFixedUint32::HasReceivedValue() const { … }
uint32_t QuicFixedUint32::GetReceivedValue() const { … }
void QuicFixedUint32::SetReceivedValue(uint32_t value) { … }
void QuicFixedUint32::ToHandshakeMessage(CryptoHandshakeMessage* out) const { … }
QuicErrorCode QuicFixedUint32::ProcessPeerHello(
const CryptoHandshakeMessage& peer_hello, HelloType ,
std::string* error_details) { … }
QuicFixedUint62::QuicFixedUint62(QuicTag name, QuicConfigPresence presence)
: … { … }
QuicFixedUint62::~QuicFixedUint62() { … }
bool QuicFixedUint62::HasSendValue() const { … }
uint64_t QuicFixedUint62::GetSendValue() const { … }
void QuicFixedUint62::SetSendValue(uint64_t value) { … }
bool QuicFixedUint62::HasReceivedValue() const { … }
uint64_t QuicFixedUint62::GetReceivedValue() const { … }
void QuicFixedUint62::SetReceivedValue(uint64_t value) { … }
void QuicFixedUint62::ToHandshakeMessage(CryptoHandshakeMessage* out) const { … }
QuicErrorCode QuicFixedUint62::ProcessPeerHello(
const CryptoHandshakeMessage& peer_hello, HelloType ,
std::string* error_details) { … }
QuicFixedStatelessResetToken::QuicFixedStatelessResetToken(
QuicTag tag, QuicConfigPresence presence)
: … { … }
QuicFixedStatelessResetToken::~QuicFixedStatelessResetToken() { … }
bool QuicFixedStatelessResetToken::HasSendValue() const { … }
const StatelessResetToken& QuicFixedStatelessResetToken::GetSendValue() const { … }
void QuicFixedStatelessResetToken::SetSendValue(
const StatelessResetToken& value) { … }
bool QuicFixedStatelessResetToken::HasReceivedValue() const { … }
const StatelessResetToken& QuicFixedStatelessResetToken::GetReceivedValue()
const { … }
void QuicFixedStatelessResetToken::SetReceivedValue(
const StatelessResetToken& value) { … }
void QuicFixedStatelessResetToken::ToHandshakeMessage(
CryptoHandshakeMessage* out) const { … }
QuicErrorCode QuicFixedStatelessResetToken::ProcessPeerHello(
const CryptoHandshakeMessage& peer_hello, HelloType ,
std::string* error_details) { … }
QuicFixedTagVector::QuicFixedTagVector(QuicTag name,
QuicConfigPresence presence)
: … { … }
QuicFixedTagVector::QuicFixedTagVector(const QuicFixedTagVector& other) =
default;
QuicFixedTagVector::~QuicFixedTagVector() { … }
bool QuicFixedTagVector::HasSendValues() const { … }
const QuicTagVector& QuicFixedTagVector::GetSendValues() const { … }
void QuicFixedTagVector::SetSendValues(const QuicTagVector& values) { … }
bool QuicFixedTagVector::HasReceivedValues() const { … }
const QuicTagVector& QuicFixedTagVector::GetReceivedValues() const { … }
void QuicFixedTagVector::SetReceivedValues(const QuicTagVector& values) { … }
void QuicFixedTagVector::ToHandshakeMessage(CryptoHandshakeMessage* out) const { … }
QuicErrorCode QuicFixedTagVector::ProcessPeerHello(
const CryptoHandshakeMessage& peer_hello, HelloType ,
std::string* error_details) { … }
QuicFixedSocketAddress::QuicFixedSocketAddress(QuicTag tag,
QuicConfigPresence presence)
: … { … }
QuicFixedSocketAddress::~QuicFixedSocketAddress() { … }
bool QuicFixedSocketAddress::HasSendValue() const { … }
const QuicSocketAddress& QuicFixedSocketAddress::GetSendValue() const { … }
void QuicFixedSocketAddress::SetSendValue(const QuicSocketAddress& value) { … }
void QuicFixedSocketAddress::ClearSendValue() { … }
bool QuicFixedSocketAddress::HasReceivedValue() const { … }
const QuicSocketAddress& QuicFixedSocketAddress::GetReceivedValue() const { … }
void QuicFixedSocketAddress::SetReceivedValue(const QuicSocketAddress& value) { … }
void QuicFixedSocketAddress::ToHandshakeMessage(
CryptoHandshakeMessage* out) const { … }
QuicErrorCode QuicFixedSocketAddress::ProcessPeerHello(
const CryptoHandshakeMessage& peer_hello, HelloType ,
std::string* error_details) { … }
QuicConfig::QuicConfig()
: … { … }
QuicConfig::QuicConfig(const QuicConfig& other) = default;
QuicConfig::~QuicConfig() { … }
bool QuicConfig::SetInitialReceivedConnectionOptions(
const QuicTagVector& tags) { … }
void QuicConfig::SetConnectionOptionsToSend(
const QuicTagVector& connection_options) { … }
void QuicConfig::AddConnectionOptionsToSend(
const QuicTagVector& connection_options) { … }
void QuicConfig::SetGoogleHandshakeMessageToSend(std::string message) { … }
const std::optional<std::string>&
QuicConfig::GetReceivedGoogleHandshakeMessage() const { … }
bool QuicConfig::HasReceivedConnectionOptions() const { … }
const QuicTagVector& QuicConfig::ReceivedConnectionOptions() const { … }
bool QuicConfig::HasSendConnectionOptions() const { … }
const QuicTagVector& QuicConfig::SendConnectionOptions() const { … }
bool QuicConfig::HasClientSentConnectionOption(QuicTag tag,
Perspective perspective) const { … }
void QuicConfig::SetClientConnectionOptions(
const QuicTagVector& client_connection_options) { … }
bool QuicConfig::HasClientRequestedIndependentOption(
QuicTag tag, Perspective perspective) const { … }
const QuicTagVector& QuicConfig::ClientRequestedIndependentOptions(
Perspective perspective) const { … }
void QuicConfig::SetIdleNetworkTimeout(QuicTime::Delta idle_network_timeout) { … }
QuicTime::Delta QuicConfig::IdleNetworkTimeout() const { … }
void QuicConfig::SetMaxBidirectionalStreamsToSend(uint32_t max_streams) { … }
uint32_t QuicConfig::GetMaxBidirectionalStreamsToSend() const { … }
bool QuicConfig::HasReceivedMaxBidirectionalStreams() const { … }
uint32_t QuicConfig::ReceivedMaxBidirectionalStreams() const { … }
void QuicConfig::SetMaxUnidirectionalStreamsToSend(uint32_t max_streams) { … }
uint32_t QuicConfig::GetMaxUnidirectionalStreamsToSend() const { … }
bool QuicConfig::HasReceivedMaxUnidirectionalStreams() const { … }
uint32_t QuicConfig::ReceivedMaxUnidirectionalStreams() const { … }
void QuicConfig::SetMaxAckDelayToSendMs(uint32_t max_ack_delay_ms) { … }
uint32_t QuicConfig::GetMaxAckDelayToSendMs() const { … }
bool QuicConfig::HasReceivedMaxAckDelayMs() const { … }
uint32_t QuicConfig::ReceivedMaxAckDelayMs() const { … }
void QuicConfig::SetMinAckDelayMs(uint32_t min_ack_delay_ms) { … }
uint32_t QuicConfig::GetMinAckDelayToSendMs() const { … }
bool QuicConfig::HasReceivedMinAckDelayMs() const { … }
uint32_t QuicConfig::ReceivedMinAckDelayMs() const { … }
void QuicConfig::SetAckDelayExponentToSend(uint32_t exponent) { … }
uint32_t QuicConfig::GetAckDelayExponentToSend() const { … }
bool QuicConfig::HasReceivedAckDelayExponent() const { … }
uint32_t QuicConfig::ReceivedAckDelayExponent() const { … }
void QuicConfig::SetMaxPacketSizeToSend(uint64_t max_udp_payload_size) { … }
uint64_t QuicConfig::GetMaxPacketSizeToSend() const { … }
bool QuicConfig::HasReceivedMaxPacketSize() const { … }
uint64_t QuicConfig::ReceivedMaxPacketSize() const { … }
void QuicConfig::SetMaxDatagramFrameSizeToSend(
uint64_t max_datagram_frame_size) { … }
uint64_t QuicConfig::GetMaxDatagramFrameSizeToSend() const { … }
bool QuicConfig::HasReceivedMaxDatagramFrameSize() const { … }
uint64_t QuicConfig::ReceivedMaxDatagramFrameSize() const { … }
void QuicConfig::SetActiveConnectionIdLimitToSend(
uint64_t active_connection_id_limit) { … }
uint64_t QuicConfig::GetActiveConnectionIdLimitToSend() const { … }
bool QuicConfig::HasReceivedActiveConnectionIdLimit() const { … }
uint64_t QuicConfig::ReceivedActiveConnectionIdLimit() const { … }
bool QuicConfig::HasSetBytesForConnectionIdToSend() const { … }
void QuicConfig::SetBytesForConnectionIdToSend(uint32_t bytes) { … }
bool QuicConfig::HasReceivedBytesForConnectionId() const { … }
uint32_t QuicConfig::ReceivedBytesForConnectionId() const { … }
void QuicConfig::SetInitialRoundTripTimeUsToSend(uint64_t rtt) { … }
bool QuicConfig::HasReceivedInitialRoundTripTimeUs() const { … }
uint64_t QuicConfig::ReceivedInitialRoundTripTimeUs() const { … }
bool QuicConfig::HasInitialRoundTripTimeUsToSend() const { … }
uint64_t QuicConfig::GetInitialRoundTripTimeUsToSend() const { … }
void QuicConfig::SetInitialStreamFlowControlWindowToSend(
uint64_t window_bytes) { … }
uint64_t QuicConfig::GetInitialStreamFlowControlWindowToSend() const { … }
bool QuicConfig::HasReceivedInitialStreamFlowControlWindowBytes() const { … }
uint64_t QuicConfig::ReceivedInitialStreamFlowControlWindowBytes() const { … }
void QuicConfig::SetInitialMaxStreamDataBytesIncomingBidirectionalToSend(
uint64_t window_bytes) { … }
uint64_t QuicConfig::GetInitialMaxStreamDataBytesIncomingBidirectionalToSend()
const { … }
bool QuicConfig::HasReceivedInitialMaxStreamDataBytesIncomingBidirectional()
const { … }
uint64_t QuicConfig::ReceivedInitialMaxStreamDataBytesIncomingBidirectional()
const { … }
void QuicConfig::SetInitialMaxStreamDataBytesOutgoingBidirectionalToSend(
uint64_t window_bytes) { … }
uint64_t QuicConfig::GetInitialMaxStreamDataBytesOutgoingBidirectionalToSend()
const { … }
bool QuicConfig::HasReceivedInitialMaxStreamDataBytesOutgoingBidirectional()
const { … }
uint64_t QuicConfig::ReceivedInitialMaxStreamDataBytesOutgoingBidirectional()
const { … }
void QuicConfig::SetInitialMaxStreamDataBytesUnidirectionalToSend(
uint64_t window_bytes) { … }
uint64_t QuicConfig::GetInitialMaxStreamDataBytesUnidirectionalToSend() const { … }
bool QuicConfig::HasReceivedInitialMaxStreamDataBytesUnidirectional() const { … }
uint64_t QuicConfig::ReceivedInitialMaxStreamDataBytesUnidirectional() const { … }
void QuicConfig::SetInitialSessionFlowControlWindowToSend(
uint64_t window_bytes) { … }
uint64_t QuicConfig::GetInitialSessionFlowControlWindowToSend() const { … }
bool QuicConfig::HasReceivedInitialSessionFlowControlWindowBytes() const { … }
uint64_t QuicConfig::ReceivedInitialSessionFlowControlWindowBytes() const { … }
void QuicConfig::SetDisableConnectionMigration() { … }
bool QuicConfig::DisableConnectionMigration() const { … }
void QuicConfig::SetIPv6AlternateServerAddressToSend(
const QuicSocketAddress& alternate_server_address_ipv6) { … }
bool QuicConfig::HasReceivedIPv6AlternateServerAddress() const { … }
const QuicSocketAddress& QuicConfig::ReceivedIPv6AlternateServerAddress()
const { … }
void QuicConfig::SetIPv4AlternateServerAddressToSend(
const QuicSocketAddress& alternate_server_address_ipv4) { … }
bool QuicConfig::HasReceivedIPv4AlternateServerAddress() const { … }
const QuicSocketAddress& QuicConfig::ReceivedIPv4AlternateServerAddress()
const { … }
void QuicConfig::SetPreferredAddressConnectionIdAndTokenToSend(
const QuicConnectionId& connection_id,
const StatelessResetToken& stateless_reset_token) { … }
bool QuicConfig::HasReceivedPreferredAddressConnectionIdAndToken() const { … }
const std::pair<QuicConnectionId, StatelessResetToken>&
QuicConfig::ReceivedPreferredAddressConnectionIdAndToken() const { … }
void QuicConfig::SetOriginalConnectionIdToSend(
const QuicConnectionId& original_destination_connection_id) { … }
bool QuicConfig::HasReceivedOriginalConnectionId() const { … }
QuicConnectionId QuicConfig::ReceivedOriginalConnectionId() const { … }
void QuicConfig::SetInitialSourceConnectionIdToSend(
const QuicConnectionId& initial_source_connection_id) { … }
bool QuicConfig::HasReceivedInitialSourceConnectionId() const { … }
QuicConnectionId QuicConfig::ReceivedInitialSourceConnectionId() const { … }
void QuicConfig::SetRetrySourceConnectionIdToSend(
const QuicConnectionId& retry_source_connection_id) { … }
bool QuicConfig::HasReceivedRetrySourceConnectionId() const { … }
QuicConnectionId QuicConfig::ReceivedRetrySourceConnectionId() const { … }
void QuicConfig::SetStatelessResetTokenToSend(
const StatelessResetToken& stateless_reset_token) { … }
bool QuicConfig::HasStatelessResetTokenToSend() const { … }
bool QuicConfig::HasReceivedStatelessResetToken() const { … }
const StatelessResetToken& QuicConfig::ReceivedStatelessResetToken() const { … }
bool QuicConfig::negotiated() const { … }
void QuicConfig::SetCreateSessionTagIndicators(QuicTagVector tags) { … }
const QuicTagVector& QuicConfig::create_session_tag_indicators() const { … }
void QuicConfig::SetDefaults() { … }
void QuicConfig::ToHandshakeMessage(
CryptoHandshakeMessage* out, QuicTransportVersion transport_version) const { … }
QuicErrorCode QuicConfig::ProcessPeerHello(
const CryptoHandshakeMessage& peer_hello, HelloType hello_type,
std::string* error_details) { … }
bool QuicConfig::FillTransportParameters(TransportParameters* params) const { … }
QuicErrorCode QuicConfig::ProcessTransportParameters(
const TransportParameters& params, bool is_resumption,
std::string* error_details) { … }
void QuicConfig::ClearGoogleHandshakeMessage() { … }
std::optional<QuicSocketAddress> QuicConfig::GetPreferredAddressToSend(
quiche::IpAddressFamily address_family) const { … }
void QuicConfig::SetIPv4AlternateServerAddressForDNat(
const QuicSocketAddress& alternate_server_address_ipv4_to_send,
const QuicSocketAddress& mapped_alternate_server_address_ipv4) { … }
void QuicConfig::SetIPv6AlternateServerAddressForDNat(
const QuicSocketAddress& alternate_server_address_ipv6_to_send,
const QuicSocketAddress& mapped_alternate_server_address_ipv6) { … }
std::optional<QuicSocketAddress> QuicConfig::GetMappedAlternativeServerAddress(
quiche::IpAddressFamily address_family) const { … }
void QuicConfig::ClearAlternateServerAddressToSend(
quiche::IpAddressFamily address_family) { … }
bool QuicConfig::SupportsServerPreferredAddress(Perspective perspective) const { … }
}