blob: d968b1b552773bce0f42f18c68d41ea96eedf6eb [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 NET_THIRD_PARTY_QUIC_TOOLS_QUIC_SIMPLE_DISPATCHER_H_
#define NET_THIRD_PARTY_QUIC_TOOLS_QUIC_SIMPLE_DISPATCHER_H_
#include "net/third_party/quic/core/http/quic_server_session_base.h"
#include "net/third_party/quic/core/quic_dispatcher.h"
#include "net/third_party/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);
~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 // NET_THIRD_PARTY_QUIC_TOOLS_QUIC_SIMPLE_DISPATCHER_H_