Project import generated by Copybara.
PiperOrigin-RevId: 237361882
Change-Id: I109a68f44db867b20f8c6a7732b0ce657133e52a
diff --git a/quic/tools/quic_simple_dispatcher.h b/quic/tools/quic_simple_dispatcher.h
new file mode 100644
index 0000000..46d976c
--- /dev/null
+++ b/quic/tools/quic_simple_dispatcher.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2012 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.
+
+#ifndef QUICHE_QUIC_TOOLS_QUIC_SIMPLE_DISPATCHER_H_
+#define QUICHE_QUIC_TOOLS_QUIC_SIMPLE_DISPATCHER_H_
+
+#include "net/third_party/quiche/src/quic/core/http/quic_server_session_base.h"
+#include "net/third_party/quiche/src/quic/core/quic_dispatcher.h"
+#include "net/third_party/quiche/src/quic/tools/quic_simple_server_backend.h"
+
+namespace quic {
+
+class QuicSimpleDispatcher : public QuicDispatcher {
+ public:
+ QuicSimpleDispatcher(
+ const QuicConfig* config,
+ const QuicCryptoServerConfig* crypto_config,
+ QuicVersionManager* version_manager,
+ std::unique_ptr<QuicConnectionHelperInterface> helper,
+ std::unique_ptr<QuicCryptoServerStream::Helper> session_helper,
+ std::unique_ptr<QuicAlarmFactory> alarm_factory,
+ QuicSimpleServerBackend* quic_simple_server_backend,
+ uint8_t expected_connection_id_length);
+
+ ~QuicSimpleDispatcher() override;
+
+ int GetRstErrorCount(QuicRstStreamErrorCode rst_error_code) const;
+
+ void OnRstStreamReceived(const QuicRstStreamFrame& frame) override;
+
+ protected:
+ QuicServerSessionBase* CreateQuicSession(
+ QuicConnectionId connection_id,
+ const QuicSocketAddress& client_address,
+ QuicStringPiece alpn,
+ const ParsedQuicVersion& version) override;
+
+ QuicSimpleServerBackend* server_backend() {
+ return quic_simple_server_backend_;
+ }
+
+ private:
+ QuicSimpleServerBackend* quic_simple_server_backend_; // Unowned.
+
+ // The map of the reset error code with its counter.
+ std::map<QuicRstStreamErrorCode, int> rst_error_map_;
+};
+
+} // namespace quic
+
+#endif // QUICHE_QUIC_TOOLS_QUIC_SIMPLE_DISPATCHER_H_