chromium/net/quic/quic_test_packet_maker.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include "net/quic/quic_test_packet_maker.h"

#include <list>
#include <utility>

#include "base/functional/callback.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/bind.h"
#include "net/base/features.h"
#include "net/quic/mock_crypto_client_stream.h"
#include "net/quic/quic_chromium_client_session.h"
#include "net/quic/quic_http_utils.h"
#include "net/spdy/spdy_http_utils.h"
#include "net/third_party/quiche/src/quiche/common/quiche_buffer_allocator.h"
#include "net/third_party/quiche/src/quiche/common/simple_buffer_allocator.h"
#include "net/third_party/quiche/src/quiche/quic/core/http/http_constants.h"
#include "net/third_party/quiche/src/quiche/quic/core/qpack/qpack_instruction_encoder.h"
#include "net/third_party/quiche/src/quiche/quic/core/quic_framer.h"
#include "net/third_party/quiche/src/quiche/quic/core/quic_stream.h"
#include "net/third_party/quiche/src/quiche/quic/core/quic_types.h"
#include "net/third_party/quiche/src/quiche/quic/core/quic_utils.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/mock_random.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/quic_test_utils.h"

namespace net::test {
namespace {

quic::QuicFrames CloneFrames(const quic::QuicFrames& frames) {}

}  // namespace

QuicTestPacketMaker::ConnectionState::ConnectionState() = default;

QuicTestPacketMaker::ConnectionState::~ConnectionState() {}

std::string_view QuicTestPacketMaker::ConnectionState::SaveStreamData(
    std::string_view data) {}

void QuicTestPacketMaker::ConnectionState::Reset() {}

QuicTestPacketMaker::QuicTestPacketMaker(quic::ParsedQuicVersion version,
                                         quic::QuicConnectionId connection_id,
                                         const quic::QuicClock* clock,
                                         const std::string& host,
                                         quic::Perspective perspective,
                                         bool client_priority_uses_incremental,
                                         bool use_priority_header)
    :{}

QuicTestPacketMaker::~QuicTestPacketMaker() {}

void QuicTestPacketMaker::set_hostname(const std::string& host) {}

QuicTestPacketBuilder& QuicTestPacketMaker::Packet(uint64_t packet_number) {}

std::unique_ptr<quic::QuicReceivedPacket>
QuicTestPacketMaker::MakeDummyCHLOPacket(uint64_t packet_number) {}

std::unique_ptr<quic::QuicReceivedPacket>
QuicTestPacketMaker::MakeAckAndRetransmissionPacket(
    uint64_t packet_number,
    uint64_t first_received,
    uint64_t largest_received,
    uint64_t smallest_received,
    const std::vector<uint64_t>& original_packet_numbers) {}

quic::QuicFrames QuicTestPacketMaker::CloneSavedFrames(uint64_t packet_number) {}

std::unique_ptr<quic::QuicReceivedPacket>
QuicTestPacketMaker::MakeCombinedRetransmissionPacket(
    const std::vector<uint64_t>& original_packet_numbers,
    uint64_t new_packet_number) {}

std::unique_ptr<quic::QuicReceivedPacket>
QuicTestPacketMaker::MakeAckAndDataPacket(uint64_t packet_number,
                                          quic::QuicStreamId stream_id,
                                          uint64_t largest_received,
                                          uint64_t smallest_received,
                                          bool fin,
                                          std::string_view data) {}

std::unique_ptr<quic::QuicReceivedPacket>
QuicTestPacketMaker::MakeAckAndDatagramPacket(uint64_t packet_number,
                                              uint64_t largest_received,
                                              uint64_t smallest_received,
                                              std::string_view data) {}

std::unique_ptr<quic::QuicReceivedPacket>
QuicTestPacketMaker::MakeRequestHeadersAndMultipleDataFramesPacket(
    uint64_t packet_number,
    quic::QuicStreamId stream_id,
    bool fin,
    spdy::SpdyPriority spdy_priority,
    quiche::HttpHeaderBlock headers,
    size_t* spdy_headers_frame_length,
    const std::vector<std::string>& data_writes) {}

std::unique_ptr<quic::QuicReceivedPacket>
QuicTestPacketMaker::MakeRequestHeadersPacket(
    uint64_t packet_number,
    quic::QuicStreamId stream_id,
    bool fin,
    spdy::SpdyPriority spdy_priority,
    quiche::HttpHeaderBlock headers,
    size_t* spdy_headers_frame_length,
    bool should_include_priority_frame) {}

std::unique_ptr<quic::QuicReceivedPacket>
QuicTestPacketMaker::MakeRetransmissionAndRequestHeadersPacket(
    const std::vector<uint64_t>& original_packet_numbers,
    uint64_t packet_number,
    quic::QuicStreamId stream_id,
    bool fin,
    spdy::SpdyPriority spdy_priority,
    quiche::HttpHeaderBlock headers,
    size_t* spdy_headers_frame_length) {}

std::unique_ptr<quic::QuicReceivedPacket>
QuicTestPacketMaker::MakeRequestHeadersAndRstPacket(
    uint64_t packet_number,
    quic::QuicStreamId stream_id,
    bool fin,
    spdy::SpdyPriority spdy_priority,
    quiche::HttpHeaderBlock headers,
    size_t* spdy_headers_frame_length,
    quic::QuicRstStreamErrorCode error_code) {}

std::unique_ptr<quic::QuicReceivedPacket>
QuicTestPacketMaker::MakeResponseHeadersPacket(
    uint64_t packet_number,
    quic::QuicStreamId stream_id,
    bool fin,
    quiche::HttpHeaderBlock headers,
    size_t* spdy_headers_frame_length) {}

std::unique_ptr<quic::QuicReceivedPacket>
QuicTestPacketMaker::MakeInitialSettingsPacket(uint64_t packet_number) {}

std::unique_ptr<quic::QuicReceivedPacket>
QuicTestPacketMaker::MakePriorityPacket(uint64_t packet_number,
                                        quic::QuicStreamId id,
                                        spdy::SpdyPriority spdy_priority) {}

std::unique_ptr<quic::QuicReceivedPacket>
QuicTestPacketMaker::MakeRetransmissionPacket(uint64_t original_packet_number,
                                              uint64_t new_packet_number) {}

std::unique_ptr<quic::QuicEncryptedPacket>
QuicTestPacketMaker::MakeStatelessResetPacket() {}

void QuicTestPacketMaker::RemoveSavedStreamFrames(
    quic::QuicStreamId stream_id) {}

void QuicTestPacketMaker::SetEncryptionLevel(quic::EncryptionLevel level) {}

quiche::HttpHeaderBlock QuicTestPacketMaker::GetRequestHeaders(
    const std::string& method,
    const std::string& scheme,
    const std::string& path) const {}

quiche::HttpHeaderBlock QuicTestPacketMaker::ConnectRequestHeaders(
    const std::string& host_port) const {}

quiche::HttpHeaderBlock QuicTestPacketMaker::GetResponseHeaders(
    const std::string& status) const {}

quiche::HttpHeaderBlock QuicTestPacketMaker::GetResponseHeaders(
    const std::string& status,
    const std::string& alt_svc) const {}

void QuicTestPacketMaker::Reset() {}

std::string QuicTestPacketMaker::QpackEncodeHeaders(
    quic::QuicStreamId stream_id,
    quiche::HttpHeaderBlock headers,
    size_t* encoded_data_length) {}

std::unique_ptr<quic::QuicReceivedPacket> QuicTestPacketMaker::FinishPacket(
    quic::QuicPacketHeader header,
    quic::QuicFrames frames,
    std::unique_ptr<quic::QuicStreamFrameDataProducer> data_producer) {}

quic::QuicStreamId QuicTestPacketMaker::GetFirstBidirectionalStreamId() const {}

std::string QuicTestPacketMaker::GenerateHttp3PriorityData(
    spdy::SpdyPriority spdy_priority,
    quic::QuicStreamId stream_id) {}

void QuicTestPacketMaker::AddPriorityHeader(spdy::SpdyPriority spdy_priority,
                                            quiche::HttpHeaderBlock* headers) {}

QuicTestPacketBuilder::QuicTestPacketBuilder(
    uint64_t packet_number,
    QuicTestPacketMaker* maker,
    QuicTestPacketMaker::ConnectionState* connection_state)
    :{}

QuicTestPacketBuilder::~QuicTestPacketBuilder() {}

QuicTestPacketBuilder& QuicTestPacketBuilder::AddPaddingFrame(size_t length) {}

QuicTestPacketBuilder& QuicTestPacketBuilder::AddPingFrame() {}

QuicTestPacketBuilder& QuicTestPacketBuilder::AddRetireConnectionIdFrame(
    uint64_t sequence_number) {}

QuicTestPacketBuilder& QuicTestPacketBuilder::AddNewConnectionIdFrame(
    const quic::QuicConnectionId& cid,
    uint64_t sequence_number,
    uint64_t retire_prior_to) {}

QuicTestPacketBuilder& QuicTestPacketBuilder::AddMaxStreamsFrame(
    quic::QuicControlFrameId control_frame_id,
    quic::QuicStreamCount stream_count,
    bool unidirectional) {}

QuicTestPacketBuilder& QuicTestPacketBuilder::AddStreamsBlockedFrame(
    quic::QuicControlFrameId control_frame_id,
    quic::QuicStreamCount stream_count,
    bool unidirectional) {}

QuicTestPacketBuilder& QuicTestPacketBuilder::AddStreamFrame(
    quic::QuicStreamId stream_id,
    bool fin,
    std::string_view data) {}

QuicTestPacketBuilder& QuicTestPacketBuilder::AddAckFrame(
    uint64_t first_received,
    uint64_t largest_received,
    uint64_t smallest_received,
    std::optional<quic::QuicEcnCounts> ecn) {}

QuicTestPacketBuilder& QuicTestPacketBuilder::AddMessageFrame(
    std::string_view data) {}

QuicTestPacketBuilder& QuicTestPacketBuilder::AddRstStreamFrame(
    quic::QuicStreamId stream_id,
    quic::QuicRstStreamErrorCode error_code) {}

QuicTestPacketBuilder& QuicTestPacketBuilder::AddConnectionCloseFrame(
    quic::QuicErrorCode quic_error,
    const std::string& quic_error_details,
    uint64_t frame_type) {}

QuicTestPacketBuilder& QuicTestPacketBuilder::AddGoAwayFrame(
    quic::QuicErrorCode error_code,
    std::string reason_phrase) {}

QuicTestPacketBuilder& QuicTestPacketBuilder::AddPathResponseFrame() {}

QuicTestPacketBuilder& QuicTestPacketBuilder::AddPathChallengeFrame() {}

QuicTestPacketBuilder& QuicTestPacketBuilder::AddStopSendingFrame(
    quic::QuicStreamId stream_id,
    quic::QuicRstStreamErrorCode error_code) {}

QuicTestPacketBuilder& QuicTestPacketBuilder::AddCryptoFrame(
    quic::EncryptionLevel level,
    quic::QuicStreamOffset offset,
    const quic::QuicData& data) {}

QuicTestPacketBuilder& QuicTestPacketBuilder::AddFrame(quic::QuicFrame frame) {}

QuicTestPacketBuilder& QuicTestPacketBuilder::AddFrameWithCoalescing(
    const quic::QuicFrame& frame) {}

QuicTestPacketBuilder& QuicTestPacketBuilder::AddPacketRetransmission(
    uint64_t packet_number,
    base::RepeatingCallback<bool(const quic::QuicFrame&)> filter) {}

std::unique_ptr<quic::QuicReceivedPacket> QuicTestPacketBuilder::Build() {}

QuicTestPacketBuilder& QuicTestPacketBuilder::MaybeAddHttp3SettingsFrames() {}

std::string QuicTestPacketBuilder::GenerateHttp3SettingsData() const {}

std::string QuicTestPacketBuilder::GenerateHttp3GreaseData() const {}

void QuicTestPacketBuilder::InitializeHeader(uint64_t packet_number) {}

quic::QuicConnectionId QuicTestPacketBuilder::DestinationConnectionId() const {}

quic::QuicConnectionId QuicTestPacketBuilder::SourceConnectionId() const {}

bool QuicTestPacketBuilder::ShouldIncludeVersion() const {}

}  // namespace net::test