blob: c01359d84984a0fbfc4f738b55d7606235c5fa4a [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,
nharper5f23a2d2020-02-20 10:44:09 -080022 std::unique_ptr<QuicCryptoServerStreamBase::Helper> session_helper,
QUICHE teama6ef0a62019-03-07 20:34:33 -050023 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:
wub89490e02019-12-12 12:45:58 -080034 std::unique_ptr<QuicSession> CreateQuicSession(
QUICHE teama6ef0a62019-03-07 20:34:33 -050035 QuicConnectionId connection_id,
wub4e3fb902020-07-15 13:37:29 -070036 const QuicSocketAddress& self_address,
37 const QuicSocketAddress& peer_address,
QUICHE team5015e2e2019-12-11 09:38:06 -080038 quiche::QuicheStringPiece alpn,
QUICHE teama6ef0a62019-03-07 20:34:33 -050039 const ParsedQuicVersion& version) override;
40
41 QuicSimpleServerBackend* server_backend() {
42 return quic_simple_server_backend_;
43 }
44
45 private:
46 QuicSimpleServerBackend* quic_simple_server_backend_; // Unowned.
47
48 // The map of the reset error code with its counter.
49 std::map<QuicRstStreamErrorCode, int> rst_error_map_;
50};
51
52} // namespace quic
53
54#endif // QUICHE_QUIC_TOOLS_QUIC_SIMPLE_DISPATCHER_H_