blob: 901d162bdac9fe1590a79595efc0a1e4f6348505 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// 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.
#ifndef CAST_STREAMING_MESSAGE_PORT_H_
#define CAST_STREAMING_MESSAGE_PORT_H_
#include "absl/strings/string_view.h"
namespace openscreen {
class Error;
}
namespace cast {
namespace streaming {
// 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 receiver session (and potentially other classes) from any
// network implementation.
class MessagePort {
public:
class Client {
public:
virtual void OnMessage(absl::string_view sender_id,
absl::string_view message_namespace,
absl::string_view message) = 0;
virtual void OnError(openscreen::Error error) = 0;
};
virtual ~MessagePort() = default;
virtual void SetClient(Client* client) = 0;
virtual void PostMessage(absl::string_view sender_id,
absl::string_view message_namespace,
absl::string_view message) = 0;
};
} // namespace streaming
} // namespace cast
#endif // CAST_STREAMING_MESSAGE_PORT_H_
|