You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2016/10/20 12:26:29 UTC

[01/10] qpid-proton git commit: PROTON-1315: Force compilation in multi-threading mode for Solaris SunStudio

Repository: qpid-proton
Updated Branches:
  refs/heads/master 6dabb379b -> d280f8fad


PROTON-1315: Force compilation in multi-threading mode for Solaris SunStudio

Signed-off-by: aboutros <ad...@murex.com>


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

Branch: refs/heads/master
Commit: 68f64e0fbcec30b05324d46550591b0a5846f280
Parents: 3dd7be3
Author: aboutros <ad...@murex.com>
Authored: Wed Oct 5 10:52:18 2016 +0200
Committer: Alan Conway <ac...@redhat.com>
Committed: Wed Oct 19 17:14:47 2016 -0400

----------------------------------------------------------------------
 proton-c/CMakeLists.txt | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/68f64e0f/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index f2a5b76..c634113 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -109,6 +109,15 @@ elseif (SASL_IMPL STREQUAL none)
   set(pn_sasl_impl src/sasl/sasl.c src/sasl/none_sasl.c)
 endif ()
 
+# Set Compiler extra flags for Solaris when using SunStudio
+IF( ${CMAKE_CXX_COMPILER_ID} STREQUAL "SunPro" )
+    SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mt" )
+ENDIF()
+
+IF( ${CMAKE_C_COMPILER_ID} STREQUAL "SunPro" )
+    SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mt" )
+ENDIF()
+
 # Link in openssl if present
 if (SSL_IMPL STREQUAL openssl)
   set (pn_ssl_impl src/ssl/openssl.c)


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


[02/10] qpid-proton git commit: PROTON-1314: Fixing SIGPIPE ignore on Solaris OS

Posted by ac...@apache.org.
PROTON-1314: Fixing SIGPIPE ignore on Solaris OS

Signed-off-by: aboutros <ad...@murex.com>


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

Branch: refs/heads/master
Commit: 3dd7be374d0eb69dc9cf70e793de11bd765050a3
Parents: 6dabb37
Author: aboutros <ad...@murex.com>
Authored: Wed Oct 5 10:38:34 2016 +0200
Committer: Alan Conway <ac...@redhat.com>
Committed: Wed Oct 19 17:14:47 2016 -0400

----------------------------------------------------------------------
 proton-c/src/posix/io.c | 48 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 47 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3dd7be37/proton-c/src/posix/io.c
----------------------------------------------------------------------
diff --git a/proton-c/src/posix/io.c b/proton-c/src/posix/io.c
index c0dc425..27d1a35 100644
--- a/proton-c/src/posix/io.c
+++ b/proton-c/src/posix/io.c
@@ -257,7 +257,53 @@ static inline int pn_create_socket(int af, int protocol) {
   return sock;
 }
 #else
-#error "Don't know how to turn off SIGPIPE on this platform"
+
+#include <signal.h>
+
+static inline int pn_create_socket(int af, int protocol) {
+  return socket(af, SOCK_STREAM, protocol);
+}
+
+static ssize_t nosigpipe_send(int fd, const void *buffer, size_t size) {
+  sigset_t pendingSignals, oldSignals, newSignals;
+  ssize_t count;
+  int sendErrno, sigmaskErr;
+
+  sigpending(&pendingSignals);
+  int sigpipeIsPending = sigismember(&pendingSignals, SIGPIPE);
+  if (!sigpipeIsPending) {
+    sigemptyset(&newSignals);
+    sigaddset(&newSignals, SIGPIPE);
+    if (sigmaskErr = pthread_sigmask(SIG_BLOCK, (const sigset_t *)&newSignals, (sigset_t *)&oldSignals))
+    {
+      errno = sigmaskErr;
+      return -1;
+    }
+  }
+
+  count = send(fd, buffer, size, 0);
+  if (!sigpipeIsPending) {
+    sendErrno = errno;
+    if (count == -1 && errno == EPIPE) {
+      while (-1 == sigtimedwait(&newSignals, NULL, &(struct timespec){ 0, 0 }) && errno == EINTR)
+        ; //do nothing
+    }
+    if (sigmaskErr = pthread_sigmask(SIG_SETMASK, (const sigset_t *)&oldSignals, (sigset_t *)NULL))
+    {
+      errno = sigmaskErr;
+      return -1;
+    }
+    errno = sendErrno;
+  }
+  return count;
+}
+
+ssize_t pn_send(pn_io_t *io, pn_socket_t socket, const void *buf, size_t size) {
+  ssize_t count = nosigpipe_send(socket, buf, size);
+  io->wouldblock = (errno == EAGAIN || errno == EWOULDBLOCK);
+  if (count < 0) { pn_i_error_from_errno(io->error, "send"); }
+  return count;
+}
 #endif
 
 ssize_t pn_recv(pn_io_t *io, pn_socket_t socket, void *buf, size_t size)


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


[04/10] qpid-proton git commit: PROTON-1322: c++ Sunstudio: unable to find templated method

Posted by ac...@apache.org.
PROTON-1322: c++ Sunstudio: unable to find templated method

Sunstudio can't find templated method when parameter can be constructed by an
intermediate class (proton::scalar --> proton::value)

Signed-off-by: aboutros <ad...@murex.com>


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

Branch: refs/heads/master
Commit: d280f8fad07a8c38e05dc2009fd4ee7d1682a56b
Parents: af17dea
Author: aboutros <ad...@murex.com>
Authored: Fri Oct 7 17:57:07 2016 +0200
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Oct 20 08:13:52 2016 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/include/proton/value.hpp | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d280f8fa/proton-c/bindings/cpp/include/proton/value.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/value.hpp b/proton-c/bindings/cpp/include/proton/value.hpp
index 242ec68..b24f02e 100644
--- a/proton-c/bindings/cpp/include/proton/value.hpp
+++ b/proton-c/bindings/cpp/include/proton/value.hpp
@@ -160,6 +160,9 @@ template<class T> T get(const value& v) { T x; get(v, x); return x; }
 /// @related proton::value
 template<class T> void get(const value& v, T& x) { codec::decoder d(v, true); d >> x; }
 
+/// @related proton::value
+template<class T, class U> inline void get(const U& u, T& x) { const value v(u); get(v, x); }
+
 /// @copydoc scalar::coerce
 /// @related proton::value
 template<class T> T coerce(const value& v) { T x; coerce(v, x); return x; }


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


[07/10] qpid-proton git commit: PROTON-1312: c++ Sunstudio does not compile "++vector.begin()"

Posted by ac...@apache.org.
PROTON-1312: c++ Sunstudio does not compile "++vector.begin()"

Error message:"Operand for operator "++" must be an lvalue.". We used a local
variable to bypass that.

Signed-off-by: aboutros <ad...@murex.com>


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

