1
#pragma once
2

            
3
#include "envoy/http/codec.h"
4
#include "envoy/registry/registry.h"
5
#include "envoy/server/overload/overload_manager.h"
6

            
7
#include "source/common/common/assert.h"
8
#include "source/common/common/logger.h"
9
#include "source/common/quic/codec_impl.h"
10
#include "source/common/quic/envoy_quic_server_session.h"
11
#include "source/common/quic/server_connection_factory.h"
12

            
13
namespace Envoy {
14
namespace Quic {
15

            
16
class QuicHttpServerConnectionImpl : public QuicHttpConnectionImplBase,
17
                                     public Http::ServerConnection {
18
public:
19
  QuicHttpServerConnectionImpl(
20
      EnvoyQuicServerSession& quic_session, Http::ServerConnectionCallbacks& callbacks,
21
      Http::Http3::CodecStats& stats,
22
      const envoy::config::core::v3::Http3ProtocolOptions& http3_options,
23
      const uint32_t max_request_headers_kb, const uint32_t max_request_headers_count,
24
      envoy::config::core::v3::HttpProtocolOptions::HeadersWithUnderscoresAction
25
          headers_with_underscores_action,
26
      Server::OverloadManager& overload_manager);
27

            
28
  // Http::Connection
29
  void goAway() override;
30
  void shutdownNotice() override;
31
  void onUnderlyingConnectionAboveWriteBufferHighWatermark() override;
32
  void onUnderlyingConnectionBelowWriteBufferLowWatermark() override;
33

            
34
2
  EnvoyQuicServerSession& quicServerSession() { return quic_server_session_; }
35

            
36
private:
37
  EnvoyQuicServerSession& quic_server_session_;
38
};
39

            
40
class QuicHttpServerConnectionFactoryImpl : public QuicHttpServerConnectionFactory {
41
public:
42
  std::unique_ptr<Http::ServerConnection> createQuicHttpServerConnectionImpl(
43
      Network::Connection& connection, Http::ServerConnectionCallbacks& callbacks,
44
      Http::Http3::CodecStats& stats,
45
      const envoy::config::core::v3::Http3ProtocolOptions& http3_options,
46
      const uint32_t max_request_headers_kb, const uint32_t max_request_headers_count,
47
      envoy::config::core::v3::HttpProtocolOptions::HeadersWithUnderscoresAction
48
          headers_with_underscores_action,
49
1992
      Server::OverloadManager& overload_manager) override {
50
1992
    return std::make_unique<QuicHttpServerConnectionImpl>(
51
1992
        dynamic_cast<Quic::EnvoyQuicServerSession&>(connection), callbacks, stats, http3_options,
52
1992
        max_request_headers_kb, max_request_headers_count, headers_with_underscores_action,
53
1992
        overload_manager);
54
1992
  }
55
511
  std::string name() const override { return "quic.http_server_connection.default"; }
56
};
57

            
58
DECLARE_FACTORY(QuicHttpServerConnectionFactoryImpl);
59

            
60
} // namespace Quic
61
} // namespace Envoy