chromium/net/quic/dedicated_web_transport_http3_client.cc

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

#include "net/quic/dedicated_web_transport_http3_client.h"

#include <string_view>
#include <vector>

#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_functions.h"
#include "base/task/single_thread_task_runner.h"
#include "net/base/address_list.h"
#include "net/base/port_util.h"
#include "net/base/url_util.h"
#include "net/http/http_network_session.h"
#include "net/log/net_log_values.h"
#include "net/proxy_resolution/configured_proxy_resolution_service.h"
#include "net/proxy_resolution/proxy_resolution_request.h"
#include "net/quic/address_utils.h"
#include "net/quic/crypto/proof_verifier_chromium.h"
#include "net/quic/quic_chromium_alarm_factory.h"
#include "net/spdy/spdy_http_utils.h"
#include "net/third_party/quiche/src/quiche/quic/core/http/web_transport_http3.h"
#include "net/third_party/quiche/src/quiche/quic/core/quic_connection.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/url_request/url_request_context.h"
#include "url/scheme_host_port.h"

namespace net {

namespace {

// From
// https://wicg.github.io/web-transport/#dom-quictransportconfiguration-server_certificate_fingerprints
constexpr int kCustomCertificateMaxValidityDays =;

// The time the client would wait for the server to acknowledge the session
// being closed.
constexpr base::TimeDelta kMaxCloseTimeout =;

// Enables custom congestion control for WebTransport over HTTP/3.
BASE_FEATURE();
constexpr base::FeatureParam<quic::CongestionControlType>::Option
    kWebTransportCongestionControlAlgorithms[] =;
constexpr base::FeatureParam<quic::CongestionControlType>
    kWebTransportCongestionControlAlgorithm{};

std::set<std::string> HostsFromOrigins(std::set<HostPortPair> origins) {}

// A version of WebTransportFingerprintProofVerifier that enforces
// Chromium-specific policies.
class ChromiumWebTransportFingerprintProofVerifier
    : public quic::WebTransportFingerprintProofVerifier {};

std::unique_ptr<quic::ProofVerifier> CreateProofVerifier(
    const NetworkAnonymizationKey& anonymization_key,
    URLRequestContext* context,
    const WebTransportParameters& parameters) {}

void RecordNetLogQuicSessionClientStateChanged(
    NetLogWithSource& net_log,
    WebTransportState last_state,
    WebTransportState next_state,
    const std::optional<WebTransportError>& error) {}

// The stream associated with an extended CONNECT request for the WebTransport
// session.
class ConnectStream : public quic::QuicSpdyClientStream {};

class DedicatedWebTransportHttp3ClientSession
    : public quic::QuicSpdyClientSession {};

class WebTransportVisitorProxy : public quic::WebTransportVisitor {};

bool IsTerminalState(WebTransportState state) {}

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class NegotiatedHttpDatagramVersion {};

void RecordNegotiatedHttpDatagramSupport(quic::HttpDatagramSupport support) {}

const char* WebTransportHttp3VersionString(
    quic::WebTransportHttp3Version version) {}

enum class NegotiatedWebTransportVersion {};

void RecordNegotiatedWebTransportVersion(
    quic::WebTransportHttp3Version version) {}

void AdjustSendAlgorithm(quic::QuicConnection& connection) {}

}  // namespace

DedicatedWebTransportHttp3Client::DedicatedWebTransportHttp3Client(
    const GURL& url,
    const url::Origin& origin,
    WebTransportClientVisitor* visitor,
    const NetworkAnonymizationKey& anonymization_key,
    URLRequestContext* context,
    const WebTransportParameters& parameters)
    :{}

DedicatedWebTransportHttp3Client::~DedicatedWebTransportHttp3Client() {}

void DedicatedWebTransportHttp3Client::Connect() {}

void DedicatedWebTransportHttp3Client::Close(
    const std::optional<WebTransportCloseInfo>& close_info) {}

quic::WebTransportSession* DedicatedWebTransportHttp3Client::session() {}

void DedicatedWebTransportHttp3Client::DoLoop(int rv) {}

int DedicatedWebTransportHttp3Client::DoInit() {}

int DedicatedWebTransportHttp3Client::DoCheckProxy() {}

int DedicatedWebTransportHttp3Client::DoCheckProxyComplete(int rv) {}

int DedicatedWebTransportHttp3Client::DoResolveHost() {}

int DedicatedWebTransportHttp3Client::DoResolveHostComplete(int rv) {}

int DedicatedWebTransportHttp3Client::DoConnect() {}

void DedicatedWebTransportHttp3Client::CreateConnection() {}

int DedicatedWebTransportHttp3Client::DoConnectComplete() {}

int DedicatedWebTransportHttp3Client::DoConnectConfigure(int rv) {}

void DedicatedWebTransportHttp3Client::OnSettingsReceived() {}

void DedicatedWebTransportHttp3Client::OnHeadersComplete(
    const quiche::HttpHeaderBlock& headers) {}

void DedicatedWebTransportHttp3Client::
    OnConnectStreamWriteSideInDataRecvdState() {}

void DedicatedWebTransportHttp3Client::OnConnectStreamAborted() {}

void DedicatedWebTransportHttp3Client::OnConnectStreamDeleted() {}

void DedicatedWebTransportHttp3Client::OnCloseTimeout() {}

int DedicatedWebTransportHttp3Client::DoSendRequest() {}

int DedicatedWebTransportHttp3Client::DoConfirmConnection() {}

void DedicatedWebTransportHttp3Client::TransitionToState(
    WebTransportState next_state) {}

void DedicatedWebTransportHttp3Client::SetErrorIfNecessary(int error) {}

void DedicatedWebTransportHttp3Client::SetErrorIfNecessary(
    int error,
    quic::QuicErrorCode quic_error,
    std::string_view details) {}

void DedicatedWebTransportHttp3Client::OnSessionReady() {}

void DedicatedWebTransportHttp3Client::OnSessionClosed(
    quic::WebTransportSessionError error_code,
    const std::string& error_message) {}

void DedicatedWebTransportHttp3Client::
    OnIncomingBidirectionalStreamAvailable() {}

void DedicatedWebTransportHttp3Client::
    OnIncomingUnidirectionalStreamAvailable() {}

void DedicatedWebTransportHttp3Client::OnDatagramReceived(
    std::string_view datagram) {}

void DedicatedWebTransportHttp3Client::
    OnCanCreateNewOutgoingBidirectionalStream() {}

void DedicatedWebTransportHttp3Client::
    OnCanCreateNewOutgoingUnidirectionalStream() {}

bool DedicatedWebTransportHttp3Client::OnReadError(
    int result,
    const DatagramClientSocket* socket) {}

bool DedicatedWebTransportHttp3Client::OnPacket(
    const quic::QuicReceivedPacket& packet,
    const quic::QuicSocketAddress& local_address,
    const quic::QuicSocketAddress& peer_address) {}

int DedicatedWebTransportHttp3Client::HandleWriteError(
    int error_code,
    scoped_refptr<QuicChromiumPacketWriter::ReusableIOBuffer> /*last_packet*/) {}

void DedicatedWebTransportHttp3Client::OnWriteError(int error_code) {}

void DedicatedWebTransportHttp3Client::OnWriteUnblocked() {}

void DedicatedWebTransportHttp3Client::OnConnectionClosed(
    quic::QuicErrorCode error,
    const std::string& error_details,
    quic::ConnectionCloseSource source) {}

void DedicatedWebTransportHttp3Client::OnDatagramProcessed(
    std::optional<quic::MessageStatus> status) {}

}  // namespace net