8#include <azure/core/context.hpp>
16namespace Azure {
namespace Core {
namespace Amqp {
namespace Network {
namespace _detail {
20namespace Azure {
namespace Core {
namespace Amqp {
namespace Network {
namespace _internal {
26 enum class TransportOpenStatus
41 enum class TransportSendStatus
66 class TransportEvents {
78 virtual void OnBytesReceived(
79 Transport
const& transport,
80 const unsigned char* buffer,
85 virtual void OnIOError() = 0;
88 class Transport final {
91 using TransportSendCompleteFn = std::function<void(TransportSendStatus)>;
101 TransportOpenStatus Open(Context
const& context = {});
108 void Close(Context
const& context = {});
117 bool Send(uint8_t* buffer,
size_t size, TransportSendCompleteFn callback)
const;
131 void SetEventHandler(TransportEvents* events);
133 Transport(std::shared_ptr<_detail::TransportImpl> impl) : m_impl{impl} {}
134 std::shared_ptr<_detail::TransportImpl> GetImpl()
const {
return m_impl; }
137 std::shared_ptr<_detail::TransportImpl> m_impl;