Skip to content

Commit

Permalink
clang-format fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
LarryOsterman committed Mar 31, 2023
1 parent 34fe594 commit 513c796
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ namespace Azure { namespace Core { namespace Amqp {
Connection const& connectionToPoll,
MessageSenderOptions const& options,
MessageSenderEvents* events);
MessageSender(std::shared_ptr<Azure::Core::Amqp::_detail::MessageSenderImpl> sender) : m_impl{sender} {}
MessageSender(std::shared_ptr<Azure::Core::Amqp::_detail::MessageSenderImpl> sender)
: m_impl{sender}
{
}
virtual ~MessageSender() noexcept;

MessageSender() = default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ namespace Azure { namespace Core { namespace Amqp { namespace Network { namespac
TransportEvents* eventHandler = nullptr);
~TlsTransport() = default;
};

}}}}} // namespace Azure::Core::Amqp::Network::_internal
316 changes: 158 additions & 158 deletions sdk/core/azure-core-amqp/inc/azure/core/amqp/session.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,166 +20,166 @@ extern "C"
}

namespace Azure { namespace Core { namespace Amqp {
namespace _detail {
class SessionImpl;
} // namespace _detail
namespace _internal {

class Connection;
class Cbs;

// Dummy operations for operations that should never be used.
class Flow;
class Attach;
class Disposition;
class Detach;
class Transfer;
enum class SessionRole;

struct SessionOptions
namespace _detail {
class SessionImpl;
} // namespace _detail
namespace _internal {

class Connection;
class Cbs;

// Dummy operations for operations that should never be used.
class Flow;
class Attach;
class Disposition;
class Detach;
class Transfer;
enum class SessionRole;

struct SessionOptions
{
uint32_t IncomingWindow;
uint32_t OutgoingWindow;
uint32_t MaxLinks;
};

enum class ExpiryPolicy
{
LinkDetach,
SessionEnd,
ConnectionClose,
Never
};

// An "Endpoint" is an intermediate type used to create sessions in an OnNewSession callback.
struct Endpoint
{
ENDPOINT_INSTANCE_TAG* m_endpoint;
Endpoint(ENDPOINT_INSTANCE_TAG* endpoint) : m_endpoint{endpoint} {};
~Endpoint();
Endpoint(Endpoint const&) = delete;
Endpoint& operator=(Endpoint const&) = delete;

Endpoint(Endpoint&& other) noexcept : m_endpoint{other.m_endpoint}
{
uint32_t IncomingWindow;
uint32_t OutgoingWindow;
uint32_t MaxLinks;
};

enum class ExpiryPolicy
{
LinkDetach,
SessionEnd,
ConnectionClose,
Never
};

// An "Endpoint" is an intermediate type used to create sessions in an OnNewSession callback.
struct Endpoint
{
ENDPOINT_INSTANCE_TAG* m_endpoint;
Endpoint(ENDPOINT_INSTANCE_TAG* endpoint) : m_endpoint{endpoint} {};
~Endpoint();
Endpoint(Endpoint const&) = delete;
Endpoint& operator=(Endpoint const&) = delete;

Endpoint(Endpoint&& other) noexcept : m_endpoint{other.m_endpoint}
{
other.m_endpoint = nullptr;
}
Endpoint& operator=(Endpoint&& other);
ENDPOINT_INSTANCE_TAG* Release()
{
ENDPOINT_INSTANCE_TAG* rv = m_endpoint;
m_endpoint = nullptr;
return rv;
}
};

// A "Link Endpoint" is an intermediate type used to create new Links in an OnLinkAttached
// callback. Note that LinkEndpoints do not support copy semantics, and the only way to
// retrieve the underlying LINK_ENDPOINT_INSTANCE_TAG is to call Release(). That is because
// the primary use scenario for a LinkEndpoint is to call link_create_from_endpoint, and
// link_create_from_endpoint takes ownership of the underlying LINK_ENDPOINT object.
struct LinkEndpoint
other.m_endpoint = nullptr;
}
Endpoint& operator=(Endpoint&& other);
ENDPOINT_INSTANCE_TAG* Release()
{
LINK_ENDPOINT_INSTANCE_TAG* m_endpoint;
LinkEndpoint(LINK_ENDPOINT_INSTANCE_TAG* endpoint) : m_endpoint{endpoint} {};
/* NOTE: We do *NOT* own a LinkEndpoint object, it is completely controlled by uAMQP-c. As
* such, we are not allowed to free it.*/
~LinkEndpoint(){};
LinkEndpoint(Endpoint const&) = delete;
LinkEndpoint& operator=(LinkEndpoint const&) = delete;

LinkEndpoint(LinkEndpoint&& other) noexcept : m_endpoint{other.m_endpoint}
{
other.m_endpoint = nullptr;
}
LinkEndpoint& operator=(Endpoint&& other);
LINK_ENDPOINT_INSTANCE_TAG* Release()
{
LINK_ENDPOINT_INSTANCE_TAG* rv = m_endpoint;
m_endpoint = nullptr;
return rv;
}
};

enum class SessionState
ENDPOINT_INSTANCE_TAG* rv = m_endpoint;
m_endpoint = nullptr;
return rv;
}
};

// A "Link Endpoint" is an intermediate type used to create new Links in an OnLinkAttached
// callback. Note that LinkEndpoints do not support copy semantics, and the only way to
// retrieve the underlying LINK_ENDPOINT_INSTANCE_TAG is to call Release(). That is because
// the primary use scenario for a LinkEndpoint is to call link_create_from_endpoint, and
// link_create_from_endpoint takes ownership of the underlying LINK_ENDPOINT object.
struct LinkEndpoint
{
LINK_ENDPOINT_INSTANCE_TAG* m_endpoint;
LinkEndpoint(LINK_ENDPOINT_INSTANCE_TAG* endpoint) : m_endpoint{endpoint} {};
/* NOTE: We do *NOT* own a LinkEndpoint object, it is completely controlled by uAMQP-c. As
* such, we are not allowed to free it.*/
~LinkEndpoint(){};
LinkEndpoint(Endpoint const&) = delete;
LinkEndpoint& operator=(LinkEndpoint const&) = delete;

LinkEndpoint(LinkEndpoint&& other) noexcept : m_endpoint{other.m_endpoint}
{
Unmapped,
BeginSent,
BeginReceived,
Mapped,
EndSent,
EndReceived,
Discarding,
Error,
};

enum class SessionSendTransferResult
{
Ok,
Error,
Busy,
};

class Session;
struct SessionEvents
other.m_endpoint = nullptr;
}
LinkEndpoint& operator=(Endpoint&& other);
LINK_ENDPOINT_INSTANCE_TAG* Release()
{
virtual bool OnLinkAttached(
Session const& session,
LinkEndpoint& newLink,
std::string const& name,
SessionRole role,
Azure::Core::Amqp::Models::Value source,
Azure::Core::Amqp::Models::Value target,
Azure::Core::Amqp::Models::Value properties)
= 0;
};

class Session final {
public:
using OnEndpointFrameReceivedCallback = std::function<
void(AMQP_VALUE_DATA_TAG* performative, uint32_t framePayloadSize, uint8_t* payload)>;

Session(
Connection const& parentConnection,
Endpoint& newEndpoint,
SessionEvents* eventHandler);
Session(Connection const& parentConnection, SessionEvents* eventHandler);
Session(std::shared_ptr<Azure::Core::Amqp::_detail::SessionImpl> impl) : m_impl{impl} {}
~Session() noexcept;

Session(Session const&) = delete;
Session& operator=(Session const&) = delete;
Session(Session&&) noexcept = delete;
Session& operator=(Session&&) noexcept = delete;
// operator SESSION_INSTANCE_TAG*() const { return m_session; }
std::shared_ptr<Azure::Core::Amqp::_detail::SessionImpl> GetImpl() const { return m_impl; }
void SetIncomingWindow(uint32_t incomingWindow);
uint32_t GetIncomingWindow() const;
void SetOutgoingWindow(uint32_t outgoingWindow);
uint32_t GetOutgoingWindow() const;
void SetHandleMax(uint32_t handleMax);
uint32_t GetHandleMax() const;

void Begin();
void End(std::string const& condition_value, std::string const& description);
Endpoint CreateLinkEndpoint(std::string const& name);
void DestroyLinkEndpoint(Endpoint& endpoint);
void SetLinkEndpointCallback(Endpoint& endpoint, OnEndpointFrameReceivedCallback callback);
void StartLinkEndpoint(Endpoint& endpoint, OnEndpointFrameReceivedCallback callback);
void SendFlow(Endpoint& endpoint, Flow& flow);
void SendAttach(Endpoint& endpoint, Attach& attach);
void SendDisposition(Endpoint& endpoint, Disposition& disposition);
void SendDetach(Endpoint& endpoint, Detach& detach);
// SessionSendTransferResult SendTransfer(
// Endpoint& endpoint,
// Transfer& transfer,
// std::vector<Azure::Core::Amqp::Models::BinaryData> payloads,
// uint32_t* deliveryNumber,
// Azure::Core::Amqp::_internal::Network::Transport::TransportSendCompleteFn
// sendComplete);

private:
std::shared_ptr<Azure::Core::Amqp::_detail::SessionImpl> m_impl;
};
} // namespace _internal
LINK_ENDPOINT_INSTANCE_TAG* rv = m_endpoint;
m_endpoint = nullptr;
return rv;
}
};

