1 #ifndef PROTON_CPP_LINK_H
2 #define PROTON_CPP_LINK_H
25 #include "proton/endpoint.hpp"
26 #include "proton/export.hpp"
27 #include "proton/message.hpp"
28 #include "proton/terminus.hpp"
29 #include "proton/types.h"
30 #include "proton/object.hpp"
31 #include "proton/link_options.hpp"
46 link(pn_link_t* l=0) : object<pn_link_t>(l) {}
63 PN_CPP_EXTERN
void close();
66 PN_CPP_EXTERN
class sender sender();
69 PN_CPP_EXTERN
const class sender sender() const;
72 PN_CPP_EXTERN
class receiver receiver();
75 PN_CPP_EXTERN
const class receiver receiver() const;
78 PN_CPP_EXTERN
int credit()
const;
81 PN_CPP_EXTERN
int queued();
86 PN_CPP_EXTERN
int unsettled();
91 PN_CPP_EXTERN
int drained();
107 PN_CPP_EXTERN std::string
name()
const;
110 PN_CPP_EXTERN
class connection connection() const;
113 PN_CPP_EXTERN
class session session() const;
119 PN_CPP_EXTERN
void handler(proton_handler &);
122 PN_CPP_EXTERN
void detach_handler();
128 PN_CPP_EXTERN ssize_t recv(
char* buffer,
size_t size);
132 PN_CPP_EXTERN
bool advance();
141 PN_CPP_EXTERN link_options::receiver_settle_mode receiver_settle_mode();
142 PN_CPP_EXTERN
void receiver_settle_mode(link_options::receiver_settle_mode);
144 PN_CPP_EXTERN link_options::receiver_settle_mode remote_receiver_settle_mode();
152 class link_iterator :
public iter_base<link> {
155 iter_base<
link>(p, s), session_(0) {}
156 explicit link_iterator(
const link_iterator& i,
const session& ssn) :
157 iter_base<link>(i.ptr_, i.state_), session_(&ssn) {}
158 PN_CPP_EXTERN link_iterator operator++();
159 link_iterator operator++(
int) { link_iterator x(*
this); ++(*this);
return x; }
162 const session* session_;
167 typedef range<link_iterator> link_range;
171 #include "proton/sender.hpp"
172 #include "proton/receiver.hpp"
174 #endif // PROTON_CPP_LINK_H
int credit() const
Credit available on the link.
terminus remote_source() const
Remote source of the link.
One end of a link, either a source or a target.
Definition: terminus.hpp:42
A link for sending messages.
Definition: sender.hpp:38
A named channel for sending or receiving messages.
Definition: link.hpp:43
terminus local_target() const
Local target of the link.
A connection to a remote AMQP peer.
Definition: connection.hpp:42
The base class for session, connection, and link.
Definition: endpoint.hpp:32
terminus remote_target() const
Remote target of the link.
terminus local_source() const
Local source of the link.
A container of links.
Definition: session.hpp:42
Describes an endpoint error state.
Definition: condition.hpp:35
sender_settle_mode
Sender settlement behaviour for a link.
Definition: link_options.hpp:78
int state
A bit mask of state bit values.
Definition: endpoint.hpp:45
void open(const link_options &opts=link_options())
Locally open the link.
endpoint::state state() const
Get the state of this link.
Callback functions for handling proton events.
Definition: handler.hpp:40
int queued()
The number of deliveries queued on the link.
Options for creating a link.
Definition: link_options.hpp:60
A link for receiving messages.
Definition: receiver.hpp:36
void close()
Locally close the link.
condition local_condition() const
Get the local error condition.
std::string name() const
Get the link name.
condition remote_condition() const
Get the error condition of the remote endpoint.