blob: 46d976c7b5bb3f403413ca20c2ee02a72f0090cc [file] [log] [blame]
QUICHE teama6ef0a62019-03-07 20:34:33 -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(
17 const QuicConfig* config,
18 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 uint8_t expected_connection_id_length);
25
26 ~QuicSimpleDispatcher() override;
27
28 int GetRstErrorCount(QuicRstStreamErrorCode rst_error_code) const;
29
30 void OnRstStreamReceived(const QuicRstStreamFrame& frame) override;
31
32 protected:
33 QuicServerSessionBase* CreateQuicSession(
34 QuicConnectionId connection_id,
35 const QuicSocketAddress& client_address,
36 QuicStringPiece alpn,
37 const ParsedQuicVersion& version) override;
38
39 QuicSimpleServerBackend* server_backend() {
40 return quic_simple_server_backend_;
41 }
42
43 private:
44 QuicSimpleServerBackend* quic_simple_server_backend_; // Unowned.
45
46 // The map of the reset error code with its counter.
47 std::map<QuicRstStreamErrorCode, int> rst_error_map_;
48};
49
50} // namespace quic
51
52#endif // QUICHE_QUIC_TOOLS_QUIC_SIMPLE_DISPATCHER_H_