Accept new WebTransport sessions over HTTP/3. PiperOrigin-RevId: 362614422 Change-Id: I08c3572279ac3bee29d1da62dde520808fb1321e
diff --git a/quic/core/http/web_transport_http3.cc b/quic/core/http/web_transport_http3.cc new file mode 100644 index 0000000..0c7c9a8 --- /dev/null +++ b/quic/core/http/web_transport_http3.cc
@@ -0,0 +1,75 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "quic/core/http/web_transport_http3.h" + +#include <memory> + +#include "quic/core/http/quic_spdy_session.h" +#include "quic/core/http/quic_spdy_stream.h" + +namespace quic { + +namespace { +class QUIC_EXPORT_PRIVATE NoopWebTransportVisitor : public WebTransportVisitor { + void OnSessionReady() override {} + void OnIncomingBidirectionalStreamAvailable() override {} + void OnIncomingUnidirectionalStreamAvailable() override {} + void OnDatagramReceived(absl::string_view /*datagram*/) override {} + void OnCanCreateNewOutgoingBidirectionalStream() override {} + void OnCanCreateNewOutgoingUnidirectionalStream() override {} +}; +} // namespace + +WebTransportHttp3::WebTransportHttp3(QuicSpdySession* session, + QuicSpdyStream* connect_stream, + WebTransportSessionId id) + : session_(session), + connect_stream_(connect_stream), + id_(id), + visitor_(std::make_unique<NoopWebTransportVisitor>()) {} + +void WebTransportHttp3::HeadersReceived( + const spdy::SpdyHeaderBlock& /*headers*/) { + ready_ = true; + visitor_->OnSessionReady(); +} + +WebTransportStream* WebTransportHttp3::AcceptIncomingBidirectionalStream() { + // TODO(vasilvv): implement this. + return nullptr; +} +WebTransportStream* WebTransportHttp3::AcceptIncomingUnidirectionalStream() { + // TODO(vasilvv): implement this. + return nullptr; +} + +bool WebTransportHttp3::CanOpenNextOutgoingBidirectionalStream() { + // TODO(vasilvv): implement this. + return false; +} +bool WebTransportHttp3::CanOpenNextOutgoingUnidirectionalStream() { + // TODO(vasilvv): implement this. + return false; +} +WebTransportStream* WebTransportHttp3::OpenOutgoingBidirectionalStream() { + // TODO(vasilvv): implement this. + return nullptr; +} +WebTransportStream* WebTransportHttp3::OpenOutgoingUnidirectionalStream() { + // TODO(vasilvv): implement this. + return nullptr; +} + +MessageStatus WebTransportHttp3::SendOrQueueDatagram( + QuicMemSlice /*datagram*/) { + // TODO(vasilvv): implement this. + return MessageStatus::MESSAGE_STATUS_UNSUPPORTED; +} +void WebTransportHttp3::SetDatagramMaxTimeInQueue( + QuicTime::Delta /*max_time_in_queue*/) { + // TODO(vasilvv): implement this. +} + +} // namespace quic