#include "quiche/quic/core/quic_buffered_packet_store.h"
#include <cstddef>
#include <list>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "absl/container/inlined_vector.h"
#include "absl/strings/string_view.h"
#include "quiche/quic/core/connection_id_generator.h"
#include "quiche/quic/core/crypto/crypto_handshake.h"
#include "quiche/quic/core/crypto/crypto_utils.h"
#include "quiche/quic/core/quic_alarm.h"
#include "quiche/quic/core/quic_alarm_factory.h"
#include "quiche/quic/core/quic_clock.h"
#include "quiche/quic/core/quic_connection_id.h"
#include "quiche/quic/core/quic_constants.h"
#include "quiche/quic/core/quic_error_codes.h"
#include "quiche/quic/core/quic_framer.h"
#include "quiche/quic/core/quic_packet_creator.h"
#include "quiche/quic/core/quic_packet_number.h"
#include "quiche/quic/core/quic_packets.h"
#include "quiche/quic/core/quic_time.h"
#include "quiche/quic/core/quic_types.h"
#include "quiche/quic/core/quic_versions.h"
#include "quiche/quic/platform/api/quic_bug_tracker.h"
#include "quiche/quic/platform/api/quic_exported_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_logging.h"
#include "quiche/quic/platform/api/quic_socket_address.h"
#include "quiche/common/platform/api/quiche_logging.h"
#include "quiche/common/print_elements.h"
#include "quiche/common/simple_buffer_allocator.h"
namespace quic {
BufferedPacket;
BufferedPacketList;
EnqueuePacketResult;
static const size_t kDefaultMaxConnectionsInStore = …;
static const size_t kMaxConnectionsWithoutCHLO = …;
namespace {
class ConnectionExpireAlarm : public QuicAlarm::DelegateWithoutContext { … };
}
BufferedPacket::BufferedPacket(std::unique_ptr<QuicReceivedPacket> packet,
QuicSocketAddress self_address,
QuicSocketAddress peer_address,
bool is_ietf_initial_packet)
: … { … }
BufferedPacket::BufferedPacket(BufferedPacket&& other) = default;
BufferedPacket& BufferedPacket::operator=(BufferedPacket&& other) = default;
BufferedPacket::~BufferedPacket() { … }
BufferedPacketList::BufferedPacketList()
: … { … }
BufferedPacketList::BufferedPacketList(BufferedPacketList&& other) = default;
BufferedPacketList& BufferedPacketList::operator=(BufferedPacketList&& other) =
default;
BufferedPacketList::~BufferedPacketList() { … }
QuicBufferedPacketStore::QuicBufferedPacketStore(
VisitorInterface* visitor, const QuicClock* clock,
QuicAlarmFactory* alarm_factory, QuicDispatcherStats& stats)
: … { … }
QuicBufferedPacketStore::~QuicBufferedPacketStore() { … }
EnqueuePacketResult QuicBufferedPacketStore::EnqueuePacket(
const ReceivedPacketInfo& packet_info,
std::optional<ParsedClientHello> parsed_chlo,
ConnectionIdGeneratorInterface& connection_id_generator) { … }
void QuicBufferedPacketStore::MaybeAckInitialPacket(
const ReceivedPacketInfo& packet_info, BufferedPacketList& packet_list) { … }
bool QuicBufferedPacketStore::HasBufferedPackets(
QuicConnectionId connection_id) const { … }
bool QuicBufferedPacketStore::HasChlosBuffered() const { … }
const BufferedPacketList* QuicBufferedPacketStore::GetPacketList(
const QuicConnectionId& connection_id) const { … }
bool QuicBufferedPacketStore::CheckInvariants(
const BufferedPacketList& packet_list) const { … }
BufferedPacketList QuicBufferedPacketStore::DeliverPackets(
QuicConnectionId connection_id) { … }
void QuicBufferedPacketStore::DiscardPackets(QuicConnectionId connection_id) { … }
void QuicBufferedPacketStore::RemoveFromStore(BufferedPacketListNode& node) { … }
void QuicBufferedPacketStore::DiscardAllPackets() { … }
void QuicBufferedPacketStore::OnExpirationTimeout() { … }
void QuicBufferedPacketStore::MaybeSetExpirationAlarm() { … }
bool QuicBufferedPacketStore::ShouldNotBufferPacket(bool is_chlo) const { … }
BufferedPacketList QuicBufferedPacketStore::DeliverPacketsForNextConnection(
QuicConnectionId* connection_id) { … }
bool QuicBufferedPacketStore::HasChloForConnection(
QuicConnectionId connection_id) { … }
bool QuicBufferedPacketStore::IngestPacketForTlsChloExtraction(
const QuicConnectionId& connection_id, const ParsedQuicVersion& version,
const QuicReceivedPacket& packet,
std::vector<uint16_t>* out_supported_groups,
std::vector<uint16_t>* out_cert_compression_algos,
std::vector<std::string>* out_alpns, std::string* out_sni,
bool* out_resumption_attempted, bool* out_early_data_attempted,
std::optional<uint8_t>* tls_alert) { … }
}