qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject [6/6] qpid-proton git commit: PROTON-1153: [C++ binding] More removal of friends - Get rid of many friend declarations that are needed to access private members. - Do this by introducing an internal way to unwrap a wrapped proton-c object pointer and
Date Thu, 28 Apr 2016 00:48:14 GMT
PROTON-1153: [C++ binding] More removal of friends
- Get rid of many friend declarations that are needed to access
  private members.
- Do this by introducing an internal way to unwrap a wrapped proton-c
  object pointer and replace some wrapped code by "raw" proton-c


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/1f0df2a5
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/1f0df2a5
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/1f0df2a5

Branch: refs/heads/master
Commit: 1f0df2a55e8dc7c38654fbd70c10d59834b936e5
Parents: 138ffab
Author: Andrew Stitcher <astitcher@apache.org>
Authored: Wed Apr 27 03:47:49 2016 -0400
Committer: Andrew Stitcher <astitcher@apache.org>
Committed: Wed Apr 27 20:45:51 2016 -0400

----------------------------------------------------------------------
 .../bindings/cpp/include/proton/connection.hpp  |  5 --
 .../cpp/include/proton/connection_options.hpp   |  3 -
 .../bindings/cpp/include/proton/container.hpp   |  3 +-
 .../bindings/cpp/include/proton/delivery.hpp    | 15 -----
 proton-c/bindings/cpp/include/proton/link.hpp   | 13 ----
 proton-c/bindings/cpp/include/proton/object.hpp |  2 +-
 .../bindings/cpp/include/proton/receiver.hpp    |  2 -
 .../cpp/include/proton/receiver_options.hpp     |  6 +-
 proton-c/bindings/cpp/include/proton/sasl.hpp   |  7 ---
 proton-c/bindings/cpp/include/proton/sender.hpp |  2 -
 .../cpp/include/proton/sender_options.hpp       |  6 +-
 .../bindings/cpp/include/proton/session.hpp     |  4 +-
 proton-c/bindings/cpp/include/proton/source.hpp |  3 +-
 proton-c/bindings/cpp/include/proton/target.hpp |  3 +-
 .../bindings/cpp/include/proton/terminus.hpp    | 13 +---
 .../bindings/cpp/include/proton/transfer.hpp    | 10 ---
 .../bindings/cpp/include/proton/transport.hpp   |  5 --
 proton-c/bindings/cpp/src/connection.cpp        |  2 +-
 .../bindings/cpp/src/connection_options.cpp     | 17 +++---
 proton-c/bindings/cpp/src/connector.cpp         |  3 +-
 proton-c/bindings/cpp/src/container_impl.cpp    |  6 +-
 proton-c/bindings/cpp/src/contexts.cpp          |  5 ++
 proton-c/bindings/cpp/src/contexts.hpp          |  4 +-
 proton-c/bindings/cpp/src/delivery.cpp          |  3 -
 .../bindings/cpp/src/io/connection_engine.cpp   | 28 ++++-----
 proton-c/bindings/cpp/src/link.cpp              | 31 ----------
 proton-c/bindings/cpp/src/message.cpp           |  6 +-
 proton-c/bindings/cpp/src/messaging_adapter.cpp | 10 +--
 proton-c/bindings/cpp/src/node_options.cpp      | 49 +++++++++------
 proton-c/bindings/cpp/src/proton_bits.hpp       | 19 +++---
 proton-c/bindings/cpp/src/receiver_options.cpp  | 63 +++++++++----------
 proton-c/bindings/cpp/src/sasl.cpp              |  7 ---
 proton-c/bindings/cpp/src/sender_options.cpp    | 64 +++++++++++---------
 proton-c/bindings/cpp/src/session.cpp           |  2 +-
 proton-c/bindings/cpp/src/source.cpp            |  4 +-
 proton-c/bindings/cpp/src/target.cpp            |  4 +-
 proton-c/bindings/cpp/src/terminus.cpp          | 41 -------------
 proton-c/bindings/cpp/src/transfer.cpp          |  1 -
 proton-c/bindings/cpp/src/transport.cpp         |  2 +-
 39 files changed, 171 insertions(+), 302 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/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 60ffe6e..6f664db 100644
--- a/proton-c/bindings/cpp/include/proton/connection.hpp
+++ b/proton-c/bindings/cpp/include/proton/connection.hpp
@@ -120,12 +120,7 @@ PN_CPP_CLASS_EXTERN connection : public internal::object<pn_connection_t>, publi
     void host(const std::string& h);
 
     friend class internal::factory<connection>;
-    friend class connection_context;
-    friend class io::connection_engine;
-    friend class connection_options;
     friend class connector;
