diff options
Diffstat (limited to 'profiling/client/src/SocketProfilingConnection.hpp')
-rw-r--r-- | profiling/client/src/SocketProfilingConnection.hpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/profiling/client/src/SocketProfilingConnection.hpp b/profiling/client/src/SocketProfilingConnection.hpp new file mode 100644 index 0000000000..52616c9a27 --- /dev/null +++ b/profiling/client/src/SocketProfilingConnection.hpp @@ -0,0 +1,42 @@ +// +// Copyright © 2019 Arm Ltd and Contributors. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include "IProfilingConnection.hpp" + +#include <common/include/NetworkSockets.hpp> + +#pragma once + +namespace arm +{ +namespace pipe +{ + +class SocketProfilingConnection : public IProfilingConnection +{ +public: + SocketProfilingConnection(); + bool IsOpen() const final; + void Close() final; + bool WritePacket(const unsigned char* buffer, uint32_t length) final; + arm::pipe::Packet ReadPacket(uint32_t timeout) final; + +private: + + // Read a full packet from the socket. + arm::pipe::Packet ReceivePacket(); + +#ifndef __APPLE__ + // To indicate we want to use an abstract UDS ensure the first character of the address is 0. + const char* m_GatorNamespace = "\0gatord_namespace"; +#else + // MACOSX does not support abstract UDS + const char* m_GatorNamespace = "/tmp/gatord_namespace"; +#endif + arm::pipe::PollFd m_Socket[1]{}; +}; + +} // namespace pipe +} // namespace arm |