6#include "azure/core/amqp/internal/models/message_source.hpp"
7#include "azure/core/amqp/internal/models/message_target.hpp"
8#include "azure/core/amqp/internal/models/performatives/amqp_transfer.hpp"
9#include "azure/core/amqp/models/amqp_value.hpp"
10#include "azure/core/context.hpp"
17namespace Azure {
namespace Core {
namespace Amqp {
namespace _internal {
20 enum class SenderSettleMode;
21 enum class ReceiverSettleMode;
23 enum class LinkDurability
30 enum class SessionRole
37namespace Azure {
namespace Core {
namespace Amqp {
namespace _detail {
44 HalfAttachedAttachSent,
45 HalfAttachedAttachReceived,
50 std::ostream& operator<<(std::ostream& stream, LinkState linkState);
52 enum class LinkTransferResult
58 enum class LinkDeliverySettleReason
68#if defined(_azure_TESTING_BUILD)
74 class LinkImplEventsImpl;
78 virtual Models::AmqpValue OnTransferReceived(
80 Models::_internal::Performatives::AmqpTransfer transfer,
82 const unsigned char* payloadBytes)
84 virtual void OnLinkStateChanged(
86 LinkState newLinkState,
87 LinkState previousLinkState)
89 virtual void OnLinkFlowOn(Link
const& link) = 0;
90 virtual ~LinkEvents() =
default;
96 _internal::Session
const& session,
97 std::string
const& name,
98 _internal::SessionRole role,
99 Models::_internal::MessageSource
const& source,
100 Models::_internal::MessageTarget
const& target,
101 LinkEvents* events =
nullptr);
103 _internal::Session
const& session,
104 _internal::LinkEndpoint& linkEndpoint,
105 std::string
const& name,
106 _internal::SessionRole role,
107 Models::_internal::MessageSource
const& source,
108 Models::_internal::MessageTarget
const& target,
109 LinkEvents* events =
nullptr);
112 Link(Link const&) = default;
113 Link& operator=(Link const&) = default;
114 Link(Link&&) noexcept = default;
115 Link& operator=(Link&&) noexcept = default;
117 void SetSenderSettleMode(_internal::SenderSettleMode senderSettleMode);
118 _internal::SenderSettleMode GetSenderSettleMode() const;
120 void SetReceiverSettleMode(_internal::ReceiverSettleMode receiverSettleMode);
121 _internal::ReceiverSettleMode GetReceiverSettleMode() const;
123 void SetInitialDeliveryCount(uint32_t initialDeliveryCount);
124 uint32_t GetInitialDeliveryCount() const;
126 void SetMaxMessageSize(uint64_t maxMessageSize);
127 uint64_t GetMaxMessageSize() const;
129 uint64_t GetPeerMaxMessageSize() const;
131 void SetAttachProperties(Models::AmqpValue const& attachProperties);
132 void SetMaxLinkCredit(uint32_t maxLinkCredit);
134 void SetDesiredCapabilities(Models::AmqpValue const& desiredCapabilities);
135 Models::AmqpValue GetDesiredCapabilities() const;
137 void ResetLinkCredit(std::uint32_t linkCredit,
bool drain);
139 std::
string GetName() const;
141 Models::_internal::MessageTarget const& GetTarget() const;
142 Models::_internal::MessageSource const& GetSource() const;
144 uint32_t GetReceivedMessageId() const;
148 std::tuple<uint32_t, LinkDeliverySettleReason, Models::AmqpValue> Transfer(
149 std::vector<uint8_t> const& payload,
150 Azure::Core::Context const& context);
154 std::
string const& errorCondition,
155 std::
string const& errorDescription,
156 const Models::AmqpValue& info);
159 friend class LinkImpl;
160 friend class LinkImplEventsImpl;
161 Link(std::shared_ptr<LinkImpl> impl) : m_impl{impl} {}
162 std::shared_ptr<LinkImplEvents> m_implEvents;
163 std::shared_ptr<LinkImpl> m_impl;