blob: 0e62dfe6e900d2ed2559b2631c3195957202fa3e [file] [log] [blame]
// Copyright 2019 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.
#include <string>
#include "platform/base/error.h"
namespace openscreen {
namespace cast {
// This interface is intended to provide an abstraction for communicating
// cast messages across a pipe with guaranteed delivery. This is used to
// decouple the cast streaming receiver and sender sessions from the
// network implementation.
class MessagePort {
class Client {
virtual void OnMessage(const std::string& source_sender_id,
const std::string& message_namespace,
const std::string& message) = 0;
virtual void OnError(Error error) = 0;
virtual ~MessagePort() = default;
virtual void SetClient(Client* client, std::string client_sender_id) = 0;
virtual void ResetClient() = 0;
virtual void PostMessage(const std::string& destination_sender_id,
const std::string& message_namespace,
const std::string& message) = 0;
} // namespace cast
} // namespace openscreen