blob: 4d04400b94998856a079332e0552f6da7dd02d9b [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"
QUICHE team5015e2e2019-12-11 09:38:06 -080011#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
QUICHE teama6ef0a62019-03-07 20:34:33 -050012
13namespace quic {
14
15class QuicSimpleDispatcher : public QuicDispatcher {
16 public:
17 QuicSimpleDispatcher(
18 const QuicConfig* config,
19 const QuicCryptoServerConfig* crypto_config,
20 QuicVersionManager* version_manager,
21 std::unique_ptr<QuicConnectionHelperInterface> helper,
22 std::unique_ptr<QuicCryptoServerStream::Helper> session_helper,
23 std::unique_ptr<QuicAlarmFactory> alarm_factory,
24 QuicSimpleServerBackend* quic_simple_server_backend,
dschinazi8ff74822019-05-28 16:37:20 -070025 uint8_t expected_server_connection_id_length);
QUICHE teama6ef0a62019-03-07 20:34:33 -050026
27 ~QuicSimpleDispatcher() override;
28
29 int GetRstErrorCount(QuicRstStreamErrorCode rst_error_code) const;
30
31 void OnRstStreamReceived(const QuicRstStreamFrame& frame) override;
32
33 protected:
34 QuicServerSessionBase* CreateQuicSession(
35 QuicConnectionId connection_id,
36 const QuicSocketAddress& client_address,
QUICHE team5015e2e2019-12-11 09:38:06 -080037 quiche::QuicheStringPiece alpn,
QUICHE teama6ef0a62019-03-07 20:34:33 -050038 const ParsedQuicVersion& version) override;
39
40 QuicSimpleServerBackend* server_backend() {
41 return quic_simple_server_backend_;
42 }
43
44 private:
45 QuicSimpleServerBackend* quic_simple_server_backend_; // Unowned.
46
47 // The map of the reset error code with its counter.
48 std::map<QuicRstStreamErrorCode, int> rst_error_map_;
49};
50
51} // namespace quic
52
53#endif // QUICHE_QUIC_TOOLS_QUIC_SIMPLE_DISPATCHER_H_