enum class SessionState
{
Unmapped,
BeginSent,
BeginReceived,
Mapped,
EndSent,
EndReceived,
Discarding,
Error,
};

enum class SessionSendTransferResult
{
Ok,
Error,
Busy,
};

class Session;
struct SessionEvents
{
virtual bool OnLinkAttached(
Session const& session,
LinkEndpoint& newLink,
std::string const& name,
SessionRole role,
Azure::Core::Amqp::Models::Value source,
Azure::Core::Amqp::Models::Value target,
Azure::Core::Amqp::Models::Value properties)
= 0;
};

class Session final {
public:
using OnEndpointFrameReceivedCallback = std::function<
void(AMQP_VALUE_DATA_TAG* performative, uint32_t framePayloadSize, uint8_t* payload)>;

Session(
Connection const& parentConnection,
Endpoint& newEndpoint,
SessionEvents* eventHandler);
Session(Connection const& parentConnection, SessionEvents* eventHandler);
Session(std::shared_ptr<Azure::Core::Amqp::_detail::SessionImpl> impl) : m_impl{impl} {}
~Session() noexcept;

Session(Session const&) = delete;
Session& operator=(Session const&) = delete;
Session(Session&&) noexcept = delete;
Session& operator=(Session&&) noexcept = delete;
// operator SESSION_INSTANCE_TAG*() const { return m_session; }
std::shared_ptr<Azure::Core::Amqp::_detail::SessionImpl> GetImpl() const { return m_impl; }
void SetIncomingWindow(uint32_t incomingWindow);
uint32_t GetIncomingWindow() const;
void SetOutgoingWindow(uint32_t outgoingWindow);
uint32_t GetOutgoingWindow() const;
void SetHandleMax(uint32_t handleMax);
uint32_t GetHandleMax() const;

void Begin();
void End(std::string const& condition_value, std::string const& description);
Endpoint CreateLinkEndpoint(std::string const& name);
void DestroyLinkEndpoint(Endpoint& endpoint);
void SetLinkEndpointCallback(Endpoint& endpoint, OnEndpointFrameReceivedCallback callback);
void StartLinkEndpoint(Endpoint& endpoint, OnEndpointFrameReceivedCallback callback);
void SendFlow(Endpoint& endpoint, Flow& flow);
void SendAttach(Endpoint& endpoint, Attach& attach);
void SendDisposition(Endpoint& endpoint, Disposition& disposition);
void SendDetach(Endpoint& endpoint, Detach& detach);
// SessionSendTransferResult SendTransfer(
// Endpoint& endpoint,
// Transfer& transfer,
// std::vector<Azure::Core::Amqp::Models::BinaryData> payloads,
// uint32_t* deliveryNumber,
// Azure::Core::Amqp::_internal::Network::Transport::TransportSendCompleteFn
// sendComplete);

private:
std::shared_ptr<Azure::Core::Amqp::_detail::SessionImpl> m_impl;
};
} // namespace _internal
}}} // namespace Azure::Core::Amqp
4 changes: 2 additions & 2 deletions sdk/core/azure-core-amqp/src/network/tls_transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <azure_c_shared_utility/tlsio.h>
#include <string>

namespace Azure { namespace Core { namespace Amqp { namespace Network { namespace _internal {
namespace Azure { namespace Core { namespace Amqp { namespace Network { namespace _internal {

TlsTransport::TlsTransport(std::string const& host, uint16_t port, TransportEvents* eventHandler)
: Transport(eventHandler)
Expand All @@ -23,4 +23,4 @@ namespace Azure { namespace Core { namespace Amqp { namespace Network { namespac

TlsTransport::TlsTransport(TransportEvents* eventHandler) : Transport(eventHandler) {}

}}}}} // namespace Azure::Core::Amqp::_internal::Network
}}}}} // namespace Azure::Core::Amqp::Network::_internal

0 comments on commit 513c796

Please sign in to comment.