blob: 46d976c7b5bb3f403413ca20c2ee02a72f0090cc [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef QUICHE_QUIC_TOOLS_QUIC_SIMPLE_DISPATCHER_H_
#define QUICHE_QUIC_TOOLS_QUIC_SIMPLE_DISPATCHER_H_
#include "net/third_party/quiche/src/quic/core/http/quic_server_session_base.h"
#include "net/third_party/quiche/src/quic/core/quic_dispatcher.h"
#include "net/third_party/quiche/src/quic/tools/quic_simple_server_backend.h"
namespace quic {
class QuicSimpleDispatcher : public QuicDispatcher {
public:
QuicSimpleDispatcher(
const QuicConfig* config,
const QuicCryptoServerConfig* crypto_config,
QuicVersionManager* version_manager,
std::unique_ptr<QuicConnectionHelperInterface> helper,
std::unique_ptr<QuicCryptoServerStream::Helper> session_helper,
std::unique_ptr<QuicAlarmFactory> alarm_factory,
QuicSimpleServerBackend* quic_simple_server_backend,
uint8_t expected_connection_id_length);
~QuicSimpleDispatcher() override;
int GetRstErrorCount(QuicRstStreamErrorCode rst_error_code) const;
void OnRstStreamReceived(const QuicRstStreamFrame& frame) override;
protected:
QuicServerSessionBase* CreateQuicSession(
QuicConnectionId connection_id,
const QuicSocketAddress& client_address,
QuicStringPiece alpn,
const ParsedQuicVersion& version) override;
QuicSimpleServerBackend* server_backend() {
return quic_simple_server_backend_;
}
private:
QuicSimpleServerBackend* quic_simple_server_backend_; // Unowned.
// The map of the reset error code with its counter.
std::map<QuicRstStreamErrorCode, int> rst_error_map_;
};
} // namespace quic
#endif // QUICHE_QUIC_TOOLS_QUIC_SIMPLE_DISPATCHER_H_