Branch: refs/heads/master
Commit: af17dead2e31364d6741833c2884f83ae78663f8
Parents: cca892e
Author: aboutros <ad...@murex.com>
Authored: Fri Oct 7 15:03:59 2016 +0200
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Oct 20 08:13:52 2016 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/src/value_test.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/af17dead/proton-c/bindings/cpp/src/value_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/value_test.cpp b/proton-c/bindings/cpp/src/value_test.cpp
index 596cc6b..d9f0f4a 100644
--- a/proton-c/bindings/cpp/src/value_test.cpp
+++ b/proton-c/bindings/cpp/src/value_test.cpp
@@ -55,7 +55,8 @@ template <class T> void sequence_test(
     ASSERT_EQUAL(vx, v2);
 
     T y(x);
-    *y.begin() = *(++y.begin()); // Second element is bigger so y is lexicographically bigger than x
+    typename T::iterator it = y.begin();
+    *y.begin() = *(++it); // Second element is bigger so y is lexicographically bigger than x
     value vy(y);
     ASSERT(vx != vy);
     ASSERT(vx < vy);


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


[08/10] qpid-proton git commit: PROTON-1318: c++ SunStudio: Replace variadic constructor

Posted by ac...@apache.org.
PROTON-1318: c++ SunStudio: Replace variadic constructor

Variadic constructor of "sfinae::wildcard" not supported on SunStudio.

Signed-off-by: aboutros <ad...@murex.com>


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

Branch: refs/heads/master
Commit: 795278665fc90b96ec1091e878972b9112f91569
Parents: 1a20faa
Author: aboutros <ad...@murex.com>
Authored: Fri Oct 7 12:11:58 2016 +0200
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Oct 20 08:13:52 2016 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/include/proton/codec/encoder.hpp       | 8 ++++----
 .../bindings/cpp/include/proton/internal/type_traits.hpp     | 4 +++-
 2 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/79527866/proton-c/bindings/cpp/include/proton/codec/encoder.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/codec/encoder.hpp b/proton-c/bindings/cpp/include/proton/codec/encoder.hpp
index b1aff89..9183c07 100644
--- a/proton-c/bindings/cpp/include/proton/codec/encoder.hpp
+++ b/proton-c/bindings/cpp/include/proton/codec/encoder.hpp
@@ -170,15 +170,15 @@ operator<<(encoder& e, T i)  {
 }
 
 /// @cond INTERNAL
-    
-namespace is_encodable_impl {   // Protected the world from wildcard operator<<
+
+namespace is_encodable_impl {   // Protect the world from fallback operator<<
 
 using namespace internal;
 
-sfinae::no operator<<(sfinae::wildcard, sfinae::wildcard); // Fallback
+sfinae::no operator<<(encoder const&, const sfinae::any_t &); // Fallback
 
 template<typename T> struct is_encodable : public sfinae {
-    static yes test(encoder);
+    static yes test(encoder&);
     static no test(...);         // Failed test, no match.
     static encoder* e;
     static const T* t;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/79527866/proton-c/bindings/cpp/include/proton/internal/type_traits.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/internal/type_traits.hpp b/proton-c/bindings/cpp/include/proton/internal/type_traits.hpp
index 3119804..ee49a15 100644
--- a/proton-c/bindings/cpp/include/proton/internal/type_traits.hpp
+++ b/proton-c/bindings/cpp/include/proton/internal/type_traits.hpp
@@ -152,7 +152,9 @@ struct known_integer : public integer_type<sizeof(T), is_signed<T>::value> {};
 struct sfinae {
     typedef char yes;
     typedef double no;
-    struct wildcard { wildcard(...); };
+    struct any_t {
+        template < typename T > any_t(T const&);
+    };
 };
 
 template <class From, class To> struct is_convertible : public sfinae {


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


[05/10] qpid-proton git commit: PROTON-1317: c++ SunStudio: Add template parameter

Posted by ac...@apache.org.
PROTON-1317: c++ SunStudio: Add template parameter

SunStudio 12.1 doesn't handle templated method signature detection when using an
"extern c" parameter

Signed-off-by: aboutros <ad...@murex.com>


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

Branch: refs/heads/master
Commit: 1a20faa3910ecef380b47f560047eec576362ffa
Parents: dae0c55
Author: aboutros <ad...@murex.com>
Authored: Wed Oct 5 11:51:54 2016 +0200
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Oct 20 08:13:52 2016 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/src/message.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1a20faa3/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 8524782..9a9634c 100644
--- a/proton-c/bindings/cpp/src/message.cpp
+++ b/proton-c/bindings/cpp/src/message.cpp
@@ -215,7 +215,7 @@ value& message::body() { pn_msg(); return body_; }
 // empty, the non-empty one is the authority.
 
 // Decode a map on demand
-template<class M> M& get_map(pn_message_t* msg, pn_data_t* (*get)(pn_message_t*), M& map) {
+template<class M, class F> M& get_map(pn_message_t* msg, F get, M& map) {
     codec::decoder d(make_wrapper(get(msg)));
     if (map.empty() && !d.empty()) {
         d.rewind();
@@ -226,7 +226,7 @@ template<class M> M& get_map(pn_message_t* msg, pn_data_t* (*get)(pn_message_t*)
 }
 
 // Encode a map if necessary.
-template<class M> M& put_map(pn_message_t* msg, pn_data_t* (*get)(pn_message_t*), M& map) {
+template<class M, class F> M& put_map(pn_message_t* msg, F get, M& map) {
     codec::encoder e(make_wrapper(get(msg)));
     if (e.empty() && !map.empty()) {
         e << map;


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


[06/10] qpid-proton git commit: PROTON-1320: c++ Add std:: namespace prefix to srand and rand

Posted by ac...@apache.org.
PROTON-1320: c++ Add std:: namespace prefix to srand and rand

Signed-off-by: aboutros <ad...@murex.com>


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

Branch: refs/heads/master
Commit: cca892e6c7b88d0cd65aa3c1074fd4570f28d881
Parents: 8c3aa3a
Author: aboutros <ad...@murex.com>
Authored: Fri Oct 7 14:43:45 2016 +0200
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Oct 20 08:13:52 2016 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/src/container_test.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cca892e6/proton-c/bindings/cpp/src/container_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/container_test.cpp b/proton-c/bindings/cpp/src/container_test.cpp
index 1a3e2c4..062bb94 100644
--- a/proton-c/bindings/cpp/src/container_test.cpp
+++ b/proton-c/bindings/cpp/src/container_test.cpp
@@ -43,9 +43,9 @@ static std::string int2string(int n) {
 int listen_on_random_port(proton::container& c, proton::listener& l) {
     int port;
     // I'm going to hell for this:
-    srand((unsigned int)time(0));
+    std::srand((unsigned int)time(0));
     while (true) {
-        port = 20000 + (rand() % 30000);
+        port = 20000 + (std::rand() % 30000);
         try {
             l = c.listen("0.0.0.0:" + int2string(port));
             break;


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


[10/10] qpid-proton git commit: PROTON-1319: C++ SunStudo: Move internal header files of cpp bindings

Posted by ac...@apache.org.
PROTON-1319: C++ SunStudo: Move internal header files of cpp bindings

Sun compiler searches all include paths to build template-DB, creates problems
if from src files are in the path.

Signed-off-by: aboutros <ad...@murex.com>


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

Branch: refs/heads/master
Commit: 8c3aa3a5155432b5a94ff830481f0663caddce89
Parents: 7952786
Author: aboutros <ad...@murex.com>
Authored: Fri Oct 7 12:26:10 2016 +0200
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Oct 20 08:13:52 2016 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/CMakeLists.txt            |   2 +-
 proton-c/bindings/cpp/src/acceptor.hpp          |  62 ----
 proton-c/bindings/cpp/src/connector.hpp         |  65 ----
 proton-c/bindings/cpp/src/container_impl.hpp    | 124 --------
 proton-c/bindings/cpp/src/contexts.hpp          | 137 ---------
 proton-c/bindings/cpp/src/include/acceptor.hpp  |  62 ++++
 proton-c/bindings/cpp/src/include/connector.hpp |  65 ++++
 .../bindings/cpp/src/include/container_impl.hpp | 124 ++++++++
 proton-c/bindings/cpp/src/include/contexts.hpp  | 137 +++++++++
 .../cpp/src/include/messaging_adapter.hpp       |  62 ++++
 proton-c/bindings/cpp/src/include/msg.hpp       |  58 ++++
 .../bindings/cpp/src/include/proton_bits.hpp    | 149 ++++++++++
 .../bindings/cpp/src/include/proton_event.hpp   | 293 +++++++++++++++++++
 .../bindings/cpp/src/include/proton_handler.hpp |  92 ++++++
 proton-c/bindings/cpp/src/include/reactor.hpp   | 106 +++++++
 .../bindings/cpp/src/include/scalar_test.hpp    | 209 +++++++++++++
 proton-c/bindings/cpp/src/include/test_bits.hpp | 136 +++++++++
 .../cpp/src/include/test_dummy_container.hpp    |  83 ++++++
 .../bindings/cpp/src/include/types_internal.hpp |  74 +++++
 proton-c/bindings/cpp/src/messaging_adapter.hpp |  62 ----
 proton-c/bindings/cpp/src/msg.hpp               |  58 ----
 proton-c/bindings/cpp/src/proton_bits.hpp       | 149 ----------
 proton-c/bindings/cpp/src/proton_event.hpp      | 293 -------------------
 proton-c/bindings/cpp/src/proton_handler.hpp    |  92 ------
 proton-c/bindings/cpp/src/reactor.hpp           | 106 -------
 proton-c/bindings/cpp/src/scalar_test.hpp       | 209 -------------
 proton-c/bindings/cpp/src/test_bits.hpp         | 136 ---------
 .../bindings/cpp/src/test_dummy_container.hpp   |  83 ------
 proton-c/bindings/cpp/src/types_internal.hpp    |  74 -----
 29 files changed, 1651 insertions(+), 1651 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index 7709bae..ed969eb 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -22,7 +22,7 @@ include(cpp.cmake) # Compiler checks
 include_directories(
   "${CMAKE_SOURCE_DIR}/proton-c/include"
   "${CMAKE_CURRENT_SOURCE_DIR}/include"
-  "${CMAKE_CURRENT_SOURCE_DIR}/src")
+  "${CMAKE_CURRENT_SOURCE_DIR}/src/include")
 
 add_definitions(${CXX_WARNING_FLAGS})
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/acceptor.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/acceptor.hpp b/proton-c/bindings/cpp/src/acceptor.hpp
deleted file mode 100644
index 9a25592..0000000
--- a/proton-c/bindings/cpp/src/acceptor.hpp
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef PROTON_ACCEPTOR_HPP
-#define PROTON_ACCEPTOR_HPP
-
-/*
- *
- * 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/internal/export.hpp"
-#include "proton/internal/object.hpp"
-
-#include <proton/reactor.h>
-
-struct pn_acceptor_t;
-
-namespace proton {
-
-/// A context for accepting inbound connections.
-///
-/// @see container::listen
-class acceptor : public internal::object<pn_acceptor_t> {
-    /// @cond INTERNAL
-    acceptor(pn_acceptor_t* a) : internal::object<pn_acceptor_t>(a) {}
-    /// @endcond
-
-  public:
-    acceptor() : internal::object<pn_acceptor_t>(0) {}
-
-    /// Close the acceptor.
-    PN_CPP_EXTERN void close();
-
-    /// Return the current set of connection options applied to
-    /// inbound connectons by the acceptor.
-    ///
-    /// Note that changes made to the connection options only affect
-    /// connections accepted after this call returns.
-    PN_CPP_EXTERN class connection_options &connection_options();
-
-    /// @cond INTERNAL
-  friend class internal::factory<acceptor>;
-    /// @endcond
-};
-
-} // proton
-
-#endif // PROTON_ACCEPTOR_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/connector.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/connector.hpp b/proton-c/bindings/cpp/src/connector.hpp
deleted file mode 100644
index 5b6707a..0000000
--- a/proton-c/bindings/cpp/src/connector.hpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef PROTON_CPP_CONNECTOR_HANDLER_H
-#define PROTON_CPP_CONNECTOR_HANDLER_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/connection.hpp"
-#include "proton/connection_options.hpp"
-#include <proton/event.h>
-#include <proton/reactor.h>
-#include "proton/url.hpp"
-
-#include "proton_handler.hpp"
-
-#include <string>
-
-
-namespace proton {
-
-class reconnect_timer;
-
-class connector : public proton_handler
-{
-  public:
-    connector(connection &c, const connection_options &options, const url&);
-    ~connector();
-    const url &address() const { return address_; }
-    void connect();
-    void reconnect_timer(const class reconnect_timer &);
-    virtual void on_connection_local_open(proton_event &e);
-    virtual void on_connection_remote_open(proton_event &e);
-    virtual void on_connection_init(proton_event &e);
-    virtual void on_transport_closed(proton_event &e);
-    virtual void on_transport_tail_closed(proton_event &e);
-    virtual void on_timer_task(proton_event &e);
-
-  private:
-    connection connection_;
-    const connection_options options_;
-    const url address_;
-    class reconnect_timer *reconnect_timer_;
-};
-
-
-}
-
-#endif  /*!PROTON_CPP_CONNECTOR_HANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/container_impl.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/container_impl.hpp b/proton-c/bindings/cpp/src/container_impl.hpp
deleted file mode 100644
index 97f6be2..0000000
--- a/proton-c/bindings/cpp/src/container_impl.hpp
+++ /dev/null
@@ -1,124 +0,0 @@
-#ifndef PROTON_CPP_CONTAINERIMPL_H
-#define PROTON_CPP_CONTAINERIMPL_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/io/link_namer.hpp"
-
-#include "proton/container.hpp"
-#include "proton/connection.hpp"
-#include "proton/connection_options.hpp"
-#include "proton/duration.hpp"
-#include "proton/sender.hpp"
-#include "proton/receiver.hpp"
-
-#include "messaging_adapter.hpp"
-#include "reactor.hpp"
-#include "proton_bits.hpp"
-#include "proton_handler.hpp"
-
-#include <list>
-#include <map>
-#include <string>
-
-namespace proton {
-
-class dispatch_helper;
-class connection;
-class connector;
-class acceptor;
-class container;
-class url;
-class task;
-class listen_handler;
-
-class container_impl : public standard_container {
-  public:
-    // Pull in base class functions here so that name search finds all the overloads
-    using standard_container::stop;
-    using standard_container::connect;
-    using standard_container::listen;
-    using standard_container::open_receiver;
-    using standard_container::open_sender;
-
-    container_impl(const std::string& id, messaging_handler* = 0);
-    ~container_impl();
-    std::string id() const PN_CPP_OVERRIDE { return id_; }
-    returned<connection> connect(const std::string&, const connection_options&) PN_CPP_OVERRIDE;
-    returned<sender> open_sender(
-        const std::string&, const proton::sender_options &, const connection_options &) PN_CPP_OVERRIDE;
-    returned<receiver> open_receiver(
-        const std::string&, const proton::receiver_options &, const connection_options &) PN_CPP_OVERRIDE;
-    listener listen(const std::string&, listen_handler& lh) PN_CPP_OVERRIDE;
-    void stop_listening(const std::string&) PN_CPP_OVERRIDE;
-    void client_connection_options(const connection_options &) PN_CPP_OVERRIDE;
-    connection_options client_connection_options() const PN_CPP_OVERRIDE { return client_connection_options_; }
-    void server_connection_options(const connection_options &) PN_CPP_OVERRIDE;
-    connection_options server_connection_options() const PN_CPP_OVERRIDE { return server_connection_options_; }
-    void sender_options(const proton::sender_options&) PN_CPP_OVERRIDE;
-    class sender_options sender_options() const PN_CPP_OVERRIDE { return sender_options_; }
-    void receiver_options(const proton::receiver_options&) PN_CPP_OVERRIDE;
-    class receiver_options receiver_options() const PN_CPP_OVERRIDE { return receiver_options_; }
-    void run() PN_CPP_OVERRIDE;
-    void stop(const error_condition& err) PN_CPP_OVERRIDE;
-    void auto_stop(bool set) PN_CPP_OVERRIDE;
-#if PN_CPP_HAS_STD_FUNCTION
-    void schedule(duration, std::function<void()>) PN_CPP_OVERRIDE;
-#endif
-    void schedule(duration, void_function0&) PN_CPP_OVERRIDE;
-
-    // non-interface functions
-    void configure_server_connection(connection &c);
-    static task schedule(container& c, int delay, proton_handler *h);
-    template <class T> static void set_handler(T s, messaging_handler* h);
-
-  private:
-    internal::pn_ptr<pn_handler_t> cpp_handler(proton_handler *h);
-
-    typedef std::map<std::string, acceptor> acceptors;
-
-    reactor reactor_;
-    // Keep a list of all the handlers used by the container so they last as long as the container
-    std::list<internal::pn_unique_ptr<proton_handler> > handlers_;
-    std::string id_;
-    connection_options client_connection_options_;
-    connection_options server_connection_options_;
-    proton::sender_options sender_options_;
-    proton::receiver_options receiver_options_;
-    bool auto_stop_;
-    acceptors acceptors_;
-
-  friend class messaging_adapter;
-};
-
-template <class T>
-void container_impl::set_handler(T s, messaging_handler* mh) {
-    pn_record_t *record = internal::get_attachments(unwrap(s));
-    proton_handler* h = new messaging_adapter(*mh);
-    container_impl& ci = static_cast<container_impl&>(s.container());
-    ci.handlers_.push_back(h);
-    pn_record_set_handler(record, ci.cpp_handler(h).get());
-}
-
-}
-
-#endif  /*!PROTON_CPP_CONTAINERIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/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
deleted file mode 100644
index 74a763c..0000000
--- a/proton-c/bindings/cpp/src/contexts.hpp
+++ /dev/null
@@ -1,137 +0,0 @@
-#ifndef PROTON_CPP_CONTEXTS_H
-#define PROTON_CPP_CONTEXTS_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/connection.hpp"
-#include "proton/container.hpp"
-#include "proton/io/connection_engine.hpp"
-#include "proton/event_loop.hpp"
-#include "proton/listen_handler.hpp"
-#include "proton/message.hpp"
-#include "proton/internal/pn_unique_ptr.hpp"
-
-#include "proton/io/link_namer.hpp"
-
-#include "proton_handler.hpp"
-
-struct pn_session_t;
-struct pn_event_t;
-struct pn_reactor_t;
-struct pn_record_t;
-struct pn_acceptor_t;
-
-namespace proton {
-
-class proton_handler;
-class reactor;
-
-// 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 {
-  public:
-    // identifies a context, contains a record pointer and a handle.
-    typedef std::pair<pn_record_t*, pn_handle_t> id;
-
-    virtual ~context();
-
-    // Allocate a default-constructed T as a proton object.
-    // T must be a subclass of context.
-    template <class T> static T *create() { return new(alloc(sizeof(T))) T(); }
-
-    // The pn_class for a context
-    static pn_class_t* pn_class();
-
-    // Get the context identified by id as a C++ T*, return null pointer if not present.
-    template <class T> static T* ptr(id id_) {
-        return reinterpret_cast<T*>(pn_record_get(id_.first, id_.second));
-    }
-
-    // If the context is not present, create it with value x.
-    template <class T> static T& ref(id id_) {
-        T* ctx = context::ptr<T>(id_);
-        if (!ctx) {
-            ctx = create<T>();
-            pn_record_def(id_.first, id_.second, pn_class());
-            pn_record_set(id_.first, id_.second, ctx);
-            pn_decref(ctx);
-        }
-        return *ctx;
-    }
-
-  private:
-    static void *alloc(size_t n);
-};
-
-// Connection context used by all connections.
-class connection_context : public context {
-  public:
-    connection_context() : container(0), default_session(0), link_gen(0), collector(0) {}
-
-    class container* container;
-    pn_session_t *default_session; // Owned by connection.
-    message event_message;      // re-used by messaging_adapter for performance.
-    io::link_namer* link_gen;      // Link name generator.
-    pn_collector_t* collector;
-
-    internal::pn_unique_ptr<proton_handler> handler;
-    internal::pn_unique_ptr<class event_loop> event_loop;
-
-    static connection_context& get(pn_connection_t *c) { return ref<connection_context>(id(c)); }
-    static connection_context& get(const connection& c) { return ref<connection_context>(id(c)); }
-
-  protected:
-    static context::id id(pn_connection_t*);
-    static context::id id(const connection& c);
-};
-
-void container_context(const reactor&, container&);
-
-class container_context {
-  public:
-    static void set(const reactor& r, container& c);
-    static container& get(pn_reactor_t*);
-};
-
-class listener_context : public context {
-  public:
-    static listener_context& get(pn_acceptor_t* c);
-    listener_context() : listen_handler_(0), ssl(false) {}
-    connection_options  get_options() { return listen_handler_->on_accept(); }
-    class listen_handler* listen_handler_;
-    bool ssl;
-};
-
-class link_context : public context {
-  public:
-    static link_context& get(pn_link_t* l);
-    link_context() : credit_window(10), auto_accept(true), auto_settle(true), draining(false), pending_credit(0) {}
-    int credit_window;
-    bool auto_accept;
-    bool auto_settle;
-    bool draining;
-    uint32_t pending_credit;
-};
-
-}
-
-#endif  /*!PROTON_CPP_CONTEXTS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/acceptor.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/acceptor.hpp b/proton-c/bindings/cpp/src/include/acceptor.hpp
new file mode 100644
index 0000000..9a25592
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/acceptor.hpp
@@ -0,0 +1,62 @@
+#ifndef PROTON_ACCEPTOR_HPP
+#define PROTON_ACCEPTOR_HPP
+
+/*
+ *
+ * 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/internal/export.hpp"
+#include "proton/internal/object.hpp"
+
+#include <proton/reactor.h>
+
+struct pn_acceptor_t;
+
+namespace proton {
+
+/// A context for accepting inbound connections.
+///
+/// @see container::listen
+class acceptor : public internal::object<pn_acceptor_t> {
+    /// @cond INTERNAL
+    acceptor(pn_acceptor_t* a) : internal::object<pn_acceptor_t>(a) {}
+    /// @endcond
+
+  public:
+    acceptor() : internal::object<pn_acceptor_t>(0) {}
+
+    /// Close the acceptor.
+    PN_CPP_EXTERN void close();
+
+    /// Return the current set of connection options applied to
+    /// inbound connectons by the acceptor.
+    ///
+    /// Note that changes made to the connection options only affect
+    /// connections accepted after this call returns.
+    PN_CPP_EXTERN class connection_options &connection_options();
+
+    /// @cond INTERNAL
+  friend class internal::factory<acceptor>;
+    /// @endcond
+};
+
+} // proton
+
+#endif // PROTON_ACCEPTOR_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/connector.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/connector.hpp b/proton-c/bindings/cpp/src/include/connector.hpp
new file mode 100644
index 0000000..5b6707a
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/connector.hpp
@@ -0,0 +1,65 @@
+#ifndef PROTON_CPP_CONNECTOR_HANDLER_H
+#define PROTON_CPP_CONNECTOR_HANDLER_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/connection.hpp"
+#include "proton/connection_options.hpp"
+#include <proton/event.h>
+#include <proton/reactor.h>
+#include "proton/url.hpp"
+
+#include "proton_handler.hpp"
+
+#include <string>
+
+
+namespace proton {
+
+class reconnect_timer;
+
+class connector : public proton_handler
+{
+  public:
+    connector(connection &c, const connection_options &options, const url&);
+    ~connector();
+    const url &address() const { return address_; }
+    void connect();
+    void reconnect_timer(const class reconnect_timer &);
+    virtual void on_connection_local_open(proton_event &e);
+    virtual void on_connection_remote_open(proton_event &e);
+    virtual void on_connection_init(proton_event &e);
+    virtual void on_transport_closed(proton_event &e);
+    virtual void on_transport_tail_closed(proton_event &e);
+    virtual void on_timer_task(proton_event &e);
+
+  private:
+    connection connection_;
+    const connection_options options_;
+    const url address_;
+    class reconnect_timer *reconnect_timer_;
+};
+
+
+}
+
+#endif  /*!PROTON_CPP_CONNECTOR_HANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/container_impl.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/container_impl.hpp b/proton-c/bindings/cpp/src/include/container_impl.hpp
new file mode 100644
index 0000000..97f6be2
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/container_impl.hpp
@@ -0,0 +1,124 @@
+#ifndef PROTON_CPP_CONTAINERIMPL_H
+#define PROTON_CPP_CONTAINERIMPL_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/io/link_namer.hpp"
+
+#include "proton/container.hpp"
+#include "proton/connection.hpp"
+#include "proton/connection_options.hpp"
+#include "proton/duration.hpp"
+#include "proton/sender.hpp"
+#include "proton/receiver.hpp"
+
+#include "messaging_adapter.hpp"
+#include "reactor.hpp"
+#include "proton_bits.hpp"
+#include "proton_handler.hpp"
+
+#include <list>
+#include <map>
+#include <string>
+
+namespace proton {
+
+class dispatch_helper;
+class connection;
+class connector;
+class acceptor;
+class container;
+class url;
+class task;
+class listen_handler;
+
+class container_impl : public standard_container {
+  public:
+    // Pull in base class functions here so that name search finds all the overloads
+    using standard_container::stop;
+    using standard_container::connect;
+    using standard_container::listen;
+    using standard_container::open_receiver;
+    using standard_container::open_sender;
+
+    container_impl(const std::string& id, messaging_handler* = 0);
+    ~container_impl();
+    std::string id() const PN_CPP_OVERRIDE { return id_; }
+    returned<connection> connect(const std::string&, const connection_options&) PN_CPP_OVERRIDE;
+    returned<sender> open_sender(
+        const std::string&, const proton::sender_options &, const connection_options &) PN_CPP_OVERRIDE;
+    returned<receiver> open_receiver(
+        const std::string&, const proton::receiver_options &, const connection_options &) PN_CPP_OVERRIDE;
+    listener listen(const std::string&, listen_handler& lh) PN_CPP_OVERRIDE;
+    void stop_listening(const std::string&) PN_CPP_OVERRIDE;
+    void client_connection_options(const connection_options &) PN_CPP_OVERRIDE;
+    connection_options client_connection_options() const PN_CPP_OVERRIDE { return client_connection_options_; }
+    void server_connection_options(const connection_options &) PN_CPP_OVERRIDE;
+    connection_options server_connection_options() const PN_CPP_OVERRIDE { return server_connection_options_; }
+    void sender_options(const proton::sender_options&) PN_CPP_OVERRIDE;
+    class sender_options sender_options() const PN_CPP_OVERRIDE { return sender_options_; }
+    void receiver_options(const proton::receiver_options&) PN_CPP_OVERRIDE;
+    class receiver_options receiver_options() const PN_CPP_OVERRIDE { return receiver_options_; }
+    void run() PN_CPP_OVERRIDE;
+    void stop(const error_condition& err) PN_CPP_OVERRIDE;
+    void auto_stop(bool set) PN_CPP_OVERRIDE;
+#if PN_CPP_HAS_STD_FUNCTION
+    void schedule(duration, std::function<void()>) PN_CPP_OVERRIDE;
+#endif
+    void schedule(duration, void_function0&) PN_CPP_OVERRIDE;
+
+    // non-interface functions
+    void configure_server_connection(connection &c);
+    static task schedule(container& c, int delay, proton_handler *h);
+    template <class T> static void set_handler(T s, messaging_handler* h);
+
+  private:
+    internal::pn_ptr<pn_handler_t> cpp_handler(proton_handler *h);
+
+    typedef std::map<std::string, acceptor> acceptors;
+
+    reactor reactor_;
+    // Keep a list of all the handlers used by the container so they last as long as the container
+    std::list<internal::pn_unique_ptr<proton_handler> > handlers_;
+    std::string id_;
+    connection_options client_connection_options_;
+    connection_options server_connection_options_;
+    proton::sender_options sender_options_;
+    proton::receiver_options receiver_options_;
+    bool auto_stop_;
+    acceptors acceptors_;
+
+  friend class messaging_adapter;
+};
+
+template <class T>
+void container_impl::set_handler(T s, messaging_handler* mh) {
+    pn_record_t *record = internal::get_attachments(unwrap(s));
+    proton_handler* h = new messaging_adapter(*mh);
+    container_impl& ci = static_cast<container_impl&>(s.container());
+    ci.handlers_.push_back(h);
+    pn_record_set_handler(record, ci.cpp_handler(h).get());
+}
+
+}
+
+#endif  /*!PROTON_CPP_CONTAINERIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/contexts.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/contexts.hpp b/proton-c/bindings/cpp/src/include/contexts.hpp
new file mode 100644
index 0000000..74a763c
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/contexts.hpp
@@ -0,0 +1,137 @@
+#ifndef PROTON_CPP_CONTEXTS_H
+#define PROTON_CPP_CONTEXTS_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/connection.hpp"
+#include "proton/container.hpp"
+#include "proton/io/connection_engine.hpp"
+#include "proton/event_loop.hpp"
+#include "proton/listen_handler.hpp"
+#include "proton/message.hpp"
+#include "proton/internal/pn_unique_ptr.hpp"
+
+#include "proton/io/link_namer.hpp"
+
+#include "proton_handler.hpp"
+
+struct pn_session_t;
+struct pn_event_t;
+struct pn_reactor_t;
+struct pn_record_t;
+struct pn_acceptor_t;
+
+namespace proton {
+
+class proton_handler;
+class reactor;
+
+// 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 {
+  public:
+    // identifies a context, contains a record pointer and a handle.
+    typedef std::pair<pn_record_t*, pn_handle_t> id;
+
+    virtual ~context();
+
+    // Allocate a default-constructed T as a proton object.
+    // T must be a subclass of context.
+    template <class T> static T *create() { return new(alloc(sizeof(T))) T(); }
+
+    // The pn_class for a context
+    static pn_class_t* pn_class();
+
+    // Get the context identified by id as a C++ T*, return null pointer if not present.
+    template <class T> static T* ptr(id id_) {
+        return reinterpret_cast<T*>(pn_record_get(id_.first, id_.second));
+    }
+
+    // If the context is not present, create it with value x.
+    template <class T> static T& ref(id id_) {
+        T* ctx = context::ptr<T>(id_);
+        if (!ctx) {
+            ctx = create<T>();
+            pn_record_def(id_.first, id_.second, pn_class());
+            pn_record_set(id_.first, id_.second, ctx);
+            pn_decref(ctx);
+        }
+        return *ctx;
+    }
+
+  private:
+    static void *alloc(size_t n);
+};
+
+// Connection context used by all connections.
+class connection_context : public context {
+  public:
+    connection_context() : container(0), default_session(0), link_gen(0), collector(0) {}
+
+    class container* container;
+    pn_session_t *default_session; // Owned by connection.
+    message event_message;      // re-used by messaging_adapter for performance.
+    io::link_namer* link_gen;      // Link name generator.
+    pn_collector_t* collector;
+
+    internal::pn_unique_ptr<proton_handler> handler;
+    internal::pn_unique_ptr<class event_loop> event_loop;
+
+    static connection_context& get(pn_connection_t *c) { return ref<connection_context>(id(c)); }
+    static connection_context& get(const connection& c) { return ref<connection_context>(id(c)); }
+
+  protected:
+    static context::id id(pn_connection_t*);
+    static context::id id(const connection& c);
+};
+
+void container_context(const reactor&, container&);
+
+class container_context {
+  public:
+    static void set(const reactor& r, container& c);
+    static container& get(pn_reactor_t*);
+};
+
+class listener_context : public context {
+  public:
+    static listener_context& get(pn_acceptor_t* c);
+    listener_context() : listen_handler_(0), ssl(false) {}
+    connection_options  get_options() { return listen_handler_->on_accept(); }
+    class listen_handler* listen_handler_;
+    bool ssl;
+};
+
+class link_context : public context {
+  public:
+    static link_context& get(pn_link_t* l);
+    link_context() : credit_window(10), auto_accept(true), auto_settle(true), draining(false), pending_credit(0) {}
+    int credit_window;
+    bool auto_accept;
+    bool auto_settle;
+    bool draining;
+    uint32_t pending_credit;
+};
+
+}
+
+#endif  /*!PROTON_CPP_CONTEXTS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/messaging_adapter.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/messaging_adapter.hpp b/proton-c/bindings/cpp/src/include/messaging_adapter.hpp
new file mode 100644
index 0000000..5371eec
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/messaging_adapter.hpp
@@ -0,0 +1,62 @@
+#ifndef PROTON_CPP_MESSAGING_ADAPTER_H
+#define PROTON_CPP_MESSAGING_ADAPTER_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/messaging_handler.hpp"
+
+#include "proton_handler.hpp"
+
+#include <proton/event.h>
+#include <proton/reactor.h>
+
+///@cond INTERNAL
+
+namespace proton {
+
+/// Convert the low level proton-c events to the higher level proton::messaging_handler calls
+class messaging_adapter : public proton_handler
+{
+  public:
+    messaging_adapter(messaging_handler &delegate) : delegate_(delegate) {}
+
+    void on_reactor_init(proton_event &e);
+    void on_reactor_final(proton_event & e);
+    void on_link_flow(proton_event &e);
+    void on_delivery(proton_event &e);
+    void on_connection_remote_open(proton_event &e);
+    void on_connection_remote_close(proton_event &e);
+    void on_session_remote_open(proton_event &e);
+    void on_session_remote_close(proton_event &e);
+    void on_link_local_open(proton_event &e);
+    void on_link_remote_open(proton_event &e);
+    void on_link_remote_detach(proton_event & e);
+    void on_link_remote_close(proton_event &e);
+    void on_transport_closed(proton_event &e);
+
+  private:
+    messaging_handler &delegate_;  // The handler for generated messaging_event's
+};
+
+}
+///@endcond INTERNAL
+#endif  /*!PROTON_CPP_MESSAGING_ADAPTER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/msg.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/msg.hpp b/proton-c/bindings/cpp/src/include/msg.hpp
new file mode 100644
index 0000000..b24b25c
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/msg.hpp
@@ -0,0 +1,58 @@
+#ifndef PROTON_MSG_H
+#define PROTON_MSG_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 <sstream>
+#include <iostream>
+
+namespace proton {
+
+/** A simple facade for std::ostringstream that allows
+ * in place construction of a message and automatic conversion
+ * to string.
+ * E.g.
+ *@code
+ * void foo(const std::string&);
+ * foo(msg() << "hello " << 32);
+ *@endcode
+ * Will construct the string "hello 32" and pass it to foo()
+ */
+struct msg {
+    std::ostringstream os;
+    msg() {}
+    msg(const msg& m) : os(m.str()) {}
+    std::string str() const { return os.str(); }
+    operator std::string() const { return str(); }
+    template <class T> msg& operator<<(const T& t) { os << t; return *this; }
+};
+
+inline std::ostream& operator<<(std::ostream& o, const msg& m) { return o << m.str(); }
+
+/** Construct a message using operator << and append (file:line) */
+#define QUOTe_(x) #x
+#define QUOTE(x) QUOTe_(x)
+#define MSG(message) (::proton::msg() << message)
+
+}
+
+#endif  /*!PROTON_MSG_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/proton_bits.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/proton_bits.hpp b/proton-c/bindings/cpp/src/include/proton_bits.hpp
new file mode 100644
index 0000000..97d4bee
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/proton_bits.hpp
@@ -0,0 +1,149 @@
+#ifndef PROTON_BITS_HPP
+#define PROTON_BITS_HPP
+/*
+ * 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/link.h>
+#include <proton/session.h>
+
+#include <string>
+#include <iosfwd>
+
+/**@file
+ *
+ * Assorted internal proton utilities.
+ */
+
+struct pn_error_t;
+
+struct pn_data_t;
+struct pn_transport_t;
+struct pn_sasl_t;
+struct pn_ssl_t;
+struct pn_connection_t;
+struct pn_session_t;
+struct pn_link_t;
+struct pn_delivery_t;
+struct pn_condition_t;
+struct pn_acceptor_t;
+struct pn_terminus_t;
+struct pn_reactor_t;
+struct pn_record_t;
+
+namespace proton {
+
+namespace internal { class data; }
+class transport;
+class sasl;
+class ssl;
+class connection;
+class session;
+class link;
+class sender;
+class receiver;
+class transfer;
+class tracker;
+class delivery;
+class error_condition;
+class acceptor;
+class terminus;
+class source;
+class target;
+class reactor;
+
+std::string error_str(long code);
+
+/** Print the error string from pn_error_t, or from code if pn_error_t has no error. */
+std::string error_str(pn_error_t*, long code=0);
+
+/** Make a void* inspectable via operator <<. */
+struct inspectable { void* value; inspectable(void* o) : value(o) {} };
+
+/** Stream a proton object via pn_inspect. */
+std::ostream& operator<<(std::ostream& o, const inspectable& object);
+
+void set_error_condition(const error_condition&, pn_condition_t*);
+
+/// Convert a const char* to std::string, convert NULL to the empty string.
+inline std::string str(const char* s) { return s ? s : std::string(); }
+
+namespace internal {
+
+// These traits relate the wrapped and wrapper classes for the templated factories below
+template <class T> struct wrapped {};
+template <> struct wrapped<internal::data> { typedef pn_data_t type; };
+template <> struct wrapped<transport> { typedef pn_transport_t type; };
+template <> struct wrapped<sasl> { typedef pn_sasl_t type; };
+template <> struct wrapped<ssl> { typedef pn_ssl_t type; };
+template <> struct wrapped<connection> { typedef pn_connection_t type; };
+template <> struct wrapped<session> { typedef pn_session_t type; };
+template <> struct wrapped<link> { typedef pn_link_t type; };
+template <> struct wrapped<sender> { typedef pn_link_t type; };
+template <> struct wrapped<receiver> { typedef pn_link_t type; };
+template <> struct wrapped<transfer> { typedef pn_delivery_t type; };
+template <> struct wrapped<tracker> { typedef pn_delivery_t type; };
+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; }; // TODO aconway 2016-05-13: reactor only
+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 <> struct wrapped<reactor> { typedef pn_reactor_t type; };
+
+template <class T> struct wrapper {};
+template <> struct wrapper<pn_data_t> { typedef internal::data type; };
+template <> struct wrapper<pn_transport_t> { typedef transport type; };
+template <> struct wrapper<pn_sasl_t> { typedef sasl type; };
+template <> struct wrapper<pn_ssl_t> { typedef ssl type; };
+template <> struct wrapper<pn_connection_t> { typedef connection type; };
+template <> struct wrapper<pn_session_t> { typedef session type; };
+template <> struct wrapper<pn_link_t> { typedef link type; };
+template <> struct wrapper<pn_delivery_t> { typedef transfer type; };
+template <> struct wrapper<pn_condition_t> { typedef error_condition type; };
+template <> struct wrapper<pn_acceptor_t> { typedef acceptor type; };
+template <> struct wrapper<pn_terminus_t> { typedef terminus type; };
+template <> struct wrapper<pn_reactor_t> { typedef reactor type; };
+
+// Factory for wrapper types
+template <class T>
+class factory {
+public:
+    static T wrap(typename wrapped<T>::type* t) { return t; }
+    static typename wrapped<T>::type* unwrap(T t) { return t.pn_object(); }
+};
+
+// Get attachments for various proton-c types
+template <class T>
+inline pn_record_t* get_attachments(T*);
+
+template <> inline pn_record_t* get_attachments(pn_session_t* s) { return pn_session_attachments(s); }
+template <> inline pn_record_t* get_attachments(pn_link_t* l) { return pn_link_attachments(l); }
+}
+
+template <class 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>::wrap(t); }
+
+template <class T>
+typename internal::wrapped<T>::type* unwrap(T t) {return internal::factory<T>::unwrap(t); }
+
+}
+
+#endif // PROTON_BITS_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/proton_event.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/proton_event.hpp b/proton-c/bindings/cpp/src/include/proton_event.hpp
new file mode 100644
index 0000000..9b33701
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/proton_event.hpp
@@ -0,0 +1,293 @@
+#ifndef PROTON_CPP_PROTONEVENT_H
+#define PROTON_CPP_PROTONEVENT_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/error.hpp"
+
+#include <proton/event.h>
+
+namespace proton {
+
+class proton_handler;
+class container;
+
+/** Event information for a proton::proton_handler */
+class proton_event
+{
+  public:
+    /// The type of an event
+    enum event_type {
+    ///@name Event types
+    ///@{
+
+      /**
+      * Defined as a programming convenience. No event of this type will
+      * ever be generated.
+      */
+      EVENT_NONE=PN_EVENT_NONE,
+
+      /**
+      * A reactor has been started. Events of this type point to the reactor.
+      */
+      REACTOR_INIT=PN_REACTOR_INIT,
+
+      /**
+      * A reactor has no more events to process. Events of this type
+      * point to the reactor.
+      */
+      REACTOR_QUIESCED=PN_REACTOR_QUIESCED,
+
+      /**
+      * A reactor has been stopped. Events of this type point to the reactor.
+      */
+      REACTOR_FINAL=PN_REACTOR_FINAL,
+
+      /**
+      * A timer event has occurred.
+      */
+      TIMER_TASK=PN_TIMER_TASK,
+
+      /**
+      * The connection has been created. This is the first event that
+      * will ever be issued for a connection. Events of this type point
+      * to the relevant connection.
+      */
+      CONNECTION_INIT=PN_CONNECTION_INIT,
+
+      /**
+      * The connection has been bound to a transport. This event is
+      * issued when the transport::bind() is called.
+      */
+      CONNECTION_BOUND=PN_CONNECTION_BOUND,
+
+      /**
+      * The connection has been unbound from its transport. This event is
+      * issued when transport::unbind() is called.
+      */
+      CONNECTION_UNBOUND=PN_CONNECTION_UNBOUND,
+
+      /**
+      * The local connection endpoint has been closed. Events of this
+      * type point to the relevant connection.
+      */
+      CONNECTION_LOCAL_OPEN=PN_CONNECTION_LOCAL_OPEN,
+
+      /**
+      * The remote endpoint has opened the connection. Events of this
+      * type point to the relevant connection.
+      */
+      CONNECTION_REMOTE_OPEN=PN_CONNECTION_REMOTE_OPEN,
+
+      /**
+      * The local connection endpoint has been closed. Events of this
+      * type point to the relevant connection.
+      */
+      CONNECTION_LOCAL_CLOSE=PN_CONNECTION_LOCAL_CLOSE,
+
+      /**
+      *  The remote endpoint has closed the connection. Events of this
+      *  type point to the relevant connection.
+      */
+      CONNECTION_REMOTE_CLOSE=PN_CONNECTION_REMOTE_CLOSE,
+
+      /**
+      * The connection has been freed and any outstanding processing has
+      * been completed. This is the final event that will ever be issued
+      * for a connection.
+      */
+      CONNECTION_FINAL=PN_CONNECTION_FINAL,
+
+      /**
+      * The session has been created. This is the first event that will
+      * ever be issued for a session.
+      */
+      SESSION_INIT=PN_SESSION_INIT,
+
+      /**
+      * The local session endpoint has been opened. Events of this type
+      * point to the relevant session.
+      */
+      SESSION_LOCAL_OPEN=PN_SESSION_LOCAL_OPEN,
+
+      /**
+      * The remote endpoint has opened the session. Events of this type
+      * point to the relevant session.
+      */
+      SESSION_REMOTE_OPEN=PN_SESSION_REMOTE_OPEN,
+
+      /**
+      * The local session endpoint has been closed. Events of this type
+      * point ot the relevant session.
+      */
+      SESSION_LOCAL_CLOSE=PN_SESSION_LOCAL_CLOSE,
+
+      /**
+      * The remote endpoint has closed the session. Events of this type
+      * point to the relevant session.
+      */
+      SESSION_REMOTE_CLOSE=PN_SESSION_REMOTE_CLOSE,
+
+      /**
+      * The session has been freed and any outstanding processing has
+      * been completed. This is the final event that will ever be issued
+      * for a session.
+      */
+      SESSION_FINAL=PN_SESSION_FINAL,
+
+      /**
+      * The link has been created. This is the first event that will ever
+      * be issued for a link.
+      */
+      LINK_INIT=PN_LINK_INIT,
+
+      /**
+      * The local link endpoint has been opened. Events of this type
+      * point ot the relevant link.
+      */
+      LINK_LOCAL_OPEN=PN_LINK_LOCAL_OPEN,
+
+      /**
+      * The remote endpoint has opened the link. Events of this type
+      * point to the relevant link.
+      */
+      LINK_REMOTE_OPEN=PN_LINK_REMOTE_OPEN,
+
+      /**
+      * The local link endpoint has been closed. Events of this type
+      * point ot the relevant link.
+      */
+      LINK_LOCAL_CLOSE=PN_LINK_LOCAL_CLOSE,
+
+      /**
+      * The remote endpoint has closed the link. Events of this type
+      * point to the relevant link.
+      */
+      LINK_REMOTE_CLOSE=PN_LINK_REMOTE_CLOSE,
+
+      /**
+      * The local link endpoint has been detached. Events of this type
+      * point to the relevant link.
+      */
+      LINK_LOCAL_DETACH=PN_LINK_LOCAL_DETACH,
+
+      /**
+      * The remote endpoint has detached the link. Events of this type
+      * point to the relevant link.
+      */
+      LINK_REMOTE_DETACH=PN_LINK_REMOTE_DETACH,
+
+      /**
+      * The flow control state for a link has changed. Events of this
+      * type point to the relevant link.
+      */
+      LINK_FLOW=PN_LINK_FLOW,
+
+      /**
+      * The link has been freed and any outstanding processing has been
+      * completed. This is the final event that will ever be issued for a
+      * link. Events of this type point to the relevant link.
+      */
+      LINK_FINAL=PN_LINK_FINAL,
+
+      /**
+      * A delivery has been created or updated. Events of this type point
+      * to the relevant delivery.
+      */
+      DELIVERY=PN_DELIVERY,
+
+      /**
+      * The transport has new data to read and/or write. Events of this
+      * type point to the relevant transport.
+      */
+      TRANSPORT=PN_TRANSPORT,
+
+      /**
+      * The transport has authenticated, if this is received by a server
+      * the associated transport has authenticated an incoming connection
+      * and transport::user() can be used to obtain the authenticated
+      * user.
+      */
+      TRANSPORT_AUTHENTICATED=PN_TRANSPORT_AUTHENTICATED,
+
+      /**
+      * Indicates that a transport error has occurred. Use
+      * transport::condition() to access the details of the error
+      * from the associated transport.
+      */
+      TRANSPORT_ERROR=PN_TRANSPORT_ERROR,
+
+      /**
+      * Indicates that the head of the transport has been closed. This
+      * means the transport will never produce more bytes for output to
+      * the network. Events of this type point to the relevant transport.
+      */
+      TRANSPORT_HEAD_CLOSED=PN_TRANSPORT_HEAD_CLOSED,
+
+      /**
+      * Indicates that the tail of the transport has been closed. This
+      * means the transport will never be able to process more bytes from
+      * the network. Events of this type point to the relevant transport.
+      */
+      TRANSPORT_TAIL_CLOSED=PN_TRANSPORT_TAIL_CLOSED,
+
+      /**
+      * Indicates that the both the head and tail of the transport are
+      * closed. Events of this type point to the relevant transport.
+      */
+      TRANSPORT_CLOSED=PN_TRANSPORT_CLOSED,
+
+      SELECTABLE_INIT=PN_SELECTABLE_INIT,
+      SELECTABLE_UPDATED=PN_SELECTABLE_UPDATED,
+      SELECTABLE_READABLE=PN_SELECTABLE_READABLE,
+      SELECTABLE_WRITABLE=PN_SELECTABLE_WRITABLE,
+      SELECTABLE_ERROR=PN_SELECTABLE_ERROR,
+      SELECTABLE_EXPIRED=PN_SELECTABLE_EXPIRED,
+      SELECTABLE_FINAL=PN_SELECTABLE_FINAL
+    };
+    ///@}
+
+    proton_event(pn_event_t *ce, class container* cont) :
+      pn_event_(ce),
+      container_(cont)
+    {}
+
+    pn_event_t* pn_event() const { return pn_event_; }
+    class container& container() const {
+        if (!container_)
+            throw proton::error("event does not have a container");
+        return *container_;
+    }
+
+    /// Get type of event
+    event_type type() const { return event_type(pn_event_type(pn_event_)); }
+
+    void dispatch(proton_handler& h);
+
+  private:
+    pn_event_t *pn_event_;
+    class container* container_;
+};
+
+}
+
+#endif  /*!PROTON_CPP_PROTONEVENT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/proton_handler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/proton_handler.hpp b/proton-c/bindings/cpp/src/include/proton_handler.hpp
new file mode 100644
index 0000000..9941396
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/proton_handler.hpp
@@ -0,0 +1,92 @@
+#ifndef PROTON_CPP_PROTONHANDLER_H
+#define PROTON_CPP_PROTONHANDLER_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/internal/object.hpp"
+
+#include <vector>
+
+struct pn_handler_t;
+
+namespace proton {
+
+class event;
+class proton_event;
+
+/// Handler base class, subclass and over-ride event handling member functions.
+/// @see proton::proton_event for meaning of events.
+class proton_handler
+{
+  public:
+    proton_handler();
+    virtual ~proton_handler();
+
+    ///@name Over-ride these member functions to handle events
+    ///@{
+    virtual void on_reactor_init(proton_event &e);
+    virtual void on_reactor_quiesced(proton_event &e);
+    virtual void on_reactor_final(proton_event &e);
+    virtual void on_timer_task(proton_event &e);
+    virtual void on_connection_init(proton_event &e);
+    virtual void on_connection_bound(proton_event &e);
+    virtual void on_connection_unbound(proton_event &e);
+    virtual void on_connection_local_open(proton_event &e);
+    virtual void on_connection_local_close(proton_event &e);
+    virtual void on_connection_remote_open(proton_event &e);
+    virtual void on_connection_remote_close(proton_event &e);
+    virtual void on_connection_final(proton_event &e);
+    virtual void on_session_init(proton_event &e);
+    virtual void on_session_local_open(proton_event &e);
+    virtual void on_session_local_close(proton_event &e);
+    virtual void on_session_remote_open(proton_event &e);
+    virtual void on_session_remote_close(proton_event &e);
+    virtual void on_session_final(proton_event &e);
+    virtual void on_link_init(proton_event &e);
+    virtual void on_link_local_open(proton_event &e);
+    virtual void on_link_local_close(proton_event &e);
+    virtual void on_link_local_detach(proton_event &e);
+    virtual void on_link_remote_open(proton_event &e);
+    virtual void on_link_remote_close(proton_event &e);
+    virtual void on_link_remote_detach(proton_event &e);
+    virtual void on_link_flow(proton_event &e);
+    virtual void on_link_final(proton_event &e);
+    virtual void on_delivery(proton_event &e);
+    virtual void on_transport(proton_event &e);
+    virtual void on_transport_error(proton_event &e);
+    virtual void on_transport_head_closed(proton_event &e);
+    virtual void on_transport_tail_closed(proton_event &e);
+    virtual void on_transport_closed(proton_event &e);
+    virtual void on_selectable_init(proton_event &e);
+    virtual void on_selectable_updated(proton_event &e);
+    virtual void on_selectable_readable(proton_event &e);
+    virtual void on_selectable_writable(proton_event &e);
+    virtual void on_selectable_expired(proton_event &e);
+    virtual void on_selectable_error(proton_event &e);
+    virtual void on_selectable_final(proton_event &e);
+    virtual void on_unhandled(proton_event &e);
+    ///@}
+};
+
+}
+
+#endif  /*!PROTON_CPP_PROTONHANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/reactor.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/reactor.hpp b/proton-c/bindings/cpp/src/include/reactor.hpp
new file mode 100644
index 0000000..c7ab915
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/reactor.hpp
@@ -0,0 +1,106 @@
+#ifndef REACTOR_HPP
+#define REACTOR_HPP
+
+/*
+ * 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.
+ */
+
+/// @cond INTERNAL
+/// XXX remove
+
+#include "proton/internal/object.hpp"
+#include "proton/duration.hpp"
+#include "proton/timestamp.hpp"
+
+struct pn_reactor_t;
+struct pn_handler_t;
+struct pn_io_t;
+
+namespace proton {
+
+class connection;
+class container;
+class acceptor;
+class url;
+class messaging_handler;
+class task;
+
+class reactor : public internal::object<pn_reactor_t> {
+  public:
+    reactor(pn_reactor_t* r = 0) : internal::object<pn_reactor_t>(r) {}
+
+    /** Create a new reactor. */
+    static reactor create();
+
+    /** Open a connection to url and create a receiver with source=url.path() */
+    acceptor listen(const proton::url &);
+
+    /** Run the event loop, return when all connections and acceptors are closed. */
+    void run();
+
+    /** Start the reactor, you must call process() to process events */
+    void start();
+
+    /** Process events, return true if there are more events to process. */
+    bool process();
+
+    /** Stop the reactor, causes run() to return and process() to return false. */
+    void stop();
+
+    /// Identifier for the container
+    std::string id() const;
+
+    /// Get timeout, process() will return if there is no activity within the timeout.
+    duration timeout();
+
+    /// Set timeout, process() will return if there is no activity within the timeout.
+    void timeout(duration timeout);
+
+    timestamp mark();
+    timestamp now();
+
+    task schedule(int, pn_handler_t*);
+
+    class connection connection(pn_handler_t*) const;
+
+    class connection connection_to_host(const std::string &host, const std::string &port, pn_handler_t*) const;
+
+    pn_handler_t* pn_handler() const;
+
+    void pn_handler(pn_handler_t* );
+
+    pn_handler_t* pn_global_handler() const;
+
+    void pn_global_handler(pn_handler_t* );
+
+    pn_io_t* pn_io() const;
+
+    void wakeup();
+    bool quiesced();
+    void yield();
+
+  friend class container_impl;
+  friend class container_context;
+  friend class internal::factory<reactor>;
+};
+
+}
+
+/// @endcond
+
+#endif // REACTOR_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/scalar_test.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/scalar_test.hpp b/proton-c/bindings/cpp/src/include/scalar_test.hpp
new file mode 100644
index 0000000..b075c98
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/scalar_test.hpp
@@ -0,0 +1,209 @@
+#ifndef SCALAR_TEST_HPP
+#define SCALAR_TEST_HPP
+
+/*
+ * 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.
+ */
+
+// Template tests used by both scalar_test.cpp and value_test.hpp to test conversion
+// of scalar values via a proton::scalar or a proton::value.
+
+#include "test_bits.hpp"
+
+#include "proton/types.hpp"
+#include "proton/error.hpp"
+
+#include <sstream>
+
+
+namespace test {
+
+using namespace proton;
+
+// Inserting and extracting simple C++ values using same-type get<T> and coerce<T>
+template <class V, class T> void simple_type_test(T x, type_id tid, const std::string& s, T y) {
+    V vx(x);                    // Construct from C++ value
+    ASSERT_EQUAL(tid, vx.type());
+    ASSERT(!vx.empty());
+    ASSERT_EQUAL(x, get<T>(vx));
+    ASSERT_EQUAL(x, coerce<T>(vx));
+
+    V vxa = x;                  // Assign from C++ value
+    ASSERT_EQUAL(tid, vxa.type());
+    ASSERT(!vx.empty());
+    ASSERT_EQUAL(vx, vxa);
+    ASSERT_EQUAL(x, get<T>(vxa));
+    ASSERT_EQUAL(x, coerce<T>(vxa));
+
+    V v2;                       // Default construct
+    ASSERT(v2.type() == NULL_TYPE);
+    ASSERT(v2.empty());
+    v2 = x;                     // Assign from C++ value
+    ASSERT_EQUAL(tid, v2.type());
+    ASSERT_EQUAL(vx, v2);
+    ASSERT_EQUAL(x, get<T>(v2));
+    ASSERT_EQUAL(x, coerce<T>(v2));
+
+    V v3(vx);                   // Copy construct
+    ASSERT_EQUAL(tid, v3.type());
+    ASSERT_EQUAL(vx, v3);
+    ASSERT_EQUAL(x, get<T>(v3));
+    ASSERT_EQUAL(x, coerce<T>(v3));
+
+    V v4 = vx;                  // Copy assign
+    ASSERT_EQUAL(tid, v4.type());
+    ASSERT_EQUAL(x, get<T>(v4));
+    ASSERT_EQUAL(x, coerce<T>(v4));
+
+    ASSERT_EQUAL(s, to_string(vx));   // Stringify
+    V vy(y);
+    ASSERT(vx != vy);           // Compare
+    ASSERT(vx < vy);
+    ASSERT(vy > vx);
+}
+
+// Test native C/C++ integer types via their mapped integer type ([u]int_x_t)
+template <class V, class T> void simple_integral_test() {
+    typedef typename internal::integer_type<sizeof(T), internal::is_signed<T>::value>::type int_type;
+    simple_type_test<V>(T(3), internal::type_id_of<int_type>::value, "3", T(4));
+}
+
+// Test invalid gets, valid same-type get<T> is tested by simple_type_test
+// Templated to test both scalar and value.
+template<class V>  void bad_get_test() {
+    try { get<bool>(V(int8_t(1))); FAIL("byte as bool"); } catch (conversion_error) {}
+    try { get<uint8_t>(V(true)); FAIL("bool as uint8_t"); } catch (conversion_error) {}
+    try { get<uint8_t>(V(int8_t(1))); FAIL("int8 as uint8"); } catch (conversion_error) {}
+    try { get<int16_t>(V(uint16_t(1))); FAIL("uint16 as int16"); } catch (conversion_error) {}
+    try { get<int16_t>(V(int32_t(1))); FAIL("int32 as int16"); } catch (conversion_error) {}
+    try { get<symbol>(V(std::string())); FAIL("string as symbol"); } catch (conversion_error) {}
+    try { get<std::string>(V(binary())); FAIL("binary as string"); } catch (conversion_error) {}
+    try { get<binary>(V(symbol())); FAIL("symbol as binary"); } catch (conversion_error) {}
+    try { get<binary>(V(timestamp())); FAIL("timestamp as binary"); } catch (conversion_error) {}
+    try { get<int>(V(timestamp())); FAIL("timestamp as int"); } catch (conversion_error) {}
+    try { get<timestamp>(V(0)); FAIL("int as timestamp"); } catch (conversion_error) {}
+    try { get<timestamp>(V(std::string())); FAIL("string as timestamp"); } catch (conversion_error) {}
+}
+
+// Test some valid coercions and some bad ones with mixed types.
+// Templated to test both scalar and value.
+template<class V> void coerce_test() {
+    // Valid C++ conversions should work with coerce.
+    ASSERT_EQUAL(false, coerce<bool>(V(0)));
+    ASSERT_EQUAL(true, coerce<bool>(V(-1)));
+    ASSERT_EQUAL(true, coerce<bool>(V(int64_t(0xFFFF0000))));
+
+    ASSERT_EQUAL(1, coerce<uint8_t>(V(uint64_t(1)))); // In range.
+    ASSERT_EQUAL(1, coerce<uint8_t>(V(uint32_t(0xFF01)))); // int truncate.
+    ASSERT_EQUAL(0xFFFF, coerce<uint16_t>(V(int8_t(-1)))); // Sign extend.
+    ASSERT_EQUAL(-1, coerce<int32_t>(V(uint64_t(0xFFFFFFFFul)))); // 2s complement
+
+    ASSERT_EQUALISH(1.2f, coerce<float>(V(double(1.2))), 0.001f);
+    ASSERT_EQUALISH(3.4, coerce<double>(V(float(3.4))), 0.001);
+    ASSERT_EQUALISH(23.0, coerce<double>(V(uint64_t(23))), 0.001); // int to double.
+    ASSERT_EQUAL(-1945, coerce<int>(V(float(-1945.123))));    // round to int.
+
+    // String-like conversions.
+    ASSERT_EQUAL(std::string("foo"), coerce<std::string>(V(symbol("foo"))));
+    ASSERT_EQUAL(std::string("foo"), coerce<std::string>(V(binary("foo"))));
+
+    // Bad coercions, types are not `is_convertible`
+    V s("foo");
+    try { coerce<bool>(s); FAIL("string as bool"); } catch (conversion_error) {}
+    try { coerce<int>(s); FAIL("string as int"); } catch (conversion_error) {}
+    try { coerce<double>(s); FAIL("string as double"); } catch (conversion_error) {}
+
+    try { coerce<std::string>(V(0)); FAIL("int as string"); } catch (conversion_error) {}
+    try { coerce<symbol>(V(true)); FAIL("bool as symbol"); } catch (conversion_error) {}
+    try { coerce<binary>(V(0.0)); FAIL("double as binary"); } catch (conversion_error) {}
+    try { coerce<symbol>(V(binary())); FAIL("binary as symbol"); } catch (conversion_error) {}
+    try { coerce<binary>(V(symbol())); FAIL("symbol as binary"); } catch (conversion_error) {}
+    try { coerce<binary>(s); } catch (conversion_error) {}
+    try { coerce<symbol>(s); } catch (conversion_error) {}
+}
+
+template <class V> void null_test() {
+    V v;
+    ASSERT(v.empty());
+    ASSERT_EQUAL(NULL_TYPE, v.type());
+    get<null>(v);
+    null n;
+    get(v, n);
+    V v2(n);
+    ASSERT(v.empty());
+    ASSERT_EQUAL(NULL_TYPE, v.type());
+    v = "foo";
+    ASSERT_EQUAL(STRING, v.type());
+    try { get<null>(v); FAIL("Expected conversion_error"); } catch (conversion_error) {}
+    v = null();
+    get<null>(v);
+}
+
+// Nasty hack for uninterpreted decimal<> types.
+template <class T> T make(const char c) { T x; std::fill(x.begin(), x.end(), c); return x; }
+
+template <class V> void scalar_test_group(int& failed) {
+    // Direct AMQP-mapped types.
+    RUN_TEST(failed, simple_type_test<V>(false, BOOLEAN, "false", true));
+    RUN_TEST(failed, simple_type_test<V>(uint8_t(42), UBYTE, "42", uint8_t(50)));
+    RUN_TEST(failed, simple_type_test<V>(int8_t(-42), BYTE, "-42", int8_t(-40)));
+    RUN_TEST(failed, simple_type_test<V>(uint16_t(4242), USHORT, "4242", uint16_t(5252)));
+    RUN_TEST(failed, simple_type_test<V>(int16_t(-4242), SHORT, "-4242", int16_t(3)));
+    RUN_TEST(failed, simple_type_test<V>(uint32_t(4242), UINT, "4242", uint32_t(5252)));
+    RUN_TEST(failed, simple_type_test<V>(int32_t(-4242), INT, "-4242", int32_t(3)));
+    RUN_TEST(failed, simple_type_test<V>(uint64_t(4242), ULONG, "4242", uint64_t(5252)));
+    RUN_TEST(failed, simple_type_test<V>(int64_t(-4242), LONG, "-4242", int64_t(3)));
+    RUN_TEST(failed, simple_type_test<V>(wchar_t('X'), CHAR, "88", wchar_t('Y')));
+    RUN_TEST(failed, simple_type_test<V>(float(1.234), FLOAT, "1.234", float(2.345)));
+    RUN_TEST(failed, simple_type_test<V>(double(11.2233), DOUBLE, "11.2233", double(12)));
+    RUN_TEST(failed, simple_type_test<V>(timestamp(1234), TIMESTAMP, "1234", timestamp(12345)));
+    RUN_TEST(failed, simple_type_test<V>(make<decimal32>(1), DECIMAL32, "decimal32(0x01010101)", make<decimal32>(2)));
+    RUN_TEST(failed, simple_type_test<V>(make<decimal64>(3), DECIMAL64, "decimal64(0x0303030303030303)", make<decimal64>(4)));
+    RUN_TEST(failed, simple_type_test<V>(make<decimal128>(5), DECIMAL128, "decimal128(0x05050505050505050505050505050505)", make<decimal128>(6)));
+    RUN_TEST(failed, simple_type_test<V>(
+                 uuid::copy("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"),
+                 UUID, "00112233-4455-6677-8899-aabbccddeeff",
+                 uuid::copy("\xff\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff")));
+    RUN_TEST(failed, simple_type_test<V>(std::string("xxx"), STRING, "xxx", std::string("yyy")));
+    RUN_TEST(failed, simple_type_test<V>(symbol("aaa"), SYMBOL, "aaa", symbol("aaaa")));
+    RUN_TEST(failed, simple_type_test<V>(binary("\010aaa"), BINARY, "b\"\\x08aaa\"", binary("aaaa")));
+
+    // Test native C++ integral types.
+    RUN_TEST(failed, (simple_integral_test<V, char>()));
+    RUN_TEST(failed, (simple_integral_test<V, signed char>()));
+    RUN_TEST(failed, (simple_integral_test<V, unsigned char>()));
+    RUN_TEST(failed, (simple_integral_test<V, short>()));
+    RUN_TEST(failed, (simple_integral_test<V, int>()));
+    RUN_TEST(failed, (simple_integral_test<V, long>()));
+    RUN_TEST(failed, (simple_integral_test<V, unsigned short>()));
+    RUN_TEST(failed, (simple_integral_test<V, unsigned int>()));
+    RUN_TEST(failed, (simple_integral_test<V, unsigned long>()));
+#if PN_CPP_HAS_LONG_LONG
+    RUN_TEST(failed, (simple_integral_test<V, long long>()));
+    RUN_TEST(failed, (simple_integral_test<V, unsigned long long>()));
+#endif
+
+
+    RUN_TEST(failed, (coerce_test<V>()));
+    RUN_TEST(failed, (null_test<V>()));
+    RUN_TEST(failed, (bad_get_test<V>()));
+}
+
+}
+
+#endif // SCALAR_TEST_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/test_bits.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/test_bits.hpp b/proton-c/bindings/cpp/src/include/test_bits.hpp
new file mode 100644
index 0000000..0cfbe1f
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/test_bits.hpp
@@ -0,0 +1,136 @@
+#ifndef TEST_BITS_HPP
+#define TEST_BITS_HPP
+/*
+ * 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 "msg.hpp"
+#include "proton/types.hpp"
+
+#include <stdexcept>
+#include <iostream>
+#include <iterator>
+#include <sstream>
+#include <math.h>
+
+namespace test {
+
+struct fail : public std::logic_error {
+    fail(const std::string& what) : logic_error(what) {}
+};
+
+template <class T, class U>
+void assert_equal(const T& want, const U& got, const std::string& what) {
+    if (!(want == got))
+        throw fail(MSG(what << " " << want << " != " << got));
+}
+
+template <class T>
+inline void assert_equalish(T want, T got, T delta, const std::string& what)
+{
+    if (!(fabs(want-got) <= delta))
+        throw fail(MSG(what << " " << want << " !=~ " << got));
+}
+
+#define FAIL_MSG(WHAT) (MSG(__FILE__ << ":" << __LINE__ << ": " << WHAT).str())
+#define FAIL(WHAT) throw test::fail(FAIL_MSG(WHAT))
+#define ASSERT(TEST) do { if (!(TEST)) FAIL("failed ASSERT(" #TEST ")"); } while(false)
+#define ASSERT_EQUAL(WANT, GOT) \
+    test::assert_equal((WANT), (GOT), FAIL_MSG("failed ASSERT_EQUAL(" #WANT ", " #GOT ")"))
+#define ASSERT_EQUALISH(WANT, GOT, DELTA) \
+    test::assert_equalish((WANT), (GOT), (DELTA), FAIL_MSG("failed ASSERT_EQUALISH(" #WANT ", " #GOT ")"))
+
+#define RUN_TEST(BAD_COUNT, TEST)                                       \
+    do {                                                                \
+        try {                                                           \
+            TEST;                                                       \
+            break;                                                      \
+        } catch(const test::fail& e) {                                        \
+            std::cout << "FAIL " << #TEST << std::endl << e.what() << std::endl; \
+        } catch(const std::exception& e) {                              \
+            std::cout << "ERROR " << #TEST << std::endl << __FILE__ << ":" << __LINE__ << ": " << e.what() << std::endl; \
+        }                                                               \
+            ++BAD_COUNT;                                                \
+    } while(0)
+
+template<class T> std::string str(const T& x) {
+    std::ostringstream s; s << std::boolalpha << x; return s.str();
+}
+
+// A way to easily create literal collections that can be compared to std:: collections
+// and to print std collections
+// e.g.
+//     std::vector<string> v = ...;
+//     ASSERT_EQUAL(many<string>() + "a" + "b" + "c", v);
+template <class T> struct many : public std::vector<T> {
+    many() {}
+    template<class S> explicit many(const S& s) : std::vector<T>(s.begin(), s.end()) {}
+    many& operator+=(const T& t) { this->push_back(t); return *this; }
+    many& operator<<(const T& t) { return *this += t; }
+    many operator+(const T& t) { many<T> l(*this); return l += t; }
+};
+
+template <class T, class S> bool operator==(const many<T>& m, const S& s) {
+    return m.size() == s.size() && S(m.begin(), m.end()) == s;
+}
+
+template <class T, class S> bool operator==(const S& s, const many<T>& m) {
+    return m.size() == s.size() && S(m.begin(), m.end()) == s;
+}
+
+template <class T> std::ostream& operator<<(std::ostream& o, const many<T>& m) {
+    std::ostream_iterator<T> oi(o, " ");
+    std::copy(m.begin(), m.end(), oi);
+    return o;
+}
+
+}
+
+namespace std {
+template <class T> std::ostream& operator<<(std::ostream& o, const std::vector<T>& s) {
+    return o << test::many<T>(s);
+}
+
+template <class T> std::ostream& operator<<(std::ostream& o, const std::deque<T>& s) {
+    return o << test::many<T>(s);
+}
+
+template <class T> std::ostream& operator<<(std::ostream& o, const std::list<T>& s) {
+    return o << test::many<T>(s);
+}
+
+template <class K, class T> std::ostream& operator<<(std::ostream& o, const std::map<K, T>& x) {
+    return o << test::many<std::pair<K, T> >(x);
+}
+
+template <class U, class V> std::ostream& operator<<(std::ostream& o, const std::pair<U, V>& p) {
+    return o << "( " << p.first << " , " << p.second << " )";
+}
+
+#if PN_CPP_HAS_CPP11
+template <class K, class T> std::ostream& operator<<(std::ostream& o, const std::unordered_map<K, T>& x) {
+    return o << test::many<std::pair<const K, T> >(x);
+}
+
+template <class T> std::ostream& operator<<(std::ostream& o, const std::forward_list<T>& s) {
+    return o << test::many<T>(s);
+}
+#endif
+}
+
+#endif // TEST_BITS_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/test_dummy_container.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/test_dummy_container.hpp b/proton-c/bindings/cpp/src/include/test_dummy_container.hpp
new file mode 100644
index 0000000..4af432a
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/test_dummy_container.hpp
@@ -0,0 +1,83 @@
+#ifndef TEST_DUMMY_CONTAINER_HPP
+#define TEST_DUMMY_CONTAINER_HPP
+
+/*
+ * 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/container.hpp"
+#include "proton/event_loop.hpp"
+#include "proton/thread_safe.hpp"
+
+namespace test {
+
+using namespace proton;
+
+
+class dummy_container : public standard_container {
+  public:
+    dummy_container(const std::string cid="") :
+        id_(cid), fail("not implemented for dummy_container") {}
+
+    // Pull in base class functions here so that name search finds all the overloads
+    using standard_container::stop;
+    using standard_container::connect;
+    using standard_container::listen;
+    using standard_container::open_receiver;
+    using standard_container::open_sender;
+
+    returned<connection> connect(const std::string&, const connection_options&) { throw fail; }
+    listener listen(const std::string& , listen_handler& ) { throw fail; }
+    void stop_listening(const std::string&) { throw fail; }
+    void run() { throw fail; }
+    void auto_stop(bool) { throw fail; }
+    void stop(const proton::error_condition& ) { throw fail; }
+    returned<sender> open_sender(const std::string &, const proton::sender_options &, const connection_options&) { throw fail; }
+    returned<receiver> open_receiver( const std::string &, const proton::receiver_options &, const connection_options &) { throw fail; }
+    std::string id() const { return id_; }
+    void client_connection_options(const connection_options &o) { ccopts_ = o; }
+    connection_options client_connection_options() const { return ccopts_; }
+    void server_connection_options(const connection_options &o) { scopts_ = o; }
+    connection_options server_connection_options() const { return scopts_; }
+    void sender_options(const class sender_options &o) { sopts_ = o; }
+    class sender_options sender_options() const { return sopts_; }
+    void receiver_options(const class receiver_options &o) { ropts_ = o; }
+    class receiver_options receiver_options() const { return ropts_; }
+#if PN_CPP_HAS_STD_FUNCTION
+    void schedule(duration, std::function<void()>) { throw fail; }
+#endif
+    void schedule(duration, void_function0&) { throw fail; }
+
+  private:
+    std::string id_;
+    connection_options ccopts_, scopts_;
+    class sender_options sopts_;
+    class receiver_options ropts_;
+    std::runtime_error fail;
+};
+
+class dummy_event_loop : public event_loop {
+#if PN_CPP_HAS_CPP11
+    bool inject(std::function<void()> f) PN_CPP_OVERRIDE { f(); return true; }
+#endif
+    bool inject(proton::void_function0& h) PN_CPP_OVERRIDE { h(); return true; }
+};
+
+}
+
+#endif // TEST_DUMMY_CONTAINER_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/types_internal.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/types_internal.hpp b/proton-c/bindings/cpp/src/include/types_internal.hpp
new file mode 100644
index 0000000..bff93a0
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/types_internal.hpp
@@ -0,0 +1,74 @@
+#ifndef TYPES_INTERNAL_HPP
+#define TYPES_INTERNAL_HPP
+/*
+ * 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/internal/type_traits.hpp"
+#include "proton/error.hpp"
+#include "proton/binary.hpp"
+#include <sstream>
+
+///@file
+/// Inline helpers for encode/decode/type conversion/ostream operators.
+
+namespace proton {
+
+/// Byte copy between two objects, only enabled if their sizes are equal.
+template <class T, class U>
+typename internal::enable_if<sizeof(T) == sizeof(U)>::type byte_copy(T &to, const U &from) {
+    const char *p = reinterpret_cast<const char*>(&from);
+    std::copy(p, p + sizeof(T), reinterpret_cast<char*>(&to));
+}
+
+inline conversion_error
+make_conversion_error(type_id want, type_id got, const std::string& msg=std::string()) {
+    std::ostringstream s;
+    s << "unexpected type, want: " << want << " got: " << got;
+    if (!msg.empty()) s << ": " << msg;
+    return conversion_error(s.str());
+}
+
+/// Convert std::string to pn_bytes_t
+inline pn_bytes_t pn_bytes(const std::string& s) {
+    pn_bytes_t b = { s.size(), s.empty() ? 0 : const_cast<char*>(&s[0]) };
+    return b;
+}
+
+inline pn_bytes_t pn_bytes(const binary& s) {
+    pn_bytes_t b = { s.size(), s.empty() ? 0 : reinterpret_cast<const char*>(&s[0]) };
+    return b;
+}
+
+inline std::string str(const pn_bytes_t& b) { return std::string(b.start, b.size); }
+inline binary bin(const pn_bytes_t& b) { return binary(b.start, b.start+b.size); }
+
+// Save all stream format state, restore in destructor.
+struct ios_guard {
+    std::ios &guarded;
+    std::ios old;
+    ios_guard(std::ios& x) : guarded(x), old(0) { old.copyfmt(guarded); }
+    ~ios_guard() { guarded.copyfmt(old); }
+};
+
+// Convert a char (signed or unsigned) into an unsigned 1 byte integer that will ostream
+// as a numeric byte value, not a character and will not get sign-extended.
+inline unsigned int printable_byte(uint8_t byte) { return byte; }
+
+}
+#endif // TYPES_INTERNAL_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/messaging_adapter.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/messaging_adapter.hpp b/proton-c/bindings/cpp/src/messaging_adapter.hpp
deleted file mode 100644
index 5371eec..0000000
--- a/proton-c/bindings/cpp/src/messaging_adapter.hpp
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef PROTON_CPP_MESSAGING_ADAPTER_H
-#define PROTON_CPP_MESSAGING_ADAPTER_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/messaging_handler.hpp"
-
-#include "proton_handler.hpp"
-
-#include <proton/event.h>
-#include <proton/reactor.h>
-
-///@cond INTERNAL
-
-namespace proton {
-
-/// Convert the low level proton-c events to the higher level proton::messaging_handler calls
-class messaging_adapter : public proton_handler
-{
-  public:
-    messaging_adapter(messaging_handler &delegate) : delegate_(delegate) {}
-
-    void on_reactor_init(proton_event &e);
-    void on_reactor_final(proton_event & e);
-    void on_link_flow(proton_event &e);
-    void on_delivery(proton_event &e);
-    void on_connection_remote_open(proton_event &e);
-    void on_connection_remote_close(proton_event &e);
-    void on_session_remote_open(proton_event &e);
-    void on_session_remote_close(proton_event &e);
-    void on_link_local_open(proton_event &e);
-    void on_link_remote_open(proton_event &e);
-    void on_link_remote_detach(proton_event & e);
-    void on_link_remote_close(proton_event &e);
-    void on_transport_closed(proton_event &e);
-
-  private:
-    messaging_handler &delegate_;  // The handler for generated messaging_event's
-};
-
-}
-///@endcond INTERNAL
-#endif  /*!PROTON_CPP_MESSAGING_ADAPTER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/msg.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/msg.hpp b/proton-c/bindings/cpp/src/msg.hpp
deleted file mode 100644
index b24b25c..0000000
--- a/proton-c/bindings/cpp/src/msg.hpp
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef PROTON_MSG_H
-#define PROTON_MSG_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 <sstream>
-#include <iostream>
-
-namespace proton {
-
-/** A simple facade for std::ostringstream that allows
- * in place construction of a message and automatic conversion
- * to string.
- * E.g.
- *@code
- * void foo(const std::string&);
- * foo(msg() << "hello " << 32);
- *@endcode
- * Will construct the string "hello 32" and pass it to foo()
- */
-struct msg {
-    std::ostringstream os;
-    msg() {}
-    msg(const msg& m) : os(m.str()) {}
-    std::string str() const { return os.str(); }
-    operator std::string() const { return str(); }
-    template <class T> msg& operator<<(const T& t) { os << t; return *this; }
-};
-
-inline std::ostream& operator<<(std::ostream& o, const msg& m) { return o << m.str(); }
-
-/** Construct a message using operator << and append (file:line) */
-#define QUOTe_(x) #x
-#define QUOTE(x) QUOTe_(x)
-#define MSG(message) (::proton::msg() << message)
-
-}
-
-#endif  /*!PROTON_MSG_H*/


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


[09/10] qpid-proton git commit: PROTON-1319: C++ SunStudo: Move internal header files of cpp bindings

Posted by ac...@apache.org.
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/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
deleted file mode 100644
index 97d4bee..0000000
--- a/proton-c/bindings/cpp/src/proton_bits.hpp
+++ /dev/null
@@ -1,149 +0,0 @@
-#ifndef PROTON_BITS_HPP
-#define PROTON_BITS_HPP
-/*
- * 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/link.h>
-#include <proton/session.h>
-
-#include <string>
-#include <iosfwd>
-
-/**@file
- *
- * Assorted internal proton utilities.
- */
-
-struct pn_error_t;
-
-struct pn_data_t;
-struct pn_transport_t;
-struct pn_sasl_t;
-struct pn_ssl_t;
-struct pn_connection_t;
-struct pn_session_t;
-struct pn_link_t;
-struct pn_delivery_t;
-struct pn_condition_t;
-struct pn_acceptor_t;
-struct pn_terminus_t;
-struct pn_reactor_t;
-struct pn_record_t;
-
-namespace proton {
-
-namespace internal { class data; }
-class transport;
-class sasl;
-class ssl;
-class connection;
-class session;
-class link;
-class sender;
-class receiver;
-class transfer;
-class tracker;
-class delivery;
-class error_condition;
-class acceptor;
-class terminus;
-class source;
-class target;
-class reactor;
-
-std::string error_str(long code);
-
-/** Print the error string from pn_error_t, or from code if pn_error_t has no error. */
-std::string error_str(pn_error_t*, long code=0);
-
-/** Make a void* inspectable via operator <<. */
-struct inspectable { void* value; inspectable(void* o) : value(o) {} };
-
-/** Stream a proton object via pn_inspect. */
-std::ostream& operator<<(std::ostream& o, const inspectable& object);
-
-void set_error_condition(const error_condition&, pn_condition_t*);
-
-/// Convert a const char* to std::string, convert NULL to the empty string.
-inline std::string str(const char* s) { return s ? s : std::string(); }
-
-namespace internal {
-
-// These traits relate the wrapped and wrapper classes for the templated factories below
-template <class T> struct wrapped {};
-template <> struct wrapped<internal::data> { typedef pn_data_t type; };
-template <> struct wrapped<transport> { typedef pn_transport_t type; };
-template <> struct wrapped<sasl> { typedef pn_sasl_t type; };
-template <> struct wrapped<ssl> { typedef pn_ssl_t type; };
-template <> struct wrapped<connection> { typedef pn_connection_t type; };
-template <> struct wrapped<session> { typedef pn_session_t type; };
-template <> struct wrapped<link> { typedef pn_link_t type; };
-template <> struct wrapped<sender> { typedef pn_link_t type; };
-template <> struct wrapped<receiver> { typedef pn_link_t type; };
-template <> struct wrapped<transfer> { typedef pn_delivery_t type; };
-template <> struct wrapped<tracker> { typedef pn_delivery_t type; };
-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; }; // TODO aconway 2016-05-13: reactor only
-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 <> struct wrapped<reactor> { typedef pn_reactor_t type; };
-
-template <class T> struct wrapper {};
-template <> struct wrapper<pn_data_t> { typedef internal::data type; };
-template <> struct wrapper<pn_transport_t> { typedef transport type; };
-template <> struct wrapper<pn_sasl_t> { typedef sasl type; };
-template <> struct wrapper<pn_ssl_t> { typedef ssl type; };
-template <> struct wrapper<pn_connection_t> { typedef connection type; };
-template <> struct wrapper<pn_session_t> { typedef session type; };
-template <> struct wrapper<pn_link_t> { typedef link type; };
-template <> struct wrapper<pn_delivery_t> { typedef transfer type; };
-template <> struct wrapper<pn_condition_t> { typedef error_condition type; };
-template <> struct wrapper<pn_acceptor_t> { typedef acceptor type; };
-template <> struct wrapper<pn_terminus_t> { typedef terminus type; };
-template <> struct wrapper<pn_reactor_t> { typedef reactor type; };
-
-// Factory for wrapper types
-template <class T>
-class factory {
-public:
-    static T wrap(typename wrapped<T>::type* t) { return t; }
-    static typename wrapped<T>::type* unwrap(T t) { return t.pn_object(); }
-};
-
-// Get attachments for various proton-c types
-template <class T>
-inline pn_record_t* get_attachments(T*);
-
-template <> inline pn_record_t* get_attachments(pn_session_t* s) { return pn_session_attachments(s); }
-template <> inline pn_record_t* get_attachments(pn_link_t* l) { return pn_link_attachments(l); }
-}
-
-template <class 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>::wrap(t); }
-
-template <class T>
-typename internal::wrapped<T>::type* unwrap(T t) {return internal::factory<T>::unwrap(t); }
-
-}
-
-#endif // PROTON_BITS_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/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
deleted file mode 100644
index 9b33701..0000000
--- a/proton-c/bindings/cpp/src/proton_event.hpp
+++ /dev/null
@@ -1,293 +0,0 @@
-#ifndef PROTON_CPP_PROTONEVENT_H
-#define PROTON_CPP_PROTONEVENT_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/error.hpp"
-
-#include <proton/event.h>
-
-namespace proton {
-
-class proton_handler;
-class container;
-
-/** Event information for a proton::proton_handler */
-class proton_event
-{
-  public:
-    /// The type of an event
-    enum event_type {
-    ///@name Event types
-    ///@{
-
-      /**
-      * Defined as a programming convenience. No event of this type will
-      * ever be generated.
-      */
-      EVENT_NONE=PN_EVENT_NONE,
-
-      /**
-      * A reactor has been started. Events of this type point to the reactor.
-      */
-      REACTOR_INIT=PN_REACTOR_INIT,
-
-      /**
-      * A reactor has no more events to process. Events of this type
-      * point to the reactor.
-      */
-      REACTOR_QUIESCED=PN_REACTOR_QUIESCED,
-
-      /**
-      * A reactor has been stopped. Events of this type point to the reactor.
-      */
-      REACTOR_FINAL=PN_REACTOR_FINAL,
-
-      /**
-      * A timer event has occurred.
-      */
-      TIMER_TASK=PN_TIMER_TASK,
-
-      /**
-      * The connection has been created. This is the first event that
-      * will ever be issued for a connection. Events of this type point
-      * to the relevant connection.
-      */
-      CONNECTION_INIT=PN_CONNECTION_INIT,
-
-      /**
-      * The connection has been bound to a transport. This event is
-      * issued when the transport::bind() is called.
-      */
-      CONNECTION_BOUND=PN_CONNECTION_BOUND,
-
-      /**
-      * The connection has been unbound from its transport. This event is
-      * issued when transport::unbind() is called.
-      */
-      CONNECTION_UNBOUND=PN_CONNECTION_UNBOUND,
-
-      /**
-      * The local connection endpoint has been closed. Events of this
-      * type point to the relevant connection.
-      */
-      CONNECTION_LOCAL_OPEN=PN_CONNECTION_LOCAL_OPEN,
-
-      /**
-      * The remote endpoint has opened the connection. Events of this
-      * type point to the relevant connection.
-      */
-      CONNECTION_REMOTE_OPEN=PN_CONNECTION_REMOTE_OPEN,
-
-      /**
-      * The local connection endpoint has been closed. Events of this
-      * type point to the relevant connection.
-      */
-      CONNECTION_LOCAL_CLOSE=PN_CONNECTION_LOCAL_CLOSE,
-
-      /**
-      *  The remote endpoint has closed the connection. Events of this
-      *  type point to the relevant connection.
-      */
-      CONNECTION_REMOTE_CLOSE=PN_CONNECTION_REMOTE_CLOSE,
-
-      /**
-      * The connection has been freed and any outstanding processing has
-      * been completed. This is the final event that will ever be issued
-      * for a connection.
-      */
-      CONNECTION_FINAL=PN_CONNECTION_FINAL,
-
-      /**
-      * The session has been created. This is the first event that will
-      * ever be issued for a session.
-      */
-      SESSION_INIT=PN_SESSION_INIT,
-
-      /**
-      * The local session endpoint has been opened. Events of this type
-      * point to the relevant session.
-      */
-      SESSION_LOCAL_OPEN=PN_SESSION_LOCAL_OPEN,
-
-      /**
-      * The remote endpoint has opened the session. Events of this type
-      * point to the relevant session.
-      */
-      SESSION_REMOTE_OPEN=PN_SESSION_REMOTE_OPEN,
-
-      /**
-      * The local session endpoint has been closed. Events of this type
-      * point ot the relevant session.
-      */
-      SESSION_LOCAL_CLOSE=PN_SESSION_LOCAL_CLOSE,
-
-      /**
-      * The remote endpoint has closed the session. Events of this type
-      * point to the relevant session.
-      */
-      SESSION_REMOTE_CLOSE=PN_SESSION_REMOTE_CLOSE,
-
-      /**
-      * The session has been freed and any outstanding processing has
-      * been completed. This is the final event that will ever be issued
-      * for a session.
-      */
-      SESSION_FINAL=PN_SESSION_FINAL,
-
-      /**
-      * The link has been created. This is the first event that will ever
-      * be issued for a link.
-      */
-      LINK_INIT=PN_LINK_INIT,
-
-      /**
-      * The local link endpoint has been opened. Events of this type
-      * point ot the relevant link.
-      */
-      LINK_LOCAL_OPEN=PN_LINK_LOCAL_OPEN,
-
-      /**
-      * The remote endpoint has opened the link. Events of this type
-      * point to the relevant link.
-      */
-      LINK_REMOTE_OPEN=PN_LINK_REMOTE_OPEN,
-
-      /**
-      * The local link endpoint has been closed. Events of this type
-      * point ot the relevant link.
-      */
-      LINK_LOCAL_CLOSE=PN_LINK_LOCAL_CLOSE,
-
-      /**
-      * The remote endpoint has closed the link. Events of this type
-      * point to the relevant link.
-      */
-      LINK_REMOTE_CLOSE=PN_LINK_REMOTE_CLOSE,
-
-      /**
-      * The local link endpoint has been detached. Events of this type
-      * point to the relevant link.
-      */
-      LINK_LOCAL_DETACH=PN_LINK_LOCAL_DETACH,
-
-      /**
-      * The remote endpoint has detached the link. Events of this type
-      * point to the relevant link.
-      */
-      LINK_REMOTE_DETACH=PN_LINK_REMOTE_DETACH,
-
-      /**
-      * The flow control state for a link has changed. Events of this
-      * type point to the relevant link.
-      */
-      LINK_FLOW=PN_LINK_FLOW,
-
-      /**
-      * The link has been freed and any outstanding processing has been
-      * completed. This is the final event that will ever be issued for a
-      * link. Events of this type point to the relevant link.
-      */
-      LINK_FINAL=PN_LINK_FINAL,
-
-      /**
-      * A delivery has been created or updated. Events of this type point
-      * to the relevant delivery.
-      */
-      DELIVERY=PN_DELIVERY,
-
-      /**
-      * The transport has new data to read and/or write. Events of this
-      * type point to the relevant transport.
-      */
-      TRANSPORT=PN_TRANSPORT,
-
-      /**
-      * The transport has authenticated, if this is received by a server
-      * the associated transport has authenticated an incoming connection
-      * and transport::user() can be used to obtain the authenticated
-      * user.
-      */
-      TRANSPORT_AUTHENTICATED=PN_TRANSPORT_AUTHENTICATED,
-
-      /**
-      * Indicates that a transport error has occurred. Use
-      * transport::condition() to access the details of the error
-      * from the associated transport.
-      */
-      TRANSPORT_ERROR=PN_TRANSPORT_ERROR,
-
-      /**
-      * Indicates that the head of the transport has been closed. This
-      * means the transport will never produce more bytes for output to
-      * the network. Events of this type point to the relevant transport.
-      */
-      TRANSPORT_HEAD_CLOSED=PN_TRANSPORT_HEAD_CLOSED,
-
-      /**
-      * Indicates that the tail of the transport has been closed. This
-      * means the transport will never be able to process more bytes from
-      * the network. Events of this type point to the relevant transport.
-      */
-      TRANSPORT_TAIL_CLOSED=PN_TRANSPORT_TAIL_CLOSED,
-
-      /**
-      * Indicates that the both the head and tail of the transport are
-      * closed. Events of this type point to the relevant transport.
-      */
-      TRANSPORT_CLOSED=PN_TRANSPORT_CLOSED,
-
-      SELECTABLE_INIT=PN_SELECTABLE_INIT,
-      SELECTABLE_UPDATED=PN_SELECTABLE_UPDATED,
-      SELECTABLE_READABLE=PN_SELECTABLE_READABLE,
-      SELECTABLE_WRITABLE=PN_SELECTABLE_WRITABLE,
-      SELECTABLE_ERROR=PN_SELECTABLE_ERROR,
-      SELECTABLE_EXPIRED=PN_SELECTABLE_EXPIRED,
-      SELECTABLE_FINAL=PN_SELECTABLE_FINAL
-    };
-    ///@}
-
-    proton_event(pn_event_t *ce, class container* cont) :
-      pn_event_(ce),
-      container_(cont)
-    {}
-
-    pn_event_t* pn_event() const { return pn_event_; }
-    class container& container() const {
-        if (!container_)
-            throw proton::error("event does not have a container");
-        return *container_;
-    }
-
-    /// Get type of event
-    event_type type() const { return event_type(pn_event_type(pn_event_)); }
-
-    void dispatch(proton_handler& h);
-
-  private:
-    pn_event_t *pn_event_;
-    class container* container_;
-};
-
-}
-
-#endif  /*!PROTON_CPP_PROTONEVENT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/proton_handler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_handler.hpp b/proton-c/bindings/cpp/src/proton_handler.hpp
deleted file mode 100644
index 9941396..0000000
--- a/proton-c/bindings/cpp/src/proton_handler.hpp
+++ /dev/null
@@ -1,92 +0,0 @@
-#ifndef PROTON_CPP_PROTONHANDLER_H
-#define PROTON_CPP_PROTONHANDLER_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/internal/object.hpp"
-
-#include <vector>
-
-struct pn_handler_t;
-
-namespace proton {
-
-class event;
-class proton_event;
-
-/// Handler base class, subclass and over-ride event handling member functions.
-/// @see proton::proton_event for meaning of events.
-class proton_handler
-{
-  public:
-    proton_handler();
-    virtual ~proton_handler();
-
-    ///@name Over-ride these member functions to handle events
-    ///@{
-    virtual void on_reactor_init(proton_event &e);
-    virtual void on_reactor_quiesced(proton_event &e);
-    virtual void on_reactor_final(proton_event &e);
-    virtual void on_timer_task(proton_event &e);
-    virtual void on_connection_init(proton_event &e);
-    virtual void on_connection_bound(proton_event &e);
-    virtual void on_connection_unbound(proton_event &e);
-    virtual void on_connection_local_open(proton_event &e);
-    virtual void on_connection_local_close(proton_event &e);
-    virtual void on_connection_remote_open(proton_event &e);
-    virtual void on_connection_remote_close(proton_event &e);
-    virtual void on_connection_final(proton_event &e);
-    virtual void on_session_init(proton_event &e);
-    virtual void on_session_local_open(proton_event &e);
-    virtual void on_session_local_close(proton_event &e);
-    virtual void on_session_remote_open(proton_event &e);
-    virtual void on_session_remote_close(proton_event &e);
-    virtual void on_session_final(proton_event &e);
-    virtual void on_link_init(proton_event &e);
-    virtual void on_link_local_open(proton_event &e);
-    virtual void on_link_local_close(proton_event &e);
-    virtual void on_link_local_detach(proton_event &e);
-    virtual void on_link_remote_open(proton_event &e);
-    virtual void on_link_remote_close(proton_event &e);
-    virtual void on_link_remote_detach(proton_event &e);
-    virtual void on_link_flow(proton_event &e);
-    virtual void on_link_final(proton_event &e);
-    virtual void on_delivery(proton_event &e);
-    virtual void on_transport(proton_event &e);
-    virtual void on_transport_error(proton_event &e);
-    virtual void on_transport_head_closed(proton_event &e);
-    virtual void on_transport_tail_closed(proton_event &e);
-    virtual void on_transport_closed(proton_event &e);
-    virtual void on_selectable_init(proton_event &e);
-    virtual void on_selectable_updated(proton_event &e);
-    virtual void on_selectable_readable(proton_event &e);
-    virtual void on_selectable_writable(proton_event &e);
-    virtual void on_selectable_expired(proton_event &e);
-    virtual void on_selectable_error(proton_event &e);
-    virtual void on_selectable_final(proton_event &e);
-    virtual void on_unhandled(proton_event &e);
-    ///@}
-};
-
-}
-
-#endif  /*!PROTON_CPP_PROTONHANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/reactor.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/reactor.hpp b/proton-c/bindings/cpp/src/reactor.hpp
deleted file mode 100644
index c7ab915..0000000
--- a/proton-c/bindings/cpp/src/reactor.hpp
+++ /dev/null
@@ -1,106 +0,0 @@
-#ifndef REACTOR_HPP
-#define REACTOR_HPP
-
-/*
- * 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.
- */
-
-/// @cond INTERNAL
-/// XXX remove
-
-#include "proton/internal/object.hpp"
-#include "proton/duration.hpp"
-#include "proton/timestamp.hpp"
-
-struct pn_reactor_t;
-struct pn_handler_t;
-struct pn_io_t;
-
-namespace proton {
-
-class connection;
-class container;
-class acceptor;
-class url;
-class messaging_handler;
-class task;
-
-class reactor : public internal::object<pn_reactor_t> {
-  public:
-    reactor(pn_reactor_t* r = 0) : internal::object<pn_reactor_t>(r) {}
-
-    /** Create a new reactor. */
-    static reactor create();
-
-    /** Open a connection to url and create a receiver with source=url.path() */
-    acceptor listen(const proton::url &);
-
-    /** Run the event loop, return when all connections and acceptors are closed. */
-    void run();
-
-    /** Start the reactor, you must call process() to process events */
-    void start();
-
-    /** Process events, return true if there are more events to process. */
-    bool process();
-
-    /** Stop the reactor, causes run() to return and process() to return false. */
-    void stop();
-
-    /// Identifier for the container
-    std::string id() const;
-
-    /// Get timeout, process() will return if there is no activity within the timeout.
-    duration timeout();
-
-    /// Set timeout, process() will return if there is no activity within the timeout.
-    void timeout(duration timeout);
-
-    timestamp mark();
-    timestamp now();
-
-    task schedule(int, pn_handler_t*);
-
-    class connection connection(pn_handler_t*) const;
-
-    class connection connection_to_host(const std::string &host, const std::string &port, pn_handler_t*) const;
-
-    pn_handler_t* pn_handler() const;
-
-    void pn_handler(pn_handler_t* );
-
-    pn_handler_t* pn_global_handler() const;
-
-    void pn_global_handler(pn_handler_t* );
-
-    pn_io_t* pn_io() const;
-
-    void wakeup();
-    bool quiesced();
-    void yield();
-
-  friend class container_impl;
-  friend class container_context;
-  friend class internal::factory<reactor>;
-};
-
-}
-
-/// @endcond
-
-#endif // REACTOR_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/scalar_test.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/scalar_test.hpp b/proton-c/bindings/cpp/src/scalar_test.hpp
deleted file mode 100644
index b075c98..0000000
--- a/proton-c/bindings/cpp/src/scalar_test.hpp
+++ /dev/null
@@ -1,209 +0,0 @@
-#ifndef SCALAR_TEST_HPP
-#define SCALAR_TEST_HPP
-
-/*
- * 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.
- */
-
-// Template tests used by both scalar_test.cpp and value_test.hpp to test conversion
-// of scalar values via a proton::scalar or a proton::value.
-
-#include "test_bits.hpp"
-
-#include "proton/types.hpp"
-#include "proton/error.hpp"
-
-#include <sstream>
-
-
-namespace test {
-
-using namespace proton;
-
-// Inserting and extracting simple C++ values using same-type get<T> and coerce<T>
-template <class V, class T> void simple_type_test(T x, type_id tid, const std::string& s, T y) {
-    V vx(x);                    // Construct from C++ value
-    ASSERT_EQUAL(tid, vx.type());
-    ASSERT(!vx.empty());
-    ASSERT_EQUAL(x, get<T>(vx));
-    ASSERT_EQUAL(x, coerce<T>(vx));
-
-    V vxa = x;                  // Assign from C++ value
-    ASSERT_EQUAL(tid, vxa.type());
-    ASSERT(!vx.empty());
-    ASSERT_EQUAL(vx, vxa);
-    ASSERT_EQUAL(x, get<T>(vxa));
-    ASSERT_EQUAL(x, coerce<T>(vxa));
-
-    V v2;                       // Default construct
-    ASSERT(v2.type() == NULL_TYPE);
-    ASSERT(v2.empty());
-    v2 = x;                     // Assign from C++ value
-    ASSERT_EQUAL(tid, v2.type());
-    ASSERT_EQUAL(vx, v2);
-    ASSERT_EQUAL(x, get<T>(v2));
-    ASSERT_EQUAL(x, coerce<T>(v2));
-
-    V v3(vx);                   // Copy construct
-    ASSERT_EQUAL(tid, v3.type());
-    ASSERT_EQUAL(vx, v3);
-    ASSERT_EQUAL(x, get<T>(v3));
-    ASSERT_EQUAL(x, coerce<T>(v3));
-
-    V v4 = vx;                  // Copy assign
-    ASSERT_EQUAL(tid, v4.type());
-    ASSERT_EQUAL(x, get<T>(v4));
-    ASSERT_EQUAL(x, coerce<T>(v4));
-
-    ASSERT_EQUAL(s, to_string(vx));   // Stringify
-    V vy(y);
-    ASSERT(vx != vy);           // Compare
-    ASSERT(vx < vy);
-    ASSERT(vy > vx);
-}
-
-// Test native C/C++ integer types via their mapped integer type ([u]int_x_t)
-template <class V, class T> void simple_integral_test() {
-    typedef typename internal::integer_type<sizeof(T), internal::is_signed<T>::value>::type int_type;
-    simple_type_test<V>(T(3), internal::type_id_of<int_type>::value, "3", T(4));
-}
-
-// Test invalid gets, valid same-type get<T> is tested by simple_type_test
-// Templated to test both scalar and value.
-template<class V>  void bad_get_test() {
-    try { get<bool>(V(int8_t(1))); FAIL("byte as bool"); } catch (conversion_error) {}
-    try { get<uint8_t>(V(true)); FAIL("bool as uint8_t"); } catch (conversion_error) {}
-    try { get<uint8_t>(V(int8_t(1))); FAIL("int8 as uint8"); } catch (conversion_error) {}
-    try { get<int16_t>(V(uint16_t(1))); FAIL("uint16 as int16"); } catch (conversion_error) {}
-    try { get<int16_t>(V(int32_t(1))); FAIL("int32 as int16"); } catch (conversion_error) {}
-    try { get<symbol>(V(std::string())); FAIL("string as symbol"); } catch (conversion_error) {}
-    try { get<std::string>(V(binary())); FAIL("binary as string"); } catch (conversion_error) {}
-    try { get<binary>(V(symbol())); FAIL("symbol as binary"); } catch (conversion_error) {}
-    try { get<binary>(V(timestamp())); FAIL("timestamp as binary"); } catch (conversion_error) {}
-    try { get<int>(V(timestamp())); FAIL("timestamp as int"); } catch (conversion_error) {}
-    try { get<timestamp>(V(0)); FAIL("int as timestamp"); } catch (conversion_error) {}
-    try { get<timestamp>(V(std::string())); FAIL("string as timestamp"); } catch (conversion_error) {}
-}
-
-// Test some valid coercions and some bad ones with mixed types.
-// Templated to test both scalar and value.
-template<class V> void coerce_test() {
-    // Valid C++ conversions should work with coerce.
-    ASSERT_EQUAL(false, coerce<bool>(V(0)));
-    ASSERT_EQUAL(true, coerce<bool>(V(-1)));
-    ASSERT_EQUAL(true, coerce<bool>(V(int64_t(0xFFFF0000))));
-
-    ASSERT_EQUAL(1, coerce<uint8_t>(V(uint64_t(1)))); // In range.
-    ASSERT_EQUAL(1, coerce<uint8_t>(V(uint32_t(0xFF01)))); // int truncate.
-    ASSERT_EQUAL(0xFFFF, coerce<uint16_t>(V(int8_t(-1)))); // Sign extend.
-    ASSERT_EQUAL(-1, coerce<int32_t>(V(uint64_t(0xFFFFFFFFul)))); // 2s complement
-
-    ASSERT_EQUALISH(1.2f, coerce<float>(V(double(1.2))), 0.001f);
-    ASSERT_EQUALISH(3.4, coerce<double>(V(float(3.4))), 0.001);
-    ASSERT_EQUALISH(23.0, coerce<double>(V(uint64_t(23))), 0.001); // int to double.
-    ASSERT_EQUAL(-1945, coerce<int>(V(float(-1945.123))));    // round to int.
-
-    // String-like conversions.
-    ASSERT_EQUAL(std::string("foo"), coerce<std::string>(V(symbol("foo"))));
-    ASSERT_EQUAL(std::string("foo"), coerce<std::string>(V(binary("foo"))));
-
-    // Bad coercions, types are not `is_convertible`
-    V s("foo");
-    try { coerce<bool>(s); FAIL("string as bool"); } catch (conversion_error) {}
-    try { coerce<int>(s); FAIL("string as int"); } catch (conversion_error) {}
-    try { coerce<double>(s); FAIL("string as double"); } catch (conversion_error) {}
-
-    try { coerce<std::string>(V(0)); FAIL("int as string"); } catch (conversion_error) {}
-    try { coerce<symbol>(V(true)); FAIL("bool as symbol"); } catch (conversion_error) {}
-    try { coerce<binary>(V(0.0)); FAIL("double as binary"); } catch (conversion_error) {}
-    try { coerce<symbol>(V(binary())); FAIL("binary as symbol"); } catch (conversion_error) {}
-    try { coerce<binary>(V(symbol())); FAIL("symbol as binary"); } catch (conversion_error) {}
-    try { coerce<binary>(s); } catch (conversion_error) {}
-    try { coerce<symbol>(s); } catch (conversion_error) {}
-}
-
-template <class V> void null_test() {
-    V v;
-    ASSERT(v.empty());
-    ASSERT_EQUAL(NULL_TYPE, v.type());
-    get<null>(v);
-    null n;
-    get(v, n);
-    V v2(n);
-    ASSERT(v.empty());
-    ASSERT_EQUAL(NULL_TYPE, v.type());
-    v = "foo";
-    ASSERT_EQUAL(STRING, v.type());
-    try { get<null>(v); FAIL("Expected conversion_error"); } catch (conversion_error) {}
-    v = null();
-    get<null>(v);
-}
-
-// Nasty hack for uninterpreted decimal<> types.
-template <class T> T make(const char c) { T x; std::fill(x.begin(), x.end(), c); return x; }
-
-template <class V> void scalar_test_group(int& failed) {
-    // Direct AMQP-mapped types.
-    RUN_TEST(failed, simple_type_test<V>(false, BOOLEAN, "false", true));
-    RUN_TEST(failed, simple_type_test<V>(uint8_t(42), UBYTE, "42", uint8_t(50)));
-    RUN_TEST(failed, simple_type_test<V>(int8_t(-42), BYTE, "-42", int8_t(-40)));
-    RUN_TEST(failed, simple_type_test<V>(uint16_t(4242), USHORT, "4242", uint16_t(5252)));
-    RUN_TEST(failed, simple_type_test<V>(int16_t(-4242), SHORT, "-4242", int16_t(3)));
-    RUN_TEST(failed, simple_type_test<V>(uint32_t(4242), UINT, "4242", uint32_t(5252)));
-    RUN_TEST(failed, simple_type_test<V>(int32_t(-4242), INT, "-4242", int32_t(3)));
-    RUN_TEST(failed, simple_type_test<V>(uint64_t(4242), ULONG, "4242", uint64_t(5252)));
-    RUN_TEST(failed, simple_type_test<V>(int64_t(-4242), LONG, "-4242", int64_t(3)));
-    RUN_TEST(failed, simple_type_test<V>(wchar_t('X'), CHAR, "88", wchar_t('Y')));
-    RUN_TEST(failed, simple_type_test<V>(float(1.234), FLOAT, "1.234", float(2.345)));
-    RUN_TEST(failed, simple_type_test<V>(double(11.2233), DOUBLE, "11.2233", double(12)));
-    RUN_TEST(failed, simple_type_test<V>(timestamp(1234), TIMESTAMP, "1234", timestamp(12345)));
-    RUN_TEST(failed, simple_type_test<V>(make<decimal32>(1), DECIMAL32, "decimal32(0x01010101)", make<decimal32>(2)));
-    RUN_TEST(failed, simple_type_test<V>(make<decimal64>(3), DECIMAL64, "decimal64(0x0303030303030303)", make<decimal64>(4)));
-    RUN_TEST(failed, simple_type_test<V>(make<decimal128>(5), DECIMAL128, "decimal128(0x05050505050505050505050505050505)", make<decimal128>(6)));
-    RUN_TEST(failed, simple_type_test<V>(
-                 uuid::copy("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"),
-                 UUID, "00112233-4455-6677-8899-aabbccddeeff",
-                 uuid::copy("\xff\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff")));
-    RUN_TEST(failed, simple_type_test<V>(std::string("xxx"), STRING, "xxx", std::string("yyy")));
-    RUN_TEST(failed, simple_type_test<V>(symbol("aaa"), SYMBOL, "aaa", symbol("aaaa")));
-    RUN_TEST(failed, simple_type_test<V>(binary("\010aaa"), BINARY, "b\"\\x08aaa\"", binary("aaaa")));
-
-    // Test native C++ integral types.
-    RUN_TEST(failed, (simple_integral_test<V, char>()));
-    RUN_TEST(failed, (simple_integral_test<V, signed char>()));
-    RUN_TEST(failed, (simple_integral_test<V, unsigned char>()));
-    RUN_TEST(failed, (simple_integral_test<V, short>()));
-    RUN_TEST(failed, (simple_integral_test<V, int>()));
-    RUN_TEST(failed, (simple_integral_test<V, long>()));
-    RUN_TEST(failed, (simple_integral_test<V, unsigned short>()));
-    RUN_TEST(failed, (simple_integral_test<V, unsigned int>()));
-    RUN_TEST(failed, (simple_integral_test<V, unsigned long>()));
-#if PN_CPP_HAS_LONG_LONG
-    RUN_TEST(failed, (simple_integral_test<V, long long>()));
-    RUN_TEST(failed, (simple_integral_test<V, unsigned long long>()));
-#endif
-
-
-    RUN_TEST(failed, (coerce_test<V>()));
-    RUN_TEST(failed, (null_test<V>()));
-    RUN_TEST(failed, (bad_get_test<V>()));
-}
-
-}
-
-#endif // SCALAR_TEST_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/test_bits.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/test_bits.hpp b/proton-c/bindings/cpp/src/test_bits.hpp
deleted file mode 100644
index 0cfbe1f..0000000
--- a/proton-c/bindings/cpp/src/test_bits.hpp
+++ /dev/null
@@ -1,136 +0,0 @@
-#ifndef TEST_BITS_HPP
-#define TEST_BITS_HPP
-/*
- * 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 "msg.hpp"
-#include "proton/types.hpp"
-
-#include <stdexcept>
-#include <iostream>
-#include <iterator>
-#include <sstream>
-#include <math.h>
-
-namespace test {
-
-struct fail : public std::logic_error {
-    fail(const std::string& what) : logic_error(what) {}
-};
-
-template <class T, class U>
-void assert_equal(const T& want, const U& got, const std::string& what) {
-    if (!(want == got))
-        throw fail(MSG(what << " " << want << " != " << got));
-}
-
-template <class T>
-inline void assert_equalish(T want, T got, T delta, const std::string& what)
-{
-    if (!(fabs(want-got) <= delta))
-        throw fail(MSG(what << " " << want << " !=~ " << got));
-}
-
-#define FAIL_MSG(WHAT) (MSG(__FILE__ << ":" << __LINE__ << ": " << WHAT).str())
-#define FAIL(WHAT) throw test::fail(FAIL_MSG(WHAT))
-#define ASSERT(TEST) do { if (!(TEST)) FAIL("failed ASSERT(" #TEST ")"); } while(false)
-#define ASSERT_EQUAL(WANT, GOT) \
-    test::assert_equal((WANT), (GOT), FAIL_MSG("failed ASSERT_EQUAL(" #WANT ", " #GOT ")"))
-#define ASSERT_EQUALISH(WANT, GOT, DELTA) \
-    test::assert_equalish((WANT), (GOT), (DELTA), FAIL_MSG("failed ASSERT_EQUALISH(" #WANT ", " #GOT ")"))
-
-#define RUN_TEST(BAD_COUNT, TEST)                                       \
-    do {                                                                \
-        try {                                                           \
-            TEST;                                                       \
-            break;                                                      \
-        } catch(const test::fail& e) {                                        \
-            std::cout << "FAIL " << #TEST << std::endl << e.what() << std::endl; \
-        } catch(const std::exception& e) {                              \
-            std::cout << "ERROR " << #TEST << std::endl << __FILE__ << ":" << __LINE__ << ": " << e.what() << std::endl; \
-        }                                                               \
-            ++BAD_COUNT;                                                \
-    } while(0)
-
-template<class T> std::string str(const T& x) {
-    std::ostringstream s; s << std::boolalpha << x; return s.str();
-}
-
-// A way to easily create literal collections that can be compared to std:: collections
-// and to print std collections
-// e.g.
-//     std::vector<string> v = ...;
-//     ASSERT_EQUAL(many<string>() + "a" + "b" + "c", v);
-template <class T> struct many : public std::vector<T> {
-    many() {}
-    template<class S> explicit many(const S& s) : std::vector<T>(s.begin(), s.end()) {}
-    many& operator+=(const T& t) { this->push_back(t); return *this; }
-    many& operator<<(const T& t) { return *this += t; }
-    many operator+(const T& t) { many<T> l(*this); return l += t; }
-};
-
-template <class T, class S> bool operator==(const many<T>& m, const S& s) {
-    return m.size() == s.size() && S(m.begin(), m.end()) == s;
-}
-
-template <class T, class S> bool operator==(const S& s, const many<T>& m) {
-    return m.size() == s.size() && S(m.begin(), m.end()) == s;
-}
-
-template <class T> std::ostream& operator<<(std::ostream& o, const many<T>& m) {
-    std::ostream_iterator<T> oi(o, " ");
-    std::copy(m.begin(), m.end(), oi);
-    return o;
-}
-
-}
-
-namespace std {
-template <class T> std::ostream& operator<<(std::ostream& o, const std::vector<T>& s) {
-    return o << test::many<T>(s);
-}
-
-template <class T> std::ostream& operator<<(std::ostream& o, const std::deque<T>& s) {
-    return o << test::many<T>(s);
-}
-
-template <class T> std::ostream& operator<<(std::ostream& o, const std::list<T>& s) {
-    return o << test::many<T>(s);
-}
-
-template <class K, class T> std::ostream& operator<<(std::ostream& o, const std::map<K, T>& x) {
-    return o << test::many<std::pair<K, T> >(x);
-}
-
-template <class U, class V> std::ostream& operator<<(std::ostream& o, const std::pair<U, V>& p) {
-    return o << "( " << p.first << " , " << p.second << " )";
-}
-
-#if PN_CPP_HAS_CPP11
-template <class K, class T> std::ostream& operator<<(std::ostream& o, const std::unordered_map<K, T>& x) {
-    return o << test::many<std::pair<const K, T> >(x);
-}
-
-template <class T> std::ostream& operator<<(std::ostream& o, const std::forward_list<T>& s) {
-    return o << test::many<T>(s);
-}
-#endif
-}
-
-#endif // TEST_BITS_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/test_dummy_container.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/test_dummy_container.hpp b/proton-c/bindings/cpp/src/test_dummy_container.hpp
deleted file mode 100644
index 4af432a..0000000
--- a/proton-c/bindings/cpp/src/test_dummy_container.hpp
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef TEST_DUMMY_CONTAINER_HPP
-#define TEST_DUMMY_CONTAINER_HPP
-
-/*
- * 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/container.hpp"
-#include "proton/event_loop.hpp"
-#include "proton/thread_safe.hpp"
-
-namespace test {
-
-using namespace proton;
-
-
-class dummy_container : public standard_container {
-  public:
-    dummy_container(const std::string cid="") :
-        id_(cid), fail("not implemented for dummy_container") {}
-
-    // Pull in base class functions here so that name search finds all the overloads
-    using standard_container::stop;
-    using standard_container::connect;
-    using standard_container::listen;
-    using standard_container::open_receiver;
-    using standard_container::open_sender;
-
-    returned<connection> connect(const std::string&, const connection_options&) { throw fail; }
-    listener listen(const std::string& , listen_handler& ) { throw fail; }
-    void stop_listening(const std::string&) { throw fail; }
-    void run() { throw fail; }
-    void auto_stop(bool) { throw fail; }
-    void stop(const proton::error_condition& ) { throw fail; }
-    returned<sender> open_sender(const std::string &, const proton::sender_options &, const connection_options&) { throw fail; }
-    returned<receiver> open_receiver( const std::string &, const proton::receiver_options &, const connection_options &) { throw fail; }
-    std::string id() const { return id_; }
-    void client_connection_options(const connection_options &o) { ccopts_ = o; }
-    connection_options client_connection_options() const { return ccopts_; }
-    void server_connection_options(const connection_options &o) { scopts_ = o; }
-    connection_options server_connection_options() const { return scopts_; }
-    void sender_options(const class sender_options &o) { sopts_ = o; }
-    class sender_options sender_options() const { return sopts_; }
-    void receiver_options(const class receiver_options &o) { ropts_ = o; }
-    class receiver_options receiver_options() const { return ropts_; }
-#if PN_CPP_HAS_STD_FUNCTION
-    void schedule(duration, std::function<void()>) { throw fail; }
-#endif
-    void schedule(duration, void_function0&) { throw fail; }
-
-  private:
-    std::string id_;
-    connection_options ccopts_, scopts_;
-    class sender_options sopts_;
-    class receiver_options ropts_;
-    std::runtime_error fail;
-};
-
-class dummy_event_loop : public event_loop {
-#if PN_CPP_HAS_CPP11
-    bool inject(std::function<void()> f) PN_CPP_OVERRIDE { f(); return true; }
-#endif
-    bool inject(proton::void_function0& h) PN_CPP_OVERRIDE { h(); return true; }
-};
-
-}
-
-#endif // TEST_DUMMY_CONTAINER_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/types_internal.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/types_internal.hpp b/proton-c/bindings/cpp/src/types_internal.hpp
deleted file mode 100644
index 484dfc4..0000000
--- a/proton-c/bindings/cpp/src/types_internal.hpp
+++ /dev/null
@@ -1,74 +0,0 @@
-#ifndef TYPES_INTERNAL_HPP
-#define TYPES_INTERNAL_HPP
-/*
- * 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/internal/type_traits.hpp"
-#include "proton/error.hpp"
-#include "proton/binary.hpp"
-#include <sstream>
-
-///@file
-/// Inline helpers for encode/decode/type conversion/ostream operators.
-
-namespace proton {
-
-/// Byte copy between two objects, only enabled if their sizes are equal.
-template <class T, class U>
-typename internal::enable_if<sizeof(T) == sizeof(U)>::type byte_copy(T &to, const U &from) {
-    const char *p = reinterpret_cast<const char*>(&from);
-    std::copy(p, p + sizeof(T), reinterpret_cast<char*>(&to));
-}
-
-inline conversion_error
-make_conversion_error(type_id want, type_id got, const std::string& msg=std::string()) {
-    std::ostringstream s;
-    s << "unexpected type, want: " << want << " got: " << got;
-    if (!msg.empty()) s << ": " << msg;
-    return conversion_error(s.str());
-}
-
-/// Convert std::string to pn_bytes_t
-inline pn_bytes_t pn_bytes(const std::string& s) {
-    pn_bytes_t b = { s.size(), s.empty() ? 0 : const_cast<char*>(&s[0]) };
-    return b;
-}
-
-inline pn_bytes_t pn_bytes(const binary& s) {
-    pn_bytes_t b = { s.size(), s.empty() ? 0 : reinterpret_cast<const char*>(&s[0]) };
-    return b;
-}
-
-inline std::string str(const pn_bytes_t& b) { return std::string(b.start, b.size); }
-inline binary bin(const pn_bytes_t& b) { return binary(b.start, b.start+b.size); }
-
-// Save all stream format state, restore in destructor.
-struct ios_guard {
-    std::ios &guarded;
-    std::ios old;
-    ios_guard(std::ios& x) : guarded(x), old(0) { old.copyfmt(guarded); }
-    ~ios_guard() { guarded.copyfmt(old); }
-};
-
-// Convert a char (signed or unsigned) into an unsigned 1 byte integer that will ostream 
-// as a numeric byte value, not a character and will not get sign-extended.
-inline unsigned int printable_byte(uint8_t byte) { return byte; }
-
-}
-#endif // TYPES_INTERNAL_HPP


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


[03/10] qpid-proton git commit: PROTON-1316 Set visibility of exportable symbols on Solaris

Posted by ac...@apache.org.
PROTON-1316 Set visibility of exportable symbols on Solaris

Signed-off-by: aboutros <ad...@murex.com>


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

Branch: refs/heads/master
Commit: dae0c55acffc77f23c548f4d23b6dc166c388ac1
Parents: 68f64e0
Author: aboutros <ad...@murex.com>
Authored: Fri Oct 7 09:47:38 2016 +0200
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Oct 20 08:13:49 2016 -0400

----------------------------------------------------------------------
 proton-c/CMakeLists.txt                                  | 5 +++++
 proton-c/bindings/cpp/include/proton/internal/export.hpp | 5 +++++
 2 files changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/dae0c55a/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index c634113..0b4f7e1 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -250,6 +250,11 @@ if (CMAKE_COMPILER_IS_GNUCC)
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
   endif (ENABLE_HIDE_UNEXPORTED_SYMBOLS)
+elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "SunPro")
+  if (ENABLE_HIDE_UNEXPORTED_SYMBOLS)
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -xldscope=hidden")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xldscope=hidden")
+  endif (ENABLE_HIDE_UNEXPORTED_SYMBOLS)
 endif (CMAKE_COMPILER_IS_GNUCC)
 
 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/dae0c55a/proton-c/bindings/cpp/include/proton/internal/export.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/internal/export.hpp b/proton-c/bindings/cpp/include/proton/internal/export.hpp
index c38ed95..4c95956 100644
--- a/proton-c/bindings/cpp/include/proton/internal/export.hpp
+++ b/proton-c/bindings/cpp/include/proton/internal/export.hpp
@@ -33,6 +33,11 @@
 #  define PN_CPP_IMPORT __declspec(dllimport)
 #  define PN_CPP_CLASS_EXPORT
 #  define PN_CPP_CLASS_IMPORT
+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+#  define PN_CPP_EXPORT __global
+#  define PN_CPP_IMPORT
+#  define PN_CPP_CLASS_EXPORT __global
+#  define PN_CPP_CLASS_IMPORT
 #else
   //
   // Non-Windows (Linux, etc.) definitions:


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