• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // 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 "absl/strings/string_view.h"
9 #include "quiche/quic/core/http/quic_server_session_base.h"
10 #include "quiche/quic/core/quic_dispatcher.h"
11 #include "quiche/quic/tools/quic_simple_server_backend.h"
12 
13 namespace quic {
14 
15 class QuicSimpleDispatcher : public QuicDispatcher {
16  public:
17   QuicSimpleDispatcher(
18       const QuicConfig* config, const QuicCryptoServerConfig* crypto_config,
19       QuicVersionManager* version_manager,
20       std::unique_ptr<QuicConnectionHelperInterface> helper,
21       std::unique_ptr<QuicCryptoServerStreamBase::Helper> session_helper,
22       std::unique_ptr<QuicAlarmFactory> alarm_factory,
23       QuicSimpleServerBackend* quic_simple_server_backend,
24       uint8_t expected_server_connection_id_length,
25       ConnectionIdGeneratorInterface& generator);
26 
27   ~QuicSimpleDispatcher() override;
28 
29   int GetRstErrorCount(QuicRstStreamErrorCode rst_error_code) const;
30 
31   void OnRstStreamReceived(const QuicRstStreamFrame& frame) override;
32 
33  protected:
34   std::unique_ptr<QuicSession> CreateQuicSession(
35       QuicConnectionId connection_id, const QuicSocketAddress& self_address,
36       const QuicSocketAddress& peer_address, absl::string_view alpn,
37       const ParsedQuicVersion& version,
38       const ParsedClientHello& parsed_chlo) override;
39 
server_backend()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_
54