blob: 6f13d391ba8b70e05095488a514dba6b4f3576b0 [file] [log] [blame]
QUICHE teamc9b2cec2019-01-07 17:54:15 -05001// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef QUICHE_QUIC_TOOLS_QUIC_SIMPLE_DISPATCHER_H_
6#define QUICHE_QUIC_TOOLS_QUIC_SIMPLE_DISPATCHER_H_
7
8#include "net/third_party/quiche/src/quic/core/http/quic_server_session_base.h"
9#include "net/third_party/quiche/src/quic/core/quic_dispatcher.h"
10#include "net/third_party/quiche/src/quic/tools/quic_simple_server_backend.h"
11
12namespace quic {
13
14class QuicSimpleDispatcher : public QuicDispatcher {
15 public:
16 QuicSimpleDispatcher(
QUICHE team2bfc7542019-02-26 14:36:06 -050017 const QuicConfig* config,
QUICHE teamc9b2cec2019-01-07 17:54:15 -050018 const QuicCryptoServerConfig* crypto_config,
19 QuicVersionManager* version_manager,
20 std::unique_ptr<QuicConnectionHelperInterface> helper,
21 std::unique_ptr<QuicCryptoServerStream::Helper> session_helper,
22 std::unique_ptr<QuicAlarmFactory> alarm_factory,
23 QuicSimpleServerBackend* quic_simple_server_backend);
24
25 ~QuicSimpleDispatcher() override;
26
27 int GetRstErrorCount(QuicRstStreamErrorCode rst_error_code) const;
28
29 void OnRstStreamReceived(const QuicRstStreamFrame& frame) override;
30
31 protected:
32 QuicServerSessionBase* CreateQuicSession(
33 QuicConnectionId connection_id,
34 const QuicSocketAddress& client_address,
35 QuicStringPiece alpn,
36 const ParsedQuicVersion& version) override;
37
38 QuicSimpleServerBackend* server_backend() {
39 return quic_simple_server_backend_;
40 }
41
42 private:
43 QuicSimpleServerBackend* quic_simple_server_backend_; // Unowned.
44
45 // The map of the reset error code with its counter.
46 std::map<QuicRstStreamErrorCode, int> rst_error_map_;
47};
48
49} // namespace quic
50
51#endif // QUICHE_QUIC_TOOLS_QUIC_SIMPLE_DISPATCHER_H_