blob: 44c8fb8304e48254c97566ac1201f25dbd5b11fc [file] [log] [blame]
// Copyright 2023 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_MOQT_TOOLS_MOQT_SERVER_H_
#define QUICHE_QUIC_MOQT_TOOLS_MOQT_SERVER_H_
#include <memory>
#include "absl/status/statusor.h"
#include "absl/strings/string_view.h"
#include "quiche/quic/core/crypto/proof_source.h"
#include "quiche/quic/core/io/quic_event_loop.h"
#include "quiche/quic/moqt/moqt_session.h"
#include "quiche/quic/tools/quic_server.h"
#include "quiche/quic/tools/web_transport_only_backend.h"
#include "quiche/common/platform/api/quiche_export.h"
#include "quiche/common/quiche_callbacks.h"
namespace moqt {
// A callback to provide MoQT handler based on the path in the request.
using MoqtIncomingSessionCallback =
quiche::MultiUseCallback<absl::StatusOr<MoqtSessionCallbacks>(
absl::string_view path)>;
// A simple MoQT server.
class MoqtServer {
public:
explicit MoqtServer(std::unique_ptr<quic::ProofSource> proof_source,
MoqtIncomingSessionCallback callback);
quic::QuicServer& quic_server() { return server_; }
private:
quic::WebTransportOnlyBackend backend_;
quic::QuicServer server_;
};
} // namespace moqt
#endif // QUICHE_QUIC_MOQT_TOOLS_MOQT_SERVER_H_