-    friend class container_impl;
-    friend class transport;
     /// @endcond
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/include/proton/connection_options.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/connection_options.hpp b/proton-c/bindings/cpp/include/proton/connection_options.hpp
index a4b7246..df02840 100644
--- a/proton-c/bindings/cpp/include/proton/connection_options.hpp
+++ b/proton-c/bindings/cpp/include/proton/connection_options.hpp
@@ -148,9 +148,6 @@ class connection_options {
   private:
     void apply(connection&) const;
     proton_handler* handler() const;
-    static pn_connection_t *pn_connection(connection &);
-    class ssl_client_options &ssl_client_options();
-    class ssl_server_options &ssl_server_options();
 
     class impl;
     internal::pn_unique_ptr<impl> impl_;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/include/proton/container.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/container.hpp b/proton-c/bindings/cpp/include/proton/container.hpp
index dc66e78..9759c67 100644
--- a/proton-c/bindings/cpp/include/proton/container.hpp
+++ b/proton-c/bindings/cpp/include/proton/container.hpp
@@ -139,7 +139,8 @@ class container {
 
     friend class connector;
     friend class messaging_adapter;
-    friend class link;
+    friend class receiver_options;
+    friend class sender_options;
     /// @endcond
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/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 a7e0511..3f76166 100644
--- a/proton-c/bindings/cpp/include/proton/delivery.hpp
+++ b/proton-c/bindings/cpp/include/proton/delivery.hpp
@@ -60,22 +60,7 @@ class delivery : public transfer {
     PN_CPP_EXTERN void modify() { settle(MODIFIED); }
 
     /// @cond INTERNAL
-  private:
-    /// Get the size of the current delivery.
-    size_t pending() 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 a receiver.
-    bool readable() const;
-
   friend class internal::factory<delivery>;
-  friend class message;
-  friend class messaging_adapter;
     /// @endcond
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/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 3db6f95..a9622ed 100644
--- a/proton-c/bindings/cpp/include/proton/link.hpp
+++ b/proton-c/bindings/cpp/include/proton/link.hpp
@@ -120,16 +120,6 @@ PN_CPP_CLASS_EXTERN link : public internal::object<pn_link_t> , public endpoint
     void attach();
 
   private:
-    // Used by sender/receiver options
-    void handler(proton_handler &);
-    void detach_handler();
-    void sender_settle_mode(sender_options::sender_settle_mode);
-    void receiver_settle_mode(receiver_options::receiver_settle_mode);
-    // Used by message to decode message from a delivery
-    ssize_t recv(char* buffer, size_t size);
-    bool advance();
-    link_context &context();
-
     /// XXX local versus remote, mutability
     /// XXX - local_sender_settle_mode and local_receiver_settle_mode
     sender_options::sender_settle_mode sender_settle_mode();
@@ -138,9 +128,6 @@ PN_CPP_CLASS_EXTERN link : public internal::object<pn_link_t> , public endpoint
     receiver_options::receiver_settle_mode remote_receiver_settle_mode();
 
     friend class internal::factory<link>;
-    friend class message;
-    friend class receiver_options;
-    friend class sender_options;
     ///@endcond
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/include/proton/object.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/object.hpp b/proton-c/bindings/cpp/include/proton/object.hpp
index dcbe086..7c7495d 100644
--- a/proton-c/bindings/cpp/include/proton/object.hpp
+++ b/proton-c/bindings/cpp/include/proton/object.hpp
@@ -85,7 +85,7 @@ template <class T> class object : private comparable<object<T> > {
     friend bool operator<(const object& a, const object& b) { return a.object_ < b.object_; }
 };
 
-/// Factory class used internally to make wrappers
+/// Factory class used internally to make wrappers and extract proton objects
 template <class T> class factory;
 
 }}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/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 a63be67..cfc480f 100644
--- a/proton-c/bindings/cpp/include/proton/receiver.hpp
+++ b/proton-c/bindings/cpp/include/proton/receiver.hpp
@@ -55,8 +55,6 @@ PN_CPP_CLASS_EXTERN receiver : public link {
     /// @cond INTERNAL
   friend class internal::factory<receiver>;
   friend class receiver_iterator;
-  friend class source;
-  friend class target;
     /// @endcond
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/include/proton/receiver_options.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/receiver_options.hpp b/proton-c/bindings/cpp/include/proton/receiver_options.hpp
index b0bf02a..bb9ac3f 100644
--- a/proton-c/bindings/cpp/include/proton/receiver_options.hpp
+++ b/proton-c/bindings/cpp/include/proton/receiver_options.hpp
@@ -81,6 +81,9 @@ class receiver_options {
     /// Copy options.
     PN_CPP_EXTERN receiver_options& operator=(const receiver_options&);
 
+    /// Merge with another option set
+    PN_CPP_EXTERN void update(const receiver_options& other);
+
     /// Set a handler for events scoped to the receiver.  If NULL,
     /// receiver-scoped events are discarded.
     PN_CPP_EXTERN receiver_options& handler(class handler *);
@@ -121,14 +124,11 @@ class receiver_options {
     /// @cond INTERNAL
   private:
     void apply(receiver &) const;
-    proton_handler* handler() const;
-    PN_CPP_EXTERN void update(const receiver_options& other);
 
     class impl;
     internal::pn_unique_ptr<impl> impl_;
 
     friend class receiver;
-    friend class container_impl;
     /// @endcond
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/include/proton/sasl.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/sasl.hpp b/proton-c/bindings/cpp/include/proton/sasl.hpp
index e9a7731..eee6b96 100644
--- a/proton-c/bindings/cpp/include/proton/sasl.hpp
+++ b/proton-c/bindings/cpp/include/proton/sasl.hpp
@@ -67,16 +67,9 @@ class sasl {
 
     /// @cond INTERNAL
   private:
-    void allow_insecure_mechs(bool);
-    bool allow_insecure_mechs();
-    void allowed_mechs(const std::string &);
-    void config_name(const std::string&);
-    void config_path(const std::string&);
-
     pn_sasl_t* const object_;
 
     friend class internal::factory<sasl>;
-    friend class connection_options;
     /// @endcond
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/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 e620ebe..7fff04a 100644
--- a/proton-c/bindings/cpp/include/proton/sender.hpp
+++ b/proton-c/bindings/cpp/include/proton/sender.hpp
@@ -61,8 +61,6 @@ PN_CPP_CLASS_EXTERN sender : public link
   /// @cond INTERNAL
   friend class internal::factory<sender>;
   friend class sender_iterator;
-  friend class source;
-  friend class target;
   /// @endcond
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/include/proton/sender_options.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/sender_options.hpp b/proton-c/bindings/cpp/include/proton/sender_options.hpp
index d42880c..2aab021 100644
--- a/proton-c/bindings/cpp/include/proton/sender_options.hpp
+++ b/proton-c/bindings/cpp/include/proton/sender_options.hpp
@@ -80,6 +80,9 @@ class sender_options {
     /// Copy options.
     PN_CPP_EXTERN sender_options& operator=(const sender_options&);
 
+    /// Merge with another option set
+    PN_CPP_EXTERN void update(const sender_options& other);
+
     /// Set a handler for events scoped to the sender.  If NULL,
     /// sender-scoped events are discarded.
     PN_CPP_EXTERN sender_options& handler(class handler *);
@@ -100,14 +103,11 @@ class sender_options {
     /// @cond INTERNAL
   private:
     void apply(sender&) const;
-    proton_handler* handler() const;
-    PN_CPP_EXTERN void update(const sender_options& other);
 
     class impl;
     internal::pn_unique_ptr<impl> impl_;
 
     friend class sender;
-    friend class container_impl;
     /// @endcond
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/include/proton/session.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/session.hpp b/proton-c/bindings/cpp/include/proton/session.hpp
index df4d153..33efd30 100644
--- a/proton-c/bindings/cpp/include/proton/session.hpp
+++ b/proton-c/bindings/cpp/include/proton/session.hpp
@@ -91,9 +91,7 @@ PN_CPP_CLASS_EXTERN session : public internal::object<pn_session_t>, public endp
     /// Return the receivers on this session.
     PN_CPP_EXTERN receiver_range receivers() const;
 
-  friend class sender_iterator;
-  friend class receiver_iterator;
-  friend class session_iterator;
+    friend class internal::factory<session>;
 };
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/include/proton/source.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/source.hpp b/proton-c/bindings/cpp/include/proton/source.hpp
index e34632b..218610d 100644
--- a/proton-c/bindings/cpp/include/proton/source.hpp
+++ b/proton-c/bindings/cpp/include/proton/source.hpp
@@ -47,10 +47,9 @@ class source : public terminus {
     source(pn_terminus_t* t);
     source(const sender&);
     source(const receiver&);
+  friend class internal::factory<source>;
   friend class sender;
   friend class receiver;
-  friend class sender_options;
-  friend class receiver_options;
     /// @endcond
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/include/proton/target.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/target.hpp b/proton-c/bindings/cpp/include/proton/target.hpp
index 1658b26..ca7dc69 100644
--- a/proton-c/bindings/cpp/include/proton/target.hpp
+++ b/proton-c/bindings/cpp/include/proton/target.hpp
@@ -47,10 +47,9 @@ class target : public terminus {
     target(pn_terminus_t* t);
     target(const sender&);
     target(const receiver&);
+  friend class internal::factory<target>;
   friend class sender;
   friend class receiver;
-  friend class sender_options;
-  friend class receiver_options;
     /// @endcond
 
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/include/proton/terminus.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/terminus.hpp b/proton-c/bindings/cpp/include/proton/terminus.hpp
index 99f5f13..d73717b 100644
--- a/proton-c/bindings/cpp/include/proton/terminus.hpp
+++ b/proton-c/bindings/cpp/include/proton/terminus.hpp
@@ -78,26 +78,17 @@ class terminus {
     PN_CPP_EXTERN const value& filter() const;
 
     /// @cond INTERNAL
+  protected:
+    pn_terminus_t *pn_object() { return object_; }
   private:
-    void address(const std::string &);
-    void expiry_policy(enum expiry_policy);
-    void timeout(duration);
-    void distribution_mode(enum distribution_mode);
-    void durability_mode(enum durability_mode);
-    void dynamic(bool);
-    value& node_properties();
-    value& filter();
-
     pn_terminus_t* object_;
     value properties_, filter_;
     pn_link_t* parent_;
 
 
     friend class internal::factory<terminus>;
-    friend class internal::noderef;
     friend class source;
     friend class target;
-    friend class source_options;
     /// @endcond
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/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
index 67c3a42..f37984d 100644
--- a/proton-c/bindings/cpp/include/proton/transfer.hpp
+++ b/proton-c/bindings/cpp/include/proton/transfer.hpp
@@ -77,17 +77,7 @@ class transfer : public internal::object<pn_delivery_t> {
     /// 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 internal::factory<transfer>;
-  friend class messaging_adapter;
     /// @endcond
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/include/proton/transport.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/transport.hpp b/proton-c/bindings/cpp/include/proton/transport.hpp
index 6b94696..590bac0 100644
--- a/proton-c/bindings/cpp/include/proton/transport.hpp
+++ b/proton-c/bindings/cpp/include/proton/transport.hpp
@@ -72,11 +72,6 @@ class transport : public internal::object<pn_transport_t> {
 
     /// @cond INTERNAL
     friend class internal::factory<transport>;
-    friend class connection;
-    friend class connection_options;
-    friend class connector;
-    friend class io::connection_engine;
-    friend class messaging_adapter;
     /// @endcond
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/src/connection.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/connection.cpp b/proton-c/bindings/cpp/src/connection.cpp
index 5fb4268..954973d 100644
--- a/proton-c/bindings/cpp/src/connection.cpp
+++ b/proton-c/bindings/cpp/src/connection.cpp
@@ -43,7 +43,7 @@
 namespace proton {
 
 transport connection::transport() const {
-    return pn_connection_transport(pn_object());
+    return make_wrapper(pn_connection_transport(pn_object()));
 }
 
 void connection::open() {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/src/connection_options.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/connection_options.cpp b/proton-c/bindings/cpp/src/connection_options.cpp
index e655a68..d5eff82 100644
--- a/proton-c/bindings/cpp/src/connection_options.cpp
+++ b/proton-c/bindings/cpp/src/connection_options.cpp
@@ -29,6 +29,7 @@
 #include "connector.hpp"
 #include "messaging_adapter.hpp"
 #include "msg.hpp"
+#include "proton_bits.hpp"
 
 #include "proton/connection.h"
 #include "proton/transport.h"
@@ -63,7 +64,7 @@ class connection_options::impl {
     option<std::string> sasl_config_path;
 
     void apply(connection& c) {
-        pn_connection_t *pnc = connection_options::pn_connection(c);
+        pn_connection_t *pnc = unwrap(c);
         pn_transport_t *pnt = pn_connection_transport(pnc);
         connector *outbound = dynamic_cast<connector*>(
             connection_context::get(c).handler.get());
@@ -92,18 +93,17 @@ class connection_options::impl {
             }
 
             // SASL
-            transport t = c.transport();
             if (!sasl_enabled.set || sasl_enabled.value) {
                 if (sasl_enabled.set)  // Explicitly set, not just default behaviour.
-                    t.sasl();          // Force a sasl instance.  Lazily create one otherwise.
+                    pn_sasl(pnt);          // Force a sasl instance.  Lazily create one otherwise.
                 if (sasl_allow_insecure_mechs.set)
-                    t.sasl().allow_insecure_mechs(sasl_allow_insecure_mechs.value);
+                    pn_sasl_set_allow_insecure_mechs(pn_sasl(pnt), sasl_allow_insecure_mechs.value);
                 if (sasl_allowed_mechs.set)
-                    t.sasl().allowed_mechs(sasl_allowed_mechs.value);
+                    pn_sasl_allowed_mechs(pn_sasl(pnt), sasl_allowed_mechs.value.c_str());
                 if (sasl_config_name.set)
-                    t.sasl().config_name(sasl_config_name.value);
+                    pn_sasl_config_name(pn_sasl(pnt), sasl_config_name.value.c_str());
                 if (sasl_config_path.set)
-                    t.sasl().config_path(sasl_config_path.value);
+                    pn_sasl_config_path(pn_sasl(pnt), sasl_config_path.value.c_str());
             }
 
             if (max_frame_size.set)
@@ -185,8 +185,5 @@ connection_options& connection_options::sasl_config_name(const std::string &n) {
 connection_options& connection_options::sasl_config_path(const std::string &p) { impl_->sasl_config_path = p; return *this; }
 
 void connection_options::apply(connection& c) const { impl_->apply(c); }
-class ssl_client_options &connection_options::ssl_client_options() { return impl_->ssl_client_options.value; }
-class ssl_server_options &connection_options::ssl_server_options() { return impl_->ssl_server_options.value; }
 proton_handler* connection_options::handler() const { return impl_->handler.value; }
-pn_connection_t* connection_options::pn_connection(connection &c) { return c.pn_object(); }
 } // namespace proton

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/src/connector.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/connector.cpp b/proton-c/bindings/cpp/src/connector.cpp
index 9aca9a0..f2e1776 100644
--- a/proton-c/bindings/cpp/src/connector.cpp
+++ b/proton-c/bindings/cpp/src/connector.cpp
@@ -30,6 +30,7 @@
 #include "proton/sasl.hpp"
 
 #include "container_impl.hpp"
+#include "proton_bits.hpp"
 #include "proton_event.hpp"
 
 #include "proton/connection.h"
@@ -62,7 +63,7 @@ void connector::reconnect_timer(const class reconnect_timer &rt) {
 void connector::connect() {
     connection_.host(address_.host_port());
     pn_transport_t *pnt = pn_transport();
-    transport t(pnt);
+    transport t(make_wrapper(pnt));
     if (!address_.username().empty())
         connection_.user(address_.username());
     if (!address_.password().empty())

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/src/container_impl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/container_impl.cpp b/proton-c/bindings/cpp/src/container_impl.cpp
index ce7b0d5..62e626f 100644
--- a/proton-c/bindings/cpp/src/container_impl.cpp
+++ b/proton-c/bindings/cpp/src/container_impl.cpp
@@ -153,7 +153,7 @@ connection container_impl::connect(const proton::url &url, const connection_opti
     connection_context& cc(connection_context::get(conn));
     cc.handler.reset(ctor.release());
     cc.link_gen.prefix(id_gen_.next() + "/");
-    pn_connection_set_container(conn.pn_object(), id_.c_str());
+    pn_connection_set_container(unwrap(conn), id_.c_str());
 
     conn.open();
     return conn;
@@ -221,10 +221,10 @@ void container_impl::receiver_options(const proton::receiver_options &opts) {
 }
 
 void container_impl::configure_server_connection(connection &c) {
-    pn_acceptor_t *pnp = pn_connection_acceptor(connection_options::pn_connection(c));
+    pn_acceptor_t *pnp = pn_connection_acceptor(unwrap(c));
     listener_context &lc(listener_context::get(pnp));
     connection_context::get(c).link_gen.prefix(id_gen_.next() + "/");
-    pn_connection_set_container(c.pn_object(), id_.c_str());
+    pn_connection_set_container(unwrap(c), id_.c_str());
     lc.connection_options.apply(c);
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/src/contexts.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/contexts.cpp b/proton-c/bindings/cpp/src/contexts.cpp
index 99b05a1..173764e 100644
--- a/proton-c/bindings/cpp/src/contexts.cpp
+++ b/proton-c/bindings/cpp/src/contexts.cpp
@@ -22,6 +22,7 @@
 #include "contexts.hpp"
 #include "msg.hpp"
 #include "reactor.hpp"
+#include "proton_bits.hpp"
 
 #include "proton/error.hpp"
 
@@ -76,6 +77,10 @@ context::id connection_context::id(pn_connection_t* c) {
     return context::id(pn_connection_attachments(c), CONNECTION_CONTEXT);
 }
 
+context::id connection_context::id(const connection& c) {
+    return id(unwrap(c));
+}
+
 void container_context::set(const reactor& r, container& c) {
     set_context(pn_reactor_attachments(r.pn_object()), CONTAINER_CONTEXT, PN_VOID, &c);
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/src/contexts.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/contexts.hpp b/proton-c/bindings/cpp/src/contexts.hpp
index 0aa539e..0305b8a 100644
--- a/proton-c/bindings/cpp/src/contexts.hpp
+++ b/proton-c/bindings/cpp/src/contexts.hpp
@@ -40,9 +40,9 @@ struct pn_acceptor_t;
 namespace proton {
 
 class proton_handler;
+class reactor;
 class work_queue;
 
-
 // Base class for C++ classes that are used as proton contexts.
 // Contexts are pn_objects managed by pn reference counts, the C++ value is allocated in-place.
 class context {
@@ -98,7 +98,7 @@ class connection_context : public context {
 
   protected:
     static context::id id(pn_connection_t*);
-    static context::id id(const connection& c) { return id(c.pn_object()); }
+    static context::id id(const connection& c);
 };
 
 void container_context(const reactor&, container&);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/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 b60a0b3..7effc52 100644
--- a/proton-c/bindings/cpp/src/delivery.cpp
+++ b/proton-c/bindings/cpp/src/delivery.cpp
@@ -30,7 +30,4 @@ namespace proton {
 delivery::delivery(pn_delivery_t* d): transfer(make_wrapper(d)) {}
 receiver delivery::receiver() const { return make_wrapper<class receiver>(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()); }
-size_t delivery::pending() const { return pn_delivery_pending(pn_object()); }
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/src/io/connection_engine.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/io/connection_engine.cpp b/proton-c/bindings/cpp/src/io/connection_engine.cpp
index ffef3b7..045ae66 100644
--- a/proton-c/bindings/cpp/src/io/connection_engine.cpp
+++ b/proton-c/bindings/cpp/src/io/connection_engine.cpp
@@ -44,19 +44,19 @@ namespace io {
 
 connection_engine::connection_engine(class handler &h, const connection_options& opts):
     handler_(h),
-    connection_(internal::take_ownership(pn_connection()).get()),
-    transport_(internal::take_ownership(pn_transport()).get()),
+    connection_(make_wrapper(internal::take_ownership(pn_connection()).get())),
+    transport_(make_wrapper(internal::take_ownership(pn_transport()).get())),
     collector_(internal::take_ownership(pn_collector()).get())
 {
     if (!connection_ || !transport_ || !collector_)
         throw proton::error("engine create");
     transport_.bind(connection_);
-    pn_connection_collect(connection_.pn_object(), collector_.get());
+    pn_connection_collect(unwrap(connection_), collector_.get());
     opts.apply(connection_);
 
     // Provide local random defaults for connection_id and link_prefix if not by opts.
     if (connection_.container_id().empty())
-        pn_connection_set_container(connection_.pn_object(), uuid::random().str().c_str());
+        pn_connection_set_container(unwrap(connection_), uuid::random().str().c_str());
     id_generator &link_gen = connection_context::get(connection_).link_gen;
     if (link_gen.prefix().empty())
         link_gen.prefix(uuid::random().str()+"/");
@@ -81,45 +81,45 @@ bool connection_engine::dispatch() {
         }
         pn_collector_pop(collector_.get());
     }
-    return !(pn_transport_closed(transport_.pn_object()));
+    return !(pn_transport_closed(unwrap(transport_)));
 }
 
 mutable_buffer connection_engine::read_buffer() {
-    ssize_t cap = pn_transport_capacity(transport_.pn_object());
+    ssize_t cap = pn_transport_capacity(unwrap(transport_));
     if (cap > 0)
-        return mutable_buffer(pn_transport_tail(transport_.pn_object()), cap);
+        return mutable_buffer(pn_transport_tail(unwrap(transport_)), cap);
     else
         return mutable_buffer(0, 0);
 }
 
 void connection_engine::read_done(size_t n) {
     if (n > 0)
-        pn_transport_process(transport_.pn_object(), n);
+        pn_transport_process(unwrap(transport_), n);
 }
 
 void connection_engine::read_close() {
-    pn_transport_close_tail(transport_.pn_object());
+    pn_transport_close_tail(unwrap(transport_));
 }
 
 const_buffer connection_engine::write_buffer() const {
-    ssize_t pending = pn_transport_pending(transport_.pn_object());
+    ssize_t pending = pn_transport_pending(unwrap(transport_));
     if (pending > 0)
-        return const_buffer(pn_transport_head(transport_.pn_object()), pending);
+        return const_buffer(pn_transport_head(unwrap(transport_)), pending);
     else
         return const_buffer(0, 0);
 }
 
 void connection_engine::write_done(size_t n) {
     if (n > 0)
-        pn_transport_pop(transport_.pn_object(), n);
+        pn_transport_pop(unwrap(transport_), n);
 }
 
 void connection_engine::write_close() {
-    pn_transport_close_head(transport_.pn_object());
+    pn_transport_close_head(unwrap(transport_));
 }
 
 void connection_engine::close(const proton::error_condition& err) {
-    set_error_condition(err, pn_transport_condition(transport_.pn_object()));
+    set_error_condition(err, pn_transport_condition(unwrap(transport_)));
     read_close();
     write_close();
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/src/link.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/link.cpp b/proton-c/bindings/cpp/src/link.cpp
index a12fcdb..02a061d 100644
--- a/proton-c/bindings/cpp/src/link.cpp
+++ b/proton-c/bindings/cpp/src/link.cpp
@@ -70,45 +70,18 @@ class session link::session() const {
     return pn_link_session(pn_object());
 }
 
-void link::handler(proton_handler &h) {
-    pn_record_t *record = pn_link_attachments(pn_object());
-    internal::pn_ptr<pn_handler_t> chandler = connection().container().impl_->cpp_handler(&h);
-    pn_record_set_handler(record, chandler.get());
-}
-
-void link::detach_handler() {
-    pn_record_t *record = pn_link_attachments(pn_object());
-    pn_record_set_handler(record, 0);
-}
-
 error_condition link::error() const {
     return make_wrapper(pn_link_remote_condition(pn_object()));
 }
 
-ssize_t link::recv(char* buffer, size_t size) {
-    return pn_link_recv(pn_object(), buffer, size);
-}
-
-bool link::advance() {
-    return pn_link_advance(pn_object());
-}
-
 sender_options::sender_settle_mode link::sender_settle_mode() {
     return (sender_options::sender_settle_mode) pn_link_snd_settle_mode(pn_object());
 }
 
-void link::sender_settle_mode(sender_options::sender_settle_mode mode) {
-    pn_link_set_snd_settle_mode(pn_object(), (pn_snd_settle_mode_t) mode);
-}
-
 receiver_options::receiver_settle_mode link::receiver_settle_mode() {
     return (receiver_options::receiver_settle_mode) pn_link_rcv_settle_mode(pn_object());
 }
 
-void link::receiver_settle_mode(receiver_options::receiver_settle_mode mode) {
-    pn_link_set_rcv_settle_mode(pn_object(), (pn_rcv_settle_mode_t) mode);
-}
-
 sender_options::sender_settle_mode link::remote_sender_settle_mode() {
     return (sender_options::sender_settle_mode) pn_link_remote_snd_settle_mode(pn_object());
 }
@@ -117,8 +90,4 @@ receiver_options::receiver_settle_mode link::remote_receiver_settle_mode() {
     return (receiver_options::receiver_settle_mode) pn_link_remote_rcv_settle_mode(pn_object());
 }
 
-link_context &link::context() {
-    return link_context::get(pn_object());
-}
-
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/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 0f653c6..0ca5d61 100644
--- a/proton-c/bindings/cpp/src/message.cpp
+++ b/proton-c/bindings/cpp/src/message.cpp
@@ -291,13 +291,13 @@ void message::decode(const std::vector<char> &s) {
 
 void message::decode(proton::delivery delivery) {
     std::vector<char> buf;
-    buf.resize(delivery.pending());
+    buf.resize(pn_delivery_pending(unwrap(delivery)));
     proton::receiver link = delivery.receiver();
-    ssize_t n = link.recv(const_cast<char *>(&buf[0]), buf.size());
+    ssize_t n = pn_link_recv(unwrap(link), const_cast<char *>(&buf[0]), buf.size());
     if (n != ssize_t(buf.size())) throw error(MSG("receiver read failure"));
     clear();
     decode(buf);
-    link.advance();
+    pn_link_advance(unwrap(link));
 }
 
 bool message::durable() const { return pn_message_is_durable(pn_msg()); }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/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 ac362bc..8ac377e 100644
--- a/proton-c/bindings/cpp/src/messaging_adapter.cpp
+++ b/proton-c/bindings/cpp/src/messaging_adapter.cpp
@@ -87,7 +87,7 @@ void messaging_adapter::on_delivery(proton_event &pe) {
 
     if (pn_link_is_receiver(lnk)) {
         delivery d(make_wrapper<delivery>(dlv));
-        if (!d.partial() && d.readable()) {
+        if (!pn_delivery_partial(dlv) && pn_delivery_readable(dlv)) {
             // generate on_message
             pn_connection_t *pnc = pn_session_connection(pn_link_session(lnk));
             connection_context& ctx = connection_context::get(pnc);
@@ -105,15 +105,15 @@ void messaging_adapter::on_delivery(proton_event &pe) {
                     d.accept();
             }
         }
-        else if (d.updated() && d.settled()) {
+        else if (pn_delivery_updated(dlv) && d.settled()) {
             delegate_.on_delivery_settle(d);
         }
         credit_topup(lnk);
     } else {
         tracker t(make_wrapper<tracker>(dlv));
         // sender
-        if (t.updated()) {
-            uint64_t rstate = t.state();
+        if (pn_delivery_updated(dlv)) {
+            uint64_t rstate = pn_delivery_remote_state(dlv);
             if (rstate == PN_ACCEPTED) {
                 delegate_.on_tracker_accept(t);
             }
@@ -239,7 +239,7 @@ void messaging_adapter::on_transport_tail_closed(proton_event &pe) {
     pn_connection_t *conn = pn_event_connection(pe.pn_event());
     if (conn && is_local_open(pn_connection_state(conn))) {
         pn_transport_t *tspt = pn_event_transport(pe.pn_event());
-        transport t(tspt);
+        transport t(make_wrapper(tspt));
         if (pn_condition_is_set(pn_transport_condition(tspt))) {
             delegate_.on_transport_error(t);
         }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/src/node_options.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/node_options.cpp b/proton-c/bindings/cpp/src/node_options.cpp
index 56c823c..b8438fa 100644
--- a/proton-c/bindings/cpp/src/node_options.cpp
+++ b/proton-c/bindings/cpp/src/node_options.cpp
@@ -24,6 +24,10 @@
 #include "proton/target_options.hpp"
 #include "proton/target.hpp"
 
+#include "proton_bits.hpp"
+
+#include <limits>
+
 namespace proton {
 
 template <class T> struct option {
@@ -35,42 +39,50 @@ template <class T> struct option {
     void update(const option<T>& x) { if (x.set) *this = x.value; }
 };
 
-namespace internal {
-class noderef {
-    // friend class to handle private access on terminus.  TODO: change to newer single friend mechanism.
-  public:
-    static void address(terminus &t, const std::string &s) { t.address(s); }
-    static void dynamic(terminus &t, bool b) { t.dynamic(b); }
-    static void durability_mode(terminus &t, enum durability_mode m) { t.durability_mode(m); }
-    static void expiry_policy(terminus &t, enum expiry_policy p) { t.expiry_policy(p); }
-    static void timeout(terminus &t, duration d) { t.timeout(d); }
-};
+namespace {
+    void address(terminus &t, const std::string &s) { pn_terminus_set_address(unwrap(t), s.c_str()); }
+    void set_dynamic(terminus &t, bool b) { pn_terminus_set_dynamic(unwrap(t), b); }
+    void durability_mode(terminus &t, enum durability_mode m) { pn_terminus_set_durability(unwrap(t), pn_durability_t(m)); }
+    void expiry_policy(terminus &t, enum expiry_policy p) { pn_terminus_set_expiry_policy(unwrap(t), pn_expiry_policy_t(p)); }
+    void timeout(terminus &t, duration d) {
+      uint32_t seconds = 0;
+      if (d == duration::FOREVER)
+        seconds = std::numeric_limits<uint32_t>::max();
+      else if (d != duration::IMMEDIATE) {
+        uint64_t x = d.milliseconds();
+        if ((std::numeric_limits<uint64_t>::max() - x) <= 500)
+          seconds = std::numeric_limits<uint32_t>::max();
+        else {
+          x = (x + 500) / 1000;
+          seconds = x < std::numeric_limits<uint32_t>::max() ? x : std::numeric_limits<uint32_t>::max();
+        }
+      }
+      pn_terminus_set_timeout(unwrap(t), seconds);
+    }
 }
 
 namespace {
 
 // Options common to sources and targets
 
-using internal::noderef;
-
 void node_address(terminus &t, option<std::string> &addr, option<bool> &dynamic) {
     if (dynamic.set && dynamic.value) {
-        noderef::dynamic(t, true);
+        set_dynamic(t, true);
         // Ignore any addr value for dynamic.
         return;
     }
     if (addr.set) {
-        noderef::address(t, addr.value);
+        address(t, addr.value);
     }
 }
 
 void node_durability(terminus &t, option<enum durability_mode> &mode) {
-    if (mode.set) noderef::durability_mode(t, mode.value);
+    if (mode.set) durability_mode(t, mode.value);
 }
 
 void node_expiry(terminus &t, option<enum expiry_policy> &policy, option<duration> &d) {
-    if (policy.set) noderef::expiry_policy(t, policy.value);
-    if (d.set) noderef::timeout(t, d.value);
+    if (policy.set) expiry_policy(t, policy.value);
+    if (d.set) timeout(t, d.value);
 }
 
 }
@@ -89,7 +101,8 @@ class source_options::impl {
         node_address(s, address, dynamic);
         node_durability(s, durability_mode);
         node_expiry(s, expiry_policy, timeout);
-        if (distribution_mode.set) s.distribution_mode(distribution_mode.value);
+        if (distribution_mode.set)
+          pn_terminus_set_distribution_mode(unwrap(s), pn_distribution_mode_t(distribution_mode.value));
     }
 
     void update(const impl& x) {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/src/proton_bits.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_bits.hpp b/proton-c/bindings/cpp/src/proton_bits.hpp
index 6a4f5f3..6cf6322 100644
--- a/proton-c/bindings/cpp/src/proton_bits.hpp
+++ b/proton-c/bindings/cpp/src/proton_bits.hpp
@@ -42,10 +42,6 @@ struct pn_terminus_t;
 
 namespace proton {
 
-namespace internal {
-class terminus;
-}
-
 class transport;
 class sasl;
 class ssl;
@@ -59,6 +55,9 @@ class tracker;
 class delivery;
 class error_condition;
 class acceptor;
+class terminus;
+class source;
+class target;
 
 std::string error_str(long code);
 
@@ -94,6 +93,8 @@ template <> struct wrapped<delivery> { typedef pn_delivery_t type; };
 template <> struct wrapped<error_condition> { typedef pn_condition_t type; };
 template <> struct wrapped<acceptor> { typedef pn_acceptor_t type; };
 template <> struct wrapped<terminus> { typedef pn_terminus_t type; };
+template <> struct wrapped<source> { typedef pn_terminus_t type; };
+template <> struct wrapped<target> { typedef pn_terminus_t type; };
 
 template <class T> struct wrapper {};
 template <> struct wrapper<pn_transport_t> { typedef transport type; };
@@ -111,16 +112,20 @@ template <> struct wrapper<pn_terminus_t> { typedef terminus type; };
 template <class T>
 class factory {
 public:
-    static T make(typename wrapped<T>::type* t) { return t; }
+    static T wrap(typename wrapped<T>::type* t) { return t; }
+    static typename wrapped<T>::type* unwrap(T t) { return t.pn_object(); }
 };
 
 }
 
 template <class T>
-typename internal::wrapper<T>::type make_wrapper(T* t) { return internal::factory<typename internal::wrapper<T>::type>::make(t); }
+typename internal::wrapper<T>::type make_wrapper(T* t) { return internal::factory<typename internal::wrapper<T>::type>::wrap(t); }
 
 template <class U>
-U make_wrapper(typename internal::wrapped<U>::type* t) { return internal::factory<U>::make(t); }
+U make_wrapper(typename internal::wrapped<U>::type* t) { return internal::factory<U>::wrap(t); }
+
+template <class T>
+typename internal::wrapped<T>::type* unwrap(T t) {return internal::factory<T>::unwrap(t); }
 
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/src/receiver_options.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/receiver_options.cpp b/proton-c/bindings/cpp/src/receiver_options.cpp
index 1831d11..e2eb416 100644
--- a/proton-c/bindings/cpp/src/receiver_options.cpp
+++ b/proton-c/bindings/cpp/src/receiver_options.cpp
@@ -19,19 +19,16 @@
  *
  */
 
-#include "proton/binary.hpp"
-#include "proton/receiver.hpp"
 #include "proton/receiver_options.hpp"
 #include "proton/handler.hpp"
-#include "proton/settings.hpp"
 #include "proton/source_options.hpp"
 #include "proton/target_options.hpp"
 
 #include "proton/link.h"
 
 #include "contexts.hpp"
+#include "container_impl.hpp"
 #include "messaging_adapter.hpp"
-#include "msg.hpp"
 #include "proton_bits.hpp"
 
 namespace proton {
@@ -46,6 +43,30 @@ template <class T> struct option {
 };
 
 class receiver_options::impl {
+    static void set_handler(receiver l, proton_handler &h) {
+        pn_record_t *record = pn_link_attachments(unwrap(l));
+        internal::pn_ptr<pn_handler_t> chandler = connection().container().impl_->cpp_handler(&h);
+        pn_record_set_handler(record, chandler.get());
+    }
+
+    static link_context& get_context(receiver l) {
+        return link_context::get(unwrap(l));
+    }
+
+    static void set_delivery_mode(receiver l, enum delivery_mode mode) {
+        switch (mode) {
+        case AT_MOST_ONCE:
+            pn_link_set_snd_settle_mode(unwrap(l), PN_SND_SETTLED);
+            break;
+        case AT_LEAST_ONCE:
+            pn_link_set_snd_settle_mode(unwrap(l), PN_SND_UNSETTLED);
+            pn_link_set_rcv_settle_mode(unwrap(l), PN_RCV_FIRST);
+            break;
+        default:
+            break;
+        }
+    }
+
   public:
     option<proton_handler*> handler;
     option<enum delivery_mode> delivery_mode;
@@ -59,37 +80,18 @@ class receiver_options::impl {
 
     void apply(receiver& r) {
         if (r.uninitialized()) {
-            if (delivery_mode.set) {
-                switch (delivery_mode.value) {
-                case AT_MOST_ONCE:
-                    r.sender_settle_mode(sender_options::SETTLED);
-                    break;
-                case AT_LEAST_ONCE:
-                    r.sender_settle_mode(sender_options::UNSETTLED);
-                    r.receiver_settle_mode(receiver_options::SETTLE_ALWAYS);
-                    break;
-                default:
-                    break;
-                }
-            }
-            if (handler.set) {
-                if (handler.value)
-                    r.handler(*handler.value);
-                else
-                    r.detach_handler();
-            }
-
-            if (auto_settle.set) r.context().auto_settle = auto_settle.value;
-            if (auto_accept.set) r.context().auto_accept = auto_accept.value;
-            if (credit_window.set) r.context().credit_window = credit_window.value;
+            if (delivery_mode.set) set_delivery_mode(r, delivery_mode.value);
+            if (handler.set && handler.value) set_handler(r, *handler.value);
+            if (auto_settle.set) get_context(r).auto_settle = auto_settle.value;
+            if (auto_accept.set) get_context(r).auto_accept = auto_accept.value;
+            if (credit_window.set) get_context(r).credit_window = credit_window.value;
 
-            terminus local_src(make_wrapper(pn_link_source(r.pn_object())));
             if (source.set) {
-                proton::source local_s(pn_link_source(r.pn_object()));
+                proton::source local_s(make_wrapper<proton::source>(pn_link_source(unwrap(r))));
                 source.value.apply(local_s);
             }
             if (target.set) {
-                proton::target local_t(pn_link_target(r.pn_object()));
+                proton::target local_t(make_wrapper<proton::target>(pn_link_target(unwrap(r))));
                 target.value.apply(local_t);
             }
         }
@@ -131,6 +133,5 @@ receiver_options& receiver_options::target(target_options &s) {impl_->target = s
 receiver_options& receiver_options::selector(const std::string&) { return *this; }
 
 void receiver_options::apply(receiver& r) const { impl_->apply(r); }
-proton_handler* receiver_options::handler() const { return impl_->handler.value; }
 
 } // namespace proton

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/src/sasl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/sasl.cpp b/proton-c/bindings/cpp/src/sasl.cpp
index 5ce7454..73668cd 100644
--- a/proton-c/bindings/cpp/src/sasl.cpp
+++ b/proton-c/bindings/cpp/src/sasl.cpp
@@ -35,11 +35,4 @@ std::string sasl::mech() const {
     return m ? std::string(m) : std::string();
 }
 
-void sasl::allow_insecure_mechs(bool allowed) { pn_sasl_set_allow_insecure_mechs(object_, allowed); }
-bool sasl::allow_insecure_mechs() { return pn_sasl_get_allow_insecure_mechs(object_); }
-void sasl::allowed_mechs(const std::string &mechs) { pn_sasl_allowed_mechs(object_, mechs.c_str()); }
-void sasl::config_name(const std::string &name) { pn_sasl_config_name(object_, name.c_str()); }
-void sasl::config_path(const std::string &path) { pn_sasl_config_path(object_, path.c_str()); }
-
-
 } // namespace

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/src/sender_options.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/sender_options.cpp b/proton-c/bindings/cpp/src/sender_options.cpp
index a759d47..9467c9e 100644
--- a/proton-c/bindings/cpp/src/sender_options.cpp
+++ b/proton-c/bindings/cpp/src/sender_options.cpp
@@ -19,17 +19,15 @@
  *
  */
 
-#include "proton/binary.hpp"
-#include "proton/sender.hpp"
 #include "proton/sender_options.hpp"
 #include "proton/handler.hpp"
 #include "proton/source_options.hpp"
 #include "proton/target_options.hpp"
 
-#include "msg.hpp"
-#include "messaging_adapter.hpp"
+#include "container_impl.hpp"
 #include "contexts.hpp"
-
+#include "messaging_adapter.hpp"
+#include "proton_bits.hpp"
 
 namespace proton {
 
@@ -43,6 +41,30 @@ template <class T> struct option {
 };
 
 class sender_options::impl {
+    static void set_handler(sender l, proton_handler &h) {
+        pn_record_t *record = pn_link_attachments(unwrap(l));
+        internal::pn_ptr<pn_handler_t> chandler = connection().container().impl_->cpp_handler(&h);
+        pn_record_set_handler(record, chandler.get());
+    }
+
+    static link_context& get_context(sender l) {
+        return link_context::get(unwrap(l));
+    }
+
+    static void set_delivery_mode(sender l, enum delivery_mode mode) {
+        switch (mode) {
+        case AT_MOST_ONCE:
+            pn_link_set_snd_settle_mode(unwrap(l), PN_SND_SETTLED);
+            break;
+        case AT_LEAST_ONCE:
+            pn_link_set_snd_settle_mode(unwrap(l), PN_SND_UNSETTLED);
+            pn_link_set_rcv_settle_mode(unwrap(l), PN_RCV_FIRST);
+            break;
+        default:
+            break;
+        }
+    }
+
   public:
     option<proton_handler*> handler;
     option<enum delivery_mode> delivery_mode;
@@ -52,33 +74,16 @@ class sender_options::impl {
 
     void apply(sender& s) {
         if (s.uninitialized()) {
-            if (delivery_mode.set) {
-                switch (delivery_mode.value) {
-                case AT_MOST_ONCE:
-                    s.sender_settle_mode(sender_options::SETTLED);
-                    break;
-                case AT_LEAST_ONCE:
-                        s.sender_settle_mode(sender_options::UNSETTLED);
-                        s.receiver_settle_mode(receiver_options::SETTLE_ALWAYS);
-                    break;
-                default:
-                    break;
-                }
-            }
-            if (handler.set) {
-                if (handler.value)
-                    s.handler(*handler.value);
-                else
-                    s.detach_handler();
-            }
-            if (auto_settle.set) s.context().auto_settle = auto_settle.value;
+            if (delivery_mode.set) set_delivery_mode(s, delivery_mode.value);
+            if (handler.set && handler.value) set_handler(s, *handler.value);
+            if (auto_settle.set) get_context(s).auto_settle = auto_settle.value;
             if (source.set) {
-                proton::source local_src(pn_link_source(s.pn_object()));
-                source.value.apply(local_src);
+                proton::source local_s(make_wrapper<proton::source>(pn_link_source(unwrap(s))));
+                source.value.apply(local_s);
             }
             if (target.set) {
-                proton::target local_src(pn_link_target(s.pn_object()));
-                target.value.apply(local_src);
+                proton::target local_t(make_wrapper<proton::target>(pn_link_target(unwrap(s))));
+                target.value.apply(local_t);
             }
         }
     }
@@ -113,6 +118,5 @@ sender_options& sender_options::source(source_options &s) {impl_->source = s; re
 sender_options& sender_options::target(target_options &s) {impl_->target = s; return *this; }
 
 void sender_options::apply(sender& s) const { impl_->apply(s); }
-proton_handler* sender_options::handler() const { return impl_->handler.value; }
 
 } // namespace proton

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/src/session.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/session.cpp b/proton-c/bindings/cpp/src/session.cpp
index 87349c9..c620242 100644
--- a/proton-c/bindings/cpp/src/session.cpp
+++ b/proton-c/bindings/cpp/src/session.cpp
@@ -99,7 +99,7 @@ receiver_range session::receivers() const {
 
 
 session_iterator session_iterator::operator++() {
-    obj_ = pn_session_next(obj_.pn_object(), 0);
+    obj_ = pn_session_next(unwrap(obj_), 0);
     return *this;
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/src/source.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/source.cpp b/proton-c/bindings/cpp/src/source.cpp
index c955e14..26de203 100644
--- a/proton-c/bindings/cpp/src/source.cpp
+++ b/proton-c/bindings/cpp/src/source.cpp
@@ -32,9 +32,9 @@ namespace proton {
 // Set parent_ non-null when the local terminus is authoritative and may need to be looked up.
 source::source(pn_terminus_t *t) : terminus(make_wrapper(t)) {}
 
-source::source(const sender& snd) : terminus(make_wrapper(pn_link_remote_source(snd.pn_object()))) { parent_ = snd.pn_object(); }
+source::source(const sender& snd) : terminus(make_wrapper(pn_link_remote_source(unwrap(snd)))) { parent_ = unwrap(snd); }
 
-source::source(const receiver& rcv) : terminus(make_wrapper(pn_link_remote_source(rcv.pn_object()))) {}
+source::source(const receiver& rcv) : terminus(make_wrapper(pn_link_remote_source(unwrap(rcv)))) {}
 
 std::string source::address() const {
     pn_terminus_t *authoritative = object_;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/src/target.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/target.cpp b/proton-c/bindings/cpp/src/target.cpp
index 2f48bf9..2085601 100644
--- a/proton-c/bindings/cpp/src/target.cpp
+++ b/proton-c/bindings/cpp/src/target.cpp
@@ -31,8 +31,8 @@ namespace proton {
 
 // Set parent_ non-null when the local terminus is authoritative and may need to be looked up.
 target::target(pn_terminus_t *t) : terminus(make_wrapper(t)) {}
-target::target(const sender& snd) : terminus(make_wrapper(pn_link_remote_target(snd.pn_object()))) {}
-target::target(const receiver& rcv) : terminus(make_wrapper(pn_link_remote_target(rcv.pn_object()))) { parent_ = rcv.pn_object(); }
+target::target(const sender& snd) : terminus(make_wrapper(pn_link_remote_target(unwrap(snd)))) {}
+target::target(const receiver& rcv) : terminus(make_wrapper(pn_link_remote_target(unwrap(rcv)))) { parent_ = unwrap(rcv); }
 
 std::string target::address() const {
     pn_terminus_t *authoritative = object_;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/proton-c/bindings/cpp/src/terminus.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/terminus.cpp b/proton-c/bindings/cpp/src/terminus.cpp
index 396d823..f9460bb 100644
--- a/proton-c/bindings/cpp/src/terminus.cpp
+++ b/proton-c/bindings/cpp/src/terminus.cpp
@@ -24,8 +24,6 @@
 #include "proton/link.hpp"
 #include "proton/link.h"
 
-#include <limits>
-
 namespace proton {
 
 terminus::terminus(pn_terminus_t* t) :
@@ -36,67 +34,28 @@ enum expiry_policy terminus::expiry_policy() const {
     return (enum expiry_policy)pn_terminus_get_expiry_policy(object_);
 }
 
-void terminus::expiry_policy(enum expiry_policy policy) {
-    pn_terminus_set_expiry_policy(object_, pn_expiry_policy_t(policy));
-}
-
 duration terminus::timeout() const {
     return duration::SECOND * pn_terminus_get_timeout(object_);
 }
 
-void terminus::timeout(duration d) {
-    uint32_t seconds = 0;
-    if (d == duration::FOREVER)
-        seconds = std::numeric_limits<uint32_t>::max();
-    else if (d != duration::IMMEDIATE) {
-        uint64_t x = d.milliseconds();
-        if ((std::numeric_limits<uint64_t>::max() - x) <= 500)
-            seconds = std::numeric_limits<uint32_t>::max();
-        else {
-            x = (x + 500) / 1000;
-            seconds = x < std::numeric_limits<uint32_t>::max() ? x : std::numeric_limits<uint32_t>::max();
-        }
-    }
-    pn_terminus_set_timeout(object_, seconds);
-}
-
 enum distribution_mode terminus::distribution_mode() const {
     return (enum distribution_mode)pn_terminus_get_distribution_mode(object_);
 }
 
-void terminus::distribution_mode(enum distribution_mode mode) {
-    pn_terminus_set_distribution_mode(object_, pn_distribution_mode_t(mode));
-}
-
 enum durability_mode terminus::durability_mode() {
     return (enum durability_mode) pn_terminus_get_durability(object_);
 }
 
-void terminus::durability_mode(enum durability_mode d) {
-    pn_terminus_set_durability(object_, (pn_durability_t) d);
-}
-
 std::string terminus::address() const {
     return str(pn_terminus_get_address(object_));
 }
 
-void terminus::address(const std::string &addr) {
-    pn_terminus_set_address(object_, addr.c_str());
-}
-
 bool terminus::dynamic() const {
     return pn_terminus_is_dynamic(object_);
 }
 
-void terminus::dynamic(bool d) {
-    pn_terminus_set_dynamic(object_, d);
-}
-
-value& terminus::filter() { return filter_; }
 const value& terminus::filter() const { return filter_; }
 
-
-value& terminus::node_properties() { return properties_; }
 const value& terminus::node_properties() const { return properties_; }
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1f0df2a5/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
index 3559558..4356f7f 100644
--- a/proton-c/bindings/cpp/src/transfer.cpp
+++ b/proton-c/bindings/cpp/src/transfer.cpp
@@ -48,6 +48,5 @@ void transfer::settle(enum state 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/1f0df2a5/proton-c/bindings/cpp/src/transport.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/transport.cpp b/proton-c/bindings/cpp/src/transport.cpp
index 5681ce4..b22d09a 100644
--- a/proton-c/bindings/cpp/src/transport.cpp
+++ b/proton-c/bindings/cpp/src/transport.cpp
@@ -56,7 +56,7 @@ void transport::unbind() {
 }
 
 void transport::bind(class connection &conn) {
-    if (pn_transport_bind(pn_object(), conn.pn_object()))
+    if (pn_transport_bind(pn_object(), unwrap(conn)))
         throw proton::error(MSG("transport::bind failed " << pn_error_text(pn_transport_error(pn_object()))));
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message