QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 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 "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 team | 5015e2e | 2019-12-11 09:38:06 -0800 | [diff] [blame^] | 11 | #include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 12 | |
| 13 | namespace quic { |
| 14 | |
| 15 | class 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, |
dschinazi | 8ff7482 | 2019-05-28 16:37:20 -0700 | [diff] [blame] | 25 | uint8_t expected_server_connection_id_length); |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 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 | QuicServerSessionBase* CreateQuicSession( |
| 35 | QuicConnectionId connection_id, |
| 36 | const QuicSocketAddress& client_address, |
QUICHE team | 5015e2e | 2019-12-11 09:38:06 -0800 | [diff] [blame^] | 37 | quiche::QuicheStringPiece alpn, |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 38 | 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_ |