LCOV - code coverage report
Current view: top level - source/common/quic - envoy_quic_client_stream.h (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 0 6 0.0 %
Date: 2024-01-05 06:35:25 Functions: 0 4 0.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "envoy/buffer/buffer.h"
       4             : 
       5             : #include "source/common/quic/envoy_quic_stream.h"
       6             : 
       7             : #ifdef ENVOY_ENABLE_HTTP_DATAGRAMS
       8             : #include "source/common/quic/http_datagram_handler.h"
       9             : #endif
      10             : #include "quiche/common/simple_buffer_allocator.h"
      11             : #include "quiche/quic/core/http/quic_spdy_client_stream.h"
      12             : 
      13             : namespace Envoy {
      14             : namespace Quic {
      15             : 
      16             : // This class is a quic stream and also a request encoder.
      17             : class EnvoyQuicClientStream : public quic::QuicSpdyClientStream,
      18             :                               public EnvoyQuicStream,
      19             :                               public Http::RequestEncoder {
      20             : public:
      21             :   EnvoyQuicClientStream(quic::QuicStreamId id, quic::QuicSpdyClientSession* client_session,
      22             :                         quic::StreamType type, Http::Http3::CodecStats& stats,
      23             :                         const envoy::config::core::v3::Http3ProtocolOptions& http3_options);
      24             : 
      25           0 :   void setResponseDecoder(Http::ResponseDecoder& decoder) { response_decoder_ = &decoder; }
      26             : 
      27             :   // Http::StreamEncoder
      28             :   void encodeData(Buffer::Instance& data, bool end_stream) override;
      29             :   void encodeMetadata(const Http::MetadataMapVector& metadata_map_vector) override;
      30           0 :   Http::Http1StreamEncoderOptionsOptRef http1StreamEncoderOptions() override {
      31           0 :     return absl::nullopt;
      32           0 :   }
      33             : 
      34             :   // Http::RequestEncoder
      35             :   Http::Status encodeHeaders(const Http::RequestHeaderMap& headers, bool end_stream) override;
      36             :   void encodeTrailers(const Http::RequestTrailerMap& trailers) override;
      37           0 :   void enableTcpTunneling() override {}
      38             : 
      39             :   // Http::Stream
      40             :   void resetStream(Http::StreamResetReason reason) override;
      41           0 :   void setFlushTimeout(std::chrono::milliseconds) override {}
      42             : 
      43             :   // quic::QuicStream
      44             :   void OnStreamFrame(const quic::QuicStreamFrame& frame) override;
      45             :   bool OnStopSending(quic::QuicResetStreamError error) override;
      46             :   // quic::QuicSpdyStream
      47             :   void OnBodyAvailable() override;
      48             :   void OnStreamReset(const quic::QuicRstStreamFrame& frame) override;
      49             :   void ResetWithError(quic::QuicResetStreamError error) override;
      50             :   void OnClose() override;
      51             :   void OnCanWrite() override;
      52             :   // quic::Stream
      53             :   void OnConnectionClosed(quic::QuicErrorCode error, quic::ConnectionCloseSource source) override;
      54             : 
      55             :   void clearWatermarkBuffer();
      56             : 
      57             : protected:
      58             :   // EnvoyQuicStream
      59             :   void switchStreamBlockState() override;
      60             :   uint32_t streamId() override;
      61             :   Network::Connection* connection() override;
      62             : 
      63             :   // quic::QuicSpdyStream
      64             :   // Overridden to pass headers to decoder.
      65             :   void OnInitialHeadersComplete(bool fin, size_t frame_len,
      66             :                                 const quic::QuicHeaderList& header_list) override;
      67             :   void OnTrailingHeadersComplete(bool fin, size_t frame_len,
      68             :                                  const quic::QuicHeaderList& header_list) override;
      69             :   void OnInvalidHeaders() override;
      70             : 
      71             :   // Http::MultiplexedStreamImplBase
      72             :   bool hasPendingData() override;
      73             : 
      74             :   void onStreamError(absl::optional<bool> should_close_connection,
      75             :                      quic::QuicRstStreamErrorCode rst_code) override;
      76             : 
      77             : private:
      78             :   QuicFilterManagerConnectionImpl* filterManagerConnection();
      79             : 
      80             :   // Deliver awaiting trailers if body has been delivered.
      81             :   void maybeDecodeTrailers();
      82             : 
      83             : #ifdef ENVOY_ENABLE_HTTP_DATAGRAMS
      84             :   // Makes the QUIC stream use Capsule Protocol. Once this method is called, any calls to encodeData
      85             :   // are expected to contain capsules which will be sent along as HTTP Datagrams. Also, the stream
      86             :   // starts to receive HTTP/3 Datagrams and decode into Capsules.
      87             :   void useCapsuleProtocol();
      88             : #endif
      89             : 
      90             :   Http::ResponseDecoder* response_decoder_{nullptr};
      91             :   bool decoded_1xx_{false};
      92             : #ifdef ENVOY_ENABLE_HTTP_DATAGRAMS
      93             :   // Setting |http_datagram_handler_| enables HTTP Datagram support.
      94             :   std::unique_ptr<HttpDatagramHandler> http_datagram_handler_;
      95             : #endif
      96             : 
      97             :   // When an HTTP Upgrade is requested, this contains the protocol upgrade type, e.g. "websocket".
      98             :   // It will be empty, when no such request is active.
      99             :   std::string upgrade_protocol_;
     100             : };
     101             : 
     102             : } // namespace Quic
     103             : } // namespace Envoy

Generated by: LCOV version 1.15