aboutsummaryrefslogtreecommitdiff
path: root/cast/common/channel/cast_socket.h
diff options
context:
space:
mode:
Diffstat (limited to 'cast/common/channel/cast_socket.h')
-rw-r--r--cast/common/channel/cast_socket.h25
1 files changed, 12 insertions, 13 deletions
diff --git a/cast/common/channel/cast_socket.h b/cast/common/channel/cast_socket.h
index bf775543..1e5dc699 100644
--- a/cast/common/channel/cast_socket.h
+++ b/cast/common/channel/cast_socket.h
@@ -14,9 +14,6 @@
namespace cast {
namespace channel {
-using openscreen::Error;
-using TlsConnection = openscreen::platform::TlsConnection;
-
class CastMessage;
uint32_t GetNextSocketId();
@@ -24,19 +21,19 @@ uint32_t GetNextSocketId();
// Represents a simple message-oriented socket for communicating with the Cast
// V2 protocol. It isn't thread-safe, so it should only be used on the same
// TaskRunner thread as its TlsConnection.
-class CastSocket : public TlsConnection::Client {
+class CastSocket : public openscreen::TlsConnection::Client {
public:
class Client {
public:
virtual ~Client() = default;
// Called when a terminal error on |socket| has occurred.
- virtual void OnError(CastSocket* socket, Error error) = 0;
+ virtual void OnError(CastSocket* socket, openscreen::Error error) = 0;
virtual void OnMessage(CastSocket* socket, CastMessage message) = 0;
};
- CastSocket(std::unique_ptr<TlsConnection> connection,
+ CastSocket(std::unique_ptr<openscreen::TlsConnection> connection,
Client* client,
uint32_t socket_id);
~CastSocket();
@@ -45,7 +42,7 @@ class CastSocket : public TlsConnection::Client {
// write-blocked, in which case |message| will be queued. An error will be
// returned if |message| cannot be serialized for any reason, even while
// write-blocked.
- Error SendMessage(const CastMessage& message);
+ openscreen::Error SendMessage(const CastMessage& message);
void SetClient(Client* client);
@@ -53,11 +50,13 @@ class CastSocket : public TlsConnection::Client {
uint32_t socket_id() const { return socket_id_; }
- // TlsConnection::Client overrides.
- void OnWriteBlocked(TlsConnection* connection) override;
- void OnWriteUnblocked(TlsConnection* connection) override;
- void OnError(TlsConnection* connection, Error error) override;
- void OnRead(TlsConnection* connection, std::vector<uint8_t> block) override;
+ // openscreen::TlsConnection::Client overrides.
+ void OnWriteBlocked(openscreen::TlsConnection* connection) override;
+ void OnWriteUnblocked(openscreen::TlsConnection* connection) override;
+ void OnError(openscreen::TlsConnection* connection,
+ openscreen::Error error) override;
+ void OnRead(openscreen::TlsConnection* connection,
+ std::vector<uint8_t> block) override;
private:
enum class State {
@@ -67,7 +66,7 @@ class CastSocket : public TlsConnection::Client {
};
Client* client_; // May never be null.
- const std::unique_ptr<TlsConnection> connection_;
+ const std::unique_ptr<openscreen::TlsConnection> connection_;
std::vector<uint8_t> read_buffer_;
const uint32_t socket_id_;
State state_ = State::kOpen;