You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2016/04/15 16:51:47 UTC
qpid-proton git commit: PROTON-1178: [C++ binding] Rearrange delivery
class - Renamed delivery to transfer - Split into sub classes tracker (sender
side) and delivery (receiver side) - Reaaranged some of the original delivery
methods between new deli
Repository: qpid-proton
Updated Branches:
refs/heads/master 84641391f -> c62d5d4ef
PROTON-1178: [C++ binding] Rearrange delivery class
- Renamed delivery to transfer
- Split into sub classes tracker (sender side)
and delivery (receiver side)
- Reaaranged some of the original delivery methods between
new delivery, tracker and transfer.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/c62d5d4e
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/c62d5d4e
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/c62d5d4e
Branch: refs/heads/master
Commit: c62d5d4efda2accedc25e4dedabb3306d3c9e787
Parents: 8464139
Author: Andrew Stitcher <as...@apache.org>
Authored: Wed Apr 13 19:51:20 2016 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Fri Apr 15 10:49:48 2016 -0400
----------------------------------------------------------------------
examples/cpp/broker.hpp | 6 +-
examples/cpp/client.cpp | 2 +
examples/cpp/direct_recv.cpp | 2 +-
examples/cpp/direct_send.cpp | 5 +-
examples/cpp/engine/client.cpp | 2 +
examples/cpp/engine/direct_recv.cpp | 3 +-
examples/cpp/engine/direct_send.cpp | 5 +-
examples/cpp/engine/helloworld.cpp | 2 +
examples/cpp/engine/server.cpp | 2 +
examples/cpp/engine/simple_recv.cpp | 3 +-
examples/cpp/engine/simple_send.cpp | 5 +-
examples/cpp/helloworld.cpp | 2 +
examples/cpp/helloworld_direct.cpp | 6 +-
examples/cpp/queue_browser.cpp | 3 +-
examples/cpp/server.cpp | 1 +
examples/cpp/server_direct.cpp | 1 +
examples/cpp/simple_recv.cpp | 2 +-
examples/cpp/simple_send.cpp | 5 +-
examples/cpp/ssl.cpp | 5 +-
examples/cpp/ssl_client_cert.cpp | 5 +-
proton-c/bindings/cpp/CMakeLists.txt | 2 +
.../bindings/cpp/include/proton/connection.hpp | 2 +-
.../bindings/cpp/include/proton/delivery.hpp | 92 +++----------------
.../bindings/cpp/include/proton/handler.hpp | 22 ++---
proton-c/bindings/cpp/include/proton/link.hpp | 2 +-
.../bindings/cpp/include/proton/receiver.hpp | 2 +
proton-c/bindings/cpp/include/proton/sender.hpp | 6 +-
.../bindings/cpp/include/proton/tracker.hpp | 52 +++++++++++
.../bindings/cpp/include/proton/transfer.hpp | 96 ++++++++++++++++++++
proton-c/bindings/cpp/src/delivery.cpp | 29 +-----
proton-c/bindings/cpp/src/handler.cpp | 7 +-
proton-c/bindings/cpp/src/message.cpp | 2 +-
proton-c/bindings/cpp/src/messaging_adapter.cpp | 46 +++++-----
proton-c/bindings/cpp/src/proton_event.cpp | 16 ----
proton-c/bindings/cpp/src/proton_event.hpp | 3 -
proton-c/bindings/cpp/src/sender.cpp | 15 +--
proton-c/bindings/cpp/src/tracker.cpp | 29 ++++++
proton-c/bindings/cpp/src/transfer.cpp | 51 +++++++++++
tests/tools/apps/cpp/reactor_send.cpp | 17 ++--
39 files changed, 353 insertions(+), 205 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/broker.hpp
----------------------------------------------------------------------
diff --git a/examples/cpp/broker.hpp b/examples/cpp/broker.hpp
index ff88976..92b7bb5 100644
--- a/examples/cpp/broker.hpp
+++ b/examples/cpp/broker.hpp
@@ -28,9 +28,11 @@
/// easier to see the important differences between the examples.
#include "proton/connection.hpp"
+#include "proton/delivery.hpp"
#include "proton/handler.hpp"
#include "proton/message.hpp"
#include "proton/sender.hpp"
+#include "proton/tracker.hpp"
#include "proton/transport.hpp"
#include "proton/url.hpp"
@@ -215,8 +217,8 @@ class broker_handler : public proton::handler {
}
void on_message(proton::delivery &d, proton::message &m) override {
- std::string address = d.link().local_target().address();
- queues_.get(address).publish(m, d.link().receiver());
+ std::string address = d.receiver().local_target().address();
+ queues_.get(address).publish(m, d.receiver());
}
protected:
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/client.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/client.cpp b/examples/cpp/client.cpp
index edf6ab3..5e4d529 100644
--- a/examples/cpp/client.cpp
+++ b/examples/cpp/client.cpp
@@ -21,8 +21,10 @@
#include "options.hpp"
#include "proton/container.hpp"
+#include "proton/delivery.hpp"
#include "proton/handler.hpp"
#include "proton/connection.hpp"
+#include "proton/tracker.hpp"
#include <iostream>
#include <vector>
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/direct_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/direct_recv.cpp b/examples/cpp/direct_recv.cpp
index b424ef3..f999869 100644
--- a/examples/cpp/direct_recv.cpp
+++ b/examples/cpp/direct_recv.cpp
@@ -61,7 +61,7 @@ class direct_recv : public proton::handler {
}
if (received == expected) {
- d.link().close();
+ d.receiver().close();
d.connection().close();
if (!!acceptor) acceptor.close();
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/direct_send.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/direct_send.cpp b/examples/cpp/direct_send.cpp
index c5a0879..0b63ec5 100644
--- a/examples/cpp/direct_send.cpp
+++ b/examples/cpp/direct_send.cpp
@@ -26,6 +26,7 @@
#include "proton/container.hpp"
#include "proton/handler.hpp"
#include "proton/value.hpp"
+#include "proton/tracker.hpp"
#include <iostream>
#include <map>
@@ -62,13 +63,13 @@ class simple_send : public proton::handler {
}
}
- void on_delivery_accept(proton::delivery &d) override {
+ void on_tracker_accept(proton::tracker &t) override {
confirmed++;
if (confirmed == total) {
std::cout << "all messages confirmed" << std::endl;
- d.connection().close();
+ t.connection().close();
acceptor.close();
}
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/engine/client.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/client.cpp b/examples/cpp/engine/client.cpp
index 3ba6013..2ef99b0 100644
--- a/examples/cpp/engine/client.cpp
+++ b/examples/cpp/engine/client.cpp
@@ -22,8 +22,10 @@
#include "options.hpp"
#include "proton/io/socket.hpp"
#include "proton/url.hpp"
+#include "proton/delivery.hpp"
#include "proton/handler.hpp"
#include "proton/connection.hpp"
+#include "proton/tracker.hpp"
#include <iostream>
#include <vector>
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/engine/direct_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/direct_recv.cpp b/examples/cpp/engine/direct_recv.cpp
index 77d4d0c..6f220cd 100644
--- a/examples/cpp/engine/direct_recv.cpp
+++ b/examples/cpp/engine/direct_recv.cpp
@@ -21,6 +21,7 @@
#include "options.hpp"
+#include "proton/delivery.hpp"
#include "proton/io/socket.hpp"
#include "proton/handler.hpp"
#include "proton/link.hpp"
@@ -48,7 +49,7 @@ class direct_recv : public proton::handler {
received++;
}
if (received == expected) {
- d.link().close();
+ d.receiver().close();
d.connection().close();
}
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/engine/direct_send.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/direct_send.cpp b/examples/cpp/engine/direct_send.cpp
index 1a07b31..2d9acf0 100644
--- a/examples/cpp/engine/direct_send.cpp
+++ b/examples/cpp/engine/direct_send.cpp
@@ -26,6 +26,7 @@
#include "proton/io/socket.hpp"
#include "proton/url.hpp"
#include "proton/handler.hpp"
+#include "proton/tracker.hpp"
#include "proton/value.hpp"
#include <iostream>
@@ -53,11 +54,11 @@ class simple_send : public proton::handler {
}
}
- void on_delivery_accept(proton::delivery &d) override {
+ void on_tracker_accept(proton::tracker &t) override {
confirmed++;
if (confirmed == total) {
std::cout << "all messages confirmed" << std::endl;
- d.connection().close();
+ t.connection().close();
}
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/engine/helloworld.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/helloworld.cpp b/examples/cpp/engine/helloworld.cpp
index 2c9126c..a4f23ef 100644
--- a/examples/cpp/engine/helloworld.cpp
+++ b/examples/cpp/engine/helloworld.cpp
@@ -19,7 +19,9 @@
*
*/
+#include "proton/delivery.hpp"
#include "proton/handler.hpp"
+#include "proton/tracker.hpp"
#include "proton/url.hpp"
#include "proton/io/socket.hpp"
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/engine/server.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/server.cpp b/examples/cpp/engine/server.cpp
index 0898393..336dbb3 100644
--- a/examples/cpp/engine/server.cpp
+++ b/examples/cpp/engine/server.cpp
@@ -22,9 +22,11 @@
#include "options.hpp"
#include "proton/connection.hpp"
+#include "proton/delivery.hpp"
#include "proton/io/socket.hpp"
#include "proton/url.hpp"
#include "proton/handler.hpp"
+#include "proton/tracker.hpp"
#include "proton/url.hpp"
#include <iostream>
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/engine/simple_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/simple_recv.cpp b/examples/cpp/engine/simple_recv.cpp
index 10ab78a..a7df1d3 100644
--- a/examples/cpp/engine/simple_recv.cpp
+++ b/examples/cpp/engine/simple_recv.cpp
@@ -27,6 +27,7 @@
#include "proton/link.hpp"
#include "proton/value.hpp"
#include "proton/message_id.hpp"
+#include "proton/delivery.hpp"
#include <iostream>
#include <map>
@@ -55,7 +56,7 @@ class simple_recv : public proton::handler {
std::cout << msg.body() << std::endl;
received++;
if (received == expected) {
- d.link().close();
+ d.receiver().close();
d.connection().close();
}
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/engine/simple_send.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/simple_send.cpp b/examples/cpp/engine/simple_send.cpp
index bf6efa1..e08f39f 100644
--- a/examples/cpp/engine/simple_send.cpp
+++ b/examples/cpp/engine/simple_send.cpp
@@ -25,6 +25,7 @@
#include "proton/url.hpp"
#include "proton/handler.hpp"
#include "proton/connection.hpp"
+#include "proton/tracker.hpp"
#include "proton/value.hpp"
#include <iostream>
@@ -58,11 +59,11 @@ class simple_send : public proton::handler {
}
}
- void on_delivery_accept(proton::delivery &d) override {
+ void on_tracker_accept(proton::tracker &t) override {
confirmed++;
if (confirmed == total) {
std::cout << "all messages confirmed" << std::endl;
- d.connection().close();
+ t.connection().close();
}
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/helloworld.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/helloworld.cpp b/examples/cpp/helloworld.cpp
index a2f1fc8..7568e20 100644
--- a/examples/cpp/helloworld.cpp
+++ b/examples/cpp/helloworld.cpp
@@ -21,7 +21,9 @@
#include "proton/connection.hpp"
#include "proton/container.hpp"
+#include "proton/delivery.hpp"
#include "proton/handler.hpp"
+#include "proton/tracker.hpp"
#include "proton/url.hpp"
#include <iostream>
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/helloworld_direct.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/helloworld_direct.cpp b/examples/cpp/helloworld_direct.cpp
index 42986de..88db8f8 100644
--- a/examples/cpp/helloworld_direct.cpp
+++ b/examples/cpp/helloworld_direct.cpp
@@ -22,9 +22,9 @@
#include "proton/acceptor.hpp"
#include "proton/connection.hpp"
#include "proton/container.hpp"
-#include "proton/delivery.hpp"
#include "proton/handler.hpp"
#include "proton/sender.hpp"
+#include "proton/tracker.hpp"
#include <iostream>
@@ -53,8 +53,8 @@ class hello_world_direct : public proton::handler {
std::cout << m.body() << std::endl;
}
- void on_delivery_accept(proton::delivery &d) override {
- d.connection().close();
+ void on_tracker_accept(proton::tracker &t) override {
+ t.connection().close();
}
void on_connection_close(proton::connection &) override {
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/queue_browser.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/queue_browser.cpp b/examples/cpp/queue_browser.cpp
index b9dbf21..eef933b 100644
--- a/examples/cpp/queue_browser.cpp
+++ b/examples/cpp/queue_browser.cpp
@@ -21,6 +21,7 @@
#include "proton/connection.hpp"
#include "proton/container.hpp"
+#include "proton/delivery.hpp"
#include "proton/handler.hpp"
#include "proton/url.hpp"
#include "proton/link_options.hpp"
@@ -44,7 +45,7 @@ class browser : public proton::handler {
void on_message(proton::delivery &d, proton::message &m) override {
std::cout << m.body() << std::endl;
- if (d.link().queued() == 0 && d.link().drained() > 0) {
+ if (d.receiver().queued() == 0 && d.receiver().drained() > 0) {
d.connection().close();
}
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/server.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/server.cpp b/examples/cpp/server.cpp
index 8f25454..eb4cc7a 100644
--- a/examples/cpp/server.cpp
+++ b/examples/cpp/server.cpp
@@ -24,6 +24,7 @@
#include "proton/connection.hpp"
#include "proton/container.hpp"
#include "proton/handler.hpp"
+#include "proton/tracker.hpp"
#include "proton/url.hpp"
#include <iostream>
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/server_direct.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/server_direct.cpp b/examples/cpp/server_direct.cpp
index 692b60a..76b8625 100644
--- a/examples/cpp/server_direct.cpp
+++ b/examples/cpp/server_direct.cpp
@@ -25,6 +25,7 @@
#include "proton/container.hpp"
#include "proton/handler.hpp"
#include "proton/sender.hpp"
+#include "proton/tracker.hpp"
#include "proton/url.hpp"
#include <iostream>
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/simple_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/simple_recv.cpp b/examples/cpp/simple_recv.cpp
index 72b0667..091264a 100644
--- a/examples/cpp/simple_recv.cpp
+++ b/examples/cpp/simple_recv.cpp
@@ -59,7 +59,7 @@ class simple_recv : public proton::handler {
received++;
if (received == expected) {
- d.link().close();
+ d.receiver().close();
d.connection().close();
}
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/simple_send.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/simple_send.cpp b/examples/cpp/simple_send.cpp
index 2ff4611..70aa4bc 100644
--- a/examples/cpp/simple_send.cpp
+++ b/examples/cpp/simple_send.cpp
@@ -24,6 +24,7 @@
#include "proton/connection.hpp"
#include "proton/container.hpp"
#include "proton/handler.hpp"
+#include "proton/tracker.hpp"
#include "proton/value.hpp"
#include <iostream>
@@ -60,12 +61,12 @@ class simple_send : public proton::handler {
}
}
- void on_delivery_accept(proton::delivery &d) override {
+ void on_tracker_accept(proton::tracker &t) override {
confirmed++;
if (confirmed == total) {
std::cout << "all messages confirmed" << std::endl;
- d.connection().close();
+ t.connection().close();
}
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/ssl.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/ssl.cpp b/examples/cpp/ssl.cpp
index 3e228b7..c9bf79c 100644
--- a/examples/cpp/ssl.cpp
+++ b/examples/cpp/ssl.cpp
@@ -25,6 +25,7 @@
#include "proton/container.hpp"
#include "proton/handler.hpp"
#include "proton/ssl.hpp"
+#include "proton/tracker.hpp"
#include "proton/transport.hpp"
#include <iostream>
@@ -100,9 +101,9 @@ class hello_world_direct : public proton::handler {
s.close();
}
- void on_delivery_accept(proton::delivery &d) override {
+ void on_tracker_accept(proton::tracker &t) override {
// All done.
- d.connection().close();
+ t.connection().close();
}
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/examples/cpp/ssl_client_cert.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/ssl_client_cert.cpp b/examples/cpp/ssl_client_cert.cpp
index 4ed4ea4..e4053bd 100644
--- a/examples/cpp/ssl_client_cert.cpp
+++ b/examples/cpp/ssl_client_cert.cpp
@@ -26,6 +26,7 @@
#include "proton/handler.hpp"
#include "proton/sasl.hpp"
#include "proton/ssl.hpp"
+#include "proton/tracker.hpp"
#include "proton/transport.hpp"
#include <iostream>
@@ -115,9 +116,9 @@ class hello_world_direct : public proton::handler {
s.close();
}
- void on_delivery_accept(proton::delivery &d) override {
+ void on_tracker_accept(proton::tracker &t) override {
// All done.
- d.connection().close();
+ t.connection().close();
}
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index ac07a80..2549547 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -66,7 +66,9 @@ set(qpid-proton-cpp-source
src/task.cpp
src/terminus.cpp
src/timestamp.cpp
+ src/tracker.cpp
src/transport.cpp
+ src/transfer.cpp
src/type_id.cpp
src/url.cpp
src/uuid.cpp
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/proton-c/bindings/cpp/include/proton/connection.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/connection.hpp b/proton-c/bindings/cpp/include/proton/connection.hpp
index e39f104..3b686f7 100644
--- a/proton-c/bindings/cpp/include/proton/connection.hpp
+++ b/proton-c/bindings/cpp/include/proton/connection.hpp
@@ -134,7 +134,7 @@ PN_CPP_CLASS_EXTERN connection : public internal::object<pn_connection_t>, publi
friend class transport;
friend class session;
friend class link;
- friend class delivery;
+ friend class transfer;
friend class reactor;
friend class proton_event;
friend class override_handler;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/proton-c/bindings/cpp/include/proton/delivery.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/delivery.hpp b/proton-c/bindings/cpp/include/proton/delivery.hpp
index f1966eb..0fe6c90 100644
--- a/proton-c/bindings/cpp/include/proton/delivery.hpp
+++ b/proton-c/bindings/cpp/include/proton/delivery.hpp
@@ -24,61 +24,26 @@
#include "proton/export.hpp"
#include "proton/object.hpp"
+#include "proton/transfer.hpp"
#include "proton/delivery.h"
#include "proton/disposition.h"
namespace proton {
+class receiver;
+
/// A message transfer. Every delivery exists within the context of a
/// proton::link. A delivery attempt can fail. As a result, a
/// particular message may correspond to multiple deliveries.
-class delivery : public internal::object<pn_delivery_t> {
+class delivery : public transfer {
/// @cond INTERNAL
- delivery(pn_delivery_t* d) : internal::object<pn_delivery_t>(d) {}
+ delivery(pn_delivery_t* d) : transfer(d) {}
/// @endcond
public:
- delivery() : internal::object<pn_delivery_t>(0) {}
-
- /// Return the link for this delivery
- PN_CPP_EXTERN class link link() const;
-
- /// Return the session for this delivery
- PN_CPP_EXTERN class session session() const;
-
- /// Return the connection for this delivery
- PN_CPP_EXTERN class connection connection() const;
-
- /// Return the container for this delivery
- PN_CPP_EXTERN class container &container() const;
-
- /// Delivery state values.
- enum state {
- NONE = 0, ///< Unknown state
- RECEIVED = PN_RECEIVED, ///< Received but not yet settled
- ACCEPTED = PN_ACCEPTED, ///< Settled as accepted
- REJECTED = PN_REJECTED, ///< Settled as rejected
- RELEASED = PN_RELEASED, ///< Settled as released
- MODIFIED = PN_MODIFIED ///< Settled as modified
- }; // AMQP spec 3.4 delivery State
-
- /// @cond INTERNAL
- /// XXX settle how much of this we need to expose
-
- /// Return true if the delivery has been settled.
- PN_CPP_EXTERN bool settled() const;
-
- /// Settle the delivery; informs the remote end.
- PN_CPP_EXTERN void settle();
-
- /// Set the local state of the delivery.
- PN_CPP_EXTERN void update(delivery::state state);
-
- /// Update and settle a delivery with the given delivery::state
- PN_CPP_EXTERN void settle(delivery::state s);
-
- /// @endcond
+ // Return the receiver for this delivery
+ PN_CPP_EXTERN class receiver receiver() const;
/// Settle with ACCEPTED state
PN_CPP_EXTERN void accept() { settle(ACCEPTED); }
@@ -93,48 +58,21 @@ class delivery : public internal::object<pn_delivery_t> {
PN_CPP_EXTERN void modify() { settle(MODIFIED); }
/// @cond INTERNAL
- /// XXX who needs this?
-
- /// Check if a delivery is readable.
- ///
- /// A delivery is considered readable if it is the current delivery on
- /// an incoming link.
- PN_CPP_EXTERN bool partial() const;
+ private:
+ /// Get the size of the current delivery.
+ size_t pending() const;
- /// Check if a delivery is writable.
- ///
- /// A delivery is considered writable if it is the current delivery on
- /// an outgoing link, and the link has positive credit.
- PN_CPP_EXTERN bool writable() const;
+ /// Check if a delivery is complete.
+ bool partial() const;
/// Check if a delivery is readable.
///
/// A delivery is considered readable if it is the current
/// delivery on an incoming link.
- PN_CPP_EXTERN bool readable() const;
-
- /// Check if a delivery is updated.
- ///
- /// A delivery is considered updated whenever the peer
- /// communicates a new disposition for the delivery. Once a
- /// delivery becomes updated, it will remain so until clear() is
- /// called.
- PN_CPP_EXTERN bool updated() const;
-
- /// Clear the updated flag for a delivery.
- PN_CPP_EXTERN void clear();
+ bool readable() const;
- /// Get the size of the current delivery.
- PN_CPP_EXTERN size_t pending() const;
-
- /// @endcond
-
- /// Get the remote state for a delivery.
- PN_CPP_EXTERN state remote_state() const;
-
- /// @cond INTERNAL
- friend class proton_event;
- friend class sender;
+ friend class message;
+ friend class messaging_adapter;
/// @endcond
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/proton-c/bindings/cpp/include/proton/handler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/handler.hpp b/proton-c/bindings/cpp/include/proton/handler.hpp
index 7b18f60..fa81454 100644
--- a/proton-c/bindings/cpp/include/proton/handler.hpp
+++ b/proton-c/bindings/cpp/include/proton/handler.hpp
@@ -37,6 +37,7 @@ class session;
class link;
class sender;
class receiver;
+class tracker;
class delivery;
class message;
class messaging_adapter;
@@ -118,20 +119,17 @@ PN_CPP_CLASS_EXTERN handler
/// The remote peer closed the link with an error condition.
PN_CPP_EXTERN virtual void on_sender_error(sender& l);
- /// The remote peer accepted an outgoing message.
- PN_CPP_EXTERN virtual void on_delivery_accept(delivery &d);
- /// The remote peer rejected an outgoing message.
- PN_CPP_EXTERN virtual void on_delivery_reject(delivery &d);
- /// The remote peer released an outgoing message.
- PN_CPP_EXTERN virtual void on_delivery_release(delivery &d);
- /// The remote peer settled an outgoing message.
+ /// The receiving peer accepted a transfer.
+ PN_CPP_EXTERN virtual void on_tracker_accept(tracker &d);
+ /// The receiving peer rejected a transfer.
+ PN_CPP_EXTERN virtual void on_tracker_reject(tracker &d);
+ /// The receiving peer released a transfer.
+ PN_CPP_EXTERN virtual void on_tracker_release(tracker &d);
+ /// The receiving peer settled a transfer.
+ PN_CPP_EXTERN virtual void on_tracker_settle(tracker &d);
+ /// The sending peer settled a transfer.
PN_CPP_EXTERN virtual void on_delivery_settle(delivery &d);
- // XXX are we missing on_delivery_modify?
- // XXX on_delivery_accept (and co) is a more discriminated on_delivery_settle
-
- // XXX note that AMQP modified state is indicated in _release
-
/// @cond INTERNAL
/// XXX settle API questions around task
/// XXX register functions instead of having these funny generic events
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/proton-c/bindings/cpp/include/proton/link.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/link.hpp b/proton-c/bindings/cpp/include/proton/link.hpp
index 54eae3b..f917514 100644
--- a/proton-c/bindings/cpp/include/proton/link.hpp
+++ b/proton-c/bindings/cpp/include/proton/link.hpp
@@ -149,7 +149,7 @@ PN_CPP_CLASS_EXTERN link : public internal::object<pn_link_t> , public endpoint
link_context &context();
friend class connection;
- friend class delivery;
+ friend class transfer;
friend class receiver;
friend class sender;
friend class message;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/proton-c/bindings/cpp/include/proton/receiver.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/receiver.hpp b/proton-c/bindings/cpp/include/proton/receiver.hpp
index ce29844..ade17a2 100644
--- a/proton-c/bindings/cpp/include/proton/receiver.hpp
+++ b/proton-c/bindings/cpp/include/proton/receiver.hpp
@@ -44,7 +44,9 @@ PN_CPP_CLASS_EXTERN receiver : public link {
/// @cond INTERNAL
friend class link;
+ friend class delivery;
friend class session;
+ friend class messaging_adapter;
/// @endcond
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/proton-c/bindings/cpp/include/proton/sender.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/sender.hpp b/proton-c/bindings/cpp/include/proton/sender.hpp
index 0642c5a..74b1303 100644
--- a/proton-c/bindings/cpp/include/proton/sender.hpp
+++ b/proton-c/bindings/cpp/include/proton/sender.hpp
@@ -23,7 +23,6 @@
*/
#include "proton/export.hpp"
-#include "proton/delivery.hpp"
#include "proton/link.hpp"
#include "proton/message.hpp"
@@ -34,6 +33,8 @@ struct pn_connection_t;
namespace proton {
+class tracker;
+
/// A link for sending messages.
class
PN_CPP_CLASS_EXTERN sender : public link
@@ -46,10 +47,11 @@ PN_CPP_CLASS_EXTERN sender : public link
sender() : link(0) {}
/// Send a message on the link.
- PN_CPP_EXTERN delivery send(const message &m);
+ PN_CPP_EXTERN tracker send(const message &m);
/// @cond INTERNAL
friend class link;
+ friend class tracker;
friend class session;
friend class messaging_adapter;
/// @endcond
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/proton-c/bindings/cpp/include/proton/tracker.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/tracker.hpp b/proton-c/bindings/cpp/include/proton/tracker.hpp
new file mode 100644
index 0000000..9f7b691
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/tracker.hpp
@@ -0,0 +1,52 @@
+#ifndef PROTON_CPP_TRACKER_H
+#define PROTON_CPP_TRACKER_H
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "proton/export.hpp"
+#include "proton/object.hpp"
+#include "proton/transfer.hpp"
+
+#include "proton/delivery.h"
+#include "proton/disposition.h"
+
+namespace proton {
+
+/// A message transfer. Every delivery exists within the context of a
+/// proton::link. A delivery attempt can fail. As a result, a
+/// particular message may correspond to multiple deliveries.
+class tracker : public transfer {
+ /// @cond INTERNAL
+ tracker(pn_delivery_t* d) : transfer(d) {}
+ /// @endcond
+
+ public:
+ // Return the sender for this tracker
+ PN_CPP_EXTERN class sender sender() const;
+
+ friend class messaging_adapter;
+ friend class sender;
+};
+
+}
+
+#endif // PROTON_CPP_TRACKER_H
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/proton-c/bindings/cpp/include/proton/transfer.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/transfer.hpp b/proton-c/bindings/cpp/include/proton/transfer.hpp
new file mode 100644
index 0000000..d3be57b
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/transfer.hpp
@@ -0,0 +1,96 @@
+#ifndef PROTON_CPP_TRANSFER_H
+#define PROTON_CPP_TRANSFER_H
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "proton/export.hpp"
+#include "proton/object.hpp"
+
+#include "proton/delivery.h"
+#include "proton/disposition.h"
+
+namespace proton {
+
+/// A message transfer. Every delivery exists within the context of a
+/// proton::link. A delivery attempt can fail. As a result, a
+/// particular message may correspond to multiple deliveries.
+class transfer : public internal::object<pn_delivery_t> {
+ protected:
+ /// @cond INTERNAL
+ transfer(pn_delivery_t* d) : internal::object<pn_delivery_t>(d) {}
+ /// @endcond
+
+ public:
+ transfer() : internal::object<pn_delivery_t>(0) {}
+
+ /// Return the session for this transfer
+ PN_CPP_EXTERN class session session() const;
+
+ /// Return the connection for this transfer
+ PN_CPP_EXTERN class connection connection() const;
+
+ /// Return the container for this transfer
+ PN_CPP_EXTERN class container &container() const;
+
+ /// Settle the delivery; informs the remote end.
+ PN_CPP_EXTERN void settle();
+
+ /// Return true if the transfer has been settled.
+ PN_CPP_EXTERN bool settled() const;
+
+ /// @cond INTERNAL
+ protected:
+ /// Delivery state values.
+ enum state {
+ NONE = 0, ///< Unknown state
+ RECEIVED = PN_RECEIVED, ///< Received but not yet settled
+ ACCEPTED = PN_ACCEPTED, ///< Settled as accepted
+ REJECTED = PN_REJECTED, ///< Settled as rejected
+ RELEASED = PN_RELEASED, ///< Settled as released
+ MODIFIED = PN_MODIFIED ///< Settled as modified
+ }; // AMQP spec 3.4 delivery State
+
+ /// Set the local state of the delivery.
+ void update(enum state state);
+
+ /// Update and settle a delivery with the given delivery::state
+ void settle(enum state s);
+
+ /// Get the remote state for a delivery.
+ enum state state() const;
+
+ private:
+ /// Check if a delivery is updated.
+ ///
+ /// A delivery is considered updated whenever the peer
+ /// communicates a new disposition for the delivery. Once a
+ /// delivery becomes updated, it will remain so until clear() is
+ /// called.
+ bool updated() const;
+
+ friend class messaging_adapter;
+ /// @endcond
+};
+
+}
+
+#endif // PROTON_CPP_TRANSFER_H
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/proton-c/bindings/cpp/src/delivery.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/delivery.cpp b/proton-c/bindings/cpp/src/delivery.cpp
index 49f6e26..e3c0054 100644
--- a/proton-c/bindings/cpp/src/delivery.cpp
+++ b/proton-c/bindings/cpp/src/delivery.cpp
@@ -21,38 +21,13 @@
#include "proton/delivery.hpp"
-#include "proton/connection.hpp"
-#include "proton/link.hpp"
-#include "proton/session.hpp"
-
-#include "proton/delivery.h"
-#include "proton/link.h"
-#include "proton/session.h"
+#include "proton/receiver.hpp"
namespace proton {
-link delivery::link() const { return pn_delivery_link(pn_object()); }
-session delivery::session() const { return pn_link_session(pn_delivery_link(pn_object())); }
-connection delivery::connection() const { return pn_session_connection(pn_link_session(pn_delivery_link(pn_object()))); }
-container& delivery::container() const { return connection().container(); }
-
-bool delivery::settled() const { return pn_delivery_settled(pn_object()); }
-
-void delivery::settle() { pn_delivery_settle(pn_object()); }
-
-void delivery::update(delivery::state state) { pn_delivery_update(pn_object(), state); }
-
-void delivery::settle(delivery::state state) {
- update(state);
- settle();
-}
+receiver delivery::receiver() const { return pn_delivery_link(pn_object()); }
bool delivery::partial() const { return pn_delivery_partial(pn_object()); }
bool delivery::readable() const { return pn_delivery_readable(pn_object()); }
-bool delivery::writable() const { return pn_delivery_writable(pn_object()); }
-bool delivery::updated() const { return pn_delivery_updated(pn_object()); }
size_t delivery::pending() const { return pn_delivery_pending(pn_object()); }
-
-void delivery::clear() { pn_delivery_clear(pn_object()); }
-delivery::state delivery::remote_state() const { return state(pn_delivery_remote_state(pn_object())); }
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/proton-c/bindings/cpp/src/handler.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/handler.cpp b/proton-c/bindings/cpp/src/handler.cpp
index 28d0e40..3849fd8 100644
--- a/proton-c/bindings/cpp/src/handler.cpp
+++ b/proton-c/bindings/cpp/src/handler.cpp
@@ -54,9 +54,10 @@ void handler::on_receiver_open(receiver &) {}
void handler::on_sender_close(sender &) {}
void handler::on_sender_error(sender &l) { on_unhandled_error(l.remote_condition()); }
void handler::on_sender_open(sender &) {}
-void handler::on_delivery_accept(delivery &) {}
-void handler::on_delivery_reject(delivery &) {}
-void handler::on_delivery_release(delivery &) {}
+void handler::on_tracker_accept(tracker &) {}
+void handler::on_tracker_reject(tracker &) {}
+void handler::on_tracker_release(tracker &) {}
+void handler::on_tracker_settle(tracker &) {}
void handler::on_delivery_settle(delivery &) {}
void handler::on_unhandled_error(const condition& c) { throw proton::error(c.what()); }
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/proton-c/bindings/cpp/src/message.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/message.cpp b/proton-c/bindings/cpp/src/message.cpp
index e00218a..d1ba2ee 100644
--- a/proton-c/bindings/cpp/src/message.cpp
+++ b/proton-c/bindings/cpp/src/message.cpp
@@ -283,7 +283,7 @@ void message::decode(const std::vector<char> &s) {
void message::decode(proton::delivery delivery) {
std::vector<char> buf;
buf.resize(delivery.pending());
- proton::link link = delivery.link();
+ proton::link link = delivery.receiver();
ssize_t n = link.recv(const_cast<char *>(&buf[0]), buf.size());
if (n != ssize_t(buf.size())) throw error(MSG("link read failure"));
clear();
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/proton-c/bindings/cpp/src/messaging_adapter.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/messaging_adapter.cpp b/proton-c/bindings/cpp/src/messaging_adapter.cpp
index 459895d..cf022b9 100644
--- a/proton-c/bindings/cpp/src/messaging_adapter.cpp
+++ b/proton-c/bindings/cpp/src/messaging_adapter.cpp
@@ -21,8 +21,10 @@
#include "messaging_adapter.hpp"
+#include "proton/delivery.hpp"
#include "proton/sender.hpp"
#include "proton/error.hpp"
+#include "proton/tracker.hpp"
#include "proton/transport.hpp"
#include "contexts.hpp"
@@ -76,11 +78,12 @@ void messaging_adapter::on_link_flow(proton_event &pe) {
void messaging_adapter::on_delivery(proton_event &pe) {
pn_event_t *cevent = pe.pn_event();
pn_link_t *lnk = pn_event_link(cevent);
+ pn_delivery_t *dlv = pn_event_delivery(cevent);
link_context& lctx = link_context::get(lnk);
- delivery dlv = pe.delivery();
if (pn_link_is_receiver(lnk)) {
- if (!dlv.partial() && dlv.readable()) {
+ delivery d(dlv);
+ if (!d.partial() && d.readable()) {
// generate on_message
pn_connection_t *pnc = pn_session_connection(pn_link_session(lnk));
connection_context& ctx = connection_context::get(pnc);
@@ -88,39 +91,40 @@ void messaging_adapter::on_delivery(proton_event &pe) {
// Avoid expensive heap malloc/free overhead.
// See PROTON-998
class message &msg(ctx.event_message);
- msg.decode(dlv);
+ msg.decode(d);
if (pn_link_state(lnk) & PN_LOCAL_CLOSED) {
if (lctx.auto_accept)
- dlv.release();
+ d.release();
} else {
- delegate_.on_message(dlv, msg);
- if (lctx.auto_accept && !dlv.settled())
- dlv.accept();
+ delegate_.on_message(d, msg);
+ if (lctx.auto_accept && !d.settled())
+ d.accept();
}
}
- else if (dlv.updated() && dlv.settled()) {
- delegate_.on_delivery_settle(dlv);
+ else if (d.updated() && d.settled()) {
+ delegate_.on_delivery_settle(d);
}
credit_topup(lnk);
} else {
+ tracker t(dlv);
// sender
- if (dlv.updated()) {
- uint64_t rstate = dlv.remote_state();
+ if (t.updated()) {
+ uint64_t rstate = t.state();
if (rstate == PN_ACCEPTED) {
- delegate_.on_delivery_accept(dlv);
+ delegate_.on_tracker_accept(t);
}
else if (rstate == PN_REJECTED) {
- delegate_.on_delivery_reject(dlv);
+ delegate_.on_tracker_reject(t);
}
else if (rstate == PN_RELEASED || rstate == PN_MODIFIED) {
- delegate_.on_delivery_release(dlv);
+ delegate_.on_tracker_release(t);
}
- if (dlv.settled()) {
- delegate_.on_delivery_settle(dlv);
+ if (t.settled()) {
+ delegate_.on_tracker_settle(t);
}
if (lctx.auto_settle)
- dlv.settle();
+ t.settle();
}
}
}
@@ -141,13 +145,13 @@ void messaging_adapter::on_link_remote_close(proton_event &pe) {
pn_event_t *cevent = pe.pn_event();
pn_link_t *lnk = pn_event_link(cevent);
if (pn_link_is_receiver(lnk)) {
- receiver r = link(lnk).receiver();
+ receiver r(lnk);
if (pn_condition_is_set(pn_link_remote_condition(lnk))) {
delegate_.on_receiver_error(r);
}
delegate_.on_receiver_close(r);
} else {
- sender s = link(lnk).sender();
+ sender s(lnk);
if (pn_condition_is_set(pn_link_remote_condition(lnk))) {
delegate_.on_sender_error(s);
}
@@ -203,10 +207,10 @@ void messaging_adapter::on_link_local_open(proton_event &pe) {
void messaging_adapter::on_link_remote_open(proton_event &pe) {
pn_link_t *lnk = pn_event_link(pe.pn_event());
if (pn_link_is_receiver(lnk)) {
- receiver r = link(lnk).receiver();
+ receiver r(lnk);
delegate_.on_receiver_open(r);
} else {
- sender s = link(lnk).sender();
+ sender s(lnk);
delegate_.on_sender_open(s);
}
if (!is_local_open(pn_link_state(lnk)) && is_local_unititialised(pn_link_state(lnk))) {
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/proton-c/bindings/cpp/src/proton_event.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_event.cpp b/proton-c/bindings/cpp/src/proton_event.cpp
index bec1145..ade1ecd 100644
--- a/proton-c/bindings/cpp/src/proton_event.cpp
+++ b/proton-c/bindings/cpp/src/proton_event.cpp
@@ -80,22 +80,6 @@ link proton_event::link() const {
return lnk;
}
-sender proton_event::sender() const {
- if (!link().sender()) throw error(MSG("No sender context for this event"));
- return link().sender();
-}
-
-receiver proton_event::receiver() const {
- if (!link().receiver()) throw error(MSG("No receiver context for this event"));
- return link().receiver();
-}
-
-delivery proton_event::delivery() const {
- pn_delivery_t* dlv = pn_event_delivery(pn_event());
- if (!dlv) throw error(MSG("No delivery context for this event"));
- return dlv;
-}
-
void proton_event::dispatch(proton_handler &handler) {
switch(type_) {
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/proton-c/bindings/cpp/src/proton_event.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_event.hpp b/proton-c/bindings/cpp/src/proton_event.hpp
index ca6edc4..37ba63d 100644
--- a/proton-c/bindings/cpp/src/proton_event.hpp
+++ b/proton-c/bindings/cpp/src/proton_event.hpp
@@ -278,10 +278,7 @@ class proton_event
class transport transport() const;
class connection connection() const;
class session session() const;
- class sender sender() const;
- class receiver receiver() const;
class link link() const;
- class delivery delivery() const;
/** Get type of event */
event_type type() const;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/proton-c/bindings/cpp/src/sender.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/sender.cpp b/proton-c/bindings/cpp/src/sender.cpp
index f79537b..a564567 100644
--- a/proton-c/bindings/cpp/src/sender.cpp
+++ b/proton-c/bindings/cpp/src/sender.cpp
@@ -18,21 +18,14 @@
* under the License.
*
*/
+
#include "proton/link.hpp"
#include "proton/sender.hpp"
-#include "proton/error.hpp"
-#include "msg.hpp"
-#include "contexts.hpp"
+#include "proton/tracker.hpp"
-#include "proton/connection.h"
-#include "proton/session.h"
+#include "proton/delivery.h"
#include "proton/link.h"
#include "proton/types.h"
-#include "proton/codec.h"
-#include "proton/message.h"
-#include "proton/delivery.h"
-#include <stdlib.h>
-#include <string.h>
namespace proton {
@@ -41,7 +34,7 @@ namespace {
uint64_t tag_counter = 0;
}
-delivery sender::send(const message &message) {
+tracker sender::send(const message &message) {
uint64_t id = ++tag_counter;
pn_delivery_t *dlv =
pn_delivery(pn_object(), pn_dtag(reinterpret_cast<const char*>(&id), sizeof(id)));
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/proton-c/bindings/cpp/src/tracker.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/tracker.cpp b/proton-c/bindings/cpp/src/tracker.cpp
new file mode 100644
index 0000000..fd9b007
--- /dev/null
+++ b/proton-c/bindings/cpp/src/tracker.cpp
@@ -0,0 +1,29 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "proton/tracker.hpp"
+
+#include "proton/sender.hpp"
+
+namespace proton {
+
+sender tracker::sender() const { return pn_delivery_link(pn_object()); }
+}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/proton-c/bindings/cpp/src/transfer.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/transfer.cpp b/proton-c/bindings/cpp/src/transfer.cpp
new file mode 100644
index 0000000..9330ef5
--- /dev/null
+++ b/proton-c/bindings/cpp/src/transfer.cpp
@@ -0,0 +1,51 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "proton/delivery.hpp"
+
+#include "proton/connection.hpp"
+#include "proton/link.hpp"
+#include "proton/session.hpp"
+
+#include "proton/delivery.h"
+#include "proton/link.h"
+#include "proton/session.h"
+
+namespace proton {
+
+session transfer::session() const { return pn_link_session(pn_delivery_link(pn_object())); }
+connection transfer::connection() const { return pn_session_connection(pn_link_session(pn_delivery_link(pn_object()))); }
+container& transfer::container() const { return connection().container(); }
+
+bool transfer::settled() const { return pn_delivery_settled(pn_object()); }
+
+void transfer::settle() { pn_delivery_settle(pn_object()); }
+
+void transfer::update(enum state state) { pn_delivery_update(pn_object(), state); }
+
+void transfer::settle(enum state state) {
+ update(state);
+ settle();
+}
+
+bool transfer::updated() const { return pn_delivery_updated(pn_object()); }
+enum transfer::state transfer::state() const { return static_cast<enum state>(pn_delivery_remote_state(pn_object())); }
+}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c62d5d4e/tests/tools/apps/cpp/reactor_send.cpp
----------------------------------------------------------------------
diff --git a/tests/tools/apps/cpp/reactor_send.cpp b/tests/tools/apps/cpp/reactor_send.cpp
index cc9b1fb..f6d3e7b 100644
--- a/tests/tools/apps/cpp/reactor_send.cpp
+++ b/tests/tools/apps/cpp/reactor_send.cpp
@@ -22,13 +22,14 @@
#include "options.hpp"
#include "proton/binary.hpp"
-#include "proton/container.hpp"
-#include "proton/handler.hpp"
#include "proton/connection.hpp"
+#include "proton/container.hpp"
#include "proton/decoder.hpp"
-#include "proton/reactor.h"
-#include "proton/value.hpp"
+#include "proton/delivery.hpp"
+#include "proton/handler.hpp"
#include "proton/link_options.hpp"
+#include "proton/tracker.hpp"
+#include "proton/value.hpp"
#include <iostream>
#include <map>
@@ -80,13 +81,13 @@ class reactor_send : public proton::handler {
}
}
- void on_delivery_accept(proton::delivery &d) override {
+ void on_tracker_accept(proton::tracker &t) override {
confirmed_++;
- d.settle();
+ t.settle();
if (confirmed_ == total_) {
std::cout << "all messages confirmed" << std::endl;
if (!replying_)
- d.connection().close();
+ t.connection().close();
}
}
@@ -98,7 +99,7 @@ class reactor_send : public proton::handler {
}
d.settle();
if (received_ == total_) {
- d.link().close();
+ d.receiver().close();
d.connection().close